org.tentackle.appworx
Class AppDbObjectTreeExtensionToggleNode

java.lang.Object
  extended by org.tentackle.appworx.AppDbObjectTreeExtensionToggleNode
Direct Known Subclasses:
AppDbObjectTreeExtensionUsageToggleNode

public abstract class AppDbObjectTreeExtensionToggleNode
extends Object

A childnode for nodes in an AppDbObjectTree to add a popup-menu-item for toggling the display of subtrees.

Author:
harald

Constructor Summary
AppDbObjectTreeExtensionToggleNode(int toggleNodeId)
          Creates a toggle node.
 
Method Summary
 int getChildIndex()
          Gets the index of this toggle-node withing the childs of the popup node.
 JMenuItem getMenuItem(AppDbObjectTree tree, DefaultMutableTreeNode popupNode, TreePath popupPath)
          Creates a JMenuItem for the popup-Menu.
abstract  JMenuItem getMenuItem(boolean toggleNodeDisplayed)
          Gets a JMenuItem for the popup-Menu.
 DefaultMutableTreeNode getPopupNode()
          Gets the popup node this toggle node is associated to.
 int getToggleNodeId()
          Gets the toggle node id.
abstract  AppDbTreeToggleNodeObject getToggleNodeObject(Object popupObject)
          Creates an AppDbTreeToggleNodeObject to be inserted into the tree.
 AppDbObjectTree getTree()
          Gets the tree this toggle node is associated to.
 void hideToggleNode()
          Removes the togglenode from the tree.
 void insertObjects(List list)
          Sets the list of objects into this toggle node and inserts the toggle node into the tree (invokes showToggleNode().
 DefaultMutableTreeNode showToggleNode()
          Inserts the toggle-node as the first childnode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppDbObjectTreeExtensionToggleNode

public AppDbObjectTreeExtensionToggleNode(int toggleNodeId)
Creates a toggle node.

Each of toggle node must get its own unique identifier to determine whether it is already displayed in the tree or not.

Parameters:
toggleNodeId - is some unique(!) id
Method Detail

getToggleNodeId

public int getToggleNodeId()
Gets the toggle node id.

Returns:
the unique id

getTree

public AppDbObjectTree getTree()
Gets the tree this toggle node is associated to.

Returns:
the tree

getPopupNode

public DefaultMutableTreeNode getPopupNode()
Gets the popup node this toggle node is associated to.

Returns:
the popupNode

getChildIndex

public int getChildIndex()
Gets the index of this toggle-node withing the childs of the popup node.

Returns:
the index

getToggleNodeObject

public abstract AppDbTreeToggleNodeObject getToggleNodeObject(Object popupObject)
Creates an AppDbTreeToggleNodeObject to be inserted into the tree. Needs to be implemented!

Parameters:
popupObject - is the object of the popupNode (usually an AppDbObject, but not necessarily and may be null)
Returns:
the toggle node object to be inserted as a child of the popupNode

getMenuItem

public abstract JMenuItem getMenuItem(boolean toggleNodeDisplayed)
Gets a JMenuItem for the popup-Menu. Needs to be implemented!

Parameters:
toggleNodeDisplayed - is true if the toggle-node is displayed in the tree, false if not
Returns:
the array of menu items, null if none.

getMenuItem

public JMenuItem getMenuItem(AppDbObjectTree tree,
                             DefaultMutableTreeNode popupNode,
                             TreePath popupPath)
Creates a JMenuItem for the popup-Menu.

Parameters:
tree - the tree
popupNode - is the node the popupMenu is displayed for
popupPath - is the treepath for the popupNode
Returns:
the menu item

insertObjects

public void insertObjects(List list)
Sets the list of objects into this toggle node and inserts the toggle node into the tree (invokes showToggleNode().

Parameters:
list - the list of objects

showToggleNode

public DefaultMutableTreeNode showToggleNode()
Inserts the toggle-node as the first childnode.

Returns:
the toggle node

hideToggleNode

public void hideToggleNode()
Removes the togglenode from the tree.



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