Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
CueTree Class Reference
Inheritance diagram for CueTree:

Data Structures

class  CueGestureHandler
 
class  CueTreeUI
 

Public Member Functions

 CueTree ()
 
 CueTree (TreeModel model)
 
void addCueGestureListener (CueGestureListener cgl)
 
void removeCueGestureListener (CueGestureListener cgl)
 
void setShowsGhostedNode (boolean b)
 
boolean getShowsGhostedNode ()
 
void setMoveEnabled (boolean b)
 
boolean isMoveEnabled ()
 
TreePath getCuePath ()
 
void setCueLineStroke (Stroke stroke)
 
Stroke getCueLineStroke ()
 
void setCueLineColor (Color color)
 
Color getCueLineColor ()
 
void setHighlightPathStroke (Stroke stroke)
 
Stroke getHighlightPathStroke ()
 
void setMoveCursor (Cursor cursor)
 
void setNoMoveCursor (Cursor cursor)
 
void setCueLineOffset (int offset)
 
boolean inCueMode ()
 
Rectangle getPathBounds (TreePath[] paths)
 
Image getGhostedNode (TreePath path)
 
Image getGhostedNode (TreePath[] paths)
 
Rectangle getNodeIconBounds (TreePath path)
 
void initiateAddMode (TreePath[] paths, Point initPoint)
 
void startCueMode (TreePath[] paths)
 
void stopCueMode ()
 
void setTriggersPath (boolean b)
 
void fireMoveGestureRecognized (TreePath sourcePath, TreePath parentPath, int index, Point p)
 
void fireMoveGestureRecognized (TreePath[] sourcePaths, TreePath parentPath, int index, Point p)
 
void fireMoveGestureCompleted (TreePath sourcePath, TreePath parentPath, int index, int prevIndex, Point p)
 
void fireMoveGestureCompleted (TreePath[] sourcePaths, TreePath parentPath, int index, int prevIndex, Point p)
 
void fireAddGestureRecognized (TreePath sourcePath, TreePath parentPath, int index, Point p)
 
void fireAddGestureRecognized (TreePath[] sourcePaths, TreePath parentPath, int index, Point p)
 
void fireAddGestureCompleted (TreePath sourcePath, TreePath parentPath, int index, Point p)
 
void fireAddGestureCompleted (TreePath[] sourcePaths, TreePath parentPath, int index, Point p)
 
String[] getCueModeParentIds ()
 
void setCueModeParentIds (TreePath[] selectedPaths)
 
void setLastKeyPressed (int keyCode)
 
int getLastKeyPressed ()
 

Static Public Member Functions

static void main (String[] args)
 

Static Public Attributes

static final int DRAG_MODE = 1
 
static final int CLICK_MODE = 2
 
static final int ADD_REQUEST_MODE = 1
 
static final int MOVE_REQUEST_MODE = 2
 
static final String INVALID_CURSOR = "Invalid.32x32"
 
static final Rectangle VOID_RECTANGLE = new Rectangle(0, 0, 0, 0)
 

Protected Member Functions

CueGestureHandler getCueGestureHandler ()
 
Component getComponentForPath (TreePath path)
 
void paintGhostedNode (int x, int y, TreePath path)
 
boolean nodeIconContainsPoint (TreePath path, Point point)
 
boolean nodeIconContainsPoint (Point point)
 
void drawCueLine (TreePath path, boolean pathIsNewParent, boolean aboveTopPath)
 
void drawCueLine (TreePath path, int mouseY)
 
Rectangle highlightPath (TreePath path, Color color)
 
boolean canMoveNode (Object node)
 

Protected Attributes

boolean inCueMode = false
 
int cueLineOffset = 5
 
Rectangle dirtyCueBounds = VOID_RECTANGLE
 
Rectangle dirtyGhostBounds = VOID_RECTANGLE
 

Detailed Description

A CueTree provides a means for moving nodes within a tree. The cue tree does not handle the moving operations, but mearly provides an interface for moving nodes within the tree.

Author
Marc McIntyre mmcin.nosp@m.tyre.nosp@m.@squi.nosp@m.z.ne.nosp@m.t

Definition at line 38 of file CueTree.java.

Constructor & Destructor Documentation

CueTree ( )
inline

Creates a CueTree and adds some sample data

Definition at line 98 of file CueTree.java.

CueTree ( TreeModel  model)
inline

Constructs a CueTree and sets the tree model.

Parameters
modelthe tree model

Definition at line 107 of file CueTree.java.

Member Function Documentation

void addCueGestureListener ( CueGestureListener  cgl)
inline

Adds a listener for Cue Events

Parameters
clthe listener
See Also
removeCueGestureListener(CueGestureListener)

Definition at line 141 of file CueTree.java.

boolean canMoveNode ( Object  node)
inlineprotected

Returns TRUE if the node can be moved

Parameters
nodethe node the check
Returns
TRUE if the node can be moved

Definition at line 1415 of file CueTree.java.

void drawCueLine ( TreePath  path,
boolean  pathIsNewParent,
boolean  aboveTopPath 
)
inlineprotected

Draws a cue line to indicate where the node will be placed. The cue line will be drawn underneath the specified TreePath

Parameters
paththe TreePath where the cue line will be drawn underneath
pathIsNewParentif TRUE the specified path is the new parent for this node.

Definition at line 577 of file CueTree.java.

void drawCueLine ( TreePath  path,
int  mouseY 
)
inlineprotected

draws a cue line for the specifed path. The cue line may depict that the new position will be a child of the path specifed based on the specified mouse Y co-ordinate.

Parameters
paththe treePath to draw the cue line
mouseYthe mouse Y co-ordinate

Definition at line 683 of file CueTree.java.

void fireAddGestureCompleted ( TreePath[]  sourcePaths,
TreePath  parentPath,
int  index,
Point  p 
)
inline

Fires an addGestureCompleted event to CueGestureListeners to indicate that the operation for a new node has requested to be added has completed

Parameters
sourcePaththe source path of the node where the add completed
parentPaththe parent path to the node where the add completed
indexthe index of the the add completed
pthe mouse point where the event occured

Definition at line 907 of file CueTree.java.

void fireAddGestureRecognized ( TreePath[]  sourcePaths,
TreePath  parentPath,
int  index,
Point  p 
)
inline

Fires an addGestureRecognized event to CueGestureListeners to indicate that a new node has requested to be added

Parameters
sourcePaththe source path of the node to be added, use this as information carrier about the new node
parentPaththe parent path to the node to be added
indexthe index of the the add started
pthe mouse point where the event occured

Definition at line 860 of file CueTree.java.

void fireMoveGestureCompleted ( TreePath[]  sourcePaths,
TreePath  parentPath,
int  index,
int  prevIndex,
Point  p 
)
inline
Parameters
sourcePaththe source path to the node which is moving
parentPaththe parent path to the node which is moving
indexthe index of the node that is moving
pthe mouse point where the event occured

Definition at line 811 of file CueTree.java.

void fireMoveGestureRecognized ( TreePath  sourcePath,
TreePath  parentPath,
int  index,
Point  p 
)
inline

Fires an moveGestureRecognized event to CueGestureListeners to indicate that a move request has begin

Parameters
sourcePaththe source path to the node which is moving
parentPaththe parent path to the node which is moving
indexthe index of the node that is moving
pthe mouse point where the event occured

Definition at line 757 of file CueTree.java.

Component getComponentForPath ( TreePath  path)
inlineprotected

Returns the renderable component for the specified path

Parameters
paththe TreePath to the wanted renderable component
Returns
the renderable component for the specified path

Definition at line 320 of file CueTree.java.

CueGestureHandler getCueGestureHandler ( )
inlineprotected

Returns the CueRequestHandler that will be used to handle cue requests

Returns
the CueRequestHandler

Definition at line 158 of file CueTree.java.

Color getCueLineColor ( )
inline

Returns the color of the cue line.

Returns
the color of the cue line
See Also
setCueLineColor(Color)

Definition at line 254 of file CueTree.java.

Stroke getCueLineStroke ( )
inline

Gets the stroke used for the cue line

Returns
the stroke to use for the cue line
See Also
setCueLineStroke(Stroke)
setHighlightPathStroke(Stroke)
getHighlightPathStroke()

Definition at line 236 of file CueTree.java.

TreePath getCuePath ( )
inline

Returns the sourcePath of the cue, or null if not in cue mode.

Returns
the source path of the cue

Definition at line 214 of file CueTree.java.

Image getGhostedNode ( TreePath  path)
inline

Returns the Image for the component at the specified TreePath

Parameters
paththe TreePath for the wanted component Image
Returns
the image representation of the component at the give TreePath
See Also
getGhostedNode(TreePath[])

Definition at line 372 of file CueTree.java.

Image getGhostedNode ( TreePath[]  paths)
inline

Returns a ghosted image for the specfied TreePaths

Parameters
pathsthe paths of the wanted ghosted node
Returns
the ghosted node of the specifed paths
See Also
getGhostedNode(TreePath)

Definition at line 402 of file CueTree.java.

Stroke getHighlightPathStroke ( )
inline

Gets the highlight path stroke that is used to indicate that a move will move the node under the highlighted parent

Returns
the stroke to use for the cue line
See Also
setCueLineStroke(Stroke)
getCueLineStroke()
setHighlightPathStroke(Stroke)

Definition at line 278 of file CueTree.java.

Rectangle getNodeIconBounds ( TreePath  path)
inline

Returns the bounds of the Icon that belongs to the cell of the node at the specified TreePath If the component returned by the cellrenderer is not an Instance of JLabel, null is returned

Parameters
paththe TreePathof the wanted cell to whom the Icon belongs
Returns
the Icons bounds
See Also
nodeIconContainsPoint(Point)
nodeIconContainsPoint(TreePath, Point)

Definition at line 450 of file CueTree.java.

Rectangle getPathBounds ( TreePath[]  paths)
inline

Returns a union of the path bounds of all the paths in the specified TreePath array

Parameters
pathsthe paths of the wanted bounds
Returns
the union of the bounds of the specified TreePaths
See Also
JTree::getPathBounds(TreePath)

Definition at line 353 of file CueTree.java.

boolean getShowsGhostedNode ( )
inline

Returns the ghosted node property

Returns
the ghosted node property
See Also
setShowsGhostedNode(boolean)

Definition at line 181 of file CueTree.java.

Rectangle highlightPath ( TreePath  path,
Color  color 
)
inlineprotected

Highlights the specified path by drawing a rectangle around its bounds in the specified colour. The bounds of the painted rectangle are returned so the highlighted area can be erased.

Parameters
paththe path of the node to be highlighted
colorthe color of the highlighting rectangled
Returns
the bounds of the painted rectangle

Definition at line 721 of file CueTree.java.

void initiateAddMode ( TreePath[]  paths,
Point  initPoint 
)
inline

initiates that a new node will be added to the tree use the specified TreePath to specify information about the new node that will be added. eg.

  TreePath path = new TreePath(new TreeNode(userObject));
Parameters
paththe treepath that the fireAddStarted event will use as the sourcePath
initPointwhere the add gesture initiated

Definition at line 521 of file CueTree.java.

boolean isMoveEnabled ( )
inline

Returns TRUE if move opeations are enabled.

Returns
TRUE if move operation are enabled

Definition at line 205 of file CueTree.java.

boolean nodeIconContainsPoint ( TreePath  path,
Point  point 
)
inlineprotected

Returns TRUE if the specified point is within the specified path's icon's bounds

Parameters
paththe path to the node
pointthe point to check
Returns
TRUE if the point is within the icon's bounds
See Also
nodeIconContainsPoint(Point)
getNodeIconBounds(TreePath)

Definition at line 483 of file CueTree.java.

boolean nodeIconContainsPoint ( Point  point)
inlineprotected

Returns true if the specified point is within the bounds of a node's icon

Parameters
pointthe point to check
Returns
TRUE if the specified point is within the bouse of a node's icon
See Also
nodeIconContainsPoint(TreePath, Point)
getNodeIconBounds(TreePath)

Definition at line 500 of file CueTree.java.

void paintGhostedNode ( int  x,
int  y,
TreePath  path 
)
inlineprotected

Paints the ghosted node with the given TreePath at the specified location

Parameters
xthe x co-ordinate
ythe y co-ordinate
paththe TreePath of the node to paint

Definition at line 429 of file CueTree.java.

void removeCueGestureListener ( CueGestureListener  cgl)
inline

Removes a listener from Cue Events

Parameters
clthe listener
See Also
addCueGestureListener(CueGestureListener)

Definition at line 150 of file CueTree.java.

void setCueLineColor ( Color  color)
inline

Sets the color of the cue line that is drawn in move operations.

Parameters
colorthe color of the cue line
See Also
getCueLineColor()

Definition at line 245 of file CueTree.java.

void setCueLineOffset ( int  offset)
inline

Sets offset a which the cue line is drawn above/below the mouse pointer The default is 5. A negative integer will draw the cue line below the mouse pointer.

Parameters
offsetthe offset at which to draw the cue line from the mouse pointer

Definition at line 307 of file CueTree.java.

void setCueLineStroke ( Stroke  stroke)
inline

Sets the stroke used for the cue line

Parameters
strokethe stroke to use for the cue line
See Also
getCueLineStroke()
setHighlightPathStroke(Stroke)
getHighlightPathStroke()

Definition at line 225 of file CueTree.java.

void setHighlightPathStroke ( Stroke  stroke)
inline

Sets the highlight path stroke that is used to indicate that a move will move the node under the highlighted parent

Parameters
strokethe stroke to use for the cue line
See Also
setCueLineStroke(Stroke)
getCueLineStroke()
getHighlightPathStroke()

Definition at line 266 of file CueTree.java.

void setMoveCursor ( Cursor  cursor)
inline

Sets the cursor to indicate that a move operation will occur

Parameters
cursorthe cursor
See Also
setNoMoveCursor(cursor)

Definition at line 287 of file CueTree.java.

void setMoveEnabled ( boolean  b)
inline

Sets if moves are enabled on this tree. The tree has move enabled by default

Parameters
enabledif TRUE move opreations will be enabled

Definition at line 190 of file CueTree.java.

void setNoMoveCursor ( Cursor  cursor)
inline

Sets the cursor to indicate that this node cannot be moved

Parameters
cursorthe cursor
See Also
setMoveCursor(cursor)

Definition at line 296 of file CueTree.java.

void setShowsGhostedNode ( boolean  b)
inline

Sets the showsGhostedNode property. If TRUE during a drag sequence the node in question is shown as a ghosted image and follows the mouse.

Parameters
valueIf TRUE the node will be shown as a ghosted image during a drag sequence
Returns
void
See Also
getShowsGhostedNode()

Definition at line 172 of file CueTree.java.

void setTriggersPath ( boolean  b)
inline

Sets whether a path is triggered when the move operation has completed. This is enabled by default.

Parameters
bif TRUE the path will be triggered when the move operation has completed

Definition at line 564 of file CueTree.java.

void startCueMode ( TreePath[]  paths)
inline

Explicitly starts cue mode with the specified paths in the move operation.

Parameters
pathsthe paths in the move operation
See Also
stopCueMode()

Definition at line 537 of file CueTree.java.

void stopCueMode ( )
inline

Explicitly stops Cue mode operations

See Also
startCueMode(TreePath[])

Definition at line 551 of file CueTree.java.

Field Documentation

final int ADD_REQUEST_MODE = 1
static

Mode that indicates that the tree is adding a node Mode that indicates that we are adding a node

Definition at line 47 of file CueTree.java.

final int CLICK_MODE = 2
static

The mode that indicate that the tree supports clicking to move nodes

Definition at line 43 of file CueTree.java.

int cueLineOffset = 5
protected

the offset that a cue line is drawn above or below the selected path

Definition at line 58 of file CueTree.java.

final int DRAG_MODE = 1
static

The mode that indicate that the tree supports dragging

Definition at line 41 of file CueTree.java.

boolean inCueMode = false
protected

TRUE if we are in cue mode

Definition at line 56 of file CueTree.java.

final String INVALID_CURSOR = "Invalid.32x32"
static

the cursor shown when the mouse hovers over a node that cannot be moved

Definition at line 51 of file CueTree.java.

final int MOVE_REQUEST_MODE = 2
static

Mode that indicates that the tree is moving a node

Definition at line 49 of file CueTree.java.

final Rectangle VOID_RECTANGLE = new Rectangle(0, 0, 0, 0)
static

A non-null void rectangle

Definition at line 53 of file CueTree.java.


The documentation for this class was generated from the following file: