|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTree
org.tentackle.ui.FormTree
org.tentackle.appworx.AppDbObjectTree
public class AppDbObjectTree
An extended FormTree that implements object navigation,
drag and drop, clipboard functionality for AppDbObjects,
and provides a context-sensitive popup menu,
| 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.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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AppDbObjectTree(Object object)
Collection the objects of the collection
will be shown in the tree. If it is some other object, only that
object is shown.AppDbObjects.
object - the object or collection of objects, null if empty treepublic AppDbObjectTree()
| Method Detail |
|---|
public static Object getObjectInParentNode(DefaultMutableTreeNode node)
node - the child node
public TreeCellRenderer createDefaultRenderer()
AppDbObjectTreeCellRenderer.
public void setPopupEnabled(boolean enabled)
enabled - true to enable popup menus (default)public boolean isPopupEnabled()
public void setMaxDepthForExtractPath(int maxDepth)
maxDepth - the maximum path depthpublic int getMaxDepthForExtractPath()
public void showPopup()
public void buildTree(Collection col)
col - the collection, null to set the empty collectionpublic void expandTree(int maxLevel)
maxLevel - is the maximum number of levels to expand, 0 = allpublic void expandTree()
public void requestFocusForFirstItem()
public boolean isObjectAppendable(Object childObject)
childObject - the object to append
public boolean isObjectInParents(Object childObject,
DefaultMutableTreeNode node)
childObject - the object to checknode - the node to start the search up to the root
public boolean isObjectInChilds(Object childObject,
DefaultMutableTreeNode node)
childObject - the object to checknode - the node to start the search up to the root
public void doExpandPath(int level,
int maxLevel,
AppDbObject stopObject,
TreePath path)
level - is the current tree level, 0 = topmaxLevel - is the maximum level not to exceed, 0 = unlimitedstopObject - stops expansion if object met, null = unlimitedpath - is the path to expandpublic void doCollapsePath(TreePath path)
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.
path - the tree path to collapseJTree.collapsePath(javax.swing.tree.TreePath)public boolean pathConsistsOfAppDbObjects(TreePath path)
AppDbObjects.
path - the tree path
AppDbObjects.
public void treeWillExpand(TreeExpansionEvent e)
throws ExpandVetoException
Loads child objects from the database.
treeWillExpand in interface TreeWillExpandListenere - the expansion event
ExpandVetoExceptionpublic void treeWillCollapse(TreeExpansionEvent e)
The default implementation does nothing. Applications may override.
treeWillCollapse in interface TreeWillExpandListenere - the expansion eventpublic void dragGestureRecognized(DragGestureEvent event)
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.
dragGestureRecognized in interface DragGestureListenerevent - the gesture eventpublic void dragEnter(DragSourceDragEvent event)
The default implementation does nothing. Provided to be overridden.
dragEnter in interface DragSourceListenerevent - the drag source eventpublic void dragOver(DragSourceDragEvent event)
The default implementation does nothing. Provided to be overridden.
dragOver in interface DragSourceListenerevent - the drag source eventpublic void dragExit(DragSourceEvent event)
The default implementation does nothing. Provided to be overridden.
dragExit in interface DragSourceListenerevent - the drag source eventpublic void dropActionChanged(DragSourceDragEvent event)
The default implementation does nothing. Provided to be overridden.
dropActionChanged in interface DragSourceListenerevent - the drag source eventpublic void dragDropEnd(DragSourceDropEvent event)
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.
dragDropEnd in interface DragSourceListenerevent - the drag source eventpublic void dragEnter(DropTargetDragEvent dtde)
DropTarget
registered with this listener.
The default implementation does nothing. Provided to be overridden.
dragEnter in interface DropTargetListenerdtde - the drop target drag eventpublic void dragOver(DropTargetDragEvent dtde)
DropTarget
registered with this listener.
Overridden to check whether to accept the drag or not.
dragOver in interface DropTargetListenerdtde - the drop target drag eventpublic void dropActionChanged(DropTargetDragEvent dtde)
The default implementation does nothing. Provided to be overridden.
dropActionChanged in interface DropTargetListenerdtde - the drop target drag eventpublic void dragExit(DropTargetEvent dte)
DropTarget registered with this listener.
The default implementation does nothing. Provided to be overridden.
dragExit in interface DropTargetListenerdte - the drop target eventpublic void drop(DropTargetDropEvent dtde)
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.
drop in interface DropTargetListenerdtde - the drop target drop eventAppDbObject.dropTransferable(java.awt.datatransfer.Transferable)public DefaultMutableTreeNode findNodeInCollection(Object object)
object - the object
public TreePath findPathInCollection(Object object)
object - the object
public void collapseAll()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||