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.

    • 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.
      • cancel

        void cancel()
        Cancels any modifications to the model.
      • reset

        void reset()
        Resets the model.
      • 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.
      • getFormItems

        Iterable<FormItem> getFormItems()
        Returns:
        return all form items.
      • 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.