Skip navigation links


com.essbase.eas.ui.ctree
Class CTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by com.essbase.eas.ui.ctree.CTreeNode

All Implemented Interfaces:
java.awt.datatransfer.Transferable, java.awt.dnd.DropTargetListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
Direct Known Subclasses:
AdminTreeNode, CFramePanel.FrameRoot, CTreeCustomViewRootNode, EnterpriseContainerNode, EssbaseTreeNode

public abstract class CTreeNode
extends javax.swing.tree.DefaultMutableTreeNode
implements java.awt.datatransfer.Transferable, java.awt.dnd.DropTargetListener

Extends the DefaultMutableTreeNode class to implement some specific features that we need to support in the OLAP console. Notes:

12/18/2000, hcox: Implementation of DropTargetListener added. CTreeNode objects override individual methods when needed. CTreeNode objects should never register themselves as drop targets. We implement the interface in order to provide logically named methods that the containing CTree object can call. 05/19/2003, hcox: Added new willExpand() methodology.

Since:
6.2.0
Version:
7.0.0
Author:
Hank Cox
See Also:
Serialized Form

Field Summary
protected  java.awt.Component[] actionMenuItems
           
protected  boolean allChildrenRemoved
           
protected  java.lang.String caption
           
protected  java.awt.Component[] contextMenuItems
           
protected  boolean customViewEnabled
           
protected  boolean customViewNode
           
protected  boolean draggable
           
static CTreeNode[] EMPTY_NODES
           
protected  boolean expanded
           
protected  java.util.List flavors
           
protected  javax.swing.Icon icon
           
protected  boolean notifyChildRemoval
           
protected  int startSortIndex
           
protected  java.lang.String toolTipText
           

 

Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject

 

Constructor Summary
protected CTreeNode()
           
protected CTreeNode(java.lang.Object userObject, boolean allowsChildren, java.lang.String caption)
           
protected CTreeNode(java.lang.Object userObject, boolean allowsChildren, java.lang.String caption, javax.swing.Icon image)
           
protected CTreeNode(java.lang.Object userObject, boolean allowsChildren, java.lang.String caption, java.lang.String image)
           

 

Method Summary
 void add(javax.swing.tree.MutableTreeNode newChild)
           
protected  void addNodeAndNotify(CTreeNode node)
          adds a single node as a child of this node, determines its index, and notifies the model that a child was inserted.
 void addNodeAndNotify(java.lang.Object obj)
           
protected  void addNodesAndNotify(CTreeNode[] nodes)
          adds multiple nodes as children of this node.
 void addNodesSortedAndNotify(CTreeNode[] nodes)
           
 void addNodesSortedAndNotify(CTreeNode[] nodes, boolean nodesAreSorted)
           
 void addSortedChild(CTreeNode newChild)
          adds a child node and ensures it is in a correctly sorted position.
 boolean areChildrenCollated()
           
protected  void broadcastNodeChanged()
          broadcasts a nodeChanged() to the model.
 boolean changeNodeIndex(CTreeNode node, int newIndex)
           
 java.lang.Object clone()
           
protected  void dispose()
          resets the references to null for gc
 void dragEnter(java.awt.dnd.DropTargetDragEvent dtde)
          implementation of the DropTargetListener.dragEnter() method.
 void dragExit(java.awt.dnd.DropTargetEvent dte)
          implementation of the DropTargetListener.dragExit() method.
 void dragOver(java.awt.dnd.DropTargetDragEvent dtde)
          implementation of the DropTargetListener.dragOver() method.
 void drop(java.awt.dnd.DropTargetDropEvent dtde)
          implementation of the DropTargetListener.drop() method.
 void dropActionChanged(java.awt.dnd.DropTargetDragEvent dtde)
          implementation of the DropTargetListener.dropActionChanged() method.
 java.awt.Component[] getActionMenuItems()
          returns the items that this object needs placed on the console's action menu.
 boolean getAllChildrenRemoved()
           
 java.lang.String getCaption()
           
 CTreeNode getChildForUserObject(java.lang.Object value)
          returns the child node that has the associated user object.
protected  CTreeNode[] getChildrenAsArray()
           
protected  java.lang.Object[] getChildUserObjects()
          gets an array of the user objects for this nodes children.
protected  java.util.List getChildUserObjectsAsList()
          gets a list of the user objects for this nodes children.
 java.lang.String getContextCaption()
           
 java.lang.String[][] getContextInformation()
          returns an array of strings containing the context information for this tree node.
 java.awt.Component[] getContextMenuItems()
           
 boolean getCustomViewEnabled()
           
 boolean getCustomViewNode()
           
 boolean getDraggable()
          returns whether or not this node can be dragged to a new location.
 boolean getExpandedState()
          This may not be the actual state of the node.
 javax.swing.Icon getIcon()
           
 boolean getNotifyRemoveChildren()
           
 java.lang.Object[] getPrintableObjects()
          returns the printable string
 int getSortedChildIndex(CTreeNode newChild)
          returns -1 for end of the list
protected  int getStartSortIndex()
           
 java.lang.String getToolTipText()
           
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
          implementation of the Transferable.getTransferData() method.
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
          implementation of the Transferable.getTransferDataFlavors() method.
 java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree, java.lang.Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
          retrieves the tree cell renderer for this object.
 CTreeModel getTreeModel()
           
protected  java.lang.Object getUserObjectAs(java.lang.Class c)
          gets the user object as a member of a specific class.
 void handleDelete()
           
 void handleDoubleClick()
          used to handle a double click event; the default implementation is to do nothing.
 boolean handleExpand(java.util.List candidates)
          method that should be overridden by all derived classes in order to add children to the node.
protected  void initFlavors()
          initializes the flavors supported by this object.
 void insertNodeAndNotify(CTreeNode node, int index)
          adds a single node as a child of this node, determines its index, and notifies the model that a child was inserted.
protected  void installListeners()
           
 boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
          implementation of the Transferable.isDataFlavorSupported() method.
 void localizeMenuItems(java.awt.Component[] items, java.util.ResourceBundle r)
           
 void nodeRemoved()
           
 void personalizeMenuItems(java.awt.Component[] items, boolean ellipsis)
           
 void personalizeMenuItems(java.awt.Component[] items, boolean[] ellipsis)
           
 void personalizeMenuItems(java.awt.Component item, boolean ellips)
           
 void personalizeMenuItems(java.awt.Component item, boolean ellips, java.lang.String suffix)
           
 void remove(int childIndex)
           
 void removeChildrenNodeAndNotify(boolean propogate)
          removes all children node and notifies the model about the event.
 void removeNodeAndNotify(CTreeNode node)
          removes all children node and notifies the model about the event.
 void removeNodeAndNotify(CTreeNode node, boolean propogate)
          removes a child node and notifies the model about the event.
 void removeNodeAndNotify(java.lang.Object obj)
          removes a child node for a userObject and notifies the model about the event.
 void setAllChildrenRemoved(boolean value)
           
 void setCaption(java.lang.String value)
           
 boolean setContextInformation(java.lang.String[][] info)
          receives an array of strings containing the context information for this tree node.
 void setCustomViewEnabled(boolean value)
           
 void setCustomViewNode(boolean value)
           
 void setExpandedState(boolean state)
          This is not to set the expanded state of the node on the UI.
 void setIcon()
           
protected  void setIcon(javax.swing.Icon value)
           
 void setIcon(java.lang.String image)
           
 void setNotifyRemoveChildren()
           
 void setNotifyRemoveChildren(boolean notify)
           
protected  void setSortingIndex(int index)
           
 void setToolTipText(java.lang.String toolTipText)
           
 void setUserObject(java.lang.Object parm1)
           
 CTreeNode[] sortNodes(CTreeNode[] nodes)
           
 java.lang.String toString()
           
 boolean updateChildOrder(CTreeNode node)
          Updates the node order for the child node.
protected  void updateChildrenToMatch(java.lang.Object[] candidates, java.lang.Class c)
          synchronizes an array of objects with the current set of child nodes.
protected  void updateChildrenToMatch(java.lang.Object[] candidates, java.lang.Class c, boolean sorted)
           
 void updateNode()
           
 void willExpand()
           

 

Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
breadthFirstEnumeration, children, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent

 

Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Field Detail

caption

protected java.lang.String caption

icon

protected javax.swing.Icon icon

contextMenuItems

protected java.awt.Component[] contextMenuItems

actionMenuItems

protected java.awt.Component[] actionMenuItems

customViewEnabled

protected boolean customViewEnabled

customViewNode

protected boolean customViewNode

draggable

protected boolean draggable

flavors

protected java.util.List flavors

allChildrenRemoved

protected boolean allChildrenRemoved

expanded

protected boolean expanded

notifyChildRemoval

protected boolean notifyChildRemoval

startSortIndex

protected int startSortIndex

toolTipText

protected java.lang.String toolTipText

EMPTY_NODES

public static CTreeNode[] EMPTY_NODES

Constructor Detail

CTreeNode

protected CTreeNode()

CTreeNode

protected CTreeNode(java.lang.Object userObject,
                    boolean allowsChildren,
                    java.lang.String caption)

CTreeNode

protected CTreeNode(java.lang.Object userObject,
                    boolean allowsChildren,
                    java.lang.String caption,
                    java.lang.String image)

CTreeNode

protected CTreeNode(java.lang.Object userObject,
                    boolean allowsChildren,
                    java.lang.String caption,
                    javax.swing.Icon image)

Method Detail

setIcon

public void setIcon(java.lang.String image)

setIcon

public void setIcon()

setToolTipText

public void setToolTipText(java.lang.String toolTipText)

getToolTipText

public java.lang.String getToolTipText()

willExpand

public void willExpand()

getActionMenuItems

public java.awt.Component[] getActionMenuItems()
returns the items that this object needs placed on the console's action menu. All of the items should be CMenuItem objects. Any derived class should override this method.

getContextMenuItems

public java.awt.Component[] getContextMenuItems()

getContextInformation

public java.lang.String[][] getContextInformation()
returns an array of strings containing the context information for this tree node. This method is intended to be replaced by any derived classes.

setContextInformation

public boolean setContextInformation(java.lang.String[][] info)
receives an array of strings containing the context information for this tree node. This method is intended to be overridden by any derived classes. It is expected that the derived classes then perform any operations they need in order to "set" their context.

personalizeMenuItems

public void personalizeMenuItems(java.awt.Component[] items,
                                 boolean[] ellipsis)

personalizeMenuItems

public void personalizeMenuItems(java.awt.Component[] items,
                                 boolean ellipsis)

personalizeMenuItems

public void personalizeMenuItems(java.awt.Component item,
                                 boolean ellips)

personalizeMenuItems

public void personalizeMenuItems(java.awt.Component item,
                                 boolean ellips,
                                 java.lang.String suffix)

localizeMenuItems

public void localizeMenuItems(java.awt.Component[] items,
                              java.util.ResourceBundle r)

toString

public java.lang.String toString()
Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode

getTreeCellRendererComponent

public java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree,
                                                       java.lang.Object value,
                                                       boolean selected,
                                                       boolean expanded,
                                                       boolean leaf,
                                                       int row,
                                                       boolean hasFocus)
retrieves the tree cell renderer for this object. In CTreeNode we return a null pointer; this method should be overridden by any object that wishes to do special rendering.

getContextCaption

public java.lang.String getContextCaption()

getIcon

public javax.swing.Icon getIcon()

setIcon

protected void setIcon(javax.swing.Icon value)

getCaption

public java.lang.String getCaption()

setCaption

public void setCaption(java.lang.String value)

getChildForUserObject

public CTreeNode getChildForUserObject(java.lang.Object value)
returns the child node that has the associated user object.

setCustomViewEnabled

public void setCustomViewEnabled(boolean value)

getCustomViewEnabled

public boolean getCustomViewEnabled()

setCustomViewNode

public void setCustomViewNode(boolean value)

getCustomViewNode

public boolean getCustomViewNode()

getDraggable

public boolean getDraggable()
returns whether or not this node can be dragged to a new location. Returns the value of the protected draggable field. Derived classes that can always be dragged around can set the draggable field to true. Derived classes that require dynamic information to determine if they can be dragged around can override this method and determine the status when requested.

getAllChildrenRemoved

public boolean getAllChildrenRemoved()

setAllChildrenRemoved

public void setAllChildrenRemoved(boolean value)

clone

public java.lang.Object clone()
Overrides:
clone in class javax.swing.tree.DefaultMutableTreeNode

handleDoubleClick

public void handleDoubleClick()
used to handle a double click event; the default implementation is to do nothing. Derived classes that wish to perform some action when they are double clicked should override this method.

handleDelete

public void handleDelete()

handleExpand

public boolean handleExpand(java.util.List candidates)
method that should be overridden by all derived classes in order to add children to the node.

installListeners

protected void installListeners()

setUserObject

public void setUserObject(java.lang.Object parm1)
Specified by:
setUserObject in interface javax.swing.tree.MutableTreeNode
Overrides:
setUserObject in class javax.swing.tree.DefaultMutableTreeNode

initFlavors

protected void initFlavors()
initializes the flavors supported by this object. CTreeNode creates a single data flavor based on the javaJVMLocalObjectMimeType. Inherited classes should override this method and also add additional data flavors they wish to support.

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
implementation of the Transferable.getTransferDataFlavors() method.
Specified by:
getTransferDataFlavors in interface java.awt.datatransfer.Transferable

isDataFlavorSupported

public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
implementation of the Transferable.isDataFlavorSupported() method.
Specified by:
isDataFlavorSupported in interface java.awt.datatransfer.Transferable

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
                                 throws java.awt.datatransfer.UnsupportedFlavorException,
                                        java.io.IOException
implementation of the Transferable.getTransferData() method.
Specified by:
getTransferData in interface java.awt.datatransfer.Transferable
Throws:
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException

dragEnter

public void dragEnter(java.awt.dnd.DropTargetDragEvent dtde)
implementation of the DropTargetListener.dragEnter() method. CTreeNode objects, by default, always reject drag/drop events.
Specified by:
dragEnter in interface java.awt.dnd.DropTargetListener

dragOver

public void dragOver(java.awt.dnd.DropTargetDragEvent dtde)
implementation of the DropTargetListener.dragOver() method. CTreeNode objects, by default, always reject drag/drop events.
Specified by:
dragOver in interface java.awt.dnd.DropTargetListener

dropActionChanged

public void dropActionChanged(java.awt.dnd.DropTargetDragEvent dtde)
implementation of the DropTargetListener.dropActionChanged() method. Does nothing.
Specified by:
dropActionChanged in interface java.awt.dnd.DropTargetListener

dragExit

public void dragExit(java.awt.dnd.DropTargetEvent dte)
implementation of the DropTargetListener.dragExit() method. Does nothing.
Specified by:
dragExit in interface java.awt.dnd.DropTargetListener

drop

public void drop(java.awt.dnd.DropTargetDropEvent dtde)
implementation of the DropTargetListener.drop() method. CTreeNode objects, by default, always reject drag/drop events.
Specified by:
drop in interface java.awt.dnd.DropTargetListener

addSortedChild

public void addSortedChild(CTreeNode newChild)
adds a child node and ensures it is in a correctly sorted position.

areChildrenCollated

public boolean areChildrenCollated()

broadcastNodeChanged

protected void broadcastNodeChanged()
broadcasts a nodeChanged() to the model. Can be called by any derived class to save a few lines of code.

addNodesAndNotify

protected void addNodesAndNotify(CTreeNode[] nodes)
adds multiple nodes as children of this node. Notifies the model that children were added.
Parameters:
node - CTreeNode to add

addNodeAndNotify

protected void addNodeAndNotify(CTreeNode node)
adds a single node as a child of this node, determines its index, and notifies the model that a child was inserted.

insertNodeAndNotify

public void insertNodeAndNotify(CTreeNode node,
                                int index)
adds a single node as a child of this node, determines its index, and notifies the model that a child was inserted.

add

public void add(javax.swing.tree.MutableTreeNode newChild)
Overrides:
add in class javax.swing.tree.DefaultMutableTreeNode

addNodeAndNotify

public void addNodeAndNotify(java.lang.Object obj)

removeNodeAndNotify

public void removeNodeAndNotify(CTreeNode node,
                                boolean propogate)
removes a child node and notifies the model about the event.

removeNodeAndNotify

public void removeNodeAndNotify(CTreeNode node)
removes all children node and notifies the model about the event.

removeNodeAndNotify

public void removeNodeAndNotify(java.lang.Object obj)
removes a child node for a userObject and notifies the model about the event.

removeChildrenNodeAndNotify

public void removeChildrenNodeAndNotify(boolean propogate)
removes all children node and notifies the model about the event.

getChildrenAsArray

protected CTreeNode[] getChildrenAsArray()

getChildUserObjects

protected java.lang.Object[] getChildUserObjects()
gets an array of the user objects for this nodes children.

getChildUserObjectsAsList

protected java.util.List getChildUserObjectsAsList()
gets a list of the user objects for this nodes children.

getUserObjectAs

protected java.lang.Object getUserObjectAs(java.lang.Class c)
gets the user object as a member of a specific class.

updateChildrenToMatch

protected void updateChildrenToMatch(java.lang.Object[] candidates,
                                     java.lang.Class c)
synchronizes an array of objects with the current set of child nodes.

updateChildrenToMatch

protected void updateChildrenToMatch(java.lang.Object[] candidates,
                                     java.lang.Class c,
                                     boolean sorted)

getPrintableObjects

public java.lang.Object[] getPrintableObjects()
returns the printable string

getTreeModel

public CTreeModel getTreeModel()

remove

public void remove(int childIndex)
Specified by:
remove in interface javax.swing.tree.MutableTreeNode
Overrides:
remove in class javax.swing.tree.DefaultMutableTreeNode

nodeRemoved

public void nodeRemoved()

setNotifyRemoveChildren

public void setNotifyRemoveChildren()

setNotifyRemoveChildren

public void setNotifyRemoveChildren(boolean notify)

getNotifyRemoveChildren

public boolean getNotifyRemoveChildren()

changeNodeIndex

public boolean changeNodeIndex(CTreeNode node,
                               int newIndex)

updateChildOrder

public boolean updateChildOrder(CTreeNode node)
Updates the node order for the child node. The nodes caption might have changed to call this function Returns true if the order changed

getExpandedState

public boolean getExpandedState()
This may not be the actual state of the node. It is only used to keep track of the state at a given moment

setExpandedState

public void setExpandedState(boolean state)
This is not to set the expanded state of the node on the UI. It is only used to keep track of the state at a given moment

getSortedChildIndex

public int getSortedChildIndex(CTreeNode newChild)
returns -1 for end of the list

sortNodes

public CTreeNode[] sortNodes(CTreeNode[] nodes)

addNodesSortedAndNotify

public void addNodesSortedAndNotify(CTreeNode[] nodes)

addNodesSortedAndNotify

public void addNodesSortedAndNotify(CTreeNode[] nodes,
                                    boolean nodesAreSorted)

updateNode

public void updateNode()

setSortingIndex

protected void setSortingIndex(int index)

getStartSortIndex

protected int getStartSortIndex()

dispose

protected void dispose()
resets the references to null for gc

Skip navigation links


Copyright © 2001, 2012, Oracle. All rights reserved.