Package org.apache.pivot.wtk.skin.terra
Class TerraTreeViewSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.terra.TerraTreeViewSkin
-
- All Implemented Interfaces:
ComponentKeyListener
,ComponentListener
,ComponentMouseButtonListener
,ComponentMouseListener
,ComponentMouseWheelListener
,ComponentStateListener
,ComponentTooltipListener
,ConstrainedVisual
,Skin
,TreeView.Skin
,TreeViewBranchListener
,TreeViewListener
,TreeViewNodeListener
,TreeViewNodeStateListener
,TreeViewSelectionListener
,Visual
public class TerraTreeViewSkin extends ComponentSkin implements TreeView.Skin, TreeViewListener, TreeViewBranchListener, TreeViewNodeListener, TreeViewNodeStateListener, TreeViewSelectionListener
Tree view skin.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
TerraTreeViewSkin.NodeInfoVisitor
Node info visitor interface.protected class
TerraTreeViewSkin.VisibleNodeIterator
Iterates through the visible nodes.-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentKeyListener
ComponentKeyListener.Adapter, ComponentKeyListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentListener
ComponentListener.Adapter, ComponentListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseButtonListener
ComponentMouseButtonListener.Adapter, ComponentMouseButtonListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseListener
ComponentMouseListener.Adapter, ComponentMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseWheelListener
ComponentMouseWheelListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentStateListener
ComponentStateListener.Adapter, ComponentStateListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentTooltipListener
ComponentTooltipListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TreeViewBranchListener
TreeViewBranchListener.Adapter, TreeViewBranchListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TreeViewListener
TreeViewListener.Adapter, TreeViewListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TreeViewNodeListener
TreeViewNodeListener.Adapter, TreeViewNodeListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TreeViewNodeStateListener
TreeViewNodeStateListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TreeViewSelectionListener
TreeViewSelectionListener.Adapter, TreeViewSelectionListener.Listeners
-
-
Constructor Summary
Constructors Constructor Description TerraTreeViewSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
accept(TerraTreeViewSkin.NodeInfoVisitor visitor)
Accepts the specified visitor on all node info objects that exist in this skin's node info hierarchy.void
branchCollapsed(TreeView treeView, Sequence.Tree.Path path)
Called when a tree node is collapsed.void
branchExpanded(TreeView treeView, Sequence.Tree.Path path)
Called when a tree node is expanded.void
branchExpandedChangeVetoed(TreeView treeView, Sequence.Tree.Path path, Vote reason)
Called when thepreviewBranchExpandedChange()
tally produces anything but aVote.APPROVE
result (to say NOT to expand or collapse the branch).void
checkmarksEnabledChanged(TreeView treeView)
Called when a tree view's checkmarks enabled flag has changed.protected void
clearHighlightedNode()
Clears the highlighted node if one exists.void
disabledCheckmarkFilterChanged(TreeView treeView, Filter<?> previousDisabledCheckmarkFilter)
Called when a tree view's disabled checkmark filter has changed.void
disabledNodeFilterChanged(TreeView treeView, Filter<?> previousDisabledNodeFilter)
Called when a tree view's disabled node filter has changed.void
enabledChanged(Component component)
Called when a component's enabled state has changed.void
focusedChanged(Component component, Component obverseComponent)
Called when a component's focused state has changed.java.awt.Color
getBackgroundColor()
int
getBaseline(int width, int height)
Should be implemented in every subclass.java.awt.Color
getBranchControlColor()
java.awt.Color
getBranchControlInactiveSelectionColor()
java.awt.Color
getBranchControlSelectionColor()
protected org.apache.pivot.wtk.skin.terra.TerraTreeViewSkin.BranchInfo
getBranchInfoAt(Sequence.Tree.Path path)
java.awt.Color
getColor()
java.awt.Color
getDisabledColor()
java.awt.Font
getFont()
java.awt.Color
getGridColor()
java.awt.Color
getHighlightBackgroundColor()
java.awt.Color
getHighlightColor()
java.awt.Color
getInactiveSelectionBackgroundColor()
java.awt.Color
getInactiveSelectionColor()
int
getIndent()
Sequence.Tree.Path
getNodeAt(int y)
Gets the path to the node found at the specified y-coordinate (relative to the tree view).Bounds
getNodeBounds(Sequence.Tree.Path path)
Gets the bounds of the node at the specified path relative to the tree view.protected Bounds
getNodeBounds(org.apache.pivot.wtk.skin.terra.TerraTreeViewSkin.NodeInfo nodeInfo)
protected int
getNodeHeight()
int
getNodeIndent(int depth)
Gets the pixel indent of nodes at the specified depth.protected org.apache.pivot.wtk.skin.terra.TerraTreeViewSkin.NodeInfo
getNodeInfoAt(int y)
protected org.apache.pivot.wtk.skin.terra.TerraTreeViewSkin.NodeInfo
getNodeInfoAt(Sequence.Tree.Path path)
int
getPreferredHeight(int width)
Returns the visual's preferred height given the provided width constraint.int
getPreferredWidth(int height)
Returns the visual's preferred width given the provided height constraint.int
getRowIndex(Sequence.Tree.Path path)
Gets the row index of the node, as seen in the current visible nodes list.java.awt.Color
getSelectionBackgroundColor()
java.awt.Color
getSelectionColor()
boolean
getShowBranchControls()
boolean
getShowEmptyBranchControls()
boolean
getShowGridLines()
boolean
getShowHighlight()
int
getSpacing()
TreeView
getTreeView()
void
install(Component component)
Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.boolean
isFocusable()
By default, skins are focusable.boolean
isOpaque()
By default, skins are assumed to be opaque.boolean
keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
Keyboard handling (arrow keys with modifiers).boolean
keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
SPACE
toggles check mark selection when select mode isTreeView.SelectMode.SINGLE
.void
layout()
If the component on which the skin is installed is a container, lays out the container's children.boolean
mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Called when a mouse button is clicked over a component.boolean
mouseDown(Component component, Mouse.Button button, int x, int y)
Called when a mouse button is pressed over a component.boolean
mouseMove(Component component, int x, int y)
Called when the mouse is moved over a component.void
mouseOut(Component component)
Called when the mouse exits a component.boolean
mouseUp(Component component, Mouse.Button button, int x, int y)
Called when a mouse button is released over a component.boolean
mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)
Called when the mouse wheel is scrolled over a component.void
nodeCheckStateChanged(TreeView treeView, Sequence.Tree.Path path, TreeView.NodeCheckState previousCheckState)
Called when a node's checked state has changed.void
nodeInserted(TreeView treeView, Sequence.Tree.Path path, int index)
Called when a node has been inserted into the tree view.void
nodeRendererChanged(TreeView treeView, TreeView.NodeRenderer previousNodeRenderer)
Called when a tree view's node renderer has changed.void
nodesCleared(TreeView treeView, Sequence.Tree.Path path)
Called when the nodes in a branch have been cleared.void
nodesRemoved(TreeView treeView, Sequence.Tree.Path path, int index, int count)
Called when nodes have been removed from the tree view.void
nodesSorted(TreeView treeView, Sequence.Tree.Path path)
Called when the nodes in a branch have been sorted.void
nodeUpdated(TreeView treeView, Sequence.Tree.Path path, int index)
Called when a node in the tree view has been updated.void
paint(java.awt.Graphics2D graphics)
Paints the visual.Vote
previewBranchExpandedChange(TreeView treeView, Sequence.Tree.Path path)
Called before a tree node is expanded or collapsed to allow the application or the skin to refuse the operation.protected void
repaintNode(org.apache.pivot.wtk.skin.terra.TerraTreeViewSkin.NodeInfo nodeInfo)
Repaints the region occupied by the specified node.void
selectedPathAdded(TreeView treeView, Sequence.Tree.Path path)
Called when a selected path has been added to a tree view.void
selectedPathRemoved(TreeView treeView, Sequence.Tree.Path path)
Called when a selected path has been removed from a tree view.void
selectedPathsChanged(TreeView treeView, Sequence<Sequence.Tree.Path> previousSelectedPaths)
Called when a tree view's selection state has been reset.void
selectModeChanged(TreeView treeView, TreeView.SelectMode previousSelectMode)
Called when a tree view's select mode has changed.void
setBackgroundColor(int backgroundColorIndex)
void
setBackgroundColor(java.awt.Color backgroundColorValue)
void
setBackgroundColor(java.lang.String backgroundColorString)
void
setBranchControlColor(int branchControlColorIndex)
void
setBranchControlColor(java.awt.Color branchControlColorValue)
void
setBranchControlColor(java.lang.String branchControlColorString)
void
setBranchControlInactiveSelectionColor(int branchControlInactiveSelectionIndex)
void
setBranchControlInactiveSelectionColor(java.awt.Color branchControlInactiveSelectionColorValue)
void
setBranchControlInactiveSelectionColor(java.lang.String branchControlInactiveSelectionString)
void
setBranchControlSelectionColor(int branchControlSelectionColorIndex)
void
setBranchControlSelectionColor(java.awt.Color branchControlSelectionColorValue)
void
setBranchControlSelectionColor(java.lang.String branchControlSelectionColorString)
void
setColor(int colorIndex)
void
setColor(java.awt.Color colorValue)
void
setColor(java.lang.String colorString)
void
setDisabledColor(int disabledColorIndex)
void
setDisabledColor(java.awt.Color disabledColorValue)
void
setDisabledColor(java.lang.String disabledColorString)
void
setFont(java.awt.Font newFont)
void
setFont(java.lang.String fontString)
void
setFont(Dictionary<java.lang.String,?> fontDictionary)
void
setGridColor(int gridColorIndex)
void
setGridColor(java.awt.Color gridColorValue)
void
setGridColor(java.lang.String gridColorString)
void
setHighlightBackgroundColor(int highlightBackgroundColorIndex)
void
setHighlightBackgroundColor(java.awt.Color highlightBackgroundColorValue)
void
setHighlightBackgroundColor(java.lang.String highlightBackgroundColorString)
void
setHighlightColor(int highlightColorIndex)
void
setHighlightColor(java.awt.Color highlightColorValue)
void
setHighlightColor(java.lang.String highlightColorString)
void
setInactiveSelectionBackgroundColor(int inactiveSelectionBackgroundIndex)
void
setInactiveSelectionBackgroundColor(java.awt.Color inactiveSelectionBackgroundColorValue)
void
setInactiveSelectionBackgroundColor(java.lang.String inactiveSelectionBackgroundString)
void
setInactiveSelectionColor(int inactiveSelectionColorIndex)
void
setInactiveSelectionColor(java.awt.Color inactiveSelectionColorValue)
void
setInactiveSelectionColor(java.lang.String inactiveSelectionColorString)
void
setIndent(int indentValue)
void
setIndent(java.lang.Number indentValue)
void
setSelectionBackgroundColor(int selectionBackgroundColorIndex)
void
setSelectionBackgroundColor(java.awt.Color selectionBackgroundColorValue)
void
setSelectionBackgroundColor(java.lang.String selectionBackgroundColorString)
void
setSelectionColor(int selectionColorIndex)
void
setSelectionColor(java.awt.Color selectionColorValue)
void
setSelectionColor(java.lang.String selectionColorString)
void
setShowBranchControls(boolean showBranchControlsValue)
void
setShowEmptyBranchControls(boolean showEmptyBranchControlsValue)
void
setShowGridLines(boolean showGridLinesValue)
void
setShowHighlight(boolean showHighlightValue)
void
setSpacing(int spacingValue)
void
setSpacing(java.lang.Number spacingValue)
void
showMixedCheckmarkStateChanged(TreeView treeView)
Called when a tree view's "show mixed checkmark state" flag has changed.void
treeDataChanged(TreeView treeView, List<?> previousTreeData)
Called when a tree view's data has changed.-
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin
colorFromObject, colorFromObject, colorFromObject, colorFromObject, currentTheme, cursorChanged, decodeFont, defaultBackgroundColor, defaultForegroundColor, dragSourceChanged, dropTargetChanged, fontFromObject, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getPreferredSize, getSize, getTextInputMethodListener, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, keyTyped, locationChanged, menuHandlerChanged, mouseOver, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setDefaultStyles, setSize, sizeChanged, themeHasThickFocusRectangle, themeHasTransitionEnabled, themeIsDark, themeIsFlat, tooltipDelayChanged, tooltipTextChanged, tooltipTriggered, visibleChanged, widthLimitsChanged
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisual
setSize
-
Methods inherited from interface org.apache.pivot.wtk.TreeViewListener
nodeEditorChanged
-
Methods inherited from interface org.apache.pivot.wtk.TreeViewSelectionListener
selectedNodeChanged
-
-
-
-
Method Detail
-
getTreeView
public TreeView getTreeView()
- Returns:
- the
TreeView
we are attached to.
-
install
public void install(Component component)
Description copied from class:ComponentSkin
Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.- Specified by:
install
in interfaceSkin
- Overrides:
install
in classComponentSkin
- Parameters:
component
- The component to which the skin is being attached.
-
getPreferredWidth
public int getPreferredWidth(int height)
Description copied from interface:ConstrainedVisual
Returns the visual's preferred width given the provided height constraint.- Specified by:
getPreferredWidth
in interfaceConstrainedVisual
- Parameters:
height
- The height by which to constrain the preferred width, or-1
for no constraint.- Returns:
- The preferred width given the height constraint.
-
getPreferredHeight
public int getPreferredHeight(int width)
Description copied from interface:ConstrainedVisual
Returns the visual's preferred height given the provided width constraint.- Specified by:
getPreferredHeight
in interfaceConstrainedVisual
- Parameters:
width
- The width by which to constrain the preferred height, or-1
for no constraint.- Returns:
- The preferred height given the width constraint.
-
getBaseline
public int getBaseline(int width, int height)
Description copied from class:ComponentSkin
Should be implemented in every subclass.The default implementation here simply returns -1 (no baseline).
- Specified by:
getBaseline
in interfaceConstrainedVisual
- Overrides:
getBaseline
in classComponentSkin
- Parameters:
width
- Constrained width to compute the baseline for.height
- Constrained height to compute the baseline for.- Returns:
- The baseline relative to the origin of this visual, or
-1
if this visual does not have a baseline.
-
layout
public void layout()
Description copied from interface:Skin
If the component on which the skin is installed is a container, lays out the container's children.
-
paint
public void paint(java.awt.Graphics2D graphics)
Description copied from interface:Visual
Paints the visual.
-
getFont
public java.awt.Font getFont()
-
setFont
public void setFont(java.awt.Font newFont)
-
setFont
public final void setFont(java.lang.String fontString)
-
setFont
public final void setFont(Dictionary<java.lang.String,?> fontDictionary)
-
getColor
public java.awt.Color getColor()
-
setColor
public void setColor(java.awt.Color colorValue)
-
setColor
public void setColor(java.lang.String colorString)
-
setColor
public final void setColor(int colorIndex)
-
getDisabledColor
public java.awt.Color getDisabledColor()
-
setDisabledColor
public void setDisabledColor(java.awt.Color disabledColorValue)
-
setDisabledColor
public void setDisabledColor(java.lang.String disabledColorString)
-
setDisabledColor
public final void setDisabledColor(int disabledColorIndex)
-
getBackgroundColor
public java.awt.Color getBackgroundColor()
-
setBackgroundColor
public void setBackgroundColor(java.awt.Color backgroundColorValue)
-
setBackgroundColor
public void setBackgroundColor(java.lang.String backgroundColorString)
-
setBackgroundColor
public final void setBackgroundColor(int backgroundColorIndex)
-
getSelectionColor
public java.awt.Color getSelectionColor()
-
setSelectionColor
public void setSelectionColor(java.awt.Color selectionColorValue)
-
setSelectionColor
public void setSelectionColor(java.lang.String selectionColorString)
-
setSelectionColor
public final void setSelectionColor(int selectionColorIndex)
-
getSelectionBackgroundColor
public java.awt.Color getSelectionBackgroundColor()
-
setSelectionBackgroundColor
public void setSelectionBackgroundColor(java.awt.Color selectionBackgroundColorValue)
-
setSelectionBackgroundColor
public void setSelectionBackgroundColor(java.lang.String selectionBackgroundColorString)
-
setSelectionBackgroundColor
public final void setSelectionBackgroundColor(int selectionBackgroundColorIndex)
-
getInactiveSelectionColor
public java.awt.Color getInactiveSelectionColor()
-
setInactiveSelectionColor
public void setInactiveSelectionColor(java.awt.Color inactiveSelectionColorValue)
-
setInactiveSelectionColor
public void setInactiveSelectionColor(java.lang.String inactiveSelectionColorString)
-
setInactiveSelectionColor
public final void setInactiveSelectionColor(int inactiveSelectionColorIndex)
-
getInactiveSelectionBackgroundColor
public java.awt.Color getInactiveSelectionBackgroundColor()
-
setInactiveSelectionBackgroundColor
public void setInactiveSelectionBackgroundColor(java.awt.Color inactiveSelectionBackgroundColorValue)
-
setInactiveSelectionBackgroundColor
public void setInactiveSelectionBackgroundColor(java.lang.String inactiveSelectionBackgroundString)
-
setInactiveSelectionBackgroundColor
public final void setInactiveSelectionBackgroundColor(int inactiveSelectionBackgroundIndex)
-
getHighlightColor
public java.awt.Color getHighlightColor()
-
setHighlightColor
public void setHighlightColor(java.awt.Color highlightColorValue)
-
setHighlightColor
public void setHighlightColor(java.lang.String highlightColorString)
-
setHighlightColor
public final void setHighlightColor(int highlightColorIndex)
-
getHighlightBackgroundColor
public java.awt.Color getHighlightBackgroundColor()
-
setHighlightBackgroundColor
public void setHighlightBackgroundColor(java.awt.Color highlightBackgroundColorValue)
-
setHighlightBackgroundColor
public void setHighlightBackgroundColor(java.lang.String highlightBackgroundColorString)
-
setHighlightBackgroundColor
public final void setHighlightBackgroundColor(int highlightBackgroundColorIndex)
-
getSpacing
public int getSpacing()
-
setSpacing
public void setSpacing(int spacingValue)
-
setSpacing
public void setSpacing(java.lang.Number spacingValue)
-
getIndent
public int getIndent()
-
setIndent
public void setIndent(int indentValue)
-
setIndent
public void setIndent(java.lang.Number indentValue)
-
getShowHighlight
public boolean getShowHighlight()
-
setShowHighlight
public void setShowHighlight(boolean showHighlightValue)
-
getShowBranchControls
public boolean getShowBranchControls()
-
setShowBranchControls
public void setShowBranchControls(boolean showBranchControlsValue)
-
getShowEmptyBranchControls
public boolean getShowEmptyBranchControls()
-
setShowEmptyBranchControls
public void setShowEmptyBranchControls(boolean showEmptyBranchControlsValue)
-
getBranchControlColor
public java.awt.Color getBranchControlColor()
-
setBranchControlColor
public void setBranchControlColor(java.awt.Color branchControlColorValue)
-
setBranchControlColor
public void setBranchControlColor(java.lang.String branchControlColorString)
-
setBranchControlColor
public final void setBranchControlColor(int branchControlColorIndex)
-
getBranchControlSelectionColor
public java.awt.Color getBranchControlSelectionColor()
-
setBranchControlSelectionColor
public void setBranchControlSelectionColor(java.awt.Color branchControlSelectionColorValue)
-
setBranchControlSelectionColor
public void setBranchControlSelectionColor(java.lang.String branchControlSelectionColorString)
-
setBranchControlSelectionColor
public final void setBranchControlSelectionColor(int branchControlSelectionColorIndex)
-
getBranchControlInactiveSelectionColor
public java.awt.Color getBranchControlInactiveSelectionColor()
-
setBranchControlInactiveSelectionColor
public void setBranchControlInactiveSelectionColor(java.awt.Color branchControlInactiveSelectionColorValue)
-
setBranchControlInactiveSelectionColor
public void setBranchControlInactiveSelectionColor(java.lang.String branchControlInactiveSelectionString)
-
setBranchControlInactiveSelectionColor
public final void setBranchControlInactiveSelectionColor(int branchControlInactiveSelectionIndex)
-
getGridColor
public java.awt.Color getGridColor()
-
setGridColor
public void setGridColor(java.awt.Color gridColorValue)
-
setGridColor
public void setGridColor(java.lang.String gridColorString)
-
setGridColor
public final void setGridColor(int gridColorIndex)
-
getShowGridLines
public boolean getShowGridLines()
-
setShowGridLines
public void setShowGridLines(boolean showGridLinesValue)
-
getNodeHeight
protected int getNodeHeight()
- Returns:
- The fixed node height of this skin.
-
getNodeInfoAt
protected final org.apache.pivot.wtk.skin.terra.TerraTreeViewSkin.NodeInfo getNodeInfoAt(int y)
- Parameters:
y
- The current Y location.- Returns:
- The metadata associated with the node found at the specified
y-coordinate, or
null
if there is no node at that location.
-
getNodeInfoAt
protected final org.apache.pivot.wtk.skin.terra.TerraTreeViewSkin.NodeInfo getNodeInfoAt(Sequence.Tree.Path path)
- Parameters:
path
- The path to query.- Returns:
- The metadata associated with the node at the specified path. The path must be valid. The empty path is supported and represents the root node info.
-
getBranchInfoAt
protected final org.apache.pivot.wtk.skin.terra.TerraTreeViewSkin.BranchInfo getBranchInfoAt(Sequence.Tree.Path path)
- Parameters:
path
- The path to query.- Returns:
- The metadata for the branch node at the specified path.
- See Also:
getNodeInfoAt(Path)
-
getNodeBounds
protected final Bounds getNodeBounds(org.apache.pivot.wtk.skin.terra.TerraTreeViewSkin.NodeInfo nodeInfo)
- Parameters:
nodeInfo
- The node information to search for.- Returns:
- The bounding box defined by the specified node, or
null
if the node is not currently visible.
-
accept
protected final void accept(TerraTreeViewSkin.NodeInfoVisitor visitor)
Accepts the specified visitor on all node info objects that exist in this skin's node info hierarchy.- Parameters:
visitor
- The callback to execute on each node info object
-
repaintNode
protected void repaintNode(org.apache.pivot.wtk.skin.terra.TerraTreeViewSkin.NodeInfo nodeInfo)
Repaints the region occupied by the specified node.- Parameters:
nodeInfo
- The node to search for.
-
clearHighlightedNode
protected void clearHighlightedNode()
Clears the highlighted node if one exists.
-
mouseMove
public boolean mouseMove(Component component, int x, int y)
Description copied from interface:ComponentMouseListener
Called when the mouse is moved over a component.- Specified by:
mouseMove
in interfaceComponentMouseListener
- Overrides:
mouseMove
in classComponentSkin
- Parameters:
component
- Component that is under the mouse.x
- X position of the mouse.y
- Y position of the mouse.- Returns:
true
to consume the event;false
to allow it to propagate (default return).
-
mouseOut
public void mouseOut(Component component)
Description copied from interface:ComponentMouseListener
Called when the mouse exits a component.Default is to do nothing.
- Specified by:
mouseOut
in interfaceComponentMouseListener
- Overrides:
mouseOut
in classComponentSkin
- Parameters:
component
- Component that has now lost the mouse pointer.
-
mouseDown
public boolean mouseDown(Component component, Mouse.Button button, int x, int y)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is pressed over a component.- Specified by:
mouseDown
in interfaceComponentMouseButtonListener
- Overrides:
mouseDown
in classComponentSkin
- Parameters:
component
- Component that is under the mouse pointer.button
- Which mouse button was pressed.x
- X position of the mouse.y
- Y position of the mouse.- Returns:
true
to consume the event;false
to allow it to propagate (default).
-
mouseUp
public boolean mouseUp(Component component, Mouse.Button button, int x, int y)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is released over a component.- Specified by:
mouseUp
in interfaceComponentMouseButtonListener
- Overrides:
mouseUp
in classComponentSkin
- Parameters:
component
- Component user the mouse pointer.button
- Which mouse button that was released.x
- X position of the mouse.y
- Y position of the mouse.- Returns:
true
to consume the event;false
to allow it to propagate (default).
-
mouseClick
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is clicked over a component.- Specified by:
mouseClick
in interfaceComponentMouseButtonListener
- Overrides:
mouseClick
in classComponentSkin
- Parameters:
component
- Component user the mouse pointer.button
- Which mouse button was clicked.x
- X position of the mouse.y
- Y position of the mouse.count
- Number of clicks (1 = single click, 2 = double click, etc.).- Returns:
true
to consume the event;false
to allow it to propagate (default).
-
mouseWheel
public boolean mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)
Description copied from interface:ComponentMouseWheelListener
Called when the mouse wheel is scrolled over a component.- Specified by:
mouseWheel
in interfaceComponentMouseWheelListener
- Overrides:
mouseWheel
in classComponentSkin
- Parameters:
component
- Component under the mouse pointer.scrollType
- What type of scroll was requested on the mouse.scrollAmount
- Amount of scrolling.wheelRotation
- Rotation value.x
- X position of the mouse.y
- Y position of the mouse.- Returns:
true
to consume the event;false
to allow it to propagate.
-
keyPressed
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
Keyboard handling (arrow keys with modifiers).UP
Selects the previous enabled node when select mode is notTreeView.SelectMode.NONE
DOWN
Selects the next enabled node when select mode is notTreeView.SelectMode.NONE
SHIFT
+UP
Increases the selection size by including the previous enabled node when select mode isTreeView.SelectMode.MULTI
SHIFT
+DOWN
Increases the selection size by including the next enabled node when select mode isTreeView.SelectMode.MULTI
- Specified by:
keyPressed
in interfaceComponentKeyListener
- Overrides:
keyPressed
in classComponentSkin
- Parameters:
component
- Component that has the focus.keyCode
- The key code for the key that was pressed.keyLocation
- Location value for the key (left or right for shift keys, etc.).- Returns:
true
to consume the event;false
to allow it to propagate.
-
keyReleased
public boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
SPACE
toggles check mark selection when select mode isTreeView.SelectMode.SINGLE
.- Specified by:
keyReleased
in interfaceComponentKeyListener
- Overrides:
keyReleased
in classComponentSkin
- Parameters:
component
- Component that has the focus, that is receiving this key event.keyCode
- Code for the key that was released.keyLocation
- Location of the key.- Returns:
true
to consume the event;false
to allow it to propagate.
-
isFocusable
public boolean isFocusable()
Description copied from class:ComponentSkin
By default, skins are focusable.- Specified by:
isFocusable
in interfaceSkin
- Overrides:
isFocusable
in classComponentSkin
- Returns:
true
if this skin is focusable;false
, otherwise.
-
isOpaque
public boolean isOpaque()
Description copied from class:ComponentSkin
By default, skins are assumed to be opaque.- Specified by:
isOpaque
in interfaceSkin
- Overrides:
isOpaque
in classComponentSkin
- Returns:
true
if this skin is opaque;false
if any part of it is transparent or translucent.
-
enabledChanged
public void enabledChanged(Component component)
Description copied from interface:ComponentStateListener
Called when a component's enabled state has changed.Called both when the component is enabled and when it is disabled. The component's
enabled
flag has already been set when this method is called so the new state can be determined by calling theComponent.isEnabled()
method.- Specified by:
enabledChanged
in interfaceComponentStateListener
- Overrides:
enabledChanged
in classComponentSkin
- Parameters:
component
- The component whose enabled state is changing.
-
focusedChanged
public void focusedChanged(Component component, Component obverseComponent)
Description copied from interface:ComponentStateListener
Called when a component's focused state has changed.This will be called both when a component gains focus and when it loses focus. The currently focused component has already been set when this method is called, so that the new state of the component can be determined by calling the
Component.isFocused()
method.- Specified by:
focusedChanged
in interfaceComponentStateListener
- Overrides:
focusedChanged
in classComponentSkin
- Parameters:
component
- The component that is either gaining focus or the one that previously had focus and is now losing it.obverseComponent
- If the component is gaining focus, this is the component that is losing focus. If the component is losing focus this is the component that is gaining the focus instead.
-
getNodeAt
public Sequence.Tree.Path getNodeAt(int y)
Description copied from interface:TreeView.Skin
Gets the path to the node found at the specified y-coordinate (relative to the tree view).- Specified by:
getNodeAt
in interfaceTreeView.Skin
- Parameters:
y
- The y-coordinate in pixels.- Returns:
- The path to the node, or
null
if there is no node being painted at the specified y-coordinate.
-
getNodeBounds
public Bounds getNodeBounds(Sequence.Tree.Path path)
Description copied from interface:TreeView.Skin
Gets the bounds of the node at the specified path relative to the tree view. Note that all nodes are left aligned with the tree; to get the pixel value of a node's indent, useTreeView.Skin.getNodeIndent(int)
.- Specified by:
getNodeBounds
in interfaceTreeView.Skin
- Parameters:
path
- The path to the node.- Returns:
- The bounds, or
null
if the node is not currently visible.
-
getNodeIndent
public int getNodeIndent(int depth)
Description copied from interface:TreeView.Skin
Gets the pixel indent of nodes at the specified depth. Depth is measured in generations away from the tree view's "root" node, which is represented by thetree data
.- Specified by:
getNodeIndent
in interfaceTreeView.Skin
- Parameters:
depth
- The depth, where the first child of the root has depth 1, the child of that branch has depth 2, etc.- Returns:
- The indent in pixels to the node's content.
-
getRowIndex
public int getRowIndex(Sequence.Tree.Path path)
Description copied from interface:TreeView.Skin
Gets the row index of the node, as seen in the current visible nodes list. Note that as branches are expanded and collapsed, the row index of any given node in the tree will change.- Specified by:
getRowIndex
in interfaceTreeView.Skin
- Parameters:
path
- The path to the node.- Returns:
- The row index of the node, or
-1
if the node is not currently visible.
-
treeDataChanged
public void treeDataChanged(TreeView treeView, List<?> previousTreeData)
Description copied from interface:TreeViewListener
Called when a tree view's data has changed.- Specified by:
treeDataChanged
in interfaceTreeViewListener
- Parameters:
treeView
- The source of this event.previousTreeData
- The previous data for this tree.
-
nodeRendererChanged
public void nodeRendererChanged(TreeView treeView, TreeView.NodeRenderer previousNodeRenderer)
Description copied from interface:TreeViewListener
Called when a tree view's node renderer has changed.- Specified by:
nodeRendererChanged
in interfaceTreeViewListener
- Parameters:
treeView
- The source of this event.previousNodeRenderer
- The previous renderer for tree nodes.
-
selectModeChanged
public void selectModeChanged(TreeView treeView, TreeView.SelectMode previousSelectMode)
Description copied from interface:TreeViewListener
Called when a tree view's select mode has changed.- Specified by:
selectModeChanged
in interfaceTreeViewListener
- Parameters:
treeView
- The source of this event.previousSelectMode
- What the tree view's select mode was before the change.
-
checkmarksEnabledChanged
public void checkmarksEnabledChanged(TreeView treeView)
Description copied from interface:TreeViewListener
Called when a tree view's checkmarks enabled flag has changed.- Specified by:
checkmarksEnabledChanged
in interfaceTreeViewListener
- Parameters:
treeView
- The source of this event.
-
showMixedCheckmarkStateChanged
public void showMixedCheckmarkStateChanged(TreeView treeView)
Description copied from interface:TreeViewListener
Called when a tree view's "show mixed checkmark state" flag has changed.- Specified by:
showMixedCheckmarkStateChanged
in interfaceTreeViewListener
- Parameters:
treeView
- The tree view that has changed.
-
disabledNodeFilterChanged
public void disabledNodeFilterChanged(TreeView treeView, Filter<?> previousDisabledNodeFilter)
Description copied from interface:TreeViewListener
Called when a tree view's disabled node filter has changed.- Specified by:
disabledNodeFilterChanged
in interfaceTreeViewListener
- Parameters:
treeView
- The tree view that has changed.previousDisabledNodeFilter
- The previous filter that determines the disabled nodes.
-
disabledCheckmarkFilterChanged
public void disabledCheckmarkFilterChanged(TreeView treeView, Filter<?> previousDisabledCheckmarkFilter)
Description copied from interface:TreeViewListener
Called when a tree view's disabled checkmark filter has changed.- Specified by:
disabledCheckmarkFilterChanged
in interfaceTreeViewListener
- Parameters:
treeView
- The source of this event.previousDisabledCheckmarkFilter
- The previous filter that determined the disabled checkmarks.
-
branchExpanded
public void branchExpanded(TreeView treeView, Sequence.Tree.Path path)
Description copied from interface:TreeViewBranchListener
Called when a tree node is expanded. This event can be used to perform lazy loading of tree node data.- Specified by:
branchExpanded
in interfaceTreeViewBranchListener
- Parameters:
treeView
- The source of the event.path
- The path of the node that was shown.
-
branchCollapsed
public void branchCollapsed(TreeView treeView, Sequence.Tree.Path path)
Description copied from interface:TreeViewBranchListener
Called when a tree node is collapsed.- Specified by:
branchCollapsed
in interfaceTreeViewBranchListener
- Parameters:
treeView
- The source of the event.path
- The path of the node that was collapsed.
-
previewBranchExpandedChange
public Vote previewBranchExpandedChange(TreeView treeView, Sequence.Tree.Path path)
Description copied from interface:TreeViewBranchListener
Called before a tree node is expanded or collapsed to allow the application or the skin to refuse the operation.- Specified by:
previewBranchExpandedChange
in interfaceTreeViewBranchListener
- Parameters:
treeView
- The source of the event.path
- The path of the node about to be collapsed or expanded.- Returns:
- The accumulated vote as to whether to allow this expansion or collapse.
-
branchExpandedChangeVetoed
public void branchExpandedChangeVetoed(TreeView treeView, Sequence.Tree.Path path, Vote reason)
Description copied from interface:TreeViewBranchListener
Called when thepreviewBranchExpandedChange()
tally produces anything but aVote.APPROVE
result (to say NOT to expand or collapse the branch). The application or skin can reverse any GUI changes that may have happened in the preview method.- Specified by:
branchExpandedChangeVetoed
in interfaceTreeViewBranchListener
- Parameters:
treeView
- The source of the event.path
- The path of the node whose state will remain the same.reason
- The tallied vote result that caused the veto.
-
nodeInserted
public void nodeInserted(TreeView treeView, Sequence.Tree.Path path, int index)
Description copied from interface:TreeViewNodeListener
Called when a node has been inserted into the tree view.- Specified by:
nodeInserted
in interfaceTreeViewNodeListener
- Parameters:
treeView
- The source of this event.path
- The path to the branch where the node was inserted.index
- The index of the newly inserted node within the branch.
-
nodesRemoved
public void nodesRemoved(TreeView treeView, Sequence.Tree.Path path, int index, int count)
Description copied from interface:TreeViewNodeListener
Called when nodes have been removed from the tree view.- Specified by:
nodesRemoved
in interfaceTreeViewNodeListener
- Parameters:
treeView
- The source of this event.path
- The path to the branch where the node(s) were removed.index
- The index to the first removed node within the branch.count
- The number of nodes that were removed, or-1
if all nodes were removed.
-
nodeUpdated
public void nodeUpdated(TreeView treeView, Sequence.Tree.Path path, int index)
Description copied from interface:TreeViewNodeListener
Called when a node in the tree view has been updated.- Specified by:
nodeUpdated
in interfaceTreeViewNodeListener
- Parameters:
treeView
- The source of this event.path
- Path to the branch that is the parent of the updated node.index
- Index of the updated node within the branch.
-
nodesCleared
public void nodesCleared(TreeView treeView, Sequence.Tree.Path path)
Description copied from interface:TreeViewNodeListener
Called when the nodes in a branch have been cleared.- Specified by:
nodesCleared
in interfaceTreeViewNodeListener
- Parameters:
treeView
- The source of this event.path
- Path to the branch where the nodes were cleared.
-
nodesSorted
public void nodesSorted(TreeView treeView, Sequence.Tree.Path path)
Description copied from interface:TreeViewNodeListener
Called when the nodes in a branch have been sorted.- Specified by:
nodesSorted
in interfaceTreeViewNodeListener
- Parameters:
treeView
- The source of this event.path
- Path to the branch where the nodes were sorted.
-
nodeCheckStateChanged
public void nodeCheckStateChanged(TreeView treeView, Sequence.Tree.Path path, TreeView.NodeCheckState previousCheckState)
Description copied from interface:TreeViewNodeStateListener
Called when a node's checked state has changed.- Specified by:
nodeCheckStateChanged
in interfaceTreeViewNodeStateListener
- Parameters:
treeView
- The source of this event.path
- Path to the node whose state has changed.previousCheckState
- The previous check state of this node.
-
selectedPathAdded
public void selectedPathAdded(TreeView treeView, Sequence.Tree.Path path)
Description copied from interface:TreeViewSelectionListener
Called when a selected path has been added to a tree view.- Specified by:
selectedPathAdded
in interfaceTreeViewSelectionListener
- Parameters:
treeView
- The source of this event.path
- The path that has been added to the selection.
-
selectedPathRemoved
public void selectedPathRemoved(TreeView treeView, Sequence.Tree.Path path)
Description copied from interface:TreeViewSelectionListener
Called when a selected path has been removed from a tree view.- Specified by:
selectedPathRemoved
in interfaceTreeViewSelectionListener
- Parameters:
treeView
- The source of this event.path
- The path that was removed from the selection.
-
selectedPathsChanged
public void selectedPathsChanged(TreeView treeView, Sequence<Sequence.Tree.Path> previousSelectedPaths)
Description copied from interface:TreeViewSelectionListener
Called when a tree view's selection state has been reset.- Specified by:
selectedPathsChanged
in interfaceTreeViewSelectionListener
- Parameters:
treeView
- The source of this event.previousSelectedPaths
- The list of paths that were previously selected.
-
-