org.apache.wicket.model
Class ComponentModel

java.lang.Object
  extended by org.apache.wicket.model.ComponentModel
All Implemented Interfaces:
java.io.Serializable, IClusterable, IComponentAssignedModel, IDetachable, IModel

public class ComponentModel
extends java.lang.Object
implements IModel, IComponentAssignedModel

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
ComponentModel()
           
 
Method Summary
 void detach()
          Detaches model after use.
 java.lang.Object getObject()
          This getObject throws an exception.
protected  java.lang.Object getObject(Component component)
          Returns the object from the model with the use of the component where it is attached to.
protected  void setObject(Component component, java.lang.Object object)
          Sets the model object for this model.
 void setObject(java.lang.Object object)
          Sets the model object.
 IWrapModel wrapOnAssignment(Component comp)
          This method is called when the component gets its model assigned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentModel

public ComponentModel()
Method Detail

getObject

public final java.lang.Object getObject()
This getObject throws an exception.

Specified by:
getObject in interface IModel
Returns:
The model object
See Also:
IModel.getObject()

setObject

public final void setObject(java.lang.Object object)
Description copied from interface: IModel
Sets the model object.

Specified by:
setObject in interface IModel
Parameters:
object - The model object
See Also:
IModel.setObject(java.lang.Object)

getObject

protected java.lang.Object 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,
                         java.lang.Object 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.

detach

public void detach()
Description copied from interface: IDetachable
Detaches model after use. This is generally used to null out transient references that can be re-attached later.

Specified by:
detach in interface IDetachable
See Also:
IDetachable.detach()

wrapOnAssignment

public IWrapModel wrapOnAssignment(Component comp)
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 interface IComponentAssignedModel
Returns:
The WrapModel that wraps this model
See Also:
IComponentAssignedModel.wrapOnAssignment(org.apache.wicket.Component)


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.