E
- type of the represented entitypublic class ProjectionTreeNode<E> extends DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
Constructor and Description |
---|
ProjectionTreeNode(E pppmEntity,
String name)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
deselected()
Method that is called by the
TreeSelectionListener when this node gets
de-selected. |
List<ProjectionTreeNode<?>> |
getChilds()
Retrieves list of child nodes.
|
<X> List<ProjectionTreeNode<X>> |
getChildsByType(Class<X> entityType)
Retrieves all children of a given type.
|
protected <X> List<ProjectionTreeNode<X>> |
getChildsByType(List<ProjectionTreeNode<X>> list,
Class<X> entityType) |
ProjectionTreeNode<?> |
getChildWithEntity(Object childEntity)
Looks for a certain object associated with a child node of type
ProjectionTreeNode . |
JPanel |
getContentPanel() |
E |
getEntity() |
Class<?> |
getEntityClass() |
String |
getEntityLabel()
Gets the user object string.
|
<T> T |
getProjectionEntity(Class<T> targetClass)
Traverses current
JTree towards its root. |
<T> T |
getProjectionEntity(Class<T> targetClass,
ProjectionTreeNode<?> sourceNode)
Traverses a
JTree towards its root. |
<T> T |
getProjectionTreeNodeOnPath(Class<T> targetClass)
Gets a projection tree node of a specific type, which is on the path.
|
protected void |
refreshRecursively(DefaultTreeModel treeModel)
Refreshes nodes and all of its children recursively, by invoking
refreshRepresentation() . |
protected void |
refreshRepresentation()
This is called when the node's representation might have changed.
|
JPanel |
selected(TreePath selectionPath,
IProjectionTree projTree)
Method that is called by
ProjectionTreeNode#selected(TreePath, JPanel, DefaultTreeModel, javax.swing.JTree)
originally. |
void |
selected(TreePath selectionPath,
JPanel generalPanel,
IProjectionTree projTree)
Method that is called by the
TreeSelectionListener when this node gets
selected. |
add, breadthFirstEnumeration, children, clone, 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, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
public E getEntity()
public void selected(TreePath selectionPath, JPanel generalPanel, IProjectionTree projTree)
TreeSelectionListener
when this node gets
selected.selectionPath
- the path containing all ancestorsgeneralPanel
- the general panel to put the content onprojTree
- the projection treepublic JPanel selected(TreePath selectionPath, IProjectionTree projTree)
ProjectionTreeNode#selected(TreePath, JPanel, DefaultTreeModel, javax.swing.JTree)
originally. Implementations of ProjectionTreeNode
might override
either of the 'selected' methods, this one is more convenient as it stores
the generated panel in an auxiliary variable and does not require to add
the panel manually, it just needs to be returned.selectionPath
- the path containing all ancestorsprojTree
- the projection treeprotected void refreshRepresentation()
DefaultMutableTreeNode.setUserObject(Object)
.public void deselected()
TreeSelectionListener
when this node gets
de-selected.public Class<?> getEntityClass()
public JPanel getContentPanel()
public <T> T getProjectionEntity(Class<T> targetClass)
JTree
towards its root. See
getProjectionEntity(Class, ProjectionTreeNode)
,
which is called with this.T
- required typetargetClass
- class of required typepublic <T> T getProjectionEntity(Class<T> targetClass, ProjectionTreeNode<?> sourceNode)
JTree
towards its root. Returns first
entity of a given type that is found. Requires that all nodes are of type
ProjectionTreeNode
, returns null when encountering another class.T
- the type of the required entitytargetClass
- the class of the required entitysourceNode
- the node from where to start searching upwardspublic <T> T getProjectionTreeNodeOnPath(Class<T> targetClass)
T
- the type of the targettargetClass
- the target classpublic ProjectionTreeNode<?> getChildWithEntity(Object childEntity)
ProjectionTreeNode
.childEntity
- the target entitypublic <X> List<ProjectionTreeNode<X>> getChildsByType(Class<X> entityType)
X
- the type of the entityentityType
- the type of the entityprotected <X> List<ProjectionTreeNode<X>> getChildsByType(List<ProjectionTreeNode<X>> list, Class<X> entityType)
protected void refreshRecursively(DefaultTreeModel treeModel)
refreshRepresentation()
.treeModel
- the tree model to be notifiedpublic List<ProjectionTreeNode<?>> getChilds()
public String getEntityLabel()
Copyright © 2013. All Rights Reserved.