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 interfaceImageView.ImageBindMappingTranslates 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 voidclear()Clears any bound values in the component.voidclearImage()Force a reset of the image (and its listeners).ImagegetImage()Returns the image view's current image.ImageView.ImageBindMappinggetImageBindMapping()BindTypegetImageBindType()java.lang.StringgetImageKey()Returns the image view's image key.ListenerList<ImageViewBindingListener>getImageViewBindingListeners()ListenerList<ImageViewListener>getImageViewListeners()booleanisAsynchronous()Returns the image view's asynchronous flag.voidload(java.lang.Object context)Copies bound values from the bind context to the component.voidsetAsynchronous(boolean asynchronous)Sets the image view's asynchronous flag.voidsetImage(java.lang.String imageName)Sets the image view's image by resource name.voidsetImage(java.net.URL imageURL)Sets the image view's current image by URL.voidsetImage(Image image)Sets the image view's current image.voidsetImageBindMapping(ImageView.ImageBindMapping imageBindMapping)voidsetImageBindType(BindType imageBindType)voidsetImageKey(java.lang.String imageKey)Sets the image view's image key.voidstore(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, ornullfor no image.
-
-
Method Detail
-
getImage
public final Image getImage()
Returns the image view's current image.- Returns:
- The current image, or
nullif no image is set.
-
setImage
public final void setImage(Image image)
Sets the image view's current image.- Parameters:
image- The image to set, ornullfor 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:
trueif images specified via URL will be loaded in the background;falseif they will be loaded synchronously.
-
setAsynchronous
public void setAsynchronous(boolean asynchronous)
Sets the image view's asynchronous flag.- Parameters:
asynchronous-trueif images specified via URL will be loaded in the background;falseif they will be loaded synchronously.
-
getImageKey
public java.lang.String getImageKey()
Returns the image view's image key.- Returns:
- The image key, or
nullif no key is set.
-
setImageKey
public void setImageKey(java.lang.String imageKey)
Sets the image view's image key.- Parameters:
imageKey- The image key, ornullto 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:ComponentCopies 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:ComponentCopies 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:ComponentClears 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).
-
-