| wicket.model.IModel
All known Subclasses: wicket.model.AbstractModel, wicket.model.AbstractDetachableModel, wicket.extensions.model.AbstractCheckBoxModel,
IModel | public interface IModel extends IDetachable(Code) | | A IModel wraps the actual model Object used by a Component. IModel
implementations are used as a facade for the real model so that users have
control over the actual persistence strategy. Note that objects implementing
this interface will be stored in the Session. Hence, you should use
(non-transient) instance variables sparingly.
- Basic Models - To implement a basic (non-detachable) model which
holds its entire state in the Session, you can either subclass
AbstractModel , or use the simple model wrapper
Model directly.
- Detachable Models - IModel inherits a hook,
IDetachable.detach , so that interface implementers can detach
transient information when a model is no longer being actively used by the
framework. This reduces memory use and reduces the expense of replicating the
model in a clustered server environment. To implement a detachable model, you
should generally extend
wicket.model.AbstractDetachableModel instead
of implementing IModel directly.
- Nested Models - IModels can be nested and the innermost model is
also known as the "root" model since it is the model on which the outer
models rely. The getNestedModel() method on IModel gets any nested model
within the given model. This allows Component.sameRootModel() to compare two
models to see if they both have the same root model (the same most nested
model).
For example, a Form might have a Person model and then a TextField might have
a PropertyModel which is the "name" property of the Person model. In this
case, PropertyModel will implement getNestedModel(), returning the Person
model which is the root model of the property model.
- Property Models - The AbstractPropertyModel class provides
default functionality for property models. A property model provides access
to a particular property of its wrapped model.
- Compound Property Models - The IModel interface is parameterized
by Component, allowing a model to be shared among several Components. When
the
IModel.getObject(Component) method is called, the value returned
will depend on the Component which is asking for the value. Likewise, the
IModel.setObject(ComponentObject) method sets a different property
depending on which Component is doing the setting. For more information on
CompoundPropertyModels and model inheritance, see
wicket.model.CompoundPropertyModel and
wicket.Page .
See Also: wicket.Component.sameRootModel(wicket.Component) See Also: wicket.Component.sameRootModel(IModel) author: Chris Turner author: Eelco Hillenius author: Jonathan Locke |
getNestedModel | IModel getNestedModel()(Code) | | Gets the nested model.
The nested model object. |
getObject | Object getObject(Component component)(Code) | | Gets the model object.
Parameters: component - The component which wants to get a model Object The model object |
setObject | void setObject(Component component, Object object)(Code) | | Sets the model object.
Parameters: component - The component which wants to set a new model Object Parameters: object - The model object |
|
|