T - the bean typepublic class HierarchicalDataCommunicator<T> extends DataCommunicator<T>
HierarchicalDataProvider and sending it to client side.DataCommunicator.ActiveDataHandler, DataCommunicator.SimpleDataRequestRpcClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListenerreset| Constructor and Description |
|---|
HierarchicalDataCommunicator()
Construct a new hierarchical data communicator backed by a
TreeDataProvider. |
| Modifier and Type | Method and Description |
|---|---|
void |
collapse(T item)
Collapses given item, removing all its subtrees.
|
void |
doCollapse(T item,
Optional<Integer> index)
Collapses given item, removing all its subtrees.
|
void |
doExpand(T item,
Optional<Integer> index)
Expands the given item at given index.
|
void |
expand(T item)
Expands the given item.
|
protected List<T> |
fetchItemsWithRange(int offset,
int limit)
Fetches a list of items from the DataProvider.
|
HierarchicalDataProvider<T,?> |
getDataProvider()
Gets the current data provider from this DataCommunicator.
|
protected int |
getDataProviderSize()
Getter method for finding the size of DataProvider.
|
ItemCollapseAllowedProvider<T> |
getItemCollapseAllowedProvider()
Gets the item collapse allowed provider.
|
Integer |
getParentIndex(T item)
Returns parent index for the row or
null. |
protected HierarchicalDataCommunicatorState |
getState()
Returns the shared state for this connector.
|
protected HierarchicalDataCommunicatorState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
boolean |
hasChildren(T item)
Returns whether given item has children.
|
boolean |
isExpanded(T item)
Returns whether given item is expanded.
|
void |
setBackEndSorting(List<QuerySortOrder> sortOrder)
Sets the
QuerySortOrders to use with backend sorting. |
<F> SerializableConsumer<F> |
setDataProvider(DataProvider<T,F> dataProvider,
F initialFilter)
Set the current hierarchical data provider for this communicator.
|
<F> SerializableConsumer<F> |
setDataProvider(HierarchicalDataProvider<T,F> dataProvider,
F initialFilter)
Set the current hierarchical data provider for this communicator.
|
protected <F> void |
setFilter(F filter)
Sets the filter for this DataCommunicator.
|
void |
setInMemorySorting(Comparator<T> comparator)
Sets the
Comparator to use with in-memory sorting. |
void |
setItemCollapseAllowedProvider(ItemCollapseAllowedProvider<T> provider)
Sets the item collapse allowed provider for this
HierarchicalDataCommunicator.
|
addDataGenerator, attach, beforeClientResponse, createKeyMapper, createRpc, detach, dropAllData, getActiveDataHandler, getBackEndSorting, getClientRpc, getDataObject, getFilter, getInMemorySorting, getKeyMapper, getMinPushSize, getPushRows, getUpdatedData, onDropRows, onRequestRows, pushData, refresh, removeDataGenerator, reset, sendDataToClient, setDataProvider, setMinPushSize, setPushRowsextend, getParent, getSupportedParentType, remove, setParentaddAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isConnectorEnabled, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstateclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitaddAttachListener, addDetachListener, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlergetConnectorIdpublic HierarchicalDataCommunicator()
TreeDataProvider.protected HierarchicalDataCommunicatorState getState()
AbstractClientConnector
As a side effect, marks the connector dirty so any changes done to the
state will be sent to the client. Use getState(false) to avoid
marking the connector as dirty.
getState in class DataCommunicator<T>protected HierarchicalDataCommunicatorState getState(boolean markAsDirty)
AbstractClientConnectorgetState in class DataCommunicator<T>markAsDirty - true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()protected List<T> fetchItemsWithRange(int offset, int limit)
DataCommunicatorfetchItemsWithRange in class DataCommunicator<T>offset - the starting index of the rangelimit - the max number of resultspublic HierarchicalDataProvider<T,?> getDataProvider()
DataCommunicatorgetDataProvider in class DataCommunicator<T>public <F> SerializableConsumer<F> setDataProvider(HierarchicalDataProvider<T,F> dataProvider, F initialFilter)
F - the filter typedataProvider - the data provider to set, not nullinitialFilter - the initial filter value to use, or null to not
use any initial filter valuepublic <F> SerializableConsumer<F> setDataProvider(DataProvider<T,F> dataProvider, F initialFilter)
setDataProvider in class DataCommunicator<T>F - the filter typedataProvider - the data provider to set, must extend
HierarchicalDataProvider, not nullinitialFilter - the initial filter value to use, or null to not
use any initial filter valuepublic void collapse(T item)
item - the item to collapsepublic void doCollapse(T item, Optional<Integer> index)
item - the item to collapseindex - the index of the itemcollapse(Object)public void expand(T item)
item - the item to expandpublic void doExpand(T item, Optional<Integer> index)
item - the item to expandindex - the index of the itemexpand(Object)public boolean hasChildren(T item)
item - the item to testtrue if item has children; false if notpublic boolean isExpanded(T item)
item - the item to testtrue if item is expanded; false if notpublic void setItemCollapseAllowedProvider(ItemCollapseAllowedProvider<T> provider)
true for
any item that the user can collapse.
Note: This callback will be accessed often when sending data to the client. The callback should not do any costly operations.
provider - the item collapse allowed provider, not nullpublic Integer getParentIndex(T item)
null.item - the item to find the parent ofnull for top-level itemspublic ItemCollapseAllowedProvider<T> getItemCollapseAllowedProvider()
protected int getDataProviderSize()
DataCommunicatorgetDataProviderSize in class DataCommunicator<T>public void setBackEndSorting(List<QuerySortOrder> sortOrder)
DataCommunicatorQuerySortOrders to use with backend sorting.setBackEndSorting in class DataCommunicator<T>sortOrder - list of sort order information to pass to a querypublic void setInMemorySorting(Comparator<T> comparator)
DataCommunicatorComparator to use with in-memory sorting.setInMemorySorting in class DataCommunicator<T>comparator - comparator used to sort dataprotected <F> void setFilter(F filter)
DataCommunicatorDataCommunicator.setDataProvider(com.vaadin.data.provider.DataProvider<T, F>, F) and should not
be called elsewhere.setFilter in class DataCommunicator<T>F - the filter typefilter - the filterCopyright © 2017 Vaadin Ltd. All rights reserved.