org.apache.pivot.wtk.content
Class TreeViewNodeRenderer

java.lang.Object
  extended by org.apache.pivot.wtk.Component
      extended by org.apache.pivot.wtk.Container
          extended by org.apache.pivot.wtk.BoxPane
              extended by org.apache.pivot.wtk.content.TreeViewNodeRenderer
All Implemented Interfaces:
Iterable<Component>, Sequence<Component>, ConstrainedVisual, Renderer, TreeView.NodeRenderer, Visual

public class TreeViewNodeRenderer
extends BoxPane
implements TreeView.NodeRenderer

Default tree node renderer, which knows how to render instances of TreeNode and Image. Anything else will be rendered as a string (by calling node.toString().


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Component
Component.ComponentDictionary, Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
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
TreeViewNodeRenderer()
           
 
Method Summary
 int getIconHeight()
           
 int getIconWidth()
           
 boolean getShowIcon()
           
 Bounds getTextBounds()
          Gets the bounds of the text that is rendered by this renderer.
 void render(Object node, TreeView treeView, boolean expanded, boolean selected, TreeView.NodeCheckState checkState, 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 org.apache.pivot.wtk.BoxPane
getBoxPaneListeners, getOrientation, setOrientation, setOrientation
 
Methods inherited from class org.apache.pivot.wtk.Container
add, containsFocus, descendantGainedFocus, descendantLostFocus, descendantRemoved, get, getComponentAt, getContainerListeners, getContainerMouseListeners, getContextKey, getDescendantAt, getFocusTraversalPolicy, getLength, indexOf, insert, isAncestor, iterator, load, mouseClick, mouseDown, mouseMove, mouseOut, mouseUp, mouseWheel, move, paint, remove, remove, removeAll, requestFocus, setContextKey, setFocusTraversalPolicy, setParent, setTooltip, setVisible, store, transferFocus, update, validate
 
Methods inherited from class org.apache.pivot.wtk.Component
clearFocus, getAttributes, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentKeyListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponents, getComponentStateListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getGraphics, getHandle, getHeight, getLocation, getMaximumPreferredHeight, getMaximumPreferredWidth, getMenuHandler, getMinimumPreferredHeight, getMinimumPreferredWidth, getParent, getPreferredHeight, getPreferredHeight, getPreferredHeightLimits, getPreferredSize, getPreferredWidth, getPreferredWidth, getPreferredWidthLimits, getSize, getSkin, getStyles, getTooltipText, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWindow, getX, getY, installSkin, invalidate, isBlocked, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, load, mapPointFromAncestor, mapPointToAncestor, mouseOver, repaint, repaint, repaint, repaint, repaint, repaint, scrollAreaToVisible, scrollAreaToVisible, setAttributes, setCursor, setCursor, setDragSource, setDropTarget, setEnabled, setHeight, setLocation, setLocation, setMaximumPreferredHeight, setMaximumPreferredWidth, setMenuHandler, setMinimumPreferredHeight, setMinimumPreferredWidth, setPreferredHeight, setPreferredHeightLimits, setPreferredHeightLimits, setPreferredSize, setPreferredSize, setPreferredWidth, setPreferredWidthLimits, setPreferredWidthLimits, setSize, setSkin, setStyles, setStyles, setStyles, setTooltipText, setWidth, setX, setY, store, toString, transferFocus
 
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.Renderer
getStyles
 
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisual
getPreferredHeight, getPreferredSize, getPreferredWidth
 
Methods inherited from interface org.apache.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

TreeViewNodeRenderer

public TreeViewNodeRenderer()
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(Object node,
                   TreeView treeView,
                   boolean expanded,
                   boolean selected,
                   TreeView.NodeCheckState checkState,
                   boolean highlighted,
                   boolean disabled)
Specified by:
render in interface TreeView.NodeRenderer

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.