public abstract class AbstractForm<T> extends org.jboss.gwt.elemento.core.LazyElement implements Form<T>
The form consists of links and three sections:
Form.CancelCallback<T>, Form.FinishRemove<T>, Form.FinishReset<T>, Form.Operation, Form.PrepareRemove<T>, Form.PrepareReset<T>, Form.SaveCallback<T>, Form.State| Modifier and Type | Field and Description |
|---|---|
protected Form.CancelCallback<T> |
cancelCallback |
protected FormLinks<T> |
formLinks |
protected Form.PrepareRemove<T> |
prepareRemove |
protected Form.PrepareReset<T> |
prepareReset |
protected Form.SaveCallback<T> |
saveCallback |
| Constructor and Description |
|---|
AbstractForm(String id,
StateMachine stateMachine,
DataMapping<T> dataMapping,
EmptyState emptyState) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addFormItem(FormItem formItem,
FormItem... formItems) |
void |
addFormValidation(FormValidation<T> formValidation)
Makes it possible to validate the form as a whole or to check fields which depend on other fields.
|
protected void |
addHelp(String label,
com.google.gwt.safehtml.shared.SafeHtml description) |
void |
attach() |
void |
cancel()
Executes the
Operation#CANCEL operation and calls the registered
cancel callback (if any). |
void |
clear()
Removes the model reference, executes the
Operation#CLEAR operation and
calls DataMapping.clearFormItems(Form). |
protected elemental2.dom.HTMLElement |
createElement() |
void |
detach() |
void |
edit(T model)
Executes the
Operation#EDIT operation and calls DataMapping.newModel(Object, Form) if the model
is transitive otherwise DataMapping.populateFormItems(Object, Form). |
protected void |
flip(Form.State state) |
Iterable<FormItem> |
getBoundFormItems() |
protected Map<String,Object> |
getChangedValues() |
<I> FormItem<I> |
getFormItem(String name) |
Iterable<FormItem> |
getFormItems() |
String |
getId() |
T |
getModel() |
StateMachine |
getStateMachine() |
protected void |
markAsUnbound(String name) |
protected void |
prepare(Form.State state) |
protected void |
prepareEditState()
Gives subclasses a way to prepare the edit state.
|
protected void |
prepareEmptyState()
Gives subclasses a way to prepare the empty state.
|
protected void |
prepareViewState()
Gives subclasses a way to prepare the view state.
|
void |
remove()
Removes the model reference and executes the
Operation#REMOVE operation. |
void |
reset()
Executes the
Operation#RESET operation. |
boolean |
save()
Upon successful validation, executes the
Operation#SAVE operation,
calls DataMapping.persistModel(Object, Form) and finally calls the registered save callback (if any). |
protected void |
separateOptionalFields(boolean separateOptionalFields) |
void |
setCancelCallback(Form.CancelCallback<T> cancelCallback) |
void |
setPrepareRemove(Form.PrepareRemove<T> removeCallback) |
void |
setPrepareReset(Form.PrepareReset<T> prepareReset) |
void |
setSaveCallback(Form.SaveCallback<T> saveCallback) |
protected boolean |
validate() |
void |
view(T model)
Executes the
Operation#VIEW operation and calls DataMapping.populateFormItems(Object, Form) if the form is not undefined. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisTransient, isUndefinedprotected Form.SaveCallback<T> saveCallback
protected Form.CancelCallback<T> cancelCallback
protected Form.PrepareReset<T> prepareReset
protected Form.PrepareRemove<T> prepareRemove
public AbstractForm(String id, StateMachine stateMachine, DataMapping<T> dataMapping, EmptyState emptyState)
protected void separateOptionalFields(boolean separateOptionalFields)
protected void markAsUnbound(String name)
protected void addHelp(String label, com.google.gwt.safehtml.shared.SafeHtml description)
public void addFormValidation(FormValidation<T> formValidation)
FormaddFormValidation in interface Form<T>protected elemental2.dom.HTMLElement createElement()
createElement in class org.jboss.gwt.elemento.core.LazyElementpublic void attach()
attach in interface Attachablepublic void detach()
detach in interface Attachablepublic final void view(T model)
Operation#VIEW operation and calls DataMapping.populateFormItems(Object, Form) if the form is not undefined.public void clear()
Operation#CLEAR operation and
calls DataMapping.clearFormItems(Form).public final void edit(T model)
Operation#EDIT operation and calls DataMapping.newModel(Object, Form) if the model
is transitive otherwise DataMapping.populateFormItems(Object, Form).public final boolean save()
Operation#SAVE operation,
calls DataMapping.persistModel(Object, Form) and finally calls the registered save callback (if any).public void setSaveCallback(Form.SaveCallback<T> saveCallback)
setSaveCallback in interface Form<T>public final void cancel()
Operation#CANCEL operation and calls the registered
cancel callback (if any).public void setCancelCallback(Form.CancelCallback<T> cancelCallback)
setCancelCallback in interface Form<T>public void setPrepareReset(Form.PrepareReset<T> prepareReset)
setPrepareReset in interface Form<T>public final void reset()
Operation#RESET operation.public void setPrepareRemove(Form.PrepareRemove<T> removeCallback)
setPrepareRemove in interface Form<T>public void remove()
Operation#REMOVE operation.protected void prepare(Form.State state)
protected void prepareEmptyState()
protected void prepareViewState()
protected void prepareEditState()
protected void flip(Form.State state)
public String getId()
public T getModel()
public StateMachine getStateMachine()
getStateMachine in interface Form<T>public <I> FormItem<I> getFormItem(String name)
getFormItem in interface Form<T>public Iterable<FormItem> getBoundFormItems()
getBoundFormItems in interface Form<T>public Iterable<FormItem> getFormItems()
getFormItems in interface Form<T>protected boolean validate()
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.