java.lang.Object
furbelow.AbstractComponentDecorator
furbelow.TreeAnimator
- All Implemented Interfaces:
EventListener
,TreeExpansionListener
Animates moving tree cells out of the way for a potential drop. This
decorator completely over-paints the target JTree, optionally
painting a dragged item and animating creation of a space for the
dragged item to be dropped.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class furbelow.AbstractComponentDecorator
AbstractComponentDecorator.Painter
-
Field Summary
Fields inherited from class furbelow.AbstractComponentDecorator
DEFAULT_BOUNDS, TOP
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
The default assumes any node except the root may be moved.protected boolean
Returns whether the node at the given path may be moved to the given index on the given target path.void
dispose()
Stop decorating.void
End an internal drag.protected TreeAnimator.DragDestination
getDragDestination
(Point where) Return a proposed insertion location for the given coordinate given in actual JTree coordinate space.protected int
static void
Throw up a frame to demonstrate the animator at work.protected void
Request that the node on the given path be moved to the given index on the given target path.void
Define the decoration's appearance.void
setPlaceholderLocation
(Point where) Invoke this method as the cursor location changes.void
setVisible
(boolean visible) Use this to change the visibility of the decoration.boolean
Start a local drag.void
void
Methods inherited from class furbelow.AbstractComponentDecorator
attach, clipDecorationBounds, getComponent, getDecorationBounds, getPainter, getToolTipText, getToolTipText, isVisible, repaint, setCursor, setDecorationBounds, setDecorationBounds, setPainterBounds, setToolTipText, synch, toString
-
Constructor Details
-
TreeAnimator
-
-
Method Details
-
canMove
The default assumes any node except the root may be moved. -
canMove
Returns whether the node at the given path may be moved to the given index on the given target path. The default disallows moves only if the target is a descendent of the moved path. -
moveNode
Request that the node on the given path be moved to the given index on the given target path. If toPath is the parent path to fromPath, then the index represents the insertion index after the object is removed from its current index. -
startDrag
Start a local drag. Returns whether the drag is started. -
treeExpanded
- Specified by:
treeExpanded
in interfaceTreeExpansionListener
-
treeCollapsed
- Specified by:
treeCollapsed
in interfaceTreeExpansionListener
-
setVisible
public void setVisible(boolean visible) Description copied from class:AbstractComponentDecorator
Use this to change the visibility of the decoration.- Overrides:
setVisible
in classAbstractComponentDecorator
-
endDrag
End an internal drag. -
dispose
public void dispose()Description copied from class:AbstractComponentDecorator
Stop decorating.- Overrides:
dispose
in classAbstractComponentDecorator
-
getDragDestination
Return a proposed insertion location for the given coordinate given in actual JTree coordinate space. If there is no vertical row change from the current insertion position, then horizontal movement is used to make changes in depth. Returns null if no insertion is allowed at the given location. -
setPlaceholderLocation
Invoke this method as the cursor location changes. -
getPlaceholderRow
protected int getPlaceholderRow() -
paint
Description copied from class:AbstractComponentDecorator
Define the decoration's appearance. The point (0,0) represents the upper left corner of the decorated component. The default clip mask will be the extents of the decoration bounds, as indicated byAbstractComponentDecorator.getDecorationBounds()
, which defaults to the decorated component bounds.- Specified by:
paint
in classAbstractComponentDecorator
-
main
Throw up a frame to demonstrate the animator at work.
-