org.tentackle.appworx
Class AppDbObjectTree

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTree
                  extended by org.tentackle.ui.FormTree
                      extended by org.tentackle.appworx.AppDbObjectTree
All Implemented Interfaces:
DragGestureListener, DragSourceListener, DropTargetListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, TreeWillExpandListener, Scrollable

public class AppDbObjectTree
extends FormTree
implements TreeWillExpandListener, DragSourceListener, DragGestureListener, DropTargetListener

An extended FormTree that implements object navigation, drag and drop, clipboard functionality for AppDbObjects, and provides a context-sensitive popup menu,

Author:
harald
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTree
JTree.AccessibleJTree, JTree.DropLocation, JTree.DynamicUtilTreeNode, JTree.EmptySelectionModel, JTree.TreeModelHandler, JTree.TreeSelectionRedirector
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class org.tentackle.ui.FormTree
CLICK_ACTION, ENTER_ACTION
 
Fields inherited from class javax.swing.JTree
ANCHOR_SELECTION_PATH_PROPERTY, CELL_EDITOR_PROPERTY, CELL_RENDERER_PROPERTY, cellEditor, cellRenderer, editable, EDITABLE_PROPERTY, EXPANDS_SELECTED_PATHS_PROPERTY, INVOKES_STOP_CELL_EDITING_PROPERTY, invokesStopCellEditing, LARGE_MODEL_PROPERTY, largeModel, LEAD_SELECTION_PATH_PROPERTY, ROOT_VISIBLE_PROPERTY, rootVisible, ROW_HEIGHT_PROPERTY, rowHeight, SCROLLS_ON_EXPAND_PROPERTY, scrollsOnExpand, SELECTION_MODEL_PROPERTY, selectionModel, selectionRedirector, SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles, TOGGLE_CLICK_COUNT_PROPERTY, toggleClickCount, TREE_MODEL_PROPERTY, treeModel, treeModelListener, VISIBLE_ROW_COUNT_PROPERTY, visibleRowCount
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AppDbObjectTree()
          Creates an empty tree.
AppDbObjectTree(Object object)
          Creates a tree.
If the given object is a Collection the objects of the collection will be shown in the tree.
 
Method Summary
 void buildTree(Collection col)
          Builds the tree from a collection of objects.
 void collapseAll()
          Collapses all childnodes of the root.
 TreeCellRenderer createDefaultRenderer()
          Creates the default tree cell renderer.
The default implementation returns a AppDbObjectTreeCellRenderer.
 void doCollapsePath(TreePath path)
          Collapses a given path.
The method invokes collapsePath and set expanded=false in all AppDbTreeObject-nodes.
 void doExpandPath(int level, int maxLevel, AppDbObject stopObject, TreePath path)
          Recursively expands the path.
 void dragDropEnd(DragSourceDropEvent event)
          This method is invoked to signify that the Drag and Drop operation is complete.
 void dragEnter(DragSourceDragEvent event)
          Called as the cursor's hotspot enters a platform-dependent drop site.
 void dragEnter(DropTargetDragEvent dtde)
          Called while a drag operation is ongoing, when the mouse pointer enters the operable part of the drop site for the DropTarget registered with this listener.
 void dragExit(DragSourceEvent event)
          Called as the cursor's hotspot exits a platform-dependent drop site.
 void dragExit(DropTargetEvent dte)
          Called while a drag operation is ongoing, when the mouse pointer has exited the operable part of the drop site for the DropTarget registered with this listener.
 void dragGestureRecognized(DragGestureEvent event)
          A DragGestureRecognizer has detected a platform-dependent drag initiating gesture and is notifying this listener in order for it to initiate the action for the user.
 void dragOver(DragSourceDragEvent event)
          Called as the cursor's hotspot moves over a platform-dependent drop site.
 void dragOver(DropTargetDragEvent dtde)
          Called when a drag operation is ongoing, while the mouse pointer is still over the operable part of the drop site for the DropTarget registered with this listener.
 void drop(DropTargetDropEvent dtde)
          Called when the drag operation has terminated with a drop on the operable part of the drop site for the DropTarget registered with this listener.
 void dropActionChanged(DragSourceDragEvent event)
          Called when the user has modified the drop gesture.
 void dropActionChanged(DropTargetDragEvent dtde)
          Called if the user has modified the current drop gesture.
 void expandTree()
          Expands all items in this tree, unlimited.
 void expandTree(int maxLevel)
          Expands all items in this tree.
 DefaultMutableTreeNode findNodeInCollection(Object object)
          Finds the treenode for an object which is part of the displayed collection.
 TreePath findPathInCollection(Object object)
          Find the treepath for an object which is part of the displayed collection.
 int getMaxDepthForExtractPath()
          Gets the maximum treepath depth up to which the "extract path"-button is displayed in the popupmenu.
static Object getObjectInParentNode(DefaultMutableTreeNode node)
          Helper method for applications to get the object of the parent node.
 boolean isObjectAppendable(Object childObject)
          Checks whether the given object is appendable.
An object is appendable if it is not null, not an AppDbObject or an AppDbObject with granted read permission.
 boolean isObjectInChilds(Object childObject, DefaultMutableTreeNode node)
          Checks whether given object is in some of the child paths down to the leafs.
Used to detect recursion loops.
 boolean isObjectInParents(Object childObject, DefaultMutableTreeNode node)
          Checks whether given object is in path (parents to root) or not.
Used to detect recursion loops.
 boolean isPopupEnabled()
          Returns whether popup-menu for nodes are enabled.
 boolean pathConsistsOfAppDbObjects(TreePath path)
          Checks whether a path contains only AppDbObjects.
 void requestFocusForFirstItem()
          Transfer the focus to the first item in tree.
 void setMaxDepthForExtractPath(int maxDepth)
          Sets the maximum treepath depth up to which the "extract path"-button is displayed in the popupmenu.
 void setPopupEnabled(boolean enabled)
          Enables/disables the popup-menu for nodes.
 void showPopup()
          Shows the popup menu at current selection.
 void treeWillCollapse(TreeExpansionEvent e)
          Invoked whenever a node in the tree is about to be collapsed.
 void treeWillExpand(TreeExpansionEvent e)
          Invoked whenever a node in the tree is about to be expanded.
 
Methods inherited from class org.tentackle.ui.FormTree
addActionListener, fireActionPerformed, getClickCount, removeActionListener
 
Methods inherited from class javax.swing.JTree
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, clearToggledPaths, collapsePath, collapseRow, convertValueToText, createTreeModel, createTreeModelListener, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, fireValueChanged, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, getDefaultTreeModel, getDescendantToggledPaths, getDragEnabled, getDropLocation, getDropMode, getEditingPath, getExpandedDescendants, getExpandsSelectedPaths, getInvokesStopCellEditing, getLastSelectedPathComponent, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getModel, getNextMatch, getPathBetweenRows, getPathBounds, getPathForLocation, getPathForRow, getPreferredScrollableViewportSize, getRowBounds, getRowCount, getRowForLocation, getRowForPath, getRowHeight, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getScrollsOnExpand, getSelectionCount, getSelectionModel, getSelectionPath, getSelectionPaths, getSelectionRows, getShowsRootHandles, getToggleClickCount, getToolTipText, getTreeExpansionListeners, getTreeSelectionListeners, getTreeWillExpandListeners, getUI, getUIClassID, getVisibleRowCount, hasBeenExpanded, isCollapsed, isCollapsed, isEditable, isEditing, isExpanded, isExpanded, isFixedRowHeight, isLargeModel, isPathEditable, isPathSelected, isRootVisible, isRowSelected, isSelectionEmpty, isVisible, makeVisible, paramString, removeDescendantSelectedPaths, removeDescendantToggledPaths, removeSelectionInterval, removeSelectionPath, removeSelectionPaths, removeSelectionRow, removeSelectionRows, removeTreeExpansionListener, removeTreeSelectionListener, removeTreeWillExpandListener, scrollPathToVisible, scrollRowToVisible, setAnchorSelectionPath, setCellEditor, setCellRenderer, setDragEnabled, setDropMode, setEditable, setExpandedState, setExpandsSelectedPaths, setInvokesStopCellEditing, setLargeModel, setLeadSelectionPath, setModel, setRootVisible, setRowHeight, setScrollsOnExpand, setSelectionInterval, setSelectionModel, setSelectionPath, setSelectionPaths, setSelectionRow, setSelectionRows, setShowsRootHandles, setToggleClickCount, setUI, setVisibleRowCount, startEditingAtPath, stopEditing, treeDidChange, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AppDbObjectTree

public AppDbObjectTree(Object object)
Creates a tree.
If the given object is a Collection the objects of the collection will be shown in the tree. If it is some other object, only that object is shown.
Notice that the objects need not necessarily be AppDbObjects.

Parameters:
object - the object or collection of objects, null if empty tree

AppDbObjectTree

public AppDbObjectTree()
Creates an empty tree.

Method Detail

getObjectInParentNode

public static Object getObjectInParentNode(DefaultMutableTreeNode node)
Helper method for applications to get the object of the parent node.

Parameters:
node - the child node
Returns:
the object of the parent node, null if none or no parent

createDefaultRenderer

public TreeCellRenderer createDefaultRenderer()
Creates the default tree cell renderer.
The default implementation returns a AppDbObjectTreeCellRenderer.

Returns:
the renderer

setPopupEnabled

public void setPopupEnabled(boolean enabled)
Enables/disables the popup-menu for nodes.

Parameters:
enabled - true to enable popup menus (default)

isPopupEnabled

public boolean isPopupEnabled()
Returns whether popup-menu for nodes are enabled.

Returns:
true if popup menus are enabled (default)

setMaxDepthForExtractPath

public void setMaxDepthForExtractPath(int maxDepth)
Sets the maximum treepath depth up to which the "extract path"-button is displayed in the popupmenu. Default is 5.

Parameters:
maxDepth - the maximum path depth

getMaxDepthForExtractPath

public int getMaxDepthForExtractPath()
Gets the maximum treepath depth up to which the "extract path"-button is displayed in the popupmenu.

Returns:
the maximum path depth

showPopup

public void showPopup()
Shows the popup menu at current selection.


buildTree

public void buildTree(Collection col)
Builds the tree from a collection of objects.

Parameters:
col - the collection, null to set the empty collection

expandTree

public void expandTree(int maxLevel)
Expands all items in this tree.

Parameters:
maxLevel - is the maximum number of levels to expand, 0 = all

expandTree

public void expandTree()
Expands all items in this tree, unlimited.


requestFocusForFirstItem

public void requestFocusForFirstItem()
Transfer the focus to the first item in tree.


isObjectAppendable

public boolean isObjectAppendable(Object childObject)
Checks whether the given object is appendable.
An object is appendable if it is not null, not an AppDbObject or an AppDbObject with granted read permission.

Parameters:
childObject - the object to append
Returns:
true if appendable

isObjectInParents

public boolean isObjectInParents(Object childObject,
                                 DefaultMutableTreeNode node)
Checks whether given object is in path (parents to root) or not.
Used to detect recursion loops.

Parameters:
childObject - the object to check
node - the node to start the search up to the root
Returns:
true if object is in already in path

isObjectInChilds

public boolean isObjectInChilds(Object childObject,
                                DefaultMutableTreeNode node)
Checks whether given object is in some of the child paths down to the leafs.
Used to detect recursion loops.

Parameters:
childObject - the object to check
node - the node to start the search up to the root
Returns:
true if object is in already in path

doExpandPath

public void doExpandPath(int level,
                         int maxLevel,
                         AppDbObject stopObject,
                         TreePath path)
Recursively expands the path.

Parameters:
level - is the current tree level, 0 = top
maxLevel - is the maximum level not to exceed, 0 = unlimited
stopObject - stops expansion if object met, null = unlimited
path - is the path to expand

doCollapsePath

public void doCollapsePath(TreePath path)
Collapses a given path.
The method invokes collapsePath and set expanded=false in all AppDbTreeObject-nodes. Furthermore, all nodes referring to AppDbTreeToggleNodeObjects will get their childs removed. Tentackle applications should not use collapsePath directly.

Parameters:
path - the tree path to collapse
See Also:
JTree.collapsePath(javax.swing.tree.TreePath)

pathConsistsOfAppDbObjects

public boolean pathConsistsOfAppDbObjects(TreePath path)
Checks whether a path contains only AppDbObjects.

Parameters:
path - the tree path
Returns:
true if only AppDbObjects.

treeWillExpand

public void treeWillExpand(TreeExpansionEvent e)
                    throws ExpandVetoException
Invoked whenever a node in the tree is about to be expanded.

Loads child objects from the database.

Specified by:
treeWillExpand in interface TreeWillExpandListener
Parameters:
e - the expansion event
Throws:
ExpandVetoException

treeWillCollapse

public void treeWillCollapse(TreeExpansionEvent e)
Invoked whenever a node in the tree is about to be collapsed.

The default implementation does nothing. Applications may override.

Specified by:
treeWillCollapse in interface TreeWillExpandListener
Parameters:
e - the expansion event

dragGestureRecognized

public void dragGestureRecognized(DragGestureEvent event)
A DragGestureRecognizer has detected a platform-dependent drag initiating gesture and is notifying this listener in order for it to initiate the action for the user.

The default implementation creates the transferable and starts the drag if the node refers to an AppDbObject or AppDbObjectTreeExtension.

Specified by:
dragGestureRecognized in interface DragGestureListener
Parameters:
event - the gesture event

dragEnter

public void dragEnter(DragSourceDragEvent event)
Called as the cursor's hotspot enters a platform-dependent drop site. This method is invoked when all the following conditions are true:

The default implementation does nothing. Provided to be overridden.

Specified by:
dragEnter in interface DragSourceListener
Parameters:
event - the drag source event

dragOver

public void dragOver(DragSourceDragEvent event)
Called as the cursor's hotspot moves over a platform-dependent drop site. This method is invoked when all the following conditions are true:

The default implementation does nothing. Provided to be overridden.

Specified by:
dragOver in interface DragSourceListener
Parameters:
event - the drag source event

dragExit

public void dragExit(DragSourceEvent event)
Called as the cursor's hotspot exits a platform-dependent drop site. This method is invoked when any of the following conditions are true: OR OR

The default implementation does nothing. Provided to be overridden.

Specified by:
dragExit in interface DragSourceListener
Parameters:
event - the drag source event

dropActionChanged

public void dropActionChanged(DragSourceDragEvent event)
Called when the user has modified the drop gesture. This method is invoked when the state of the input device(s) that the user is interacting with changes. Such devices are typically the mouse buttons or keyboard modifiers that the user is interacting with.

The default implementation does nothing. Provided to be overridden.

Specified by:
dropActionChanged in interface DragSourceListener
Parameters:
event - the drag source event

dragDropEnd

public void dragDropEnd(DragSourceDropEvent event)
This method is invoked to signify that the Drag and Drop operation is complete. The getDropSuccess() method of the DragSourceDropEvent can be used to determine the termination state. The getDropAction() method returns the operation that the drop site selected to apply to the Drop operation. Once this method is complete, the current DragSourceContext and associated resources become invalid.

The default implementation does nothing. Provided to be overridden.

Specified by:
dragDropEnd in interface DragSourceListener
Parameters:
event - the drag source event

dragEnter

public void dragEnter(DropTargetDragEvent dtde)
Called while a drag operation is ongoing, when the mouse pointer enters the operable part of the drop site for the DropTarget registered with this listener.

The default implementation does nothing. Provided to be overridden.

Specified by:
dragEnter in interface DropTargetListener
Parameters:
dtde - the drop target drag event

dragOver

public void dragOver(DropTargetDragEvent dtde)
Called when a drag operation is ongoing, while the mouse pointer is still over the operable part of the drop site for the DropTarget registered with this listener.

Overridden to check whether to accept the drag or not.

Specified by:
dragOver in interface DropTargetListener
Parameters:
dtde - the drop target drag event

dropActionChanged

public void dropActionChanged(DropTargetDragEvent dtde)
Called if the user has modified the current drop gesture.

The default implementation does nothing. Provided to be overridden.

Specified by:
dropActionChanged in interface DropTargetListener
Parameters:
dtde - the drop target drag event

dragExit

public void dragExit(DropTargetEvent dte)
Called while a drag operation is ongoing, when the mouse pointer has exited the operable part of the drop site for the DropTarget registered with this listener.

The default implementation does nothing. Provided to be overridden.

Specified by:
dragExit in interface DropTargetListener
Parameters:
dte - the drop target event

drop

public void drop(DropTargetDropEvent dtde)
Called when the drag operation has terminated with a drop on the operable part of the drop site for the DropTarget registered with this listener.

This method is responsible for undertaking the transfer of the data associated with the gesture. The DropTargetDropEvent provides a means to obtain a Transferable object that represents the data object(s) to be transfered.

From this method, the DropTargetListener shall accept or reject the drop via the acceptDrop(int dropAction) or rejectDrop() methods of the DropTargetDropEvent parameter.

Subsequent to acceptDrop(), but not before, DropTargetDropEvent's getTransferable() method may be invoked, and data transfer may be performed via the returned Transferable's getTransferData() method.

At the completion of a drop, an implementation of this method is required to signal the success/failure of the drop by passing an appropriate boolean to the DropTargetDropEvent's dropComplete(boolean success) method.

Note: The data transfer should be completed before the call to the DropTargetDropEvent's dropComplete(boolean success) method. After that, a call to the getTransferData() method of the Transferable returned by DropTargetDropEvent.getTransferable() is guaranteed to succeed only if the data transfer is local; that is, only if DropTargetDropEvent.isLocalTransfer() returns true. Otherwise, the behavior of the call is implementation-dependent.

Overridden to insert the object.

Specified by:
drop in interface DropTargetListener
Parameters:
dtde - the drop target drop event
See Also:
AppDbObject.dropTransferable(java.awt.datatransfer.Transferable)

findNodeInCollection

public DefaultMutableTreeNode findNodeInCollection(Object object)
Finds the treenode for an object which is part of the displayed collection.

Parameters:
object - the object
Returns:
the child of the root node if found, null if no such node

findPathInCollection

public TreePath findPathInCollection(Object object)
Find the treepath for an object which is part of the displayed collection.

Parameters:
object - the object
Returns:
the path to the child of the root node if found, null if no such node

collapseAll

public void collapseAll()
Collapses all childnodes of the root.



Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de