Package org.hippoecm.frontend.model
Class AbstractProvider<T,M extends org.apache.wicket.model.IModel>
java.lang.Object
org.hippoecm.frontend.model.ItemModelWrapper<T>
org.hippoecm.frontend.model.AbstractProvider<T,M>
- All Implemented Interfaces:
Serializable
,org.apache.wicket.model.IDetachable
,org.apache.wicket.model.IModel<T>
,org.apache.wicket.util.io.IClusterable
- Direct Known Subclasses:
ChildNodeProvider
,PropertyValueProvider
public abstract class AbstractProvider<T,M extends org.apache.wicket.model.IModel>
extends ItemModelWrapper<T>
Provider that enumerates a list of models based on a
JcrItemModel
.
It can be used to uniformly manipulate such lists.- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
addNew()
Add a new element.void
detach()
abstract ModelPathElement
getFieldElement
(M model) Retrieve theModelPathElement
to access an element.iterator
(int first, int count) Iterate over the provided elements.protected final void
load()
protected abstract void
Method to be overridden by subclasses, to populate the list of elements.abstract void
moveToBottom
(M model) Move a model to the bottom of the list.abstract void
Move a model to the top of the list.abstract void
Move a model up one position.void
refresh()
Force a reloading of items from the session.abstract void
Remove a model from the list.void
setItemModel
(org.apache.wicket.model.IModel model) int
size()
Count the number of elementsMethods inherited from class org.hippoecm.frontend.model.ItemModelWrapper
getItemModel, getObject, setObject
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.wicket.model.IModel
as, combineWith, filter, flatMap, isPresent, map, orElse, orElseGet
-
Field Details
-
elements
-
-
Constructor Details
-
AbstractProvider
-
-
Method Details
-
refresh
public void refresh()Force a reloading of items from the session. -
setItemModel
public void setItemModel(org.apache.wicket.model.IModel model) - Overrides:
setItemModel
in classItemModelWrapper<T>
-
detach
public void detach()- Specified by:
detach
in interfaceorg.apache.wicket.model.IDetachable
- Specified by:
detach
in interfaceorg.apache.wicket.model.IModel<T>
- Overrides:
detach
in classItemModelWrapper<T>
-
iterator
Iterate over the provided elements.- Parameters:
first
-count
-- Returns:
- iterator over the elements
-
size
public int size()Count the number of elements- Returns:
- the number of elements provided
-
addNew
public abstract void addNew()Add a new element. -
remove
Remove a model from the list.- Parameters:
model
- the model to remove
-
moveUp
Move a model up one position.- Parameters:
model
- the model to move
-
moveToTop
Move a model to the top of the list.- Parameters:
model
- the model to move
-
moveToBottom
Move a model to the bottom of the list.- Parameters:
model
- the model to move
-
getFieldElement
Retrieve theModelPathElement
to access an element.- Parameters:
model
- the element to be made accessible- Returns:
- the ModelPathElement for the element
-
load
protected final void load() -
loadElements
protected abstract void loadElements()Method to be overridden by subclasses, to populate the list of elements.
-