Package org.apache.pivot.wtk
Class ImageView
- java.lang.Object
-
- org.apache.pivot.wtk.Component
-
- org.apache.pivot.wtk.ImageView
-
- All Implemented Interfaces:
ConstrainedVisual
,Visual
- Direct Known Subclasses:
ListButtonColorItemRenderer
,TableViewImageCellRenderer
@DefaultProperty("image") public class ImageView extends Component
Component that displays an image.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description 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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()
java.lang.String
getImageKey()
Returns the image view's image key.ListenerList<ImageViewBindingListener>
getImageViewBindingListeners()
ListenerList<ImageViewListener>
getImageViewListeners()
boolean
isAsynchronous()
Returns the image view's asynchronous flag.void
load(java.lang.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(java.lang.String imageName)
Sets the image view's image by resource name.void
setImage(java.net.URL imageURL)
Sets the image view's current image by URL.void
setImage(Image image)
Sets the image view's current image.void
setImageBindMapping(ImageView.ImageBindMapping imageBindMapping)
void
setImageBindType(BindType imageBindType)
void
setImageKey(java.lang.String imageKey)
Sets the image view's image key.void
store(java.lang.Object context)
Copies bound values from the component to the bind context.-
Methods inherited from class org.apache.pivot.wtk.Component
checkSkin, clearFocus, contains, copyStyle, copyStyle, 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, getScreenBounds, getSize, getSkin, getStyle, getStyle, getStyleBoolean, getStyleBoolean, getStyleColor, getStyleColor, getStyleFont, getStyleFont, getStyleInt, getStyleInt, getStyles, getTextInputMethodListener, 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, offsetToScreen, paint, putStyle, putStyle, reenterMouse, repaint, repaint, repaint, repaint, repaint, repaint, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttribute, setAutomationID, 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
-
-
-
-
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, ornull
for no image.
-
-
Method Detail
-
getImage
public final Image getImage()
Returns the image view's current image.- Returns:
- The current image, or
null
if no image is set.
-
setImage
public final void setImage(Image image)
Sets the image view's current image.- Parameters:
image
- The image to set, ornull
for no image.
-
setImage
public final void setImage(java.net.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(java.lang.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)
,ImageUtils.findByName(String,String)
-
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 java.lang.String getImageKey()
Returns the image view's image key.- Returns:
- The image key, or
null
if no key is set.
-
setImageKey
public void setImageKey(java.lang.String imageKey)
Sets the image view's image key.- Parameters:
imageKey
- The image key, ornull
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(java.lang.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.
-
store
public void store(java.lang.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.
-
clear
public void clear()
Description copied from class:Component
Clears any bound values in the component. This functionality must be provided by the subclass; the base implementation is a no-op.
-
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).
-
-