org.openxava.web.editors
Class TreeView

java.lang.Object
  extended by org.openxava.web.editors.TreeView

public class TreeView
extends java.lang.Object

Author:
Federico Alcántara

Constructor Summary
TreeView()
           
TreeView(Tree path, java.lang.Class nodeClass, java.lang.Class parent, java.lang.String collectionName, java.lang.String treeViewReaderName)
           
 
Method Summary
 java.util.Map<java.lang.String,java.lang.Boolean> getExpandedStates()
           
 java.lang.String getIdProperties()
           
 java.lang.String getIdSeparator()
           
 boolean getInitialExpandedState()
           
 int getKeyIncrement()
           
 boolean getNodeExpandedState(java.lang.Object object)
          Returns the expanded state of the object.
 java.lang.String getNodeFullPath(java.lang.Object object)
          Returns the complete path of the node including the node name.
 java.lang.String getNodeName(java.lang.Object object)
          Returns the node name as it is used in the path
 int getNodeOrder(java.lang.Object object)
          If the property orderProperty of @TreeView annotation is defined, returns the order of the object within its parent; otherwise returns 0.
 java.lang.String getNodePath(java.lang.Object object)
          Returns the parent path of the node.
 java.lang.String getOrderProperty()
           
 java.lang.String getPathProperty()
           
 java.lang.String getPathSeparator()
           
 ITreeViewReader getTreeViewReaderImpl()
          Creates the implementation of TreeView reader
 boolean isEntityObject()
           
 boolean isOrderDefined()
           
protected  void parseTreeView(Tree path, java.lang.Class nodeClass, java.lang.Class parentClass, java.lang.String collectionName)
          Parse the @TreeView annotation.
protected  void setEntityObject(boolean entityObject)
           
 void setExpandedStates(java.util.Map<java.lang.String,java.lang.Boolean> expandedStates)
           
protected  void setIdProperties(java.lang.String idProperties)
           
protected  void setIdSeparator(java.lang.String idSeparator)
           
protected  void setInitialExpandedState(boolean initialExpandedState)
           
protected  void setKeyIncrement(int keyIncrement)
           
 void setNodeExpandedState(java.lang.Object object, boolean value)
          Sets a new expanded state for the object.
 void setNodeOrder(java.lang.Object object, int value)
          Changes the order of the node within its parent.
 void setNodePath(java.lang.Object object, java.lang.String value)
          Sets the node path.
protected  void setOrderProperty(java.lang.String orderProperty)
           
protected  void setPathProperty(java.lang.String pathProperty)
           
protected  void setPathSeparator(java.lang.String pathSeparator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeView

public TreeView()

TreeView

public TreeView(Tree path,
                java.lang.Class nodeClass,
                java.lang.Class parent,
                java.lang.String collectionName,
                java.lang.String treeViewReaderName)
         throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

parseTreeView

protected void parseTreeView(Tree path,
                             java.lang.Class nodeClass,
                             java.lang.Class parentClass,
                             java.lang.String collectionName)
                      throws java.lang.Exception
Parse the @TreeView annotation.

Parameters:
nodeClass - Object to be parsed.
Throws:
java.lang.Exception

getNodeName

public java.lang.String getNodeName(java.lang.Object object)
Returns the node name as it is used in the path

Parameters:
object - Object to be inspected.
Returns:
The node name. It can be compound with multiple values (when you have multiple id, for example).

getNodePath

public java.lang.String getNodePath(java.lang.Object object)
                             throws java.lang.Exception
Returns the parent path of the node.

Parameters:
object - Object to be inspected.
Returns:
The path excluding the node name.
Throws:
java.lang.Exception

setNodePath

public void setNodePath(java.lang.Object object,
                        java.lang.String value)
                 throws java.lang.Exception
Sets the node path.

Parameters:
object - Object to be updated.
value - New path to be used.
Throws:
java.lang.Exception

getNodeExpandedState

public boolean getNodeExpandedState(java.lang.Object object)
Returns the expanded state of the object. If the expanded state is not persisted, then it returns the appropriate value according to the definition of the expandedState property of @TreeView annotation.

Parameters:
object - Object to be inspected.
Returns:
State of the object.

getNodeFullPath

public java.lang.String getNodeFullPath(java.lang.Object object)
                                 throws java.lang.Exception
Returns the complete path of the node including the node name.

Parameters:
object - Object to be inspected.
Returns:
Complete path.
Throws:
java.lang.Exception

getNodeOrder

public int getNodeOrder(java.lang.Object object)
If the property orderProperty of @TreeView annotation is defined, returns the order of the object within its parent; otherwise returns 0.

Parameters:
object - Object to be inspected.
Returns:
Current order or zero.

setNodeOrder

public void setNodeOrder(java.lang.Object object,
                         int value)
Changes the order of the node within its parent. Ignored if orderProperty is not defined.

Parameters:
object - Object to be updated.
value - New order to be applied.

setNodeExpandedState

public void setNodeExpandedState(java.lang.Object object,
                                 boolean value)
Sets a new expanded state for the object. If expandedProperty is not defined it is ignored.

Parameters:
object - Object to be modified.
value - New state.

getPathProperty

public java.lang.String getPathProperty()
Returns:
the pathProperty

setPathProperty

protected void setPathProperty(java.lang.String pathProperty)
Parameters:
pathProperty - the pathProperty to set

setIdProperties

protected void setIdProperties(java.lang.String idProperties)
Parameters:
idProperties - the idProperties to set

getIdProperties

public java.lang.String getIdProperties()
Returns:
the idProperties

getOrderProperty

public java.lang.String getOrderProperty()
Returns:
the orderProperty

setOrderProperty

protected void setOrderProperty(java.lang.String orderProperty)
Parameters:
orderProperty - the orderProperty to set

getInitialExpandedState

public boolean getInitialExpandedState()
Returns:
the initialExpandedState

setInitialExpandedState

protected void setInitialExpandedState(boolean initialExpandedState)
Parameters:
initialExpandedState - the initialExpandedState to set

getKeyIncrement

public int getKeyIncrement()
Returns:
the keyIncrement

setKeyIncrement

protected void setKeyIncrement(int keyIncrement)
Parameters:
keyIncrement - the keyIncrement to set

setPathSeparator

protected void setPathSeparator(java.lang.String pathSeparator)
Parameters:
pathSeparator - the pathSeparator to set

getPathSeparator

public java.lang.String getPathSeparator()
Returns:
the pathSeparator

setEntityObject

protected void setEntityObject(boolean entityObject)
Parameters:
entityObject - the entityObject to set

isEntityObject

public boolean isEntityObject()
Returns:
the entityObject

isOrderDefined

public boolean isOrderDefined()

setIdSeparator

protected void setIdSeparator(java.lang.String idSeparator)
Parameters:
idSeparator - the idSeparator to set

getIdSeparator

public java.lang.String getIdSeparator()
Returns:
the idSeparator

setExpandedStates

public void setExpandedStates(java.util.Map<java.lang.String,java.lang.Boolean> expandedStates)
Parameters:
expandedStates - the expandedStates to set

getExpandedStates

public java.util.Map<java.lang.String,java.lang.Boolean> getExpandedStates()
Returns:
the expandedStates

getTreeViewReaderImpl

public ITreeViewReader getTreeViewReaderImpl()
Creates the implementation of TreeView reader

Returns:
Object implementing the ITreeViewReader
Throws:
java.lang.Exception