Package org.hippoecm.frontend.model
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. AnIModelReference.IModelChangeEvent
should be sent wheneversetModel(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
IModelReference.IModelChangeEvent<T>
Event that's sent toIObserver
s of the service.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.apache.wicket.model.IModel<T>
getModel()
Retrieve the current model of the model servicevoid
setModel(org.apache.wicket.model.IModel<T> model)
Update the model of the service.-
Methods inherited from interface org.hippoecm.frontend.model.event.IObservable
equals, hashCode, setObservationContext, startObservation, stopObservation
-
-
-
-
Method Detail
-
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 anIModelReference.IModelChangeEvent
.- Parameters:
model
- the new model
-
-