Interface IModelReference<T>

Type Parameters:
T - the type of the object for the model
All Superinterfaces:
org.apache.wicket.util.io.IClusterable, org.apache.wicket.model.IDetachable, IObservable, Serializable
All Known Implementing Classes:
ModelReference

public interface IModelReference<T> extends org.apache.wicket.model.IDetachable, IObservable
Service interface for sharing models. When a model is shared between plugins and it is subject to change, it should be wrapped in an IModelReference service. The service is usually available under the configuration key 'wicket.model'.

This service is observable as well, so it is possible to receive model change events by registering an IObserver with the service as the observable. An IModelReference.IModelChangeEvent should be sent whenever setModel(org.apache.wicket.model.IModel<T>) is invoked.

The default implementation ModelReference, takes care of sending the events.

Model services should be registered before any of the plugins that uses them is started. This makes it easier to create plugins that consume models (they don't need to register service trackers). Since generally a model is injected into a new plugin cluster, this is usually quite a natural thing to do.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Event that's sent to IObservers of the service.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.wicket.model.IModel<T>
    Retrieve the current model of the model service
    void
    setModel(org.apache.wicket.model.IModel<T> model)
    Update the model of the service.

    Methods inherited from interface org.apache.wicket.model.IDetachable

    detach

    Methods inherited from interface org.hippoecm.frontend.model.event.IObservable

    equals, hashCode, setObservationContext, startObservation, stopObservation
  • Method Details

    • getModel

      org.apache.wicket.model.IModel<T> getModel()
      Retrieve the current model of the model service
      Returns:
      the model
    • setModel

      void setModel(org.apache.wicket.model.IModel<T> model)
      Update the model of the service. Observers will be notified with an IModelReference.IModelChangeEvent.
      Parameters:
      model - the new model