Package de.xima.fc.gui.model.lazydata
Class DaoLazyDataModel<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- java.lang.Object
-
- javax.faces.model.DataModel<E>
-
- javax.faces.model.ListDataModel<T>
-
- org.primefaces.model.LazyDataModel<T>
-
- de.xima.fc.gui.model.lazydata.DaoLazyDataModel<T>
-
- Type Parameters:
T
- Type of the entities to store in the lazy list model.
- All Implemented Interfaces:
Serializable
,Iterable<T>
,org.primefaces.model.SelectableDataModel<T>
public class DaoLazyDataModel<T extends de.xima.cmn.dao.interfaces.IEntity<Long>> extends org.primefaces.model.LazyDataModel<T>
LazyDataModel
forIEntity
s & use withDataTable
. Helps definingSortingCriterion
as well asFilterCriterion
.- Since:
- 8.0.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DaoLazyDataModel.Builder<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
DaoLazyDataModel.Builder<T>builder(EEntityKeySelectionType keyType, Class<T> entityClass)
Creates a new builder for a lazy entity list model.int
count(Map<String,org.primefaces.model.FilterMeta> filterBy)
protected IGenericDao<T>
getDao()
int
getFirst()
List<T>
getMarked()
String
getRowKey(T entity)
T
getSelected()
List<T>
load(int first, int pageSize, Map<String,org.primefaces.model.SortMeta> sortBy, Map<String,org.primefaces.model.FilterMeta> filterBy)
void
moveToPageOfSelected()
Switches to the page that contains the currently selected item.void
restoreSavedSelection()
Reads the last selected entity, and, if such an entity exists, selects that entity.void
selectFirstOfPage()
Selects the first item on the current page, if such an item exists.void
setAdditionalFilters(List<IFilterCriterionSupplier> additionalFilters)
void
setFirst(int first)
void
setMarked(List<T> marked)
void
setSelected(T selected)
void
setSortingCriterions(List<IEntitySortingCriterion> sortingCriterions)
-
Methods inherited from class org.primefaces.model.LazyDataModel
getConverter, getMessage, getPageSize, getRowCount, getRowData, getRowData, getRowData, getRowIndex, getWrappedData, isRowAvailable, iterator, iterator, recalculateFirst, setConverter, setPageSize, setRowCount, setRowIndex, setWrappedData
-
Methods inherited from class javax.faces.model.DataModel
addDataModelListener, getDataModelListeners, removeDataModelListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
builder
public static <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> DaoLazyDataModel.Builder<T> builder(EEntityKeySelectionType keyType, Class<T> entityClass)
Creates a new builder for a lazy entity list model.- Type Parameters:
T
- Type of the entity to store in the lazy list model.- Parameters:
keyType
- Scope of the entity that determines how the currently selected entity is stored. Used to restore the last selected entity when the UI is reloaded.entityClass
- Type of the entity.- Returns:
- A new builder for configuring a lazy entity list model.
-
load
public List<T> load(int first, int pageSize, Map<String,org.primefaces.model.SortMeta> sortBy, Map<String,org.primefaces.model.FilterMeta> filterBy)
-
getSelected
public T getSelected()
- Returns:
- The currently selected entity.
-
setSelected
public void setSelected(T selected)
- Parameters:
selected
- The entity to select.
-
setSortingCriterions
public void setSortingCriterions(List<IEntitySortingCriterion> sortingCriterions)
-
setAdditionalFilters
public void setAdditionalFilters(List<IFilterCriterionSupplier> additionalFilters)
-
setFirst
public void setFirst(int first)
- Parameters:
first
- The index of the first item of the page to display.
-
getFirst
public int getFirst()
- Returns:
- The index of the first item of the page to display.
-
selectFirstOfPage
public void selectFirstOfPage()
Selects the first item on the current page, if such an item exists.
-
moveToPageOfSelected
public void moveToPageOfSelected()
Switches to the page that contains the currently selected item.
-
restoreSavedSelection
public void restoreSavedSelection()
Reads the last selected entity, and, if such an entity exists, selects that entity. This should usually be called only once for a given UI page, after the model was created.
-
getDao
protected final IGenericDao<T> getDao()
-
-