public class ResultTree extends Tree
Tree
API, used to handle hierarchical
data, whose nodes are DataSource records which are retrieved from a server.config, id, scClassName
Constructor and Description |
---|
ResultTree() |
ResultTree(com.google.gwt.core.client.JavaScriptObject jsObj) |
Modifier and Type | Method and Description |
---|---|
Tree |
applyFilter(Tree tree,
Criteria criteria,
TreeFilterMode filterMode,
DataSource dataSource)
The ResultTree will call applyFilter() when it needs to locally filter the tree using the current filter criteria.
|
Tree |
applyFilter(Tree tree,
Criteria criteria,
TreeFilterMode filterMode,
DataSource dataSource,
DSRequest requestProperties)
The ResultTree will call applyFilter() when it needs to locally filter the tree using the current filter criteria.
|
int |
compareCriteria(Criteria newCriteria,
Criteria oldCriteria)
Default behavior is to call
DataSource.compareCriteria to
determine whether new criteria is equivalent to the old criteria (returns 0) or not. |
int |
compareCriteria(Criteria newCriteria,
Criteria oldCriteria,
DSRequest requestProperties)
Default behavior is to call
DataSource.compareCriteria to
determine whether new criteria is equivalent to the old criteria (returns 0) or not. |
com.google.gwt.core.client.JavaScriptObject |
create() |
void |
dataArrived(TreeNode parentNode)
This callback fires whenever the resultTree receives new nodes from the server, after the new nodes have been integrated
into the tree.
|
PreserveOpenState |
getAutoPreserveOpenState()
Controls what happens to the
"open state" - the set of
nodes opened or closed by the end user after tree data is loaded - when an entirely new tree of nodes is loaded from the
server, as a consequence of calling ResultTree.invalidateCache or of changing criteria such that the current cache of nodes is dropped. |
DataSource |
getDataSource()
What
DataSource is this resultTree associated with? |
java.lang.Boolean |
getDefaultIsFolder()
Controls whether nodes are assumed to be folders or leaves by default.
|
java.lang.Boolean |
getDefaultNewNodesToRoot()
This attribute governs how to handle cache-synch when a new node is added to this dataSource with no explicit parentId.
|
java.lang.Boolean |
getDisableCacheSync()
By default when the data of this ResultTree's dataSource is modified, the ResultTree will be updated to display these
changes.
|
java.lang.Boolean |
getDiscardParentlessNodes()
When data is loaded from the server, should nodes with an explicit value for the
parentIdField which doesn't map to a valid parent node be
dropped? If set to false, for loadDataOnDemand :false trees, parentless nodes will be added as children of the root node - for loadDataOnDemand :true, they will be added as children of
the folder currently requesting children. |
FetchMode |
getFetchMode()
Mode of fetching records from server.
|
java.lang.Boolean |
getKeepParentsOnFilter()
If set, tree-based filtering is performed such that parent nodes are kept as long as they have children that match the
filter criteria, even if the parents themselves do not match the filter criteria.
|
java.lang.Boolean |
getLoadDataOnDemand()
Does this resultTree load data incrementally as folders within the tree are opened, or is it all loaded in a single
request?
|
java.lang.String |
getOpenState()
Returns a snapshot of the current open state of this tree's data as a TreeGridOpenState object.
|
static ResultTree |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
com.google.gwt.core.client.JavaScriptObject |
getRootNode()
This attribute may be used to specify a root value for the parentIdField of this resultTree.
|
java.lang.String[] |
getServerFilterFields()
When
keepParentsOnFilter is enabled, this
property lists field names that will be sent to the server if they are present in criteria. |
java.lang.Boolean |
getUpdateCacheFromRequest()
When a successful Add, Update or Remove type operation fires on this ResultTree's dataSource, if
data is unset, should we integrate the submitted data values (from the
request) into our data-set? |
void |
invalidateCache()
Manually invalidate this ResultTree's cache.
|
void |
setAutoPreserveOpenState(PreserveOpenState autoPreserveOpenState)
Controls what happens to the
"open state" - the set of
nodes opened or closed by the end user after tree data is loaded - when an entirely new tree of nodes is loaded from the
server, as a consequence of calling ResultTree.invalidateCache or of changing criteria such that the current cache of nodes is dropped. |
void |
setCriteria(Criteria newCriteria)
Set the filter criteria to use when fetching rows.
|
void |
setDataSource(DataSource dataSource)
What
DataSource is this resultTree associated with? |
void |
setDefaultIsFolder(java.lang.Boolean defaultIsFolder)
Controls whether nodes are assumed to be folders or leaves by default.
|
void |
setDefaultNewNodesToRoot(java.lang.Boolean defaultNewNodesToRoot)
This attribute governs how to handle cache-synch when a new node is added to this dataSource with no explicit parentId.
|
void |
setDisableCacheSync(java.lang.Boolean disableCacheSync)
By default when the data of this ResultTree's dataSource is modified, the ResultTree will be updated to display these
changes.
|
void |
setDiscardParentlessNodes(java.lang.Boolean discardParentlessNodes)
When data is loaded from the server, should nodes with an explicit value for the
parentIdField which doesn't map to a valid parent node be
dropped? If set to false, for loadDataOnDemand :false trees, parentless nodes will be added as children of the root node - for loadDataOnDemand :true, they will be added as children of
the folder currently requesting children. |
void |
setFetchMode(FetchMode fetchMode)
Mode of fetching records from server.
|
void |
setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj) |
void |
setKeepParentsOnFilter(java.lang.Boolean keepParentsOnFilter)
If set, tree-based filtering is performed such that parent nodes are kept as long as they have children that match the
filter criteria, even if the parents themselves do not match the filter criteria.
|
void |
setLoadDataOnDemand(java.lang.Boolean loadDataOnDemand)
Does this resultTree load data incrementally as folders within the tree are opened, or is it all loaded in a single
request?
|
void |
setOpenState(java.lang.String openState)
Reset the set of open folders within this tree's data to match the TreeGridOpenState object passed in.
|
void |
setRootNode(com.google.gwt.core.client.JavaScriptObject rootNode)
This attribute may be used to specify a root value for the parentIdField of this resultTree.
|
void |
setServerFilterFields(java.lang.String... serverFilterFields)
When
keepParentsOnFilter is enabled, this
property lists field names that will be sent to the server if they are present in criteria. |
void |
setUpdateCacheFromRequest(java.lang.Boolean updateCacheFromRequest)
When a successful Add, Update or Remove type operation fires on this ResultTree's dataSource, if
data is unset, should we integrate the submitted data values (from the
request) into our data-set? |
void |
unloadChildren(TreeNode node)
Unload the children of a folder, returning the folder to the "unloaded" state.
|
java.lang.Boolean |
willFetchData(Criteria newCriteria)
Will changing the criteria for this resultTree require fetching new data from the server or can the new criteria be
satisfied from data already cached on the client?
|
add, add, add, add, addDataChangedHandler, addList, addList, addList, addList, closeAll, closeAll, closeFolder, closeFolders, find, find, findById, getAllNodes, getAllNodes, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsString, getAutoOpenRoot, getChildren, getChildrenProperty, getData, getDefaultNodeTitle, getDescendantFolders, getDescendantFolders, getDescendantLeaves, getDescendantLeaves, getDescendants, getDescendants, getFilteredTree, getFilteredTree, getFolders, getIdField, getIsFolderProperty, getLeaves, getLength, getLevel, getLoadState, getModelType, getName, getNameProperty, getOpenList, getOpenProperty, getParent, getParentIdField, getParentPath, getParents, getPath, getPathDelim, getReportCollisions, getRoot, getRootValue, getSeparateFolders, getShowRoot, getSortFoldersBeforeLeaves, getTitle, getTitleProperty, hasChildren, hasFolders, hasLeaves, isDescendantOf, isFolder, isLeaf, isLoaded, isOpen, isRoot, linkNodes, loadChildren, loadChildren, move, move, nodeForRecord, openAll, openAll, openFolder, openFolders, reloadChildren, remove, removeList, setAutoOpenRoot, setChildrenProperty, setData, setDefaultNodeTitle, setIdField, setIsFolderProperty, setModelType, setNameProperty, setOpenProperty, setParentIdField, setPathDelim, setProperty, setProperty, setProperty, setProperty, setReportCollisions, setRoot, setRootValue, setRootValue, setSeparateFolders, setShowRoot, setSortFoldersBeforeLeaves, setTitleProperty
asSGWTComponent, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttributeAsMap, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getID, getJsObj, getOrCreateJsObj, getRef, getScClassName, internalSetID, internalSetID, isCreated, onBind, onInit, registerID, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setID, setScClassName
public ResultTree()
public ResultTree(com.google.gwt.core.client.JavaScriptObject jsObj)
public static ResultTree getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public void setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj)
setJavaScriptObject
in class Tree
public void setAutoPreserveOpenState(PreserveOpenState autoPreserveOpenState)
"open state"
- the set of
nodes opened or closed by the end user after tree data is loaded - when an entirely new tree of nodes is loaded from the
server, as a consequence of calling ResultTree.invalidateCache
or of changing criteria such that the current cache of nodes is dropped.autoPreserveOpenState
- autoPreserveOpenState Default value is "whenUnique"public PreserveOpenState getAutoPreserveOpenState()
"open state"
- the set of
nodes opened or closed by the end user after tree data is loaded - when an entirely new tree of nodes is loaded from the
server, as a consequence of calling ResultTree.invalidateCache
or of changing criteria such that the current cache of nodes is dropped.public void setDefaultIsFolder(java.lang.Boolean defaultIsFolder) throws java.lang.IllegalStateException
Nodes that have children or have the isFolderProperty
set to true will always be considered
folders. Other nodes will be considered folders or leaves by default according to this setting.
If
defaultIsFolder
is unset, the ResultTree will automatically set it to match the value of loadDataOnDemand
. This means that, when using
folder-by-folder load on demand (loadDataOnDemand:true
), by default a newly loaded node will be considered
to be a folder that has not loaded its children yet.
When not using folder-by-folder load on demand, by default a
newly loaded node is considered a leaf. If you set defaultIsFolder:true
explicitly, by default a newly
loaded node is considered to be a folder with no children.
See Tree.isFolder
for details on how to explicitly mark nodes as folders or
leaves.
setDefaultIsFolder
in class Tree
defaultIsFolder
- defaultIsFolder Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdTreeGrid.setLoadDataOnDemand(java.lang.Boolean)
public java.lang.Boolean getDefaultIsFolder()
Nodes that have children or have the isFolderProperty
set to true will always be considered
folders. Other nodes will be considered folders or leaves by default according to this setting.
If
defaultIsFolder
is unset, the ResultTree will automatically set it to match the value of loadDataOnDemand
. This means that, when using
folder-by-folder load on demand (loadDataOnDemand:true
), by default a newly loaded node will be considered
to be a folder that has not loaded its children yet.
When not using folder-by-folder load on demand, by default a
newly loaded node is considered a leaf. If you set defaultIsFolder:true
explicitly, by default a newly
loaded node is considered to be a folder with no children.
See Tree.isFolder
for details on how to explicitly mark nodes as folders or
leaves.
getDefaultIsFolder
in class Tree
TreeGrid.getLoadDataOnDemand()
public void setDefaultNewNodesToRoot(java.lang.Boolean defaultNewNodesToRoot)
If set to true
, when a new node is added to this dataSource via DataSource.addData
, with no explicit parentId, the node will be added as a
child of the root node of this result tree. Otherwise it will be ignored.
Similar logic applies to updated nodes
- if this property is true and the parentId of an updated
node is cleared, it will be moved to become a child of root, otherwise it will be dropped from the tree.
Note : This is an advanced setting
defaultNewNodesToRoot
- defaultNewNodesToRoot Default value is falsepublic java.lang.Boolean getDefaultNewNodesToRoot()
If set to true
, when a new node is added to this dataSource via DataSource.addData
, with no explicit parentId, the node will be added as a
child of the root node of this result tree. Otherwise it will be ignored.
Similar logic applies to updated nodes
- if this property is true and the parentId of an updated
node is cleared, it will be moved to become a child of root, otherwise it will be dropped from the tree.
public void setDisableCacheSync(java.lang.Boolean disableCacheSync) throws java.lang.IllegalStateException
Note : This is an advanced setting
disableCacheSync
- disableCacheSync Default value is falsejava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getDisableCacheSync()
public void setDiscardParentlessNodes(java.lang.Boolean discardParentlessNodes) throws java.lang.IllegalStateException
parentIdField
which doesn't map to a valid parent node be
dropped? If set to false, for loadDataOnDemand
:false trees, parentless nodes will be added as children of the root node - for loadDataOnDemand
:true, they will be added as children of
the folder currently requesting children. This effectively allows nodes to be loaded into the current (or root)
folder without needing an explicit parentIdField value
that matches the folder's ID or rootValue
for the resultTree.
Note: For
loadDataOnDemand:false
trees, if this property is unset at init time, it will default to true
if an explicit rootNode
has been specified. This ensures
that if the data tree retrieved from the server includes ancestors of the desired root-node we don't display them.
Otherwise this property always defaults to false.
Note : This is an advanced setting
setDiscardParentlessNodes
in class Tree
discardParentlessNodes
- discardParentlessNodes Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getDiscardParentlessNodes()
parentIdField
which doesn't map to a valid parent node be
dropped? If set to false, for loadDataOnDemand
:false trees, parentless nodes will be added as children of the root node - for loadDataOnDemand
:true, they will be added as children of
the folder currently requesting children. This effectively allows nodes to be loaded into the current (or root)
folder without needing an explicit parentIdField value
that matches the folder's ID or rootValue
for the resultTree.
Note: For
loadDataOnDemand:false
trees, if this property is unset at init time, it will default to true
if an explicit rootNode
has been specified. This ensures
that if the data tree retrieved from the server includes ancestors of the desired root-node we don't display them.
Otherwise this property always defaults to false.
getDiscardParentlessNodes
in class Tree
public void setFetchMode(FetchMode fetchMode) throws java.lang.IllegalStateException
In a ResultTree, "basic" fetchMode implies that if search criteria change, the
entire tree will be discarded and re-fetched from the server. ResultTree.getOpenState
will be preserved.
fetchMode:"local" implies that local filtering will be performed. See keepParentsOnFilter
for additional filtering
details.
fetchMode:"paged" does not apply to ResultTrees. Instead, loadDataOnDemand
is used for folder-by-folder loading
of tree data. If enough nodes exist that paging is desirable within a folder, a better UI can be obtained by showing an
adjacent ListGrid (similar to Outlook email) to show a large number of child nodes.
fetchMode
- fetchMode Default value is "basic"java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic FetchMode getFetchMode()
In a ResultTree, "basic" fetchMode implies that if search criteria change, the
entire tree will be discarded and re-fetched from the server. ResultTree.getOpenState
will be preserved.
fetchMode:"local" implies that local filtering will be performed. See keepParentsOnFilter
for additional filtering
details.
fetchMode:"paged" does not apply to ResultTrees. Instead, loadDataOnDemand
is used for folder-by-folder loading
of tree data. If enough nodes exist that paging is desirable within a folder, a better UI can be obtained by showing an
adjacent ListGrid (similar to Outlook email) to show a large number of child nodes.
public void setKeepParentsOnFilter(java.lang.Boolean keepParentsOnFilter) throws java.lang.IllegalStateException
When enabled, fetchMode:"local" is
automatically enabled so that all filtering behavior shifts to the client-side and full criteria are no longer sent to
the server. Instead, server fetches will always load all nodes, or with loadDataOnDemand
:true, will always load all nodes under
a given parent. This means that the server does not need to implement special tree filtering logic.
Optionally,
serverFilterFields
can be set to a list of
field names that will be sent to the server whenever they are present in the criteria.
keepParentsOnFilter
- keepParentsOnFilter Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getKeepParentsOnFilter()
When enabled, fetchMode:"local" is
automatically enabled so that all filtering behavior shifts to the client-side and full criteria are no longer sent to
the server. Instead, server fetches will always load all nodes, or with loadDataOnDemand
:true, will always load all nodes under
a given parent. This means that the server does not need to implement special tree filtering logic.
Optionally,
serverFilterFields
can be set to a list of
field names that will be sent to the server whenever they are present in the criteria.
public void setLoadDataOnDemand(java.lang.Boolean loadDataOnDemand) throws java.lang.IllegalStateException
loadDataOnDemand
- loadDataOnDemand Default value is truejava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdTreeGrid.setLoadDataOnDemand(java.lang.Boolean)
public java.lang.Boolean getLoadDataOnDemand()
TreeGrid.getLoadDataOnDemand()
public void setServerFilterFields(java.lang.String... serverFilterFields) throws java.lang.IllegalStateException
keepParentsOnFilter
is enabled, this
property lists field names that will be sent to the server if they are present in criteria.serverFilterFields
- . See String
. Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.String[] getServerFilterFields()
keepParentsOnFilter
is enabled, this
property lists field names that will be sent to the server if they are present in criteria.String
public void setUpdateCacheFromRequest(java.lang.Boolean updateCacheFromRequest) throws java.lang.IllegalStateException
data
is unset, should we integrate the submitted data values (from the
request) into our data-set?
Note : This is an advanced setting
updateCacheFromRequest
- updateCacheFromRequest Default value is truejava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getUpdateCacheFromRequest()
data
is unset, should we integrate the submitted data values (from the
request) into our data-set?public Tree applyFilter(Tree tree, Criteria criteria, TreeFilterMode filterMode, DataSource dataSource)
Default behavior is to call Tree.getFilteredTree
to obtain
a new, filtered tree.
Override this method or Tree.getFilteredTree
to implement your own client-side filtering behavior. Note that the original tree should not be
affected.
tree
- the source tree to be filteredcriteria
- the filter criteriafilterMode
- mode to use for filteringdataSource
- dataSource for filtering if the Tree does not already have onepublic Tree applyFilter(Tree tree, Criteria criteria, TreeFilterMode filterMode, DataSource dataSource, DSRequest requestProperties)
Default behavior is to call Tree.getFilteredTree
to obtain
a new, filtered tree.
Override this method or Tree.getFilteredTree
to implement your own client-side filtering behavior. Note that the original tree should not be
affected.
tree
- the source tree to be filteredcriteria
- the filter criteriafilterMode
- mode to use for filteringdataSource
- dataSource for filtering if the Tree does not already have onerequestProperties
- Request properties block. This allows developers to specify properties that would impact the filter such as textMatchStyle
public int compareCriteria(Criteria newCriteria, Criteria oldCriteria)
DataSource.compareCriteria
to
determine whether new criteria is equivalent to the old criteria (returns 0) or not. See DataSource.compareCriteria
for a full explanation of the default
behavior. The CriteriaPolicy
used is "dropOnChange".
Override this method or
DataSource.compareCriteria
to implement your own client-side
filtering behavior.
newCriteria
- new filter criteriaoldCriteria
- old filter criteriaCriteriaPolicy
public int compareCriteria(Criteria newCriteria, Criteria oldCriteria, DSRequest requestProperties)
DataSource.compareCriteria
to
determine whether new criteria is equivalent to the old criteria (returns 0) or not. See DataSource.compareCriteria
for a full explanation of the default
behavior. The CriteriaPolicy
used is "dropOnChange".
Override this method or
DataSource.compareCriteria
to implement your own client-side
filtering behavior.
newCriteria
- new filter criteriaoldCriteria
- old filter criteriarequestProperties
- dataSource request propertiesCriteriaPolicy
public void dataArrived(TreeNode parentNode)
parentNode
- The parentNode for which children were just loadedpublic java.lang.String getOpenState()
This object can be
passed to ResultTree.setOpenState
or TreeGrid.setOpenState
to open the same set of folders within the
tree's data (assuming the nodes are still present in the data).
setOpenState(java.lang.String)
public void invalidateCache()
Generally a ResultTree will observe and incorporate updates to the
DataSource that provides it's records, but when this is not possible, invalidateCache()
allows manual cache
invalidation.
Components bound to this ResultTree will typically re-request the currently visible portion of the dataset, causing the ResultTree to re-fetch data from the server.
public void setCriteria(Criteria newCriteria)
Depending on the result of ResultTree.compareCriteria
and setting for fetchMode
, setting criteria may cause a trip to the server to
get a new set of nodes, or may simply cause already-fetched nodes to be re-filtered according to the new criteria.
For a basic overview on when server fetches are generally performed, see fetchMode
. However, this is not the final determination of
when server fetches occur. Criteria can be split into local criteria and server criteria by specifying serverFilterFields
. Thus, even when using
fetchMode:"local" a new server fetch will occur if the server criteria changes. For details on how the criteria is
split, see DataSource.splitCriteria
.
Note: if criteria is
being split to retrieve server criteria portion and the criteria is an AdvancedCriteria
, the criteria must consist of a single "and" operator and one or more simple
criteria below it. No other logical operators may be used. In other words, the AdvancedCriteria
provided must be exactly representable by a simple criteria.
newCriteria
- the filter criteriapublic void setOpenState(java.lang.String openState)
Used to
restore previous state retrieved from the tree by a call to ResultTree.getOpenState
.
openState
- Object describing the desired set of open folders.. See TreeGridOpenState
getOpenState()
public void unloadChildren(TreeNode node)
unloadChildren
in class Tree
node
- folder in questionpublic java.lang.Boolean willFetchData(Criteria newCriteria)
This method can be used to determine whether TreeGrid.fetchData
or TreeGrid.filterData
will cause a server side fetch when passed a
certain set of criteria.
newCriteria
- new criteria to test.public void setDataSource(DataSource dataSource) throws java.lang.IllegalStateException
DataSource
is this resultTree associated with?dataSource
- dataSource Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdDatabinding overview and related methods
,
DataSource fields Examplepublic DataSource getDataSource()
DataSource
is this resultTree associated with?Databinding overview and related methods
,
DataSource fields Examplepublic void setRootNode(com.google.gwt.core.client.JavaScriptObject rootNode) throws java.lang.IllegalStateException
rootValue
for this tree, allowing a component to navigate
a tree starting at a specific node. May be overridden via treeRootValue
for ResultTrees generated by a TreeGrid
component.
rootNode
- rootNode Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic com.google.gwt.core.client.JavaScriptObject getRootNode()
rootValue
for this tree, allowing a component to navigate
a tree starting at a specific node. May be overridden via treeRootValue
for ResultTrees generated by a TreeGrid
component.