Interface EditorDriver<T>

    • Method Detail

      • accept

        void accept​(EditorVisitor visitor)
        Visit the Editor hierarchy controlled by the EditorDriver.
      • flush

        T flush()
        Update the object being edited with the current state of the Editor.
        Returns:
        an implementation-specific value
      • getErrors

        java.util.List<EditorError> getErrors()
        Returns any unconsumed EditorErrors from the last call to flush().
        Returns:
        a List of EditorError instances
      • hasErrors

        boolean hasErrors()
        Indicates if the last call to flush() resulted in any errors.
        Returns:
        true if errors are present
      • isDirty

        boolean isDirty()
        Returns true if any of the Editors in the hierarchy have been modified relative to the last value passed into SimpleBeanEditorDriver.edit(Object).

        This method is not affected by flush() to support the following workflow:

        1. EditorDriver.edit()
        2. The user edits the on-screen values
        3. EditorDriver.flush()
        4. The data in the edited object is validated:
          1. The validation fails, returning to step 2
          2. The validation succeeds and the editing UI is dismissed
        The simplest implementation of a "navigate away from dirty UI warning" by checking isDirty() is correct for the above workflow. If the flush() method were to clear the dirty state, it would be necessary to implement an alternate flag to distinguish between a newly-initialized editor entering step 2 or re-entering step 2.
        See Also:
        EditorDelegate.setDirty(boolean)