|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.model.AbstractReadOnlyModel org.apache.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 AbstractReadOnlyModel.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()
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 org.apache.wicket.model.AbstractReadOnlyModel |
---|
getObject, setObject |
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 objectMethod Detail |
---|
public void detach()
IDetachable
detach
in interface IDetachable
detach
in class AbstractReadOnlyModel
IDetachable.detach()
public java.lang.Object getObject()
IModel
getObject
in interface IModel
getObject
in class AbstractReadOnlyModel
IModel.getObject()
public final boolean isAttached()
public java.lang.String toString()
toString
in class AbstractReadOnlyModel
Object.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 |