com.tensegrity.gui.swing.control.tree.strategy
Class AbstractVisualGraphTreeStrategy

java.lang.Object
  extended bycom.tensegrity.gui.swing.control.tree.strategy.AbstractTreeStrategy
      extended bycom.tensegrity.gui.swing.control.tree.strategy.AbstractVisualGraphTreeStrategy
All Implemented Interfaces:
EventListenerTag, OutlinerStrategy, TreeStrategy, VisualGraphListener
Direct Known Subclasses:
DefaultVisualGraphTreeStrategy

public abstract class AbstractVisualGraphTreeStrategy
extends AbstractTreeStrategy
implements VisualGraphListener

This abstract class offers another abstract layer above the AbstractTreeStrategy abstract class it extends in order to provide more default methods implementation that can be used for concrete "strategies" associated to VisualGraphs. It also implements the VisualGraphListener interface and these abstract class should be extended by all concrete strategy implementation associated to VisualGraphs. The default Comparator return by the getComparator factory method uses the VisualGraphObjectTreeNode Ids in order to compare the different Tree Nodes.

Version:
$Id: AbstractVisualGraphTreeStrategy.java,v 1.8 2004/10/14 13:28:26 SebastienGuyon Exp $
Author:
S�bastien Guyon
See Also:
AbstractTreeStrategy, VisualGraphListener, TreeOutliner, DefaultVisualGraphTreeStrategy

Field Summary
static java.lang.String DOCUMENT_TYPE_KEY
          represents the type of Document this strategy is associated to.
static int VISUAL_EDGE_TREE_NODE
          represents a tree node for visual edges
static int VISUAL_NODE_TREE_NODE
          represents a tree node for visual nodes
static int VISUAL_SUBGRAPH_TREE_NODE
          represents a tree node for visual subgraphs
 
Constructor Summary
protected AbstractVisualGraphTreeStrategy(UIManager uiManager)
           Initializes instances of this class with the passed UIManager
protected AbstractVisualGraphTreeStrategy(UIManager uiManager, TreeOutliner tree)
           Initializes instances of this class with the passed UIManager and TreeOutliner instances
 
Method Summary
 void addNode(javax.swing.tree.DefaultMutableTreeNode parent, javax.swing.tree.DefaultMutableTreeNode node)
          Override addNode in order to keep documentIdNodeMap up to date.
 java.util.Comparator getComparator(boolean asc)
          Default implementation.
 javax.swing.tree.DefaultMutableTreeNode getNewTreeNode(int subClassType, java.lang.Object documentObject)
          Possible values for subClassType are: AbstractVisualGraphTreeStrategy.VISUAL_EDGE_TREE_NODE AbstractVisualGraphTreeStrategy.VISUAL_NODE_TREE_NODE AbstractVisualGraphTreeStrategy.VISUAL_SUBGRAPH_TREE_NODE
 
Methods inherited from class com.tensegrity.gui.swing.control.tree.strategy.AbstractTreeStrategy
findNodeByID, getActiveDocument, getDocumentIdNodeMap, getDocumentModelMap, getIdNodeMap, getModel, getRoot, getTree, getUIManager, initializeModel, removeModel, setActiveDocument, setModel, setTree, updateNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.tensegrity.graph.event.VisualGraphListener
isolatedVisualEdgeAdded, isolatedVisualEdgeRemoved, layout, visualEdgeAdded, visualEdgeAttachRejected, visualEdgeRemoved, visualEdgeSplit, visualNodeAdded, visualNodeDeleteEdgeCascade, visualNodeRemoved
 
Methods inherited from interface com.tensegrity.gui.swing.control.tree.strategy.TreeStrategy
getParentIndex, removeNode
 

Field Detail

VISUAL_EDGE_TREE_NODE

public static final int VISUAL_EDGE_TREE_NODE
represents a tree node for visual edges

See Also:
Constant Field Values

VISUAL_NODE_TREE_NODE

public static final int VISUAL_NODE_TREE_NODE
represents a tree node for visual nodes

See Also:
Constant Field Values

VISUAL_SUBGRAPH_TREE_NODE

public static final int VISUAL_SUBGRAPH_TREE_NODE
represents a tree node for visual subgraphs

See Also:
Constant Field Values

DOCUMENT_TYPE_KEY

public static final java.lang.String DOCUMENT_TYPE_KEY
represents the type of Document this strategy is associated to. Here, it is associated with a GraphDocument

See Also:
Constant Field Values
Constructor Detail

AbstractVisualGraphTreeStrategy

protected AbstractVisualGraphTreeStrategy(UIManager uiManager,
                                          TreeOutliner tree)

Initializes instances of this class with the passed UIManager and TreeOutliner instances

Parameters:
uiManager - the application UIManager.
tree - the TreeOutliner to which this strategy is applied.

AbstractVisualGraphTreeStrategy

protected AbstractVisualGraphTreeStrategy(UIManager uiManager)

Initializes instances of this class with the passed UIManager

Parameters:
uiManager - the application UIManager.
Method Detail

addNode

public void addNode(javax.swing.tree.DefaultMutableTreeNode parent,
                    javax.swing.tree.DefaultMutableTreeNode node)
Override addNode in order to keep documentIdNodeMap up to date.

Specified by:
addNode in interface TreeStrategy
Overrides:
addNode in class AbstractTreeStrategy
See Also:
TreeStrategy.addNode(javax.swing.tree.DefaultMutableTreeNode, javax.swing.tree.DefaultMutableTreeNode)

getNewTreeNode

public javax.swing.tree.DefaultMutableTreeNode getNewTreeNode(int subClassType,
                                                              java.lang.Object documentObject)
Possible values for subClassType are:

Specified by:
getNewTreeNode in interface TreeStrategy
Parameters:
subClassType - To be defined will implementing this method. This parameter should allow distinguishing possible subClasses of DefaultMutableTreeNode required by the caller.
documentObject - This is the object located on the active document for which a TreeNode is required.
Returns:
a new instance of DefaultMutableTreeNode (usually a subClass)
See Also:
TreeStrategy.getNewTreeNode(int, java.lang.Object), VisualEdgeTreeNode, VisualNodeTreeNode, VisualSubgraphTreeNode

getComparator

public java.util.Comparator getComparator(boolean asc)

Default implementation. Returns the default instance of Comparator that can be used in order to sort VisualNodes

Specified by:
getComparator in interface OutlinerStrategy
Parameters:
asc - True if an ascending sorting is required, false if a descending sorting is required.
Returns:
a Comparator
See Also:
OutlinerStrategy.getComparator(boolean)


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.