public abstract class FetchedArrayViewModel<E extends IViewModel,P> extends ViewModel implements IFetchedArrayViewModel<E,P,java.lang.Void,java.util.Collection<E>>, java.util.RandomAccess
IFetchedArrayViewModel that fetches ViewModels by calling onFetch(Object)| Constructor and Description |
|---|
FetchedArrayViewModel() |
| Modifier and Type | Method and Description |
|---|---|
protected ICommand<java.lang.Void,java.util.Collection<E>> |
createFetchCommand() |
protected ICommand<java.lang.Void,java.util.Collection<E>> |
createFetchIfNeededCommand() |
protected ICommand<java.lang.Void,java.util.Collection<E>> |
createRefreshCommand() |
IProperty<java.lang.Integer> |
getCount() |
ICommand<java.lang.Void,java.util.Collection<E>> |
getFetchCommand() |
ICommand<java.lang.Void,java.util.Collection<E>> |
getFetchIfNeededCommand() |
IMutableProperty<java.lang.CharSequence> |
getLocalizedEmptyMessage() |
P |
getNextPage() |
ICommand<java.lang.Void,java.util.Collection<E>> |
getRefreshCommand() |
E |
getViewModel(int index)
Access the indexth element.
|
java.util.List<E> |
getViewModels() |
IProperty<java.lang.Boolean> |
hasNextPage() |
int |
indexOf(E element) |
IProperty<java.lang.Boolean> |
isEmpty() |
IProperty<java.lang.Boolean> |
isFetchingNextPage() |
IProperty<java.lang.Boolean> |
isRefreshing() |
java.util.Iterator<E> |
iterator() |
protected abstract rx.Observable<Pair<P,java.util.Collection<E>>> |
onFetch(P page)
Implement this method to fetch ViewModels at
page |
protected void |
setNextPage(P nextPage) |
protected void |
setViewModels(java.util.Collection<E> viewModels) |
bindCommand, bindErrors, bindLoading, getActive, getErrors, getTitle, isEnabled, isLoadingclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbindCommand, bindErrors, bindLoading, getActive, getErrors, getTitle, isEnabled, isLoadingprotected abstract rx.Observable<Pair<P,java.util.Collection<E>>> onFetch(P page)
pagepublic java.util.Iterator<E> iterator()
iterator in interface java.lang.Iterable<E extends IViewModel>public IProperty<java.lang.Integer> getCount()
getCount in interface IArrayViewModel<E extends IViewModel>public IProperty<java.lang.Boolean> isEmpty()
isEmpty in interface IArrayViewModel<E extends IViewModel>public IMutableProperty<java.lang.CharSequence> getLocalizedEmptyMessage()
getLocalizedEmptyMessage in interface IArrayViewModel<E extends IViewModel>public java.util.List<E> getViewModels()
getViewModels in interface IArrayViewModel<E extends IViewModel>Elementprotected void setViewModels(java.util.Collection<E> viewModels)
public int indexOf(E element)
indexOf in interface IArrayViewModel<E extends IViewModel>value equals element or null
element is not found.public E getViewModel(int index)
IArrayViewModelgetViewModel in interface IArrayViewModel<E extends IViewModel>index - Must be > 0 and < count.public IProperty<java.lang.Boolean> isRefreshing()
isRefreshing in interface IFetchedArrayViewModel<E extends IViewModel,P,java.lang.Void,java.util.Collection<E extends IViewModel>>public P getNextPage()
getNextPage in interface IFetchedArrayViewModel<E extends IViewModel,P,java.lang.Void,java.util.Collection<E extends IViewModel>>protected void setNextPage(P nextPage)
public IProperty<java.lang.Boolean> isFetchingNextPage()
isFetchingNextPage in interface IFetchedArrayViewModel<E extends IViewModel,P,java.lang.Void,java.util.Collection<E extends IViewModel>>public IProperty<java.lang.Boolean> hasNextPage()
hasNextPage in interface IFetchedArrayViewModel<E extends IViewModel,P,java.lang.Void,java.util.Collection<E extends IViewModel>>public ICommand<java.lang.Void,java.util.Collection<E>> getRefreshCommand()
getRefreshCommand in interface IFetchedArrayViewModel<E extends IViewModel,P,java.lang.Void,java.util.Collection<E extends IViewModel>>public ICommand<java.lang.Void,java.util.Collection<E>> getFetchCommand()
getFetchCommand in interface IFetchedArrayViewModel<E extends IViewModel,P,java.lang.Void,java.util.Collection<E extends IViewModel>>nextPage is null, this command will refresh, else this command should fetch next page.public ICommand<java.lang.Void,java.util.Collection<E>> getFetchIfNeededCommand()
getFetchIfNeededCommand in interface IFetchedArrayViewModel<E extends IViewModel,P,java.lang.Void,java.util.Collection<E extends IViewModel>>IFetchedArrayViewModel.getFetchCommand() only if next page is non null or returns Observable.empty()protected ICommand<java.lang.Void,java.util.Collection<E>> createRefreshCommand()