com.extjs.gxt.ui.client.data
Class TreeModelReader<D extends java.util.List<? extends ModelData>>

java.lang.Object
  extended by com.extjs.gxt.ui.client.data.TreeModelReader<D>
All Implemented Interfaces:
DataReader<D>

public class TreeModelReader<D extends java.util.List<? extends ModelData>>
extends java.lang.Object
implements DataReader<D>

A DataReader that simply returns the children of the passed TreeModel.


Field Summary
protected  java.lang.String childrenProperty
           
 
Constructor Summary
TreeModelReader()
          Creates a tree model reader.
TreeModelReader(java.lang.String childrenProperty)
          Creates a new tree model reader.
 
Method Summary
protected  java.util.List<? extends ModelData> getChildren(ModelData parent)
          Returns the children for the given parent.
 java.lang.String getChildrenProperty()
          Returns the property name that contains the model's children.
 D read(java.lang.Object loadConfig, java.lang.Object data)
          Reads the raw data and returns the typed data.
 void setChildrenProperty(java.lang.String childrenProperty)
          Sets the property name that contains the children for the parent model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

childrenProperty

protected java.lang.String childrenProperty
Constructor Detail

TreeModelReader

public TreeModelReader()
Creates a tree model reader.


TreeModelReader

public TreeModelReader(java.lang.String childrenProperty)
Creates a new tree model reader.

Parameters:
childrenProperty - the children property name
Method Detail

read

public D read(java.lang.Object loadConfig,
              java.lang.Object data)
Description copied from interface: DataReader
Reads the raw data and returns the typed data.

Specified by:
read in interface DataReader<D extends java.util.List<? extends ModelData>>
data - the data to read
Returns:
the data

getChildren

protected java.util.List<? extends ModelData> getChildren(ModelData parent)
Returns the children for the given parent. The default implementation first checks the childrenProperty. If null, and the parent is a TreeModel instance, its children are returned. Finally, an empty list is returned.

Parameters:
parent - the parent model
Returns:
the parents children

getChildrenProperty

public java.lang.String getChildrenProperty()
Returns the property name that contains the model's children.

Returns:
the children property name

setChildrenProperty

public void setChildrenProperty(java.lang.String childrenProperty)
Sets the property name that contains the children for the parent model.

Parameters:
childrenProperty - the property name