pivot.wtk.content
Class ListViewItemRenderer

java.lang.Object
  extended by pivot.wtk.Component
      extended by pivot.wtk.Container
          extended by pivot.wtk.FlowPane
              extended by pivot.wtk.content.ListViewItemRenderer
All Implemented Interfaces:
java.lang.Iterable<Component>, Sequence<Component>, ConstrainedVisual, ListView.ItemRenderer, Renderer, Visual
Direct Known Subclasses:
ListViewColorRenderer

public class ListViewItemRenderer
extends FlowPane
implements ListView.ItemRenderer

Default list view item renderer.

Author:
gbrown

Nested Class Summary
 
Nested classes/interfaces inherited from class pivot.wtk.Component
Component.Attributes, Component.ComponentDictionary, Component.DecoratorSequence, Component.StyleDictionary
 
Nested classes/interfaces inherited from interface pivot.collections.Sequence
Sequence.Search, Sequence.Sort, Sequence.Tree
 
Field Summary
static int DEFAULT_ICON_HEIGHT
           
static int DEFAULT_ICON_WIDTH
           
static boolean DEFAULT_SHOW_ICON
           
protected  ImageView imageView
           
protected  Label label
           
 
Constructor Summary
ListViewItemRenderer()
           
 
Method Summary
 int getIconHeight()
           
 int getIconWidth()
           
 boolean getShowIcon()
           
 Bounds getTextBounds()
          Gets the bounds of the text that is rendered by this renderer.
 void render(java.lang.Object item, ListView listView, boolean selected, boolean checked, boolean highlighted, boolean disabled)
          Prepares the renderer for layout or paint.
protected  void renderStyles(ListView listView, boolean selected, boolean highlighted, boolean disabled)
           
 void setIconHeight(int iconHeight)
           
 void setIconWidth(int iconWidth)
           
 void setShowIcon(boolean showIcon)
           
 void setSize(int width, int height)
          NOTE This method should only be called during layout.
 
Methods inherited from class pivot.wtk.FlowPane
getOrientation, setOrientation, setOrientation
 
Methods inherited from class pivot.wtk.Container
add, containsFocus, get, getComponentAt, getContainerListeners, getContainerMouseListeners, getContextKey, getDescendantAt, getFocusTraversalPolicy, getLength, indexOf, insert, invalidate, isAncestor, isFocusable, isValid, iterator, load, load, mouseClick, mouseDown, mouseMove, mouseOut, mouseUp, mouseWheel, move, paint, remove, remove, removeAll, requestFocus, setContextKey, setEnabled, setFocusTraversalPolicy, setParent, setTooltip, setVisible, store, store, update, validate
 
Methods inherited from class pivot.wtk.Component
clearFocus, clearFocus, finalize, getAttributes, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentDragDropListeners, getComponentKeyListeners, getComponentLayoutListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponents, getComponentStateListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getHandle, getHeight, getLocation, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getSize, getSkin, getStyles, getTooltipText, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWindow, getX, getY, installSkin, isBlocked, isDisplayable, isEnabled, isFocused, isMouseOver, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isVisible, keyPressed, keyReleased, keyTyped, mapPointFromAncestor, mapPointToAncestor, mouseOver, repaint, repaint, repaint, repaint, repaint, repaint, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttributes, setCursor, setCursor, setDisplayable, setDragSource, setDropTarget, setFocused, setLocation, setLocation, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSkin, setStyles, setStyles, setStyles, setTooltipText, setUserData, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface pivot.wtk.Renderer
getStyles
 
Methods inherited from interface pivot.wtk.ConstrainedVisual
getPreferredHeight, getPreferredSize, getPreferredWidth
 
Methods inherited from interface pivot.wtk.Visual
getHeight, getWidth, paint
 

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 boolean DEFAULT_SHOW_ICON
Constructor Detail

ListViewItemRenderer

public ListViewItemRenderer()
Method Detail

setSize

public void setSize(int width,
                    int height)
Description copied from class: Component
NOTE This method should only be called during layout. Callers should use Component.setPreferredSize(int, int).

Specified by:
setSize in interface ConstrainedVisual
Overrides:
setSize in class Component

render

public void render(java.lang.Object item,
                   ListView listView,
                   boolean selected,
                   boolean checked,
                   boolean highlighted,
                   boolean disabled)
Description copied from interface: ListView.ItemRenderer
Prepares the renderer for layout or paint.

Specified by:
render in interface ListView.ItemRenderer
Parameters:
item - The item to render.
listView - The host component.
selected - If true, the renderer should present a selected state for the item.
highlighted - If true, the renderer should present a highlighted state for the item.

renderStyles

protected void renderStyles(ListView listView,
                            boolean selected,
                            boolean highlighted,
                            boolean disabled)

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)

getTextBounds

public Bounds getTextBounds()
Gets the bounds of the text that is rendered by this renderer.

Returns:
The bounds of the rendered text, or null if this renderer did not render any text.