java.lang.Object
org.apache.wicket.model.ComponentDetachableModel<T>
- Type Parameters:
T
- The model object type
- All Implemented Interfaces:
Serializable
,IComponentAssignedModel<T>
,IDetachable
,IModel<T>
,IClusterable
Quick detachable model that is implements the IComponentAssignedModel and the IModel interfaces.
Its a quick replacement for the current setObject(Component,Object) and getObject(Component)
methods when the component is needed in a detachable model.
- Author:
- jcompagner
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
attach()
Attaches to the current request.final T
This getObject throws an exception.protected T
Called when getObject is called in order to retrieve the detachable object.final boolean
Gets whether this model has been attached to the current session.protected final void
Set this model in an attached state.protected void
Called when setObject is called in order to change the detachable object.final void
Sets the model object.wrapOnAssignment
(Component comp) This method is called when the component gets its model assigned.
-
Constructor Details
-
ComponentDetachableModel
public ComponentDetachableModel()
-
-
Method Details
-
getObject
This getObject throws an exception. -
setObject
Description copied from interface:IModel
Sets the model object. -
isAttached
Gets whether this model has been attached to the current session.- Returns:
- whether this model has been attached to the current session
-
setAttached
Set this model in an attached state. Called if the constructor sets the data. (attached) -
attach
Attaches to the current request. Implement this method with custom behavior, such as loading the model object. -
getObject
Called when getObject is called in order to retrieve the detachable object. Before this method is called, attach() is always called to ensure that the object is attached.- Parameters:
component
- The component asking for the object- Returns:
- The object
-
setObject
Called when setObject is called in order to change the detachable object. Before this method is called, attach() is always called to ensure that the object is attached.- Parameters:
component
- The component asking for replacement of the model objectobject
- The new model object
-
wrapOnAssignment
Description copied from interface:IComponentAssignedModel
This method is called when the component gets its model assigned. WARNING: Because the model can be assigned in the constructor of component this method can also be called with a 'this' of a component that is not fully constructed yet.- Specified by:
wrapOnAssignment
in interfaceIComponentAssignedModel<T>
- Returns:
- The WrapModel that wraps this model
-