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 aJcrItemModel
. It can be used to uniformly manipulate such lists.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected LinkedList<M>
elements
-
Constructor Summary
Constructors Constructor Description AbstractProvider(JcrItemModel itemModel)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addNew()
Add a new element.void
detach()
abstract ModelPathElement
getFieldElement(M model)
Retrieve theModelPathElement
to access an element.Iterator<M>
iterator(int first, int count)
Iterate over the provided elements.protected void
load()
protected abstract void
loadElements()
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
moveToTop(M model)
Move a model to the top of the list.abstract void
moveUp(M model)
Move a model up one position.void
refresh()
Force a reloading of items from the session.abstract void
remove(M model)
Remove a model from the list.void
setItemModel(org.apache.wicket.model.IModel model)
int
size()
Count the number of elements-
Methods inherited from class org.hippoecm.frontend.model.ItemModelWrapper
getItemModel, getObject, setObject
-
-
-
-
Field Detail
-
elements
protected transient LinkedList<M extends org.apache.wicket.model.IModel> elements
-
-
Constructor Detail
-
AbstractProvider
public AbstractProvider(JcrItemModel itemModel)
-
-
Method Detail
-
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
public Iterator<M> iterator(int first, int count)
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
public abstract void remove(M model)
Remove a model from the list.- Parameters:
model
- the model to remove
-
moveUp
public abstract void moveUp(M model)
Move a model up one position.- Parameters:
model
- the model to move
-
moveToTop
public abstract void moveToTop(M model)
Move a model to the top of the list.- Parameters:
model
- the model to move
-
moveToBottom
public abstract void moveToBottom(M model)
Move a model to the bottom of the list.- Parameters:
model
- the model to move
-
getFieldElement
public abstract ModelPathElement getFieldElement(M model)
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.
-
-