|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.gui.swing.control.tree.strategy.AbstractTreeStrategy
This is the implementation of TreeStrategy that all classes
requiring to implement TreeStrategy should extend. It is
indeed not recommanded to directly implement TreeStrategy.
Note that the provided initializeModel method is intended to be overridden.
It is also required to be called ( super.initializeModel())
when overridden since it sets the locally held active Graph instance. It is
important to do so in order to get the getModel and setModel methods working
as expected.
Subclasses should overridde the public constant DOCUMENT_TYPE_KEY. Set this
constant to be the Class name of the specific Document the strategy is
associated to. For example, in AbstractVisualGraphTreeStrategy it is set to
"GraphDocument"
Note also that this class is javax.swing dependant.
TreeStrategy,
AbstractVisualGraphTreeStrategy| Field Summary | |
static java.lang.String |
DOCUMENT_TYPE_KEY
represents the type of Document this strategy is associated to. |
| Constructor Summary | |
protected |
AbstractTreeStrategy(UIManager uiManager)
Initializes instances of this class with the passed
instance.
|
protected |
AbstractTreeStrategy(UIManager uiManager,
TreeOutliner tree)
Initializes instances of this class with the passed
and instances.
|
| Method Summary | |
void |
addNode(javax.swing.tree.DefaultMutableTreeNode parent,
javax.swing.tree.DefaultMutableTreeNode node)
Method addNode adds the given node the the given parent.
|
abstract javax.swing.tree.DefaultMutableTreeNode |
findNodeByID(javax.swing.tree.DefaultMutableTreeNode parent,
long id)
Utility method. |
protected Document |
getActiveDocument()
Returns the currently active . |
java.util.Map |
getDocumentIdNodeMap()
Returns the containing
s of
s Ids /s. |
protected java.util.HashMap |
getDocumentModelMap()
Returns the local of
s and s.
|
protected java.util.Map |
getIdNodeMap(Document document)
Returns the of
s Ids / s corresponding to the passed
. |
protected javax.swing.tree.DefaultTreeModel |
getModel()
Returns the associated to the
active . |
protected javax.swing.tree.DefaultMutableTreeNode |
getRoot()
Returns the root of the Tree, null if the model is null.
|
protected TreeOutliner |
getTree()
Method giving access to the instance
to which the strategy is applied.
|
UIManager |
getUIManager()
Returns the local instance of |
abstract javax.swing.tree.DefaultTreeModel |
initializeModel(java.util.Map uiMap,
Document document,
java.lang.String name,
boolean recreateModelEvenIfExists)
Method initializing and returning the
associated to the passed . |
void |
removeModel(Document document)
Removes the model associated to the passed
from the local of
s and s.
|
protected void |
setActiveDocument(Document activeDocument)
Sets the currently active .
|
protected void |
setModel(javax.swing.tree.DefaultTreeModel model)
Locally stores the passed model. |
void |
setTree(TreeOutliner tree)
Sets the local instance of .
|
void |
updateNode(javax.swing.tree.TreeNode node)
Method updateNode reflects the changes made on the passed TreeNode on the TreeModel |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.tensegrity.gui.swing.control.tree.strategy.TreeStrategy |
getNewTreeNode, getParentIndex, removeNode |
| Methods inherited from interface com.tensegrity.gui.swing.control.tree.strategy.OutlinerStrategy |
getComparator |
| Field Detail |
public static final java.lang.String DOCUMENT_TYPE_KEY
| Constructor Detail |
protected AbstractTreeStrategy(UIManager uiManager,
TreeOutliner tree)
Initializes instances of this class with the passed
and UIManager instances.
TreeOutliner
uiManager - the application UIManager.tree - the TreeOutliner to which this
strategy is applied.protected AbstractTreeStrategy(UIManager uiManager)
Initializes instances of this class with the passed
instance.
UIManager
uiManager - the application UIManager.| Method Detail |
protected final java.util.Map getIdNodeMap(Document document)
Map of VisualGraphObject
s Ids /TreeNode s corresponding to the passed
Document.
document - the Document for which the Map of
VisualGraphObject
s Ids and TreeNode s is requested.
public final java.util.Map getDocumentIdNodeMap()
Map containing Map
s of VisualGraphObject
s Ids /TreeNodes. This Map
keys are Documents.
public final UIManager getUIManager()
Returns the local instance of UIManager
UIManagerpublic void removeModel(Document document)
Removes the model associated to the passed
from the local Document of Map
s and Documents.
DefaultTreeModel
document - the Document of which the associated
DefaultTreeModel should be removed
from the local Map.protected final java.util.HashMap getDocumentModelMap()
Returns the local of Map
s and Documents.
DefaultTreeModel
Map of Document
s and DefaultTreeModels.public final void setTree(TreeOutliner tree)
Sets the local instance of .
TreeOutliner
tree - the TreeOutliner to which the AbstractTreeStrategy
is applied.protected final javax.swing.tree.DefaultMutableTreeNode getRoot()
Returns the root of the Tree, null if the model is null.
null if the model is null.protected final javax.swing.tree.DefaultTreeModel getModel()
Returns the associated to the
active DefaultTreeModel. The active Document
is locally stored when Document
is called.
initializeModel(Map, Document, String, boolean)
DefaultTreeModel associated to the
active Document.protected void setModel(javax.swing.tree.DefaultTreeModel model)
Locally stores the passed model.
Important Note
It is internally storing the model in a for
which the key is the Map corresponding to
the passed model.
Document
Document local instance is
set to the desired Document before this method is
called. This is done by initializeModel(Map, Document, String, boolean).
model - the DefaultTreeModel associated to the
active Docuement, if any.protected final TreeOutliner getTree()
Method giving access to the instance
to which the strategy is applied.
TreeOutliner
TreeOutliner
public abstract javax.swing.tree.DefaultMutableTreeNode findNodeByID(javax.swing.tree.DefaultMutableTreeNode parent,
long id)
DefaultMutableTreeNode which matches
the given id. If no such node is found, null is returned.
parent - DefaultMutableTreeNode representing
the parent of the DefaultMutableTreeNode
we are looking for.id - unique identifier for a tree node.
DefaultMutableTreeNode
which matches the given id, or nulll/code> if no match is found.
public abstract javax.swing.tree.DefaultTreeModel initializeModel(java.util.Map uiMap,
Document document,
java.lang.String name,
boolean recreateModelEvenIfExists)
Method initializing and returning the
associated to the passed TreeModel. If the
document does not already have a Document
associated to it, the TreeModel associated
to the type of this document is created and associated to the document.
Note that by setting the DefaultTreeModelrecreateModelEvenIfExists
parameter to true the
is recreated even if one was already associated to the document.
IMPORTANTTreeModel
First thing to do when overriding this method is to call
setActiveDocument(Document). It is important to do so in
order to get the and getModel()
methods working as expected.
setModel(DefaultTreeModel)
uiMap - this is the UI Map.document - The document of which the Model is requiredname - The name of the documentrecreateModelEvenIfExists - True if the Model should be recreated even if a Model is
already associated to the document.
public void addNode(javax.swing.tree.DefaultMutableTreeNode parent,
javax.swing.tree.DefaultMutableTreeNode node)
TreeStrategynode the the given parent.
If parent s childcount is 0 before the
adding, its added to the root. The current expanded TreePath instances
are saved and restored after the sucessful adding.
addNode in interface TreeStrategyparent - the DefaultMutableTreeNode of which
node is going to be added as a childnode - the DefaultMutableTreeNode to add.TreeStrategy.addNode(javax.swing.tree.DefaultMutableTreeNode, javax.swing.tree.DefaultMutableTreeNode)public final void updateNode(javax.swing.tree.TreeNode node)
TreeStrategyMethod updateNode reflects the changes made on the passed TreeNode on the TreeModel
updateNode in interface TreeStrategynode - The TreeNode which requires to be updatedTreeStrategy.updateNode(javax.swing.tree.TreeNode)protected Document getActiveDocument()
Document.
Document.protected void setActiveDocument(Document activeDocument)
Sets the currently active .
Document
activeDocument - the currently active Document.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||