com.metamatrix.toolbox.ui.widget.transfer
Class AbstractTreeNodeDragAndDropController

java.lang.Object
  extended by com.metamatrix.toolbox.ui.widget.transfer.AbstractDragAndDropController
      extended by com.metamatrix.toolbox.ui.widget.transfer.AbstractTreeNodeDragAndDropController
All Implemented Interfaces:
DragAndDropController, TreeNodeDragAndDropController, java.awt.dnd.DragGestureListener, java.awt.dnd.DragSourceListener, java.awt.dnd.DropTargetListener, java.util.EventListener

public abstract class AbstractTreeNodeDragAndDropController
extends AbstractDragAndDropController
implements TreeNodeDragAndDropController

Since:
2.1
Version:
2.1
Author:
John P. A. Verhaeg

Field Summary
protected  boolean allowsDropsBetweenNodes
           
protected  boolean allowsDropsWithinNodes
           
protected static int dragNdx
           
protected static TreeNode dragParent
           
protected  boolean dragSrc
           
protected static int dropNdx
           
protected static TreeNode dropParent
           
protected  boolean dropTarget
           
protected static boolean validDragSrc
           
protected static boolean validDropTarget
           
protected  TreeView view
           
protected  boolean willDropAboveTarget
           
protected  boolean willDropBelowTarget
           
protected  boolean willDropOnTarget
           
protected static TransferableTreeNode xferable
           
 
Constructor Summary
protected AbstractTreeNodeDragAndDropController(boolean allowsDropsWithinNodes, boolean allowsDropsBetweenNodes)
           
 
Method Summary
protected  boolean addNode()
           
 boolean allowsDropsBetweenNodes()
           
 boolean allowsDropsWithinNodes()
           
protected  void constructAbstractTreeNodeDragAndDropController(boolean allowsDropsWithinNodes, boolean allowsDropsBetweenNodes)
           
 void dragDropEnd(java.awt.dnd.DragSourceDropEvent event)
          Sets drag-in-progress indicator to false.
 void dragEnter(java.awt.dnd.DropTargetDragEvent event)
          Accepts TreeNode move & copy operations.
 void dragExit(java.awt.dnd.DragSourceEvent event)
          Does nothing.
 void dragExit(java.awt.dnd.DropTargetEvent event)
          Does nothing.
 void dragOver(java.awt.dnd.DragSourceDragEvent event)
          Sets the cursor to reflect whether the node under the mouse is a legal drop target.
 void dragOver(java.awt.dnd.DropTargetDragEvent event)
          Resets the will-drop-xxx-target and is-valid-drop-target indicators to false, resets the drop target to null.
 void drop(java.awt.dnd.DropTargetDropEvent event)
          Moves or copies the dragged node to the drop location determined in the dragOver(DropTargetDragEvent) method.
protected  int getDefaultAllowedDragActions()
          Gets the default allowed drag actions.
protected  int getDefaultAllowedDropActions()
          Gets the default allowed drop actions.
static int getDragIndex()
           
static TreeNode getDragParent()
           
static int getDropIndex()
           
static TreeNode getDropParent()
           
protected static TransferableTreeNode getTransferable()
           
protected  TreeView getTreeView()
           
protected  boolean getValidDragSource(java.awt.datatransfer.DataFlavor[] flavors)
           
protected  boolean getValidDropTarget()
          Retrieves whether the current component beneath the cursor is a valid drop target.
protected  boolean isDragCandidate(java.util.List dragNode)
           
protected  boolean isDragSource()
           
protected  boolean isDropTarget()
           
protected  boolean isTreeNodeFlavor(java.awt.datatransfer.DataFlavor flavor)
           
protected static boolean isValidDragSource()
           
protected  boolean moveNode()
           
 void setAllowsDropsBetweenNodes(boolean allowsDropsBetweenNodes)
           
 void setAllowsDropsWithinNodes(boolean allowsDropsWithinNodes)
           
protected  void setDropNode(TreeNode dropNode, boolean betweenNodes)
           
protected  void setTreeView(TreeView view)
           
protected  void setValidDropTarget(boolean valid)
          Sets whether the current component beneath the cursor is a valid drop target.
 void setWillDropAboveTarget(boolean aboveTarget)
          Sets whether a drop at the current mouse position will occur above the current drop target.
 void setWillDropBelowTarget(boolean belowTarget)
          Sets whether a drop at the current mouse position will occur below the current drop target.
 void setWillDropOnTarget(boolean onTarget)
          Sets whether a drop at the current mouse position will occur on the current drop target.
protected  void startDrag(java.awt.dnd.DragGestureEvent event, java.util.List dragNode)
          Begins drag operations, saving reference to node being dragged.
protected  void startDrag(java.awt.dnd.DragGestureEvent event, TreeNode dragNode)
          Begins drag operations, saving reference to node being dragged.
protected  boolean transferNode()
           
 boolean willDropAboveTarget()
          Returns whether a drop at the current mouse position will occur above the current drop target.
 boolean willDropBelowTarget()
          Returns whether a drop at the current mouse position will occur below the current drop target.
 boolean willDropOnTarget()
          Returns whether a drop at the current mouse position will occur on the current drop target.
 
Methods inherited from class com.metamatrix.toolbox.ui.widget.transfer.AbstractDragAndDropController
constructAbstractDragAndDropController, debug, dragEnter, dragGestureRecognized, dropActionChanged, dropActionChanged, getActualDropAction, getAllowedDragActions, getAllowedDropActions, getComponent, getDragSource, getDropTarget, isDragging, setAllowedDragActions, setAllowedDropActions, setComponent, setDragSource, setDropTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.metamatrix.toolbox.ui.widget.transfer.DragAndDropController
getAllowedDragActions, getAllowedDropActions, getComponent, getDragSource, getDropTarget, isDragging, setAllowedDragActions, setAllowedDropActions, setComponent
 

Field Detail

dragParent

protected static transient TreeNode dragParent

dropParent

protected static transient TreeNode dropParent

dropNdx

protected static transient int dropNdx

dragNdx

protected static transient int dragNdx

xferable

protected static transient TransferableTreeNode xferable

validDragSrc

protected static transient boolean validDragSrc

validDropTarget

protected static transient boolean validDropTarget

allowsDropsWithinNodes

protected boolean allowsDropsWithinNodes

allowsDropsBetweenNodes

protected boolean allowsDropsBetweenNodes

view

protected TreeView view

dragSrc

protected transient boolean dragSrc

dropTarget

protected transient boolean dropTarget

willDropAboveTarget

protected boolean willDropAboveTarget

willDropBelowTarget

protected boolean willDropBelowTarget

willDropOnTarget

protected boolean willDropOnTarget
Constructor Detail

AbstractTreeNodeDragAndDropController

protected AbstractTreeNodeDragAndDropController(boolean allowsDropsWithinNodes,
                                                boolean allowsDropsBetweenNodes)
Since:
2.1
Method Detail

getDragIndex

public static int getDragIndex()
Since:
2.1

getDragParent

public static TreeNode getDragParent()
Since:
2.1

getDropIndex

public static int getDropIndex()
Since:
2.1

getDropParent

public static TreeNode getDropParent()
Since:
2.1

getTransferable

protected static TransferableTreeNode getTransferable()
Since:
2.1

isValidDragSource

protected static boolean isValidDragSource()
Since:
2.1

addNode

protected boolean addNode()
Since:
2.1

allowsDropsBetweenNodes

public boolean allowsDropsBetweenNodes()
Since:
2.1

allowsDropsWithinNodes

public boolean allowsDropsWithinNodes()
Since:
2.1

constructAbstractTreeNodeDragAndDropController

protected void constructAbstractTreeNodeDragAndDropController(boolean allowsDropsWithinNodes,
                                                              boolean allowsDropsBetweenNodes)
Since:
2.1

dragDropEnd

public void dragDropEnd(java.awt.dnd.DragSourceDropEvent event)
Description copied from class: AbstractDragAndDropController
Sets drag-in-progress indicator to false.

Specified by:
dragDropEnd in interface java.awt.dnd.DragSourceListener
Overrides:
dragDropEnd in class AbstractDragAndDropController
Parameters:
event - Not used
Since:
2.1

dragEnter

public void dragEnter(java.awt.dnd.DropTargetDragEvent event)
Accepts TreeNode move & copy operations.

Specified by:
dragEnter in interface java.awt.dnd.DropTargetListener
Overrides:
dragEnter in class AbstractDragAndDropController
Since:
2.1

dragExit

public void dragExit(java.awt.dnd.DragSourceEvent event)
Description copied from class: AbstractDragAndDropController
Does nothing.

Specified by:
dragExit in interface java.awt.dnd.DragSourceListener
Overrides:
dragExit in class AbstractDragAndDropController
Since:
2.1

dragExit

public void dragExit(java.awt.dnd.DropTargetEvent event)
Description copied from class: AbstractDragAndDropController
Does nothing.

Specified by:
dragExit in interface java.awt.dnd.DropTargetListener
Overrides:
dragExit in class AbstractDragAndDropController
Since:
2.1

dragOver

public void dragOver(java.awt.dnd.DragSourceDragEvent event)
Sets the cursor to reflect whether the node under the mouse is a legal drop target.

Specified by:
dragOver in interface java.awt.dnd.DragSourceListener
Overrides:
dragOver in class AbstractDragAndDropController
Since:
2.1

dragOver

public void dragOver(java.awt.dnd.DropTargetDragEvent event)
Resets the will-drop-xxx-target and is-valid-drop-target indicators to false, resets the drop target to null.

Specified by:
dragOver in interface java.awt.dnd.DropTargetListener
Overrides:
dragOver in class AbstractDragAndDropController
Parameters:
event - Not used
Since:
2.0

drop

public void drop(java.awt.dnd.DropTargetDropEvent event)
Moves or copies the dragged node to the drop location determined in the dragOver(DropTargetDragEvent) method.

Specified by:
drop in interface java.awt.dnd.DropTargetListener
Overrides:
drop in class AbstractDragAndDropController
Since:
2.1

getDefaultAllowedDragActions

protected int getDefaultAllowedDragActions()
Gets the default allowed drag actions.

Overrides:
getDefaultAllowedDragActions in class AbstractDragAndDropController
Since:
2.1

getDefaultAllowedDropActions

protected int getDefaultAllowedDropActions()
Gets the default allowed drop actions.

Overrides:
getDefaultAllowedDropActions in class AbstractDragAndDropController
Since:
2.1

getTreeView

protected TreeView getTreeView()
Since:
2.1

getValidDragSource

protected boolean getValidDragSource(java.awt.datatransfer.DataFlavor[] flavors)
Since:
2.1

getValidDropTarget

protected boolean getValidDropTarget()
Retrieves whether the current component beneath the cursor is a valid drop target.

Returns:
True if the drop target is valid
Since:
2.1

isDragSource

protected boolean isDragSource()
Since:
2.1

isDropTarget

protected boolean isDropTarget()
Since:
2.1

isTreeNodeFlavor

protected boolean isTreeNodeFlavor(java.awt.datatransfer.DataFlavor flavor)
Since:
2.1

moveNode

protected boolean moveNode()
Since:
2.1

setAllowsDropsBetweenNodes

public void setAllowsDropsBetweenNodes(boolean allowsDropsBetweenNodes)
Since:
2.1

setAllowsDropsWithinNodes

public void setAllowsDropsWithinNodes(boolean allowsDropsWithinNodes)
Since:
2.1

setDropNode

protected void setDropNode(TreeNode dropNode,
                           boolean betweenNodes)
Since:
2.1

setTreeView

protected void setTreeView(TreeView view)
Since:
2.1

setWillDropAboveTarget

public void setWillDropAboveTarget(boolean aboveTarget)
Sets whether a drop at the current mouse position will occur above the current drop target.

Parameters:
aboveTarget - True if the drop will occur above the current drop target.
Since:
2.1

setWillDropBelowTarget

public void setWillDropBelowTarget(boolean belowTarget)
Sets whether a drop at the current mouse position will occur below the current drop target.

Parameters:
belowTarget - True if the drop will occur below the current drop target.
Since:
2.1

setWillDropOnTarget

public void setWillDropOnTarget(boolean onTarget)
Sets whether a drop at the current mouse position will occur on the current drop target.

Parameters:
onTarget - True if the drop will occur on the current drop target.
Since:
2.1

setValidDropTarget

protected void setValidDropTarget(boolean valid)
Sets whether the current component beneath the cursor is a valid drop target.

Parameters:
valid - True if the drop target is valid
Since:
2.1

startDrag

protected void startDrag(java.awt.dnd.DragGestureEvent event,
                         TreeNode dragNode)
Begins drag operations, saving reference to node being dragged.

Since:
2.1

startDrag

protected void startDrag(java.awt.dnd.DragGestureEvent event,
                         java.util.List dragNode)
Begins drag operations, saving reference to node being dragged.

Since:
2.1

isDragCandidate

protected boolean isDragCandidate(java.util.List dragNode)

transferNode

protected boolean transferNode()
Since:
2.1

willDropAboveTarget

public boolean willDropAboveTarget()
Returns whether a drop at the current mouse position will occur above the current drop target.

Specified by:
willDropAboveTarget in interface TreeNodeDragAndDropController
Returns:
True if the drop will occur above the current drop target.
Since:
2.1

willDropBelowTarget

public boolean willDropBelowTarget()
Returns whether a drop at the current mouse position will occur below the current drop target.

Specified by:
willDropBelowTarget in interface TreeNodeDragAndDropController
Returns:
True if the drop will occur below the current drop target.
Since:
2.1

willDropOnTarget

public boolean willDropOnTarget()
Returns whether a drop at the current mouse position will occur on the current drop target.

Specified by:
willDropOnTarget in interface TreeNodeDragAndDropController
Returns:
True if the drop will occur on the current drop target.
Since:
2.1


Copyright © 2009. All Rights Reserved.