oracle.adf.view.faces.model
Class ChildPropertyTreeModel

java.lang.Object
  |
  +--javax.faces.model.DataModel
        |
        +--oracle.adf.view.faces.model.CollectionModel
              |
              +--oracle.adf.view.faces.model.TreeModel
                    |
                    +--oracle.adf.view.faces.model.ChildPropertyTreeModel

public class ChildPropertyTreeModel
extends TreeModel

Creates a TreeModel from some other instance.


Constructor Summary
ChildPropertyTreeModel(CollectionModel model, java.lang.String childProperty)
          Creates a TreeModel from the given CollectionModel
ChildPropertyTreeModel(java.lang.Object instance, java.lang.String childProperty)
          Creates a TreeModel
 
Method Summary
protected  CollectionModel createChildModel(java.lang.Object childData)
          Converts childData into a CollectionModel
protected  java.lang.Object getChildData(java.lang.Object parentData)
          Gets the child data for a node
 java.lang.Object getParentData()
          Gets the rowData of the parent that contains this Collection of children.
 java.util.List getPath()
          Gets the path that points to the row that is the parentData of this collection
 int getRowCount()
           
 java.lang.Object getRowData()
           
 int getRowIndex()
           
 java.lang.String getRowKey()
          Gets the row key of the current row
 java.lang.String getSortBy()
          Gets the property that this collection is sorted on.
 boolean getSortOrder()
          Gets the sort order
 java.lang.Object getWrappedData()
           
 boolean isRowAvailable()
           
 boolean isRowContainer()
          Tests to see if the row identified by getRowData() has children.
 boolean isSortable(java.lang.String property)
          Return true iff this collection is sortable by the given property
 void popPath()
          Removes the last rowKey from the path.
 void pushPath()
          The row identified by getRowKey() is added to the path and made the new parent.
 void setPath(java.util.List path)
          sets the path.
 void setRowIndex(int rowIndex)
           
 void setRowKey(java.lang.String key)
          Finds the row with the matching key and makes it current
 void setWrappedData(java.lang.Object data)
           
 void sort(java.lang.String sortBy, boolean sortOrder)
          Sort this collection by the given property
 
Methods inherited from class javax.faces.model.DataModel
addDataModelListener, getDataModelListeners, removeDataModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChildPropertyTreeModel

public ChildPropertyTreeModel(java.lang.Object instance,
                              java.lang.String childProperty)
                       throws java.beans.IntrospectionException
Creates a TreeModel

Parameters:
instance - This instance is first converted into a CollectionModel.
childProperty - This property will be used to get at the child Lists from each rowData returned by getRowData()
Throws:
java.beans.IntrospectionException

ChildPropertyTreeModel

public ChildPropertyTreeModel(CollectionModel model,
                              java.lang.String childProperty)
                       throws java.beans.IntrospectionException
Creates a TreeModel from the given CollectionModel

Parameters:
model -
childProperty - This property will be used to get at the child Lists from each rowData returned by getRowData()
Throws:
java.beans.IntrospectionException - if the Objects in the CollectionModel cannot be introspected (eg: if they are not public).
Method Detail

getChildData

protected java.lang.Object getChildData(java.lang.Object parentData)
Gets the child data for a node

Parameters:
parentData - the node to get the child data from
Returns:
the List or array that is the child data. must return null for a leaf node.

createChildModel

protected CollectionModel createChildModel(java.lang.Object childData)
Converts childData into a CollectionModel

Parameters:
childData - the data to convert. This can be a List or array.

getParentData

public java.lang.Object getParentData()
Description copied from class: TreeModel
Gets the rowData of the parent that contains this Collection of children. this is the row identified by the path. This may be null if the path is null

Specified by:
getParentData in class TreeModel
Returns:
the parent rowData

getPath

public java.util.List getPath()
Description copied from class: TreeModel
Gets the path that points to the row that is the parentData of this collection

Specified by:
getPath in class TreeModel
Returns:
an immutable List - each element is a rowKey String The first element in the List is the first path element, and so on. This may be null, if this is the root Collection

getRowCount

public int getRowCount()
Specified by:
getRowCount in class javax.faces.model.DataModel

getRowData

public java.lang.Object getRowData()
Specified by:
getRowData in class javax.faces.model.DataModel

getRowIndex

public int getRowIndex()
Specified by:
getRowIndex in class javax.faces.model.DataModel

getWrappedData

public java.lang.Object getWrappedData()
Specified by:
getWrappedData in class javax.faces.model.DataModel
Returns:
(currently, incorrectly returns the wrapped data on the individual DataModels; it should return the instance on this TreeModel.)

isRowContainer

public boolean isRowContainer()
Description copied from class: TreeModel
Tests to see if the row identified by getRowData() has children.

Specified by:
isRowContainer in class TreeModel
Returns:
true if there are children

isRowAvailable

public boolean isRowAvailable()
Specified by:
isRowAvailable in class javax.faces.model.DataModel

popPath

public void popPath()
Description copied from class: TreeModel
Removes the last rowKey from the path. The parentData will change to be the parent of the previous parent (or null, if this Collection is now the root Collection). This Collection will change to include the children of the new parent.

Specified by:
popPath in class TreeModel

pushPath

public void pushPath()
Description copied from class: TreeModel
The row identified by getRowKey() is added to the path and made the new parent. This Collection changes to reflect the children of the new parent.

Specified by:
pushPath in class TreeModel

setPath

public void setPath(java.util.List path)
sets the path. This is the path to the parentData

Specified by:
setPath in class TreeModel
Parameters:
path - each element is a rowKey and is of type String. Use null to clear the path and point this Collection back to the root Collection.

setRowIndex

public void setRowIndex(int rowIndex)
Specified by:
setRowIndex in class javax.faces.model.DataModel

setWrappedData

public void setWrappedData(java.lang.Object data)
Specified by:
setWrappedData in class javax.faces.model.DataModel
Parameters:
data -

sort

public void sort(java.lang.String sortBy,
                 boolean sortOrder)
Description copied from class: CollectionModel
Sort this collection by the given property

Overrides:
sort in class CollectionModel
Parameters:
sortBy - the property to sort on
sortOrder - true for ascending. false for descending

setRowKey

public void setRowKey(java.lang.String key)
Description copied from class: CollectionModel
Finds the row with the matching key and makes it current

Specified by:
setRowKey in class CollectionModel
Parameters:
key - this String cannot contain spaces

isSortable

public boolean isSortable(java.lang.String property)
Description copied from class: CollectionModel
Return true iff this collection is sortable by the given property

Overrides:
isSortable in class CollectionModel

getSortOrder

public boolean getSortOrder()
Description copied from class: CollectionModel
Gets the sort order

Overrides:
getSortOrder in class CollectionModel
Returns:
true if ascending

getSortBy

public java.lang.String getSortBy()
Description copied from class: CollectionModel
Gets the property that this collection is sorted on.

Overrides:
getSortBy in class CollectionModel
Returns:
null, if not sorted

getRowKey

public java.lang.String getRowKey()
Description copied from class: CollectionModel
Gets the row key of the current row

Specified by:
getRowKey in class CollectionModel
Returns:
this String cannot contain spaces


Copyright © 2003-2004 Oracle Corporation. All Rights Reserved.