T
- the type of the object for the shared modelpublic class ModelReference<T> extends Object implements IModelReference<T>
IModelReference
service interface.
After a model service is created, it can be made to register it self under the provided service id
using the init(org.hippoecm.frontend.plugin.IPluginContext)
method.
When model services are no longer needed, e.g. because the cluster that need it is no longer active,
be sure to unregister the service using destroy()
.
IModelReference.IModelChangeEvent<T>
Constructor and Description |
---|
ModelReference(String serviceId,
org.apache.wicket.model.IModel<T> model)
Construct a model service with a given service id and initial model.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Unregister the service with the specified service id.
|
void |
detach() |
org.apache.wicket.model.IModel<T> |
getModel()
Retrieve the current model of the model service
|
void |
init(IPluginContext context)
Register the service with the specified service id.
|
void |
setModel(org.apache.wicket.model.IModel<T> newModel)
Update the model of the service.
|
void |
setObservationContext(IObservationContext context)
Before observation is started on the observable, an observation context is injected by
the observer registry.
|
void |
startObservation()
When the first
IObserver of this observable is registered with the observer
registry, observation is started. |
void |
stopObservation()
When the last
IObserver unregisters, observation is stopped. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode
public void init(IPluginContext context)
context
- the plugin context to use for registrationpublic void destroy()
public org.apache.wicket.model.IModel<T> getModel()
IModelReference
getModel
in interface IModelReference<T>
public void setModel(org.apache.wicket.model.IModel<T> newModel)
IModelReference
IModelReference.IModelChangeEvent
.setModel
in interface IModelReference<T>
newModel
- the new modelpublic void setObservationContext(IObservationContext context)
IObservable
setObservationContext
in interface IObservable
public void startObservation()
IObservable
IObserver
of this observable is registered with the observer
registry, observation is started. Implementations must notify observers until observation
is stopped.
An implementation should register listeners with external data sources, when appropriate. It is possible for an observable to register as an observer for another observable.
startObservation
in interface IObservable
public void stopObservation()
IObservable
IObserver
unregisters, observation is stopped. Any listeners
or observers registered by the observable must be unregistered by the implementation.stopObservation
in interface IObservable
public void detach()
detach
in interface org.apache.wicket.model.IDetachable
Copyright © 2007–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.