Class TreeDragAndDropWidget
- java.lang.Object
-
- org.pushingpixels.radiance.theming.api.RadianceThemingWidget<javax.swing.JTree>
-
- org.pushingpixels.radiance.theming.internal.widget.tree.dnd.TreeDragAndDropWidget
-
public class TreeDragAndDropWidget extends RadianceThemingWidget<javax.swing.JTree>
TreeWrapper is used to handle drag and drop and popup menus in any JTree.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classTreeDragAndDropWidget.TreeDragGestureListenerInternal class that implements DragGestureListener.(package private) classTreeDragAndDropWidget.TreeDragSourceListenerInternal class that implements DragSourceListener.(package private) classTreeDragAndDropWidget.TreeDropTargetListener
-
Field Summary
Fields Modifier and Type Field Description private java.beans.PropertyChangeListenercellRendererChangeListenerprivate java.awt.dnd.DragGestureRecognizerdragGestureRecognizerprivate java.awt.dnd.DragSourcedragSourceprivate TreeDragAndDropWidget.TreeDropTargetListenerdropListenerprivate javax.swing.tree.MutableTreeNodedropNodeprivate java.awt.dnd.DropTargetdropTargetprivate static java.lang.Class[]EMPTY_CLASS_ARRAYThis to avoid excesive creation of objects in invocation.private static java.lang.Object[]EMPTY_OBJECT_ARRAYThis to avoid excesive creation of objects in invocation.private TreeDragAndDropWidget.TreeDragGestureListenergestureListenerprivate static java.lang.reflect.MethodgetTransferableMethodThis to avoid excessive reflection to find the "getTransferable" method.private javax.swing.event.EventListenerListlistenersprivate java.beans.PropertyChangeListenerpropertyChangeListenerprivate DnDCellRendererProxyrendererProxy-
Fields inherited from class org.pushingpixels.radiance.theming.api.RadianceThemingWidget
jcomp
-
-
Constructor Summary
Constructors Constructor Description TreeDragAndDropWidget()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidinstallDnDSupport()voidinstallListeners()Installs listeners for the associated component.private static booleanisAncestorOf(javax.swing.tree.TreeNode aPossibleParent, javax.swing.tree.TreeNode aNode)See if aPossibleParent is ancestor of aNodeprivate booleanmayDropHere(java.lang.String aSourceString, javax.swing.JTree aTargetTree, javax.swing.tree.TreeNode aNode)Invoked to decide if a given String can be dropped in the last path component of the given path.private booleanmayDropHere(java.lang.String aSourceString, javax.swing.JTree aTargetTree, javax.swing.tree.TreePath aPath)Invoked to decide if a given String can be dropped in the last path component of the given path.private booleanmayDropHere(javax.swing.JTree aSourceTree, javax.swing.tree.MutableTreeNode aSourceNode, javax.swing.tree.TreeNode aNode)Invoked to decide if draggedNode can be dropped into aNode.private booleanmayDropHere(javax.swing.JTree aSourceTree, javax.swing.tree.MutableTreeNode aSourceNode, javax.swing.tree.TreePath aPath)Invoked to decide if draggedNode can be dropped in the last path component of the given path.private voidresetDragAndDrop()private voiduninstallDnDSupport()voiduninstallListeners()Uninstalls listeners for the associated component.-
Methods inherited from class org.pushingpixels.radiance.theming.api.RadianceThemingWidget
installComponents, installDefaults, installUI, setComponent, uninstallComponents, uninstallDefaults, uninstallUI
-
-
-
-
Field Detail
-
EMPTY_CLASS_ARRAY
private static java.lang.Class[] EMPTY_CLASS_ARRAY
This to avoid excesive creation of objects in invocation.
-
getTransferableMethod
private static java.lang.reflect.Method getTransferableMethod
This to avoid excessive reflection to find the "getTransferable" method.
-
EMPTY_OBJECT_ARRAY
private static java.lang.Object[] EMPTY_OBJECT_ARRAY
This to avoid excesive creation of objects in invocation.
-
rendererProxy
private DnDCellRendererProxy rendererProxy
-
dragSource
private java.awt.dnd.DragSource dragSource
-
dropTarget
private java.awt.dnd.DropTarget dropTarget
-
dropNode
private javax.swing.tree.MutableTreeNode dropNode
-
listeners
private javax.swing.event.EventListenerList listeners
-
propertyChangeListener
private java.beans.PropertyChangeListener propertyChangeListener
-
cellRendererChangeListener
private java.beans.PropertyChangeListener cellRendererChangeListener
-
dropListener
private TreeDragAndDropWidget.TreeDropTargetListener dropListener
-
gestureListener
private TreeDragAndDropWidget.TreeDragGestureListener gestureListener
-
dragGestureRecognizer
private java.awt.dnd.DragGestureRecognizer dragGestureRecognizer
-
-
Method Detail
-
installListeners
public void installListeners()
Description copied from class:RadianceThemingWidgetInstalls listeners for the associated component.- Overrides:
installListenersin classRadianceThemingWidget<javax.swing.JTree>
-
installDnDSupport
private void installDnDSupport()
-
uninstallListeners
public void uninstallListeners()
Description copied from class:RadianceThemingWidgetUninstalls listeners for the associated component.- Overrides:
uninstallListenersin classRadianceThemingWidget<javax.swing.JTree>
-
uninstallDnDSupport
private void uninstallDnDSupport()
-
mayDropHere
private boolean mayDropHere(java.lang.String aSourceString, javax.swing.JTree aTargetTree, javax.swing.tree.TreePath aPath)Invoked to decide if a given String can be dropped in the last path component of the given path.- Parameters:
aSourceString- the String being dragged.aPath- the path to drop into.- Returns:
- true to allow the drop operation, false otherwise.
-
mayDropHere
private boolean mayDropHere(java.lang.String aSourceString, javax.swing.JTree aTargetTree, javax.swing.tree.TreeNode aNode)Invoked to decide if a given String can be dropped in the last path component of the given path.- Parameters:
aSourceString- the String being dragged.aTargetTree- the tree to drop into.aNode- the node to drop into.- Returns:
- true to allow the drop operation, false otherwise.
-
mayDropHere
private boolean mayDropHere(javax.swing.JTree aSourceTree, javax.swing.tree.MutableTreeNode aSourceNode, javax.swing.tree.TreePath aPath)Invoked to decide if draggedNode can be dropped in the last path component of the given path.- Parameters:
aSourceTree- the source tree.aSourceNode- the source node.aPath- the path to drop into.- Returns:
- true to allow the drop operation, false otherwise.
-
mayDropHere
private boolean mayDropHere(javax.swing.JTree aSourceTree, javax.swing.tree.MutableTreeNode aSourceNode, javax.swing.tree.TreeNode aNode)Invoked to decide if draggedNode can be dropped into aNode.- Parameters:
aSourceTree- the source tree.aSourceNode- the source node.aNode- the node to drop into.- Returns:
- true to allow the drop operation, false to avoid it.
-
isAncestorOf
private static boolean isAncestorOf(javax.swing.tree.TreeNode aPossibleParent, javax.swing.tree.TreeNode aNode)See if aPossibleParent is ancestor of aNode
-
resetDragAndDrop
private void resetDragAndDrop()
-
-