org.apache.pivot.wtk.content
Class TreeViewNodeRenderer
java.lang.Object
org.apache.pivot.wtk.Component
org.apache.pivot.wtk.Container
org.apache.pivot.wtk.BoxPane
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 toString(java.lang.Object)
.
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 |
clearFocus, contains, 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, getSize, getSkin, getStyles, 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, reenterMouse, repaint, repaint, repaint, repaint, repaint, scrollAreaToVisible, scrollAreaToVisible, setAttribute, 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 |
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
TreeViewNodeRenderer
public TreeViewNodeRenderer()
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,
Sequence.Tree.Path path,
int rowIndex,
TreeView treeView,
boolean expanded,
boolean selected,
TreeView.NodeCheckState checkState,
boolean highlighted,
boolean disabled)
- Description copied from interface:
TreeView.NodeRenderer
- Prepares the renderer for layout or paint.
- Specified by:
render
in interface TreeView.NodeRenderer
- Parameters:
node
- The node value to render, or null if called to calculate
preferred height for skins that assume a fixed renderer height.path
- The path to the node being rendered, or null if
node is null.rowIndex
- The row index of the node being rendered, as seen in the current
visible nodes list, or -1 if node is null.treeView
- The host component.expanded
- true if the node is expanded; false otherwise.selected
- true if the node is selected; false otherwise.checkState
- The node's check state.highlighted
- true if the node is highlighted; false otherwise.disabled
- true if the node is disabled; false otherwise.
toString
public String toString(Object node)
- Description copied from interface:
TreeView.NodeRenderer
- Converts a tree node to a string representation.
- Specified by:
toString
in interface TreeView.NodeRenderer
- Returns:
- The node's string representation, or null if the node 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 null if this renderer did
not render any text.