com.alveole.studio.web.data
Class NodeContainer

java.lang.Object
  extended by com.alveole.studio.web.data.NodeContainer
Direct Known Subclasses:
NodeAction, NodePackage, NodeView

public abstract class NodeContainer
extends java.lang.Object

This class is the base class of this project's tree nodes. Each node inherits of this NodeContainer. Do not use this class directly. Use one of NodePackage, NodeAction or NodeView instead.

Author:
sylvain

Field Summary
protected  java.lang.String ID
          A unique ID for this node.
protected  java.lang.String label
          A label to display this node.
protected  NodePackage parent
          The parent node package, or null if root.
protected  Project project
          The containing project.
protected  java.util.Properties uiPreferences
          User interface preferences (stores node X and Y position).
 
Constructor Summary
NodeContainer(Project project, NodePackage parent)
          Construtor.
 
Method Summary
abstract
<T> T
getAdapter(java.lang.Class<T> cls)
          Gets a adapter interface for this node.
 java.lang.String getID()
          A unique identifier.
 java.lang.String getLabel()
          Gets a label for displaying this node.
 NodePackage getParent()
          Gets parent package.
 Project getProject()
           
 java.util.Properties getUiPreferences()
          Get UI prerences.
abstract  void serialize(org.w3c.dom.Element parent)
          Serialize this node to DOM document.
protected  void serializeUiPrefs(org.w3c.dom.Element thisElement)
          Helper method for serializing all preferences for UI.
 void setID(java.lang.String id)
          A unique identifier.
 void setLabel(java.lang.String name)
          Sets a label for displaying this node.
 void setParent(NodePackage parent)
          Set parent package.
 void setProject(Project project)
           
 void setUiPreferences(java.util.Properties uiPreferences)
          Set UI preferences.
abstract  void unserialize(org.w3c.dom.Element element)
          Unserialize this node from DOM element.
protected  void unserializeUiPrefs(org.w3c.dom.Element thisElement)
          Helper method to read UI peferences from DOM element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

protected java.lang.String ID
A unique ID for this node.


label

protected java.lang.String label
A label to display this node.


parent

protected NodePackage parent
The parent node package, or null if root.


project

protected Project project
The containing project.


uiPreferences

protected java.util.Properties uiPreferences
User interface preferences (stores node X and Y position). It is usually used to store positions of sub-nodes.

Constructor Detail

NodeContainer

public NodeContainer(Project project,
                     NodePackage parent)
Construtor.

Parameters:
project - The project.
parent - The parent package.
Method Detail

getID

public java.lang.String getID()
A unique identifier.

Returns:
a unique ID.

setID

public void setID(java.lang.String id)
A unique identifier.

Parameters:
id - The unique ID for this node.

getLabel

public java.lang.String getLabel()
Gets a label for displaying this node.

Returns:
The node label.

setLabel

public void setLabel(java.lang.String name)
Sets a label for displaying this node.

Parameters:
name - The label.

serialize

public abstract void serialize(org.w3c.dom.Element parent)
Serialize this node to DOM document.

Parameters:
parent - The parent node, in which to store this node.

unserialize

public abstract void unserialize(org.w3c.dom.Element element)
                          throws javax.xml.xpath.XPathException
Unserialize this node from DOM element.

Parameters:
element - The DOM element in which data for this node is stored.
Throws:
javax.xml.xpath.XPathException - If XPath error.

serializeUiPrefs

protected void serializeUiPrefs(org.w3c.dom.Element thisElement)
Helper method for serializing all preferences for UI.

Parameters:
thisElement - The DOM element create to store this node.

unserializeUiPrefs

protected void unserializeUiPrefs(org.w3c.dom.Element thisElement)
                           throws javax.xml.xpath.XPathException
Helper method to read UI peferences from DOM element.

Parameters:
thisElement - The element that stores this node.
Throws:
javax.xml.xpath.XPathException - In case of error.

getParent

public NodePackage getParent()
Gets parent package.

Returns:
Parent package.

setParent

public void setParent(NodePackage parent)
Set parent package.

Parameters:
parent - The parent package.

getUiPreferences

public java.util.Properties getUiPreferences()
Get UI prerences.

Returns:
The UI prefs.

setUiPreferences

public void setUiPreferences(java.util.Properties uiPreferences)
Set UI preferences.

Parameters:
uiPreferences - The new prefs.

getAdapter

public abstract <T> T getAdapter(java.lang.Class<T> cls)
Gets a adapter interface for this node. This method is called to find extension features for this node. This method calls the underlying plugin manager for getting the adapter.

Parameters:
cls - The target class.
Returns:
The implementation for this node, or null.

getProject

public Project getProject()
Returns:
the project

setProject

public void setProject(Project project)
Parameters:
project - the project to set