Gridarta Editor
net.sf.gridarta.model.data.NamedTreeNode< E extends NamedObject > Class Template Reference

TreeNode implementation for Named Objects (like arches, faces, animations, artifacts etc.), used for displaying faces in a javax.swing.JTree. More...

+ Inheritance diagram for net.sf.gridarta.model.data.NamedTreeNode< E extends NamedObject >:
+ Collaboration diagram for net.sf.gridarta.model.data.NamedTreeNode< E extends NamedObject >:

Public Member Functions

void append (@NotNull final NamedObject namedObject) throws IllegalNamedObjectException
 Append a node. More...
 
 NamedTreeNode ()
 Creates a root node. More...
 

Private Member Functions

void append (@NotNull final String path, @NotNull final NamedObject namedObject) throws IllegalNamedObjectException
 Appends a node. More...
 
void initLazyArray ()
 Makes sure that the variable childNodeArray points to a valid array. More...
 
 NamedTreeNode (final boolean dir, @Nullable final NamedTreeNode< E > parent, @NotNull final NamedObject namedObject)
 Creates a new instance. More...
 
 NamedTreeNode (final boolean dir, @Nullable final NamedTreeNode< E > parent, @NotNull final String name)
 Creates a new instance. More...
 

Private Attributes

NamedTreeNode<?>[] childNodeArray
 The node array. More...
 
final SortedMap< String, NamedTreeNode< E > > childNodes = new TreeMap<>()
 The children. More...
 
final boolean dir
 Directory state,. More...
 
final String name
 The node name. More...
 
final NamedObject namedObject
 The node object. More...
 
final NamedTreeNode< E > parent
 The parent node, which may be. More...
 

Static Private Attributes

static final long serialVersionUID = 1L
 The serial version UID. More...
 

Detailed Description

TreeNode implementation for Named Objects (like arches, faces, animations, artifacts etc.), used for displaying faces in a javax.swing.JTree.

Author
Christian Hujer

Definition at line 40 of file NamedTreeNode.java.

Constructor & Destructor Documentation

◆ NamedTreeNode() [1/3]

Creates a root node.

All other nodes must be created via {}.

Definition at line 94 of file NamedTreeNode.java.

◆ NamedTreeNode() [2/3]

net.sf.gridarta.model.data.NamedTreeNode< E extends NamedObject >.NamedTreeNode ( final boolean  dir,
@Nullable final NamedTreeNode< E >  parent,
@NotNull final String  name 
)
private

Creates a new instance.

The constructor has been made private to force users on factory methods

Parameters
dirset this to
true
for directory nodes,
false
for face nodes
parentthe parent node or
null
for root node
namethe name, which is the directory name for directory nodes and the face name for face nodes

Definition at line 107 of file NamedTreeNode.java.

◆ NamedTreeNode() [3/3]

net.sf.gridarta.model.data.NamedTreeNode< E extends NamedObject >.NamedTreeNode ( final boolean  dir,
@Nullable final NamedTreeNode< E >  parent,
@NotNull final NamedObject  namedObject 
)
private

Creates a new instance.

The constructor has been made private to force users on factory methods

Parameters
dirset this to
true
for directory nodes,
false
for face nodes
parentthe parent node or
null
for root node
namedObjectthe abstract named object to show as this tree node

Definition at line 122 of file NamedTreeNode.java.

Member Function Documentation

◆ append() [1/2]

void net.sf.gridarta.model.data.NamedTreeNode< E extends NamedObject >.append ( @NotNull final NamedObject  namedObject) throws IllegalNamedObjectException

Append a node.

Parameters
namedObjectthe node to append
Exceptions
IllegalNamedObjectExceptionif the named object cannot be added

Definition at line 134 of file NamedTreeNode.java.

Referenced by net.sf.gridarta.model.data.NamedTreeNode< E >.append(), and net.sf.gridarta.model.data.AbstractNamedObjects< FaceObject >.put().

+ Here is the caller graph for this function:

◆ append() [2/2]

void net.sf.gridarta.model.data.NamedTreeNode< E extends NamedObject >.append ( @NotNull final String  path,
@NotNull final NamedObject  namedObject 
) throws IllegalNamedObjectException
private

Appends a node.

Direct invocation should only occur on the root node.

Parameters
paththe path of node to append (parent path eventually removed)
namedObjectthe abstract named object to show as this tree node
Exceptions
IllegalNamedObjectExceptionif the named object cannot be added

Definition at line 147 of file NamedTreeNode.java.

◆ initLazyArray()

void net.sf.gridarta.model.data.NamedTreeNode< E extends NamedObject >.initLazyArray ( )
private

Makes sure that the variable childNodeArray points to a valid array.

Definition at line 175 of file NamedTreeNode.java.

Member Data Documentation

◆ childNodeArray

NamedTreeNode<?> [] net.sf.gridarta.model.data.NamedTreeNode< E extends NamedObject >.childNodeArray
private

The node array.

It is required for implementing the TreeNode interface with index methods since the TreeMap does not allow indexed access despite the fact that it is ordered. Basically it is redundant. @serial

Definition at line 60 of file NamedTreeNode.java.

Referenced by net.sf.gridarta.model.data.NamedTreeNode< E >.append(), and net.sf.gridarta.model.data.NamedTreeNode< E >.initLazyArray().

◆ childNodes

final SortedMap<String, NamedTreeNode<E> > net.sf.gridarta.model.data.NamedTreeNode< E extends NamedObject >.childNodes = new TreeMap<>()
private

The children.

They are mapped name as key to child node as value. @serial

Definition at line 52 of file NamedTreeNode.java.

Referenced by net.sf.gridarta.model.data.NamedTreeNode< E >.append(), and net.sf.gridarta.model.data.NamedTreeNode< E >.initLazyArray().

◆ dir

final boolean net.sf.gridarta.model.data.NamedTreeNode< E extends NamedObject >.dir
private

Directory state,.

true

for directory nodes,

false

for face nodes. @serial

Definition at line 88 of file NamedTreeNode.java.

Referenced by net.sf.gridarta.model.data.NamedTreeNode< E >.append(), and net.sf.gridarta.model.data.NamedTreeNode< E >.NamedTreeNode().

◆ name

final String net.sf.gridarta.model.data.NamedTreeNode< E extends NamedObject >.name
private

The node name.

@serial

Definition at line 74 of file NamedTreeNode.java.

Referenced by net.sf.gridarta.model.data.NamedTreeNode< E >.NamedTreeNode().

◆ namedObject

◆ parent

The parent node, which may be.

null

for the root node. @serial

Definition at line 67 of file NamedTreeNode.java.

Referenced by net.sf.gridarta.model.data.NamedTreeNode< E >.append(), and net.sf.gridarta.model.data.NamedTreeNode< E >.NamedTreeNode().

◆ serialVersionUID

final long net.sf.gridarta.model.data.NamedTreeNode< E extends NamedObject >.serialVersionUID = 1L
staticprivate

The serial version UID.

Definition at line 45 of file NamedTreeNode.java.


The documentation for this class was generated from the following file: