|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbr.com.arsmachina.tapestrycrud.base.BasePage<T,K>
br.com.arsmachina.tapestrycrud.base.BaseEditPage<T,K>
T - the entity class related to this encoder.K - the type of the class' primary key property.@Meta(value="tapestry.persistence-strategy=flash") public abstract class BaseEditPage<T,K extends Serializable>
Base class for pages that edit entity objects. One example of its use can be found in the Ars Machina Project Example Application (page class. template).
| Constructor Summary | |
|---|---|
BaseEditPage()
Single constructor of this class. |
|
| Method Summary | |
|---|---|
protected void |
addError(String fieldId,
String message)
Adds an error to a given field in the form. |
void |
clearObject()
Sets the object to null. |
protected T |
createNewObject()
Creates a new entity object to be edited. |
protected Form |
getForm()
Returns the value of the form property. |
protected BaseListPage<T,K> |
getListPage()
Returns the BaseListPage instance associated to this object. |
T |
getObject()
Returns the value of the object property. |
String |
getZone()
Returns null if we are inserting a new object and
#DEFAULT_FORM_ZONE_ID (zone) otherwise. |
Object |
onPassivate()
Returns the current activation context of this page. |
protected void |
prepare()
Ensures the edited object is not null before form rendering and submission. |
protected void |
prepareObjectForSaveOrUpdate()
Does any processing that must be done in the object before it is saved or updated. |
protected Object |
returnFromRemove()
Defines what saveOrUpdate() will return and sets the success message. |
Object |
saveOrUpdate()
Saves or updates the edited object. |
void |
setObject(T object)
Changes the value of the object property. |
protected void |
setSaveOrUpdateSuccessMessage()
Sets the save or update success message in this page. |
protected Object |
validate()
Validates the object. |
protected void |
validateObject(T object,
Form form)
Validates an object and stores the validation erros in a form. |
| Methods inherited from class br.com.arsmachina.tapestrycrud.base.BasePage |
|---|
filterReadOnlyComponentsInBeanModel, getActivationContextEncoder, getController, getEntityClass, getFormZone, getLabelEncoder, getMessage, getMessages, getPrimaryKeyClass, getPrimaryKeyEncoder, getSelectModelFactory, getValueEncoder, returnZoneOnXHR, setMessage |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface br.com.arsmachina.tapestrycrud.EditPage |
|---|
getFormZone |
| Methods inherited from interface br.com.arsmachina.tapestrycrud.CrudPage |
|---|
getEntityClass, getMessage, getPrimaryKeyClass, setMessage |
| Constructor Detail |
|---|
public BaseEditPage()
| Method Detail |
|---|
@OnEvent(component="form",
value="prepare")
protected final void prepare()
createNewObject() to create a new entity object if needed. If not,
getController.reattach(object) is invoked.
ReadableController.reattach(Object)
@OnEvent(component="form",
value="validateForm")
protected final Object validate()
#validateObject(Form) and then takes care
of handling AJAX form submissions.
protected void validateObject(T object,
Form form)
object and stores the validation erros in a form.
This implementation does nothing.
object - an #T.a - Form.
protected final void addError(String fieldId,
String message)
fieldId - a String. It cannot be null.message - a String. It cannot be null.
@OnEvent(component="form",
value="success")
public final Object saveOrUpdate()
prepareObjectForSaveOrUpdate()BasePage.getController().saveOrUpdate(entity);.
returnFromRemove()
protected Object returnFromRemove()
saveOrUpdate() will return and sets the success message.
Object or null.protected void setSaveOrUpdateSuccessMessage()
protected BaseListPage<T,K> getListPage()
BaseListPage instance associated to this object. This is used by
#returnAfterAction() to define what will be returned by saveOrUpdate().
This implementation returns null and must be overriden by pages that want to show the listing
page after a successful save or update.
BaseListPage.protected void prepareObjectForSaveOrUpdate()
protected T createNewObject()
prepare(). This implementation attempts to instantiate the object using its
class default constructor.
T.public T getObject()
object property.
getObject in interface EditPage<T,K extends Serializable>T.public void setObject(T object)
object property.
setObject in interface EditPage<T,K extends Serializable>object - a T.protected final Form getForm()
form property.
Form.public final Object onPassivate()
#A.public String getZone()
null if we are inserting a new object and
#DEFAULT_FORM_ZONE_ID (zone) otherwise.
String.@OnEvent(value="newObject") public final void clearObject()
null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||