|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.tree.DefaultMutableTreeNode
p3j.gui.panels.projections.ProjectionTreeNode<E>
E
- type of the represented entitypublic class ProjectionTreeNode<E>
Super class of all nodes representing PPPM entities in the projection tree. Created: August 24, 2008
Field Summary |
---|
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode |
---|
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject |
Constructor Summary | |
---|---|
ProjectionTreeNode(E pppmEntity,
String name)
Default constructor. |
Method Summary | ||
---|---|---|
void |
deselected()
Method that is called by the TreeSelectionListener when this node gets
de-selected. |
|
List<ProjectionTreeNode<?>> |
getChilds()
Retrieves list of child nodes. |
|
|
getChildsByType(Class<X> entityType)
Retrieves all children of a given type. |
|
protected
|
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. |
|
|
getProjectionEntity(Class<T> targetClass)
Traverses current JTree towards its root. |
|
|
getProjectionEntity(Class<T> targetClass,
ProjectionTreeNode<?> sourceNode)
Traverses a JTree towards its root. |
|
|
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. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ProjectionTreeNode(E pppmEntity, String name)
pppmEntity
- the PPPM entity to be representedname
- the name to be displayedMethod Detail |
---|
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 tree
protected 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 type
public <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 upwards
public <T> T getProjectionTreeNodeOnPath(Class<T> targetClass)
T
- the type of the targettargetClass
- the target class
public ProjectionTreeNode<?> getChildWithEntity(Object childEntity)
ProjectionTreeNode
.
childEntity
- the target entity
public <X> List<ProjectionTreeNode<X>> getChildsByType(Class<X> entityType)
X
- the type of the entityentityType
- the type of the entity
protected <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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |