Class LazyNodeTreeContentProvider
- All Implemented Interfaces:
IPageFlowScopeAdapter
,IAddressableTableContentProvider
,IContentProvider
,IFilterableTableContentProvider
,IRefreshable
,IRefreshableContentProvider
,ISelectableTableContentProvider
,ISortableTableContentProvider
,ITableContentProvider
,ISelectableTreeContentProvider
,ITreeContentProvider
- Direct Known Subclasses:
FilterableListTreeContentProvider
INode
roots,
optimized for asynchronous usage.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
Iterates over the tree in breadth-first order, returningINode
s.protected class
Iterates over the tree in depth-first order, returningINode
s.protected static class
Compares two nodes using column sorting info.protected static class
Filter value decorator for wrapped nodes, using a binding expression to calculate the value.protected static class
Iterates over a list ofINode
s, returning each node's id.protected class
Iterates over the tree in reverse-depth-first order, returningINode
s. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
Current total nodes, or -1 if total unknown.protected INode
Current node.protected String
Filter expression; null by default (indicating no filter).protected boolean
True if this table can filter rows; false by default.protected ValueExpression
Value binding used to calculate row filter value.protected int
Current index in depth-first order, or -1 if index unknown.List ofINode
roots.protected SelectableTreeContentProviderHelper
protected ISortInfo
Current sort info.protected TreeContentProviderHelper
protected String
Row variable.protected static final ISortInfo
Fields inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
fExpireWithPageFlow
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected INode
findNodeById
(String id) Returns node with specified id or null.String
ids of child rows, in order.getChildren
(INode parent) List children for given parent node id.Current node or null.Returns wrapped current row object.int
getDepth()
Depth of current row.Filter expression.boolean
True if current row has children.boolean[]
ITreeContentProvider.isLastChild()
value of ancestors to the current row, from the root to the current row's parent.boolean
Returnstrue
whenIRefreshable.isAutoRefresh()
is on and the result properties need to be refreshed from the data source by executingIRefreshable.refresh()
method.Collection ofString
ids of open rows.Id of parent row.Object[]
Returns list of properties supported by this content provider.String
ids of root rows, in order.getRoots()
List ofINode
roots or null.int
Walks tree to determine row count.Deprecated.Value-binding which calculates the value to filter for the current row.getRowId()
Returns unique identifier for the current row.int
Walks tree to determine row index.int
Returns number of selected rows.Returns collection ofString
ids of the selected rows.Returns collection ofString
ids of the un-selected rows (all other rows are selected implicitly) May be empty or contain non-existent ids; never null, never contains null.Returns row variable name.getSiblings
(INode current) Lists the siblingINode
s of the current node.getSort()
Returns current sort info.Class<?>
Returns java type of the given propertyCollection ofString
ids of un-open rows (all other rows are open implicitly).boolean
True if it's more effecient to use the un-open model (ITreeContentProvider.getUnopenIds()
) rather than the open model (ITreeContentProvider.getOpenIds()
).boolean
Returns true if it's more effecient to use unselected model (ieISelectableTableContentProvider.getRowUnselectedIds()
rather thanISelectableTableContentProvider.getRowSelectedIds()
).Returns value of the given propertyboolean
hasProperty
(Object propertyKey) Checks if the given property is supported by this content providerboolean
Checks if this content provider truly is addressable.boolean
Returnstrue
if the provider is currenlty in auto-refresh modeboolean
True if this provider truely is filterable.boolean
True if current row is first child of parent (not whether or not current row is first row in tree).boolean
True if current row is last child of parent (not whether or not current row is last row in tree).boolean
isOpen()
True if current row is open.boolean
isReadOnly
(Object propertyKey) boolean
Return a flag indicating whether there is rowData available at the current rowIndex.boolean
True if row selection state is mixed.boolean
Returnstrue
if current row is selected.boolean
True if ancestors of current row are all open.void
openTreeNodes
(int depth) setOpenToDepth() optimizationvoid
refresh()
(Re)loads data from the data source.void
setAutoRefresh
(boolean autorefresh) Sets auto refresh mode on.void
setCurrent
(INode current) Current node or null.void
Filter expression.void
setFilterable
(boolean filterable) True if this provider truely is filterable.void
setNeedRefresh
(boolean needRefresh) Tells the provider that the input parameters have changed and the output results need to be refreshed the next time any output property is requested viaIContentProvider.getValue(Object)
.void
setOpen
(boolean open) True if current row is open.void
setOpenIds
(Collection<String> ids) Collection ofString
ids of open rows.void
setOpenToDepth
(int depth) Sets tree open to the specified depth.void
List ofINode
roots or null.void
setRowById
(String id) Selects current row by its id.void
setRowFilterValueBinding
(ValueBinding binding) Deprecated.usesetRowFilterValueExpression(ValueExpression)
insteadvoid
setRowFilterValueBindingAsString
(String binding) Deprecated.usesetRowFilterValueExpressionAsString(String)
insteadvoid
Value-binding which calculates the value to filter for the current row.void
Value-binding (in string form) which calculates the value to filter for the current row.void
setRowIndex
(int rowIndex) Walks tree to set row index.void
setRowSelected
(boolean selected) Sets the selection status for the current row.void
Sets new selection using a collection ofString
ids of the rows to select.void
Unselects rows using a collection ofString
ids of the un-selected rows (all other rows are selected implicitly).void
setRowVariable
(String var) Sets row variable name to use for accessing row specific data.void
Sets new sort info, re-sorting the table (if necessary).void
setUnopenIds
(Collection<String> ids) Collection ofString
ids of un-open rows (all other rows are open implicitly).void
boolean
Returns true if this content provider supports auto refresh feature.toString()
Returns string representation of content.Methods inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
getExpireWithPageFlow, setExpireWithPageFlow
-
Field Details
-
NO_SORT
-
m_selectableHelper
-
m_treeHelper
-
m_roots
List ofINode
roots. -
m_current
Current node. -
m_index
protected int m_indexCurrent index in depth-first order, or -1 if index unknown. -
m_count
protected int m_countCurrent total nodes, or -1 if total unknown. -
m_var
Row variable. -
m_sort
Current sort info. -
m_sortedChildren
-
m_nodes
-
m_filterable
protected boolean m_filterableTrue if this table can filter rows; false by default. -
m_filter
Filter expression; null by default (indicating no filter). -
m_filterValue
Value binding used to calculate row filter value. -
m_filteredChildren
-
-
Constructor Details
-
LazyNodeTreeContentProvider
public LazyNodeTreeContentProvider()New tree provider. List ofINode
roots must be set viasetRoots(java.util.List<? extends com.webmethods.caf.faces.data.tree.INode>)
. -
LazyNodeTreeContentProvider
New tree provider backed by singleINode
root.- Parameters:
root
- SingleINode
root.
-
LazyNodeTreeContentProvider
New tree provider backed by a list ofINode
roots.- Parameters:
list
- List ofINode
roots.
-
-
Method Details
-
toString
Description copied from interface:IContentProvider
Returns string representation of content.- Specified by:
toString
in interfaceIContentProvider
- Overrides:
toString
in classObject
- Returns:
String
representation of the wrapped content
-
getPropertyKeys
Description copied from interface:IContentProvider
Returns list of properties supported by this content provider. Can returnObject[0]
, never null.- Specified by:
getPropertyKeys
in interfaceIContentProvider
- Returns:
- array of property keys which is typically of type
String
orInteger
-
getType
Description copied from interface:IContentProvider
Returns java type of the given property- Specified by:
getType
in interfaceIContentProvider
- Parameters:
propertyKey
- the property key of typeString
orInteger
- Returns:
- property java
Class
- Throws:
PropertyNotFoundException
- if property is not supported
-
getValue
Description copied from interface:IContentProvider
Returns value of the given property- Specified by:
getValue
in interfaceIContentProvider
- Parameters:
propertyKey
- the property key of typeString
orInteger
- Returns:
- value of the property, can be
null
- Throws:
PropertyNotFoundException
- if property is not supportedELException
-
hasProperty
Description copied from interface:IContentProvider
Checks if the given property is supported by this content provider- Specified by:
hasProperty
in interfaceIContentProvider
- Parameters:
propertyKey
- property key of typeString
orInteger
- Returns:
true
if property is supported
-
isReadOnly
- Throws:
ELException
PropertyNotFoundException
-
setValue
public void setValue(Object propertyKey, Object value) throws ELException, PropertyNotFoundException - Throws:
ELException
PropertyNotFoundException
-
refresh
public void refresh()Description copied from interface:IRefreshable
(Re)loads data from the data source. Implementation specific meaning can be executing a SQL query or a web service call. All current data will be lost and updated with the new results if successful.- Specified by:
refresh
in interfaceIRefreshable
-
supportsAutoRefresh
public boolean supportsAutoRefresh()Description copied from interface:IRefreshable
Returns true if this content provider supports auto refresh feature.- Specified by:
supportsAutoRefresh
in interfaceIRefreshable
- Returns:
- always return false.
- See Also:
-
setAutoRefresh
Description copied from interface:IRefreshable
Sets auto refresh mode on. When auto refresh mode is on, the provider calls
IRefreshable.getNeedRefresh()
to determine whether the refresh needs to be done before returning any result properties. If it returnstrue
, the provider callsIRefreshable.refresh()
method to updated the result properties.- Specified by:
setAutoRefresh
in interfaceIRefreshable
- Parameters:
autorefresh
- true to turn it on- Throws:
ContentProviderException
- if autorefresh is true because this class doesn't support auto refresh.- See Also:
-
isAutoRefresh
public boolean isAutoRefresh()Description copied from interface:IRefreshable
Returnstrue
if the provider is currenlty in auto-refresh mode- Specified by:
isAutoRefresh
in interfaceIRefreshable
- Returns:
- always return false.
-
getNeedRefresh
public boolean getNeedRefresh()Description copied from interface:IRefreshable
Returns
true
whenIRefreshable.isAutoRefresh()
is on and the result properties need to be refreshed from the data source by executingIRefreshable.refresh()
method.Implementations may return an accurate value from this method if they can track the changes to the input parameter properties or they may require the clients to call
IRefreshable.setNeedRefresh(boolean)
explicitely.- Specified by:
getNeedRefresh
in interfaceIRefreshable
- Returns:
- always return false.
-
setNeedRefresh
public void setNeedRefresh(boolean needRefresh) Description copied from interface:IRefreshable
Tells the provider that the input parameters have changed and the output results need to be refreshed the next time any output property is requested viaIContentProvider.getValue(Object)
.- Specified by:
setNeedRefresh
in interfaceIRefreshable
- Parameters:
needRefresh
-true
if the input parameters have changed- Throws:
ContentProviderException
- if needRefresh is true because this class doesn't support auto refresh.
-
isRowAvailable
public boolean isRowAvailable()Description copied from interface:ITableContentProvider
Return a flag indicating whether there is rowData available at the current rowIndex. If no wrappedData is available, return false.- Specified by:
isRowAvailable
in interfaceITableContentProvider
- Returns:
- true if current node is not null.
- See Also:
-
getRowCount
public int getRowCount()Walks tree to determine row count.- Specified by:
getRowCount
in interfaceITableContentProvider
- See Also:
-
getRowIndex
public int getRowIndex()Walks tree to determine row index.- Specified by:
getRowIndex
in interfaceITableContentProvider
- See Also:
-
setRowIndex
public void setRowIndex(int rowIndex) Walks tree to set row index.- Specified by:
setRowIndex
in interfaceITableContentProvider
- See Also:
-
openTreeNodes
public void openTreeNodes(int depth) Description copied from interface:ISelectableTreeContentProvider
setOpenToDepth() optimization- Specified by:
openTreeNodes
in interfaceISelectableTreeContentProvider
-
getRowVariable
Description copied from interface:ITableContentProvider
Returns row variable name.
If specified row variable can be used to access current row data for the provider internal needs, like sorting or addressing.
- Specified by:
getRowVariable
in interfaceITableContentProvider
- Returns:
- row variable name or null if not specified
- See Also:
-
setRowVariable
Description copied from interface:ITableContentProvider
Sets row variable name to use for accessing row specific data. For example, if the provider wrapps an array of a data objects with
id
property and the variable name isitem
, then the provider implementation can accessid
property of each record asitem.id
.This property should set only once at the provider initialization time
- Specified by:
setRowVariable
in interfaceITableContentProvider
-
getCurrentRow
Description copied from interface:ITableContentProvider
Returns wrapped current row object. Can be
null
if not data is available- Specified by:
getCurrentRow
in interfaceITableContentProvider
- Returns:
- current row object
- See Also:
-
isAddressable
public boolean isAddressable()Description copied from interface:IAddressableTableContentProvider
Checks if this content provider truly is addressable.- Specified by:
isAddressable
in interfaceIAddressableTableContentProvider
- Returns:
- always return true.
-
getRowId
Description copied from interface:IAddressableTableContentProvider
Returns unique identifier for the current row. If no current row is avaiable, returns null.- Specified by:
getRowId
in interfaceIAddressableTableContentProvider
- Returns:
- current row id or null
-
setRowById
Description copied from interface:IAddressableTableContentProvider
Selects current row by its id. If id doesn't identify a row, makes no row current (equivalent tosetRowIndex(-1)
).- Specified by:
setRowById
in interfaceIAddressableTableContentProvider
- Parameters:
id
- row id to find and make current
-
isRowSelected
public boolean isRowSelected()Description copied from interface:ISelectableTableContentProvider
Returnstrue
if current row is selected.- Specified by:
isRowSelected
in interfaceISelectableTableContentProvider
- Returns:
- true if current row is selection
-
setRowSelected
public void setRowSelected(boolean selected) Description copied from interface:ISelectableTableContentProvider
Sets the selection status for the current row.- Specified by:
setRowSelected
in interfaceISelectableTableContentProvider
- Parameters:
selected
-true
to select current row;false
to unselect.
-
getRowSelectedCount
public int getRowSelectedCount()Description copied from interface:ISelectableTableContentProvider
Returns number of selected rows.- Specified by:
getRowSelectedCount
in interfaceISelectableTableContentProvider
- Returns:
- number of currently selection rows
-
getRowSelectedIds
Description copied from interface:ISelectableTableContentProvider
Returns collection ofString
ids of the selected rows. May be empty or contain non-existent ids; never null, never contains null.- Specified by:
getRowSelectedIds
in interfaceISelectableTableContentProvider
- Returns:
- collection of ids of selected rows
-
setRowSelectedIds
Description copied from interface:ISelectableTableContentProvider
Sets new selection using a collection ofString
ids of the rows to select. May be empty or contain non-existent ids; never null, never contains null.- Specified by:
setRowSelectedIds
in interfaceISelectableTableContentProvider
- Parameters:
ids
- the collection ofString
row ids
-
getUseUnselectedModel
public boolean getUseUnselectedModel()Description copied from interface:ISelectableTableContentProvider
Returns true if it's more effecient to use unselected model (ieISelectableTableContentProvider.getRowUnselectedIds()
rather thanISelectableTableContentProvider.getRowSelectedIds()
).- Specified by:
getUseUnselectedModel
in interfaceISelectableTableContentProvider
- Returns:
- true if it's more effecient to use unselected model
-
getRowUnselectedIds
Description copied from interface:ISelectableTableContentProvider
Returns collection ofString
ids of the un-selected rows (all other rows are selected implicitly) May be empty or contain non-existent ids; never null, never contains null.- Specified by:
getRowUnselectedIds
in interfaceISelectableTableContentProvider
- Returns:
- collection of ids of the un-selection rows
-
setRowUnselectedIds
Description copied from interface:ISelectableTableContentProvider
Unselects rows using a collection ofString
ids of the un-selected rows (all other rows are selected implicitly). May be empty or contain non-existent ids; never null, never contains null.- Specified by:
setRowUnselectedIds
in interfaceISelectableTableContentProvider
- Parameters:
ids
- collection ofString
row ids
-
isRowMixed
public boolean isRowMixed()Description copied from interface:ISelectableTreeContentProvider
True if row selection state is mixed.- Specified by:
isRowMixed
in interfaceISelectableTreeContentProvider
-
getSort
Description copied from interface:ISortableTableContentProvider
Returns current sort info. Never null.- Specified by:
getSort
in interfaceISortableTableContentProvider
- Returns:
- currenly set sort info
-
setSort
Description copied from interface:ISortableTableContentProvider
Sets new sort info, re-sorting the table (if necessary). This does not change the model's rowIndex property, even though it will probably now point to a different row.- Specified by:
setSort
in interfaceISortableTableContentProvider
- Parameters:
sort
- Sort info, must not be null.
-
getRootIds
Description copied from interface:ITreeContentProvider
String
ids of root rows, in order. Empty iterator (not null) if tree is empty.- Specified by:
getRootIds
in interfaceITreeContentProvider
-
getDepth
public int getDepth()Description copied from interface:ITreeContentProvider
Depth of current row. Zero (0) for root.- Specified by:
getDepth
in interfaceITreeContentProvider
-
getParentId
Description copied from interface:ITreeContentProvider
Id of parent row. Null for root. Parent depth must be exactly one less than current depth.- Specified by:
getParentId
in interfaceITreeContentProvider
-
getChildIds
Description copied from interface:ITreeContentProvider
String
ids of child rows, in order. Empty iterator (not null) if row has no children. Child depth must be exactly one more than current depth.- Specified by:
getChildIds
in interfaceITreeContentProvider
-
getHasChildren
public boolean getHasChildren()Description copied from interface:ITreeContentProvider
True if current row has children.- Specified by:
getHasChildren
in interfaceITreeContentProvider
-
isFirstChild
public boolean isFirstChild()Description copied from interface:ITreeContentProvider
True if current row is first child of parent (not whether or not current row is first row in tree). Also true for first root in tree (child with no parent is a root).- Specified by:
isFirstChild
in interfaceITreeContentProvider
-
isLastChild
public boolean isLastChild()Description copied from interface:ITreeContentProvider
True if current row is last child of parent (not whether or not current row is last row in tree). Also true for last root in tree (child with no parent is a root).- Specified by:
isLastChild
in interfaceITreeContentProvider
-
getLastChildAncestors
public boolean[] getLastChildAncestors()Description copied from interface:ITreeContentProvider
ITreeContentProvider.isLastChild()
value of ancestors to the current row, from the root to the current row's parent. Zero-length array (non-null) for root.- Specified by:
getLastChildAncestors
in interfaceITreeContentProvider
-
isOpen
public boolean isOpen()Description copied from interface:ITreeContentProvider
True if current row is open.- Specified by:
isOpen
in interfaceITreeContentProvider
-
setOpen
public void setOpen(boolean open) Description copied from interface:ITreeContentProvider
True if current row is open.- Specified by:
setOpen
in interfaceITreeContentProvider
-
isVisible
public boolean isVisible()Description copied from interface:ITreeContentProvider
True if ancestors of current row are all open. Root is always visible.- Specified by:
isVisible
in interfaceITreeContentProvider
-
getOpenIds
Description copied from interface:ITreeContentProvider
Collection ofString
ids of open rows. May be empty or contain non-existent ids; never null, never contains null.- Specified by:
getOpenIds
in interfaceITreeContentProvider
-
setOpenIds
Description copied from interface:ITreeContentProvider
Collection ofString
ids of open rows. May be empty or contain non-existent ids; never null, never contains null.- Specified by:
setOpenIds
in interfaceITreeContentProvider
-
getUseUnopenModel
public boolean getUseUnopenModel()Description copied from interface:ITreeContentProvider
True if it's more effecient to use the un-open model (ITreeContentProvider.getUnopenIds()
) rather than the open model (ITreeContentProvider.getOpenIds()
).- Specified by:
getUseUnopenModel
in interfaceITreeContentProvider
-
getUnopenIds
Description copied from interface:ITreeContentProvider
Collection ofString
ids of un-open rows (all other rows are open implicitly). May be empty or contain non-existent ids; never null, never contains null.- Specified by:
getUnopenIds
in interfaceITreeContentProvider
-
setUnopenIds
Description copied from interface:ITreeContentProvider
Collection ofString
ids of un-open rows (all other rows are open implicitly). May be empty or contain non-existent ids; never null, never contains null.- Specified by:
setUnopenIds
in interfaceITreeContentProvider
-
isFilterable
public boolean isFilterable()Description copied from interface:IFilterableTableContentProvider
True if this provider truely is filterable.- Specified by:
isFilterable
in interfaceIFilterableTableContentProvider
-
getFilter
Description copied from interface:IFilterableTableContentProvider
Filter expression. Only rows matched by this filter should be exposed. Null or empty ("") signals expose the default set of rows.- Specified by:
getFilter
in interfaceIFilterableTableContentProvider
-
setFilter
Description copied from interface:IFilterableTableContentProvider
Filter expression. Only rows matched by this filter should be exposed. Null or empty ("") signals expose the default set of rows.- Specified by:
setFilter
in interfaceIFilterableTableContentProvider
-
setOpenToDepth
public void setOpenToDepth(int depth) Sets tree open to the specified depth.- Parameters:
depth
- Depth to which to open. 0 = none, 1 = roots, 2 = roots + children of roots, etc.
-
getRoots
List ofINode
roots or null. -
setRoots
List ofINode
roots or null. -
getCurrent
Current node or null. -
setCurrent
Current node or null. -
setFilterable
public void setFilterable(boolean filterable) True if this provider truely is filterable. -
getRowFilterValueBinding
Deprecated.usegetRowFilterValueExpression()
insteadValue-binding which calculates the value to filter for the current row. -
setRowFilterValueBinding
Deprecated.usesetRowFilterValueExpression(ValueExpression)
insteadValue-binding which calculates the value to filter for the current row. -
getRowFilterValueExpression
Value-binding which calculates the value to filter for the current row. -
setRowFilterValueExpression
Value-binding which calculates the value to filter for the current row. -
setRowFilterValueBindingAsString
Deprecated.usesetRowFilterValueExpressionAsString(String)
insteadValue-binding (in string form) which calculates the value to filter for the current row. -
setRowFilterValueExpressionAsString
Value-binding (in string form) which calculates the value to filter for the current row. -
findNodeById
Returns node with specified id or null. -
getChildren
List children for given parent node id. -
getSiblings
Lists the siblingINode
s of the current node.
-
getRowFilterValueExpression()
instead