public abstract class AbstractPagedCollection<E> extends Object implements List<E>, TideEventObserver
| Modifier and Type | Class and Description |
|---|---|
class |
AbstractPagedCollection.PagedCollectionIterator |
class |
AbstractPagedCollection.PagedCollectionResponder |
| Modifier and Type | Field and Description |
|---|---|
protected int |
count |
protected boolean |
filterRefresh |
protected int |
first |
protected boolean |
fullRefresh |
protected boolean |
initializing |
protected int |
last |
protected int |
max |
| Constructor and Description |
|---|
AbstractPagedCollection() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e) |
void |
add(int index,
E element) |
boolean |
addAll(Collection<? extends E> c) |
boolean |
addAll(int index,
Collection<? extends E> c) |
void |
clear()
Clear collection content
|
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
protected void |
find(int first,
int last)
Abstract method: trigger a results query for the current filter
|
protected void |
findFault(TideFaultEvent event,
int first,
int max)
Event handler for results fault
|
protected void |
findResult(TideResultEvent<?> event,
int first,
int max)
Event handler for results query
|
protected abstract void |
firePageChange(TideRpcEvent event)
Notify listeners of remote page result
|
boolean |
fullRefresh()
Force refresh of collection when filter/sort have been changed
|
E |
get(int index)
Override of get() with lazy page loading
|
protected abstract List<E> |
getInternalWrappedList() |
protected abstract org.granite.tide.data.model.Page<E> |
getResult(TideResultEvent<?> event,
int first,
int max)
Build a result object from the result event
|
protected abstract List<E> |
getWrappedList() |
void |
handleEvent(TideEvent event) |
protected void |
handleFault(TideFaultEvent event)
Event handler for results query fault
|
protected void |
handleResult(org.granite.tide.data.model.Page<E> page,
TideResultEvent<?> event,
int first,
int max)
Event handler for results query
|
int |
indexOf(Object o) |
protected void |
initialize(TideResultEvent<?> event)
Initialize collection after first find
|
boolean |
isEmpty() |
Iterator<E> |
iterator() |
int |
lastIndexOf(Object o) |
ListIterator<E> |
listIterator() |
ListIterator<E> |
listIterator(int index) |
boolean |
refresh()
Refresh collection with new filter/sort parameters
|
E |
remove(int index) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
E |
set(int index,
E element) |
void |
setElementClass(Class<? extends E> elementClass) |
void |
setMaxResults(int max)
Set the page size.
|
int |
size()
Get total number of elements
|
List<E> |
subList(int fromIndex,
int toIndex) |
protected boolean initializing
protected int first
protected int last
protected int max
protected int count
protected boolean fullRefresh
protected boolean filterRefresh
public AbstractPagedCollection()
public int size()
public void setMaxResults(int max)
max - maximum number of requested elementspublic void setElementClass(Class<? extends E> elementClass)
public void handleEvent(TideEvent event)
handleEvent in interface TideEventObserver@PreDestroy public void clear()
protected void find(int first, int last)
first - : index of first required resultlast - : index of last required resultpublic boolean fullRefresh()
public boolean refresh()
protected abstract org.granite.tide.data.model.Page<E> getResult(TideResultEvent<?> event, int first, int max)
event - the result eventfirst - first index requestedmax - max elements requestedprotected abstract void firePageChange(TideRpcEvent event)
event - the remote event (ResultEvent or FaultEvent)protected void initialize(TideResultEvent<?> event)
event - the result event of the first findprotected void findResult(TideResultEvent<?> event, int first, int max)
event - the result eventfirst - first requested indexmax - max elements requestedprotected void handleResult(org.granite.tide.data.model.Page<E> page, TideResultEvent<?> event, int first, int max)
page - the result pageevent - the result eventfirst - first requested indexmax - max elements requestedprotected void findFault(TideFaultEvent event, int first, int max)
event - the fault eventfirst - first requested indexmax - max elements requestedprotected void handleFault(TideFaultEvent event)
event - the fault eventprotected abstract List<E> getInternalWrappedList()
protected abstract List<E> getWrappedList()
public boolean isEmpty()
public boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>containsAll in interface List<E>public int lastIndexOf(Object o)
lastIndexOf in interface List<E>public ListIterator<E> listIterator()
listIterator in interface List<E>public ListIterator<E> listIterator(int index)
listIterator in interface List<E>public boolean addAll(Collection<? extends E> c)
public boolean addAll(int index, Collection<? extends E> c)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)