org.apache.pivot.wtk
Class ImageView

java.lang.Object
  extended by org.apache.pivot.wtk.Component
      extended by org.apache.pivot.wtk.ImageView
All Implemented Interfaces:
ConstrainedVisual, Visual
Direct Known Subclasses:
ListButtonColorItemRenderer, TableViewImageCellRenderer

@DefaultProperty(value="image")
public class ImageView
extends Component

Component that displays an image.


Nested Class Summary
static interface ImageView.ImageBindMapping
          Translates between image and context data during data binding.
 
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Component
Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
 
Constructor Summary
ImageView()
          Creates an empty image view.
ImageView(Image image)
          Creates an image view with the given image.
 
Method Summary
 void clear()
          Clears any bound values in the component.
 void clearImage()
          Force a reset of the image (and its listeners).
 Image getImage()
          Returns the image view's current image.
 ImageView.ImageBindMapping getImageBindMapping()
           
 BindType getImageBindType()
           
 String getImageKey()
          Returns the image view's image key.
 ListenerList<ImageViewBindingListener> getImageViewBindingListeners()
          Returns the image view binding listener list.
 ListenerList<ImageViewListener> getImageViewListeners()
          Returns the image view listener list.
 boolean isAsynchronous()
          Returns the image view's asynchronous flag.
 void load(Object context)
          Copies bound values from the bind context to the component.
 void setAsynchronous(boolean asynchronous)
          Sets the image view's asynchronous flag.
 void setImage(Image image)
          Sets the image view's current image.
 void setImage(String imageName)
          Sets the image view's image by resource name.
 void setImage(URL imageURL)
          Sets the image view's current image by URL.
 void setImageBindMapping(ImageView.ImageBindMapping imageBindMapping)
           
 void setImageBindType(BindType imageBindType)
           
 void setImageKey(String imageKey)
          Sets the image view's image key.
 void store(Object context)
          Copies bound values from the component to the bind context.
 
Methods inherited from class org.apache.pivot.wtk.Component
clearFocus, contains, getAncestor, getAncestor, getAttribute, getAutomationID, getBaseline, getBaseline, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentKeyListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponentStateListeners, getComponentStyleListeners, getComponentTooltipListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getGraphics, getHeight, getHeightLimits, getLocation, getMaximumHeight, getMaximumWidth, getMenuHandler, getMinimumHeight, getMinimumWidth, getMouseLocation, getName, getNamedStyles, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getSize, getSkin, getStyles, getTooltipDelay, getTooltipText, getTooltipWrapText, getTypedStyles, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWidthLimits, getWindow, getX, getY, indexBoundsCheck, installSkin, invalidate, isBlocked, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, layout, mapPointFromAncestor, mapPointFromAncestor, mapPointToAncestor, mapPointToAncestor, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, paint, reenterMouse, repaint, repaint, repaint, repaint, repaint, repaint, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttribute, setAutomationID, setCursor, setDragSource, setDropTarget, setEnabled, setFocused, setHeight, setHeightLimits, setHeightLimits, setLocation, setLocation, setMaximumHeight, setMaximumWidth, setMenuHandler, setMinimumHeight, setMinimumWidth, setName, setParent, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSize, setSkin, setStyleName, setStyleNames, setStyleNames, setStyles, setStyles, setTooltipDelay, setTooltipText, setTooltipWrapText, setVisible, setWidth, setWidthLimits, setWidthLimits, setX, setY, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageView

public ImageView()
Creates an empty image view.


ImageView

public ImageView(Image image)
Creates an image view with the given image.

Parameters:
image - The initial image to set, or null for no image.
Method Detail

getImage

public Image getImage()
Returns the image view's current image.

Returns:
The current image, or null if no image is set.

setImage

public void setImage(Image image)
Sets the image view's current image.

Parameters:
image - The image to set, or null for no image.

setImage

public final void setImage(URL imageURL)
Sets the image view's current image by URL.

If the icon already exists in the application context resource cache, the cached value will be used. Otherwise, the icon will be loaded synchronously and added to the cache.

Parameters:
imageURL - The location of the image to set.

setImage

public final void setImage(String imageName)
Sets the image view's image by resource name.

Parameters:
imageName - The resource name of the image to set.
See Also:
setImage(URL)

isAsynchronous

public boolean isAsynchronous()
Returns the image view's asynchronous flag.

Returns:
true if images specified via URL will be loaded in the background; false if they will be loaded synchronously.

setAsynchronous

public void setAsynchronous(boolean asynchronous)
Sets the image view's asynchronous flag.

Parameters:
asynchronous - true if images specified via URL will be loaded in the background; false if they will be loaded synchronously.

getImageKey

public String getImageKey()
Returns the image view's image key.

Returns:
The image key, or null if no key is set.

setImageKey

public void setImageKey(String imageKey)
Sets the image view's image key.

Parameters:
imageKey - The image key, or null to clear the binding.

getImageBindType

public BindType getImageBindType()

setImageBindType

public void setImageBindType(BindType imageBindType)

getImageBindMapping

public ImageView.ImageBindMapping getImageBindMapping()

setImageBindMapping

public void setImageBindMapping(ImageView.ImageBindMapping imageBindMapping)

load

public void load(Object context)
Description copied from class: Component
Copies bound values from the bind context to the component. This functionality must be provided by the subclass; the base implementation is a no-op.

Overrides:
load in class Component

store

public void store(Object context)
Description copied from class: Component
Copies bound values from the component to the bind context. This functionality must be provided by the subclass; the base implementation is a no-op.

Overrides:
store in class Component

clear

public void clear()
Description copied from class: Component
Clears any bound values in the component.

Overrides:
clear in class Component

getImageViewListeners

public ListenerList<ImageViewListener> getImageViewListeners()
Returns the image view listener list.


getImageViewBindingListeners

public ListenerList<ImageViewBindingListener> getImageViewBindingListeners()
Returns the image view binding listener list.


clearImage

public void clearImage()
Force a reset of the image (and its listeners).