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 Details

    • elements

      protected transient LinkedList<M extends org.apache.wicket.model.IModel> elements
  • Constructor Details

    • AbstractProvider

      public AbstractProvider(JcrItemModel itemModel)
  • 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 class ItemModelWrapper<T>
    • detach

      public void detach()
      Specified by:
      detach in interface org.apache.wicket.model.IDetachable
      Specified by:
      detach in interface org.apache.wicket.model.IModel<T>
      Overrides:
      detach in class ItemModelWrapper<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 the ModelPathElement 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.