org.granite.client.tide.collections.javafx
Class PagedQuery<E,F>
java.lang.Object
org.granite.client.tide.collections.AbstractPagedCollection<E>
org.granite.client.tide.collections.javafx.PagedCollection<E>
org.granite.client.tide.collections.javafx.PagedQuery<E,F>
- All Implemented Interfaces:
- Iterable<E>, Collection<E>, List<E>, javafx.beans.Observable, javafx.collections.ObservableList<E>, ContextAware, TideEventObserver, Initializable, NameAware, PropertyHolder, Component
@Named
public class PagedQuery<E,F>
- extends PagedCollection<E>
- implements Component, PropertyHolder, NameAware, ContextAware, Initializable
Implementation of the Tide paged collection with an generic service backend.
By default the corresponding service should have the same name and expose a 'find' method
that returns a Map with the following properties :
resultCount
resultList
firstResult
maxResults
The name of the remote service can be overriden by setting the remoteComponentName property.
The name of the remote method can by set by the remoteMethodName property.
- Author:
- William DRAI
| Methods inherited from class org.granite.client.tide.collections.javafx.PagedCollection |
add, add, addAll, addAll, addAll, addListener, addListener, addListener, fireItemsUpdated, firePageChange, getInternalWrappedList, getWrappedList, remove, remove, remove, removeAll, removeAll, removeListener, removeListener, removeListener, retainAll, retainAll, set, setAll, setAll, subList, toArray, toArray |
| Methods inherited from class org.granite.client.tide.collections.AbstractPagedCollection |
contains, containsAll, findFault, findResult, fullRefresh, get, handleEvent, handleFault, handleResult, indexOf, initialize, isEmpty, iterator, lastIndexOf, listIterator, listIterator, setElementClass, setMaxResults, size |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.List |
contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, size |
component
protected Component component
methodName
protected String methodName
methodNameSet
protected boolean methodNameSet
usePage
protected boolean usePage
sortAdapter
protected SortAdapter sortAdapter
PagedQuery
protected PagedQuery()
PagedQuery
public PagedQuery(ServerSession serverSession)
setName
public void setName(String componentName)
- Specified by:
setName in interface NameAware
setContext
public void setContext(Context context)
- Specified by:
setContext in interface ContextAware
init
public void init()
- Specified by:
init in interface Initializable
setSortAdapter
public void setSortAdapter(SortAdapter sortAdapter)
getSortAdapter
public SortAdapter getSortAdapter()
resetSort
public void resetSort()
filterProperty
public javafx.beans.property.ObjectProperty<F> filterProperty()
getFilter
public F getFilter()
setFilter
public void setFilter(F filter)
setFilterClass
public void setFilterClass(Class<F> filterClass)
throws IllegalAccessException,
InstantiationException
- Throws:
IllegalAccessException
InstantiationException
resetFilter
public void resetFilter()
clear
@PreDestroy
public void clear()
- Description copied from class:
AbstractPagedCollection
- Clear collection content
- Specified by:
clear in interface Collection<E>- Specified by:
clear in interface List<E>- Overrides:
clear in class PagedCollection<E>
reset
public void reset()
refresh
public boolean refresh()
- Description copied from class:
AbstractPagedCollection
- Refresh collection with new filter/sort parameters
- Overrides:
refresh in class AbstractPagedCollection<E>
- Returns:
- always false
getName
public String getName()
- Specified by:
getName in interface Component
setRemoteComponentName
public void setRemoteComponentName(String remoteComponentName)
setRemoteComponentClass
public void setRemoteComponentClass(Class<? extends ComponentImpl> remoteComponentClass)
throws IllegalAccessException,
InstantiationException
- Throws:
IllegalAccessException
InstantiationException
setMethodName
public void setMethodName(String methodName)
setUsePage
public void setUsePage(boolean usePage)
find
protected void find(int first,
int last)
- Trigger a results query for the current filter
- Overrides:
find in class AbstractPagedCollection<E>
- Parameters:
first - : index of first required resultlast - : index of last required result
doFind
protected void doFind(Object filter,
int first,
int max,
AbstractPagedCollection.PagedCollectionResponder findResponder)
getResult
protected org.granite.tide.data.model.Page<E> getResult(TideResultEvent<?> event,
int first,
int max)
- Description copied from class:
AbstractPagedCollection
- Build a result object from the result event
- Specified by:
getResult in class AbstractPagedCollection<E>
- Parameters:
event - the result eventfirst - first index requestedmax - max elements requested
- Returns:
- an object containing data from the collection
resultList : the retrieved data
resultCount : the total count of elements (non paged)
firstResult : the index of the first retrieved element
maxResults : the maximum count of retrieved elements
getObject
public Object getObject()
- PropertyHolder interface
- Specified by:
getObject in interface PropertyHolder
setProperty
public void setProperty(String propName,
Object value)
- Specified by:
setProperty in interface PropertyHolder
call
public <T> Future<T> call(String operation,
Object... args)
- Specified by:
call in interface Component