Package org.jboss.hal.ballroom.form
Interface Form<T>
-
- Type Parameters:
T- The model for this form
- All Superinterfaces:
Attachable,org.jboss.elemento.IsElement
- All Known Implementing Classes:
AbstractForm
public interface Form<T> extends org.jboss.elemento.IsElement, Attachable
A form bound to a model using well defined states and operations. The form contains a list of form items which are used to view and modify the attributes of the model.Form items can be bound or unbound: Bound form items show the attributes of the model (text input, check boxes or select boxes). They're part of the automatic data mapping between the form and the model. Unbound form items have no relation to the model (static text or buttons). They are not part of the automatic data mapping.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceForm.CancelCallback<T>static classForm.FinishRemove<T>Callback to be used after the remove operation has been successfully executed.static classForm.FinishReset<T>Callback to be used after the reset operation has been successfully executed.static classForm.Operationstatic interfaceForm.PrepareRemove<T>Callback to prepare the remove operation.static interfaceForm.PrepareReset<T>Callback to prepare the reset operation.static interfaceForm.SaveCallback<T>static classForm.State
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddFormValidation(FormValidation<T> formValidation)Makes it possible to validate the form as a whole or to check fields which depend on other fields.voidcancel()Cancels any modifications to the model.voidclear()Clears this form by removing the model reference and by clearing all form fields.voidedit(T model)Takes the specified model and populates the editing state with the values from the model.Iterable<FormItem>getBoundFormItems()<F> FormItem<F>getFormItem(String name)Iterable<FormItem>getFormItems()StringgetId()TgetModel()StateMachinegetStateMachine()booleanisTransient()booleanisUndefined()voidremove()Removes the model.voidreset()Resets the model.booleansave()Validates the form and its fields and upon successful validation persists the changes to the model and calls the save callback.voidsetCancelCallback(Form.CancelCallback<T> cancelCallback)voidsetPrepareRemove(Form.PrepareRemove<T> removeCallback)voidsetPrepareReset(Form.PrepareReset<T> prepareReset)voidsetSaveCallback(Form.SaveCallback<T> saveCallback)voidview(T model)Takes the specified model and updates the read-only state with the values from the model.-
Methods inherited from interface org.jboss.hal.ballroom.Attachable
attach, detach
-
-
-
-
Method Detail
-
isUndefined
boolean isUndefined()
-
isTransient
boolean isTransient()
-
view
void view(T model)
Takes the specified model and updates the read-only state with the values from the model.- Parameters:
model- the model to view.
-
clear
void clear()
Clears this form by removing the model reference and by clearing all form fields.
-
edit
void edit(T model)
Takes the specified model and populates the editing state with the values from the model.- Parameters:
model- the model to edit.
-
save
boolean save()
Validates the form and its fields and upon successful validation persists the changes to the model and calls the save callback.
-
setSaveCallback
void setSaveCallback(Form.SaveCallback<T> saveCallback)
-
cancel
void cancel()
Cancels any modifications to the model.
-
setCancelCallback
void setCancelCallback(Form.CancelCallback<T> cancelCallback)
-
setPrepareReset
void setPrepareReset(Form.PrepareReset<T> prepareReset)
-
reset
void reset()
Resets the model.
-
setPrepareRemove
void setPrepareRemove(Form.PrepareRemove<T> removeCallback)
-
remove
void remove()
Removes the model.
-
getId
String getId()
- Returns:
- an unique identifier for this form.
-
getModel
T getModel()
- Returns:
- the current model.
-
getStateMachine
StateMachine getStateMachine()
- Returns:
- the state machine which access to the current state.
-
getBoundFormItems
Iterable<FormItem> getBoundFormItems()
- Returns:
- only those form items which are bound to the model.
-
addFormValidation
void addFormValidation(FormValidation<T> formValidation)
Makes it possible to validate the form as a whole or to check fields which depend on other fields.
-
-