Package org.apache.pivot.wtk.content
Class ListViewItemRenderer
- java.lang.Object
-
- org.apache.pivot.wtk.Component
-
- org.apache.pivot.wtk.Container
-
- org.apache.pivot.wtk.BoxPane
-
- org.apache.pivot.wtk.content.ListViewItemRenderer
-
- All Implemented Interfaces:
java.lang.Iterable<Component>,Sequence<Component>,ConstrainedVisual,ListView.ItemRenderer,Renderer,Visual
- Direct Known Subclasses:
ListViewColorItemRenderer
public class ListViewItemRenderer extends BoxPane implements ListView.ItemRenderer
Default list view item renderer.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Container
Container.EDTChecker
-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Component
Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
-
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
Sequence.Tree<T>
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_ICON_HEIGHTstatic intDEFAULT_ICON_WIDTHstatic booleanDEFAULT_SHOW_ICONprotected ImageViewimageViewprotected Labellabel
-
Constructor Summary
Constructors Constructor Description ListViewItemRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetFillIcon()intgetIconHeight()intgetIconWidth()booleangetShowIcon()BoundsgetTextBounds()Gets the bounds of the text that is rendered by this renderer.voidrender(java.lang.Object item, int index, ListView listView, boolean selected, Button.State state, boolean highlighted, boolean disabled)Prepares the renderer for layout or paint.protected voidrenderStyles(ListView listView, boolean selected, boolean highlighted, boolean disabled)voidsetFillIcon(boolean fillIcon)voidsetIconHeight(int iconHeight)voidsetIconWidth(int iconWidth)voidsetShowIcon(boolean showIcon)voidsetSize(int width, int height)NOTE This method should only be called during layout.java.lang.StringtoString(java.lang.Object item)Converts a list item to a string representation.-
Methods inherited from class org.apache.pivot.wtk.BoxPane
getBoxPaneListeners, getOrientation, setOrientation
-
Methods inherited from class org.apache.pivot.wtk.Container
add, assertEventDispatchThread, assertEventDispatchThread, clear, containsFocus, descendantAdded, descendantGainedFocus, descendantLostFocus, descendantRemoved, get, getComponentAt, getContainerListeners, getContainerMouseListeners, getDescendantAt, getFocusTraversalPolicy, getGraphics, getLength, getNamedComponent, indexOf, insert, invalidate, isAncestor, isDoubleBuffered, iterator, layout, load, mouseClick, mouseDown, mouseMove, mouseOut, mouseUp, mouseWheel, move, paint, remove, remove, removeAll, repaint, requestFocus, setDoubleBuffered, setEventDispatchThreadChecker, setFocusTraversalPolicy, setParent, setVisible, store, transferFocus, update
-
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, 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, isBlocked, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, mapPointFromAncestor, mapPointFromAncestor, mapPointToAncestor, mapPointToAncestor, mouseOver, offsetToScreen, putStyle, putStyle, reenterMouse, repaint, repaint, repaint, repaint, repaint, scrollAreaToVisible, scrollAreaToVisible, setAttribute, setAutomationID, setAutomationID, setCursor, setDragSource, setDropTarget, setEnabled, setFocused, setHeight, setHeightLimits, setHeightLimits, setLocation, setLocation, setMaximumHeight, setMaximumWidth, setMenuHandler, setMinimumHeight, setMinimumWidth, setName, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSkin, setStyleName, setStyleNames, setStyleNames, setStyles, setStyles, setTooltipDelay, setTooltipText, setTooltipWrapText, 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
-
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisual
getBaseline, getPreferredHeight, getPreferredSize, getPreferredWidth, setSize
-
-
-
-
Field Detail
-
imageView
protected ImageView imageView
-
label
protected Label label
-
DEFAULT_ICON_WIDTH
public static final int DEFAULT_ICON_WIDTH
- See Also:
- Constant Field Values
-
DEFAULT_ICON_HEIGHT
public static final int DEFAULT_ICON_HEIGHT
- See Also:
- Constant Field Values
-
DEFAULT_SHOW_ICON
public static final boolean DEFAULT_SHOW_ICON
- See Also:
- Constant Field Values
-
-
Method Detail
-
setSize
public void setSize(int width, int height)Description copied from class:ComponentNOTE This method should only be called during layout. Callers should useComponent.setPreferredSize(int, int).- Specified by:
setSizein interfaceConstrainedVisual- Overrides:
setSizein classComponent- Parameters:
width- Final computed widthheight- Final computed height
-
render
public void render(java.lang.Object item, int index, ListView listView, boolean selected, Button.State state, boolean highlighted, boolean disabled)Description copied from interface:ListView.ItemRendererPrepares the renderer for layout or paint.- Specified by:
renderin interfaceListView.ItemRenderer- Parameters:
item- The item to render, ornullif called to calculate preferred height for skins that assume a fixed renderer height.index- The index of the item being rendered, or-1ifitemisnull.listView- The host component.selected- Iftrue, the item is selected. the item.state- The selected, unselected or mixed state for the checkmark. If tri-state checkmarks are not enabled, this value will either be selected or unselected.highlighted- Iftrue, the item is highlighted.disabled- Iftrue, the item is disabled.
-
renderStyles
protected void renderStyles(ListView listView, boolean selected, boolean highlighted, boolean disabled)
-
toString
public java.lang.String toString(java.lang.Object item)
Description copied from interface:ListView.ItemRendererConverts a list item to a string representation.- Specified by:
toStringin interfaceListView.ItemRenderer- Parameters:
item- The particular list item.- Returns:
- The item's string representation, or
nullif the item does not have a string representation.Note that this method may be called often during keyboard navigation, so implementations should avoid unnecessary string allocations.
-
getIconWidth
public int getIconWidth()
-
setIconWidth
public void setIconWidth(int iconWidth)
-
getIconHeight
public int getIconHeight()
-
setIconHeight
public void setIconHeight(int iconHeight)
-
getShowIcon
public boolean getShowIcon()
-
setShowIcon
public void setShowIcon(boolean showIcon)
-
getFillIcon
public boolean getFillIcon()
-
setFillIcon
public void setFillIcon(boolean fillIcon)
-
getTextBounds
public Bounds getTextBounds()
Gets the bounds of the text that is rendered by this renderer.- Returns:
- The bounds of the rendered text, or
nullif this renderer did not render any text.
-
-