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
for IEntity
s & use with DataTable
. Helps defining SortingCriterion
as well as FilterCriterion
.- Since:
- 8.0.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
DaoLazyDataModel.Builder<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
-
Method Summary
Modifier and TypeMethodDescriptionstatic <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
protected final IGenericDao<T>
getDao()
int
getFirst()
load
(int first, int pageSize, Map<String, org.primefaces.model.SortMeta> sortBy, Map<String, org.primefaces.model.FilterMeta> filterBy) void
Switches to the page that contains the currently selected item.void
Reads the last selected entity, and, if such an entity exists, selects that entity.void
Selects the first item on the current page, if such an item exists.void
setAdditionalFilters
(List<IFilterCriterionSupplier> additionalFilters) void
setFirst
(int first) void
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 Details
-
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
-
count
-
getRowKey
-
getSelected
- Returns:
- The currently selected entity.
-
setSelected
- Parameters:
selected
- The entity to select.
-
getMarked
-
setMarked
-
setSortingCriterions
-
setAdditionalFilters
-
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
-