SPT Core API

com.sptci.epng.editabletree
Class Node

java.lang.Object
  extended by nextapp.echo2.app.Component
      extended by nextapp.echo2.app.Column
          extended by com.sptci.epng.editabletree.Node
All Implemented Interfaces:
View, Serializable, Comparable<Node>, RenderIdSupport
Direct Known Subclasses:
RootNode, StandardNode

public abstract class Node
extends Column
implements View, Comparable<Node>

A custom component used to display the node name and controls.

© Copyright 2007 Sans Pareil Technologies, Inc.

Version:
$Id: Node.java 4553 2008-12-24 10:34:16Z rakesh $
Author:
Rakesh Vidyadharan 2007-05-05
See Also:
Serialized Form

Field Summary
protected  AddComponent add
          The component that is used to display the components that are used to capture user input about new child to be added.
protected  DisplayComponent display
          The component that is used to display the title of the node and the controls to add/remove.
protected  String displayName
          The Treeable.getDisplayName() value stored to allow access to value when the treeable instance is no longer accessible (deleted).
protected  String objectId
          The ObjectId for the treeable object that is currently displayed in the node.
protected  Treeable treeable
          The treeable object that is represented by this node.
 
Fields inherited from class nextapp.echo2.app.Column
PROPERTY_BORDER, PROPERTY_CELL_SPACING, PROPERTY_INSETS
 
Fields inherited from class nextapp.echo2.app.Component
CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY, FOCUS_TRAVERSAL_PARTICIPANT_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
Node()
          Create a new instance with no value for treeable.
Node(Treeable treeable)
          Create a new instance using the specified model object.
 
Method Summary
 void addChild(Treeable treeable)
          Add a new child node to this node using the specified model object.
protected  void addChild(Treeable treeable, DefaultMutableTreeNode node)
          Add a new child node to this node.
 int compareTo(Node node)
          Compare the specified node with this.
protected abstract  DisplayComponent createDisplayComponent()
          Abstract method to initialise display with the appropriate subclass.
protected abstract  DisplayComponent createDisplayComponent(Treeable treeable)
          Abstract method to initialise display with the appropriate subclass.
 boolean equals(Object object)
          Check the specified object with this for equality.
 AddComponent getAdd()
          Returns add.
 DisplayComponent getDisplay()
          Returns display.
 String getName()
          Get the value displayed in the DisplayComponent.name component.
 String getObjectId()
          Returns objectId.
 Treeable getTreeable()
          Returns treeable.
 int hashCode()
          Computes a hash code for this object.
 void setAdd(AddComponent add)
          Set add.
 void setName(String name)
          Set the value displayed in the DisplayComponent.name component.
 String toString()
          Return a string representation of this object.
 
Methods inherited from class nextapp.echo2.app.Column
getBorder, getCellSpacing, getInsets, setBorder, setCellSpacing, setInsets
 
Methods inherited from class nextapp.echo2.app.Component
add, add, addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusTraversalIndex, getFont, getForeground, getId, getIndexedProperty, getLayoutData, getLayoutDirection, getLocale, getParent, getProperty, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLayoutDirection, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, init, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isValidChild, isValidParent, isVisible, processInput, remove, remove, removeAll, removePropertyChangeListener, removePropertyChangeListener, setBackground, setEnabled, setFocusTraversalIndex, setFocusTraversalParticipant, setFont, setForeground, setId, setIndexedProperty, setLayoutData, setLayoutDirection, setLocale, setProperty, setRenderId, setStyle, setStyleName, setVisible, validate, verifyInput, visibleIndexOf
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

treeable

protected Treeable treeable
The treeable object that is represented by this node.


objectId

protected String objectId
The ObjectId for the treeable object that is currently displayed in the node.


displayName

protected String displayName
The Treeable.getDisplayName() value stored to allow access to value when the treeable instance is no longer accessible (deleted).


display

protected DisplayComponent display
The component that is used to display the title of the node and the controls to add/remove.


add

protected AddComponent add
The component that is used to display the components that are used to capture user input about new child to be added.

Constructor Detail

Node

public Node()
Create a new instance with no value for treeable.


Node

public Node(Treeable treeable)
Create a new instance using the specified model object.

Parameters:
treeable - The model object for this node.
Method Detail

addChild

public void addChild(Treeable treeable)
Add a new child node to this node using the specified model object.

Parameters:
treeable - The model object to use to create the child.

addChild

protected void addChild(Treeable treeable,
                        DefaultMutableTreeNode node)
Add a new child node to this node.

Parameters:
treeable - The model object to use to create the child.
node - The TreeNode to which the new child node is to be added.

toString

public String toString()
Return a string representation of this object. Returns displayName.

Overrides:
toString in class Object
Returns:
The string representation of this object.

hashCode

public int hashCode()
Computes a hash code for this object. Returns the hash code for treeable.

Overrides:
hashCode in class Object
Returns:
Returns the hash code for this object.

equals

public boolean equals(Object object)
Check the specified object with this for equality. Checks the class type and values of treeable.

Overrides:
equals in class Object
Returns:
Returns true if the specified object is of the same class type and has the same value of treeable.

compareTo

public int compareTo(Node node)
Compare the specified node with this. Compares treeable.

Specified by:
compareTo in interface Comparable<Node>
Returns:
Returns a positive, 0, or negative number depending upon how the treeable instances compare.

getName

public String getName()
Get the value displayed in the DisplayComponent.name component.

Returns:
The value displayed in the component.

setName

public void setName(String name)
Set the value displayed in the DisplayComponent.name component.

Parameters:
name - The text to display in the component.

getDisplay

public DisplayComponent getDisplay()
Returns display.

Returns:
The value/reference of/to display.

getAdd

public AddComponent getAdd()
Returns add.

Returns:
The value/reference of/to add.

setAdd

public void setAdd(AddComponent add)
Set add.

Parameters:
add - The value to set.

getObjectId

public String getObjectId()
Returns objectId.

Returns:
The value/reference of/to objectId.

getTreeable

public Treeable getTreeable()
Returns treeable. Please note that accessing the fields of this object may result in RuntimeException thrown depending upon the persistant state.

Returns:
The value/reference of/to treeable.

createDisplayComponent

protected abstract DisplayComponent createDisplayComponent()
Abstract method to initialise display with the appropriate subclass.

Returns:
The appropriate subclass of DisplayComponent.

createDisplayComponent

protected abstract DisplayComponent createDisplayComponent(Treeable treeable)
Abstract method to initialise display with the appropriate subclass.

Parameters:
treeable - The model object to use to initialise the display component.
Returns:
The appropriate subclass of DisplayComponent.

SPT Core API