wicket.model
Class AbstractPropertyModel

java.lang.Object
  extended by wicket.model.AbstractDetachableModel
      extended by wicket.model.AbstractPropertyModel
All Implemented Interfaces:
java.io.Serializable, IDetachable, IModel
Direct Known Subclasses:
CompoundPropertyModel, PropertyModel

public abstract class AbstractPropertyModel
extends AbstractDetachableModel

Serves as a base class for different kinds of property models.

Author:
Chris Turner, Eelco Hillenius, Jonathan Locke
See Also:
AbstractDetachableModel, Serialized Form

Constructor Summary
AbstractPropertyModel(java.lang.Object modelObject)
          Constructor
 
Method Summary
 IModel getNestedModel()
          Gets the nested model.
protected  java.lang.Object modelObject(Component component)
           
protected  void onAttach()
          Attaches to the current request.
protected  void onDetach()
          Unsets this property model's instance variables and detaches the model.
protected  java.lang.Object onGetObject(Component component)
          Called when getObject is called in order to retrieve the detachable object.
protected  void onSetObject(Component component, java.lang.Object object)
          Applies the property expression on the model object using the given object argument.
protected abstract  java.lang.String propertyExpression(Component component)
           
protected abstract  java.lang.Class propertyType(Component component)
           
 java.lang.String toString()
           
 
Methods inherited from class wicket.model.AbstractDetachableModel
attach, detach, getObject, isAttached, setObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractPropertyModel

public AbstractPropertyModel(java.lang.Object modelObject)
Constructor

Parameters:
modelObject - The nested model object
Method Detail

getNestedModel

public final IModel getNestedModel()
Gets the nested model.

Specified by:
getNestedModel in interface IModel
Specified by:
getNestedModel in class AbstractDetachableModel
Returns:
The nested model, null when this is the final model in the hierarchy
See Also:
IModel.getNestedModel()

modelObject

protected java.lang.Object modelObject(Component component)
Parameters:
component - The component to get the model object for
Returns:
The model for this property

propertyExpression

protected abstract java.lang.String propertyExpression(Component component)
Parameters:
component - The component to get a property expression for
Returns:
The property expression for the component

onAttach

protected void onAttach()
Description copied from class: AbstractDetachableModel
Attaches to the current request. Implement this method with custom behavior, such as loading the model object.

Specified by:
onAttach in class AbstractDetachableModel
See Also:
AbstractDetachableModel.onAttach()

onDetach

protected void onDetach()
Unsets this property model's instance variables and detaches the model.

Specified by:
onDetach in class AbstractDetachableModel
See Also:
AbstractDetachableModel.onDetach()

onGetObject

protected java.lang.Object onGetObject(Component component)
Description copied from class: AbstractDetachableModel
Called when getObject is called in order to retrieve the detachable object. Before this method is called, getObject() always calls attach() to ensure that the object is attached.

Specified by:
onGetObject in class AbstractDetachableModel
Parameters:
component - The component asking for the object
Returns:
The object
See Also:
AbstractDetachableModel.onGetObject(wicket.Component)

onSetObject

protected void onSetObject(Component component,
                           java.lang.Object object)
Applies the property expression on the model object using the given object argument.

Specified by:
onSetObject in class AbstractDetachableModel
Parameters:
object - The object that will be used when setting a value on the model object
component - The component asking for replacement of the model object
See Also:
AbstractDetachableModel.onSetObject(Component, Object)

propertyType

protected abstract java.lang.Class propertyType(Component component)
Parameters:
component - The component
Returns:
The property type

toString

public java.lang.String toString()
Overrides:
toString in class AbstractDetachableModel
See Also:
Object.toString()


Copyright © 2004-2007 Wicket developers. All Rights Reserved.