|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwicket.model.AbstractModel
wicket.model.AbstractReadOnlyModel
wicket.model.LoadableDetachableModel
public abstract class LoadableDetachableModel
Model that makes working with detachable models a breeze.
LoadableDetachableModel holds a temporary, transient model object, that is
set when getObject(Component) is called by calling abstract method
'load', and that will be reset/ set to null on detach().
A usage example:
LoadableDetachableModel venueListModel = new LoadableDetachableModel()
{
protected Object load()
{
return getVenueDao().findVenues();
}
};
Though you can override methods onAttach() and onDetach() for
additional attach/ detach behavior, the point of this class is to hide as
much of the attaching/ detaching as possible. So you should rarely need to
override those methods, if ever.
| Constructor Summary | |
|---|---|
LoadableDetachableModel()
Construct. |
|
LoadableDetachableModel(java.lang.Object object)
This constructor is used if you already have the object retrieved and want to wrap it with a detachable model. |
|
| Method Summary | |
|---|---|
void |
detach()
Detaches model after use. |
java.lang.Object |
getObject(Component component)
Gets the model object. |
boolean |
isAttached()
Gets the attached status of this model instance |
protected abstract java.lang.Object |
load()
Loads and returns the (temporary) model object. |
protected void |
onAttach()
Attaches to the current request. |
protected void |
onDetach()
Detaches from the current request. |
java.lang.String |
toString()
|
| Methods inherited from class wicket.model.AbstractReadOnlyModel |
|---|
setObject |
| Methods inherited from class wicket.model.AbstractModel |
|---|
getNestedModel |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public LoadableDetachableModel()
public LoadableDetachableModel(java.lang.Object object)
object - retrieved instance of the detachable object| Method Detail |
|---|
public final void detach()
IDetachable
detach in interface IDetachabledetach in class AbstractModelIDetachable.detach()public java.lang.Object getObject(Component component)
IModel
getObject in interface IModelgetObject in class AbstractReadOnlyModelcomponent - The component which wants to get a model Object
IModel.getObject(wicket.Component)public final boolean isAttached()
public java.lang.String toString()
toString in class AbstractReadOnlyModelObject.toString()protected abstract java.lang.Object load()
protected void onAttach()
protected void onDetach()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||