Package org.apache.wicket.model
Class ComponentModel<T>
- java.lang.Object
-
- org.apache.wicket.model.ComponentModel<T>
-
- Type Parameters:
T- type of model object
- All Implemented Interfaces:
java.io.Serializable,IComponentAssignedModel<T>,IDetachable,IModel<T>,org.apache.wicket.util.io.IClusterable
public class ComponentModel<T> extends java.lang.Object implements IModel<T>, IComponentAssignedModel<T>
Quick 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 the model.- Author:
- jcompagner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ComponentModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TgetObject()This getObject throws an exception.protected TgetObject(Component component)Returns the object from the model with the use of the component where it is attached to.protected voidsetObject(Component component, T object)Sets the model object for this model.voidsetObject(T object)Sets the model object.IWrapModel<T>wrapOnAssignment(Component comp)This method is called when the component gets its model assigned.
-
-
-
Method Detail
-
getObject
public final T getObject()
This getObject throws an exception.- Specified by:
getObjectin interfaceIModel<T>- Returns:
- The model object
- See Also:
IModel.getObject()
-
setObject
public final void setObject(T object)
Description copied from interface:IModelSets the model object.
-
getObject
protected T getObject(Component component)
Returns the object from the model with the use of the component where it is attached to.- Parameters:
component- The component which has this model.- Returns:
- The object of the model.
-
setObject
protected void setObject(Component component, T object)
Sets the model object for this model.- Parameters:
component- The component which has this model.object- The object that will be set in the model.
-
wrapOnAssignment
public IWrapModel<T> wrapOnAssignment(Component comp)
Description copied from interface:IComponentAssignedModelThis 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:
wrapOnAssignmentin interfaceIComponentAssignedModel<T>- Returns:
- The WrapModel that wraps this model
-
-