GWT 2.7.0

com.google.gwt.editor.client
Interface EditorDriver<T>

Type Parameters:
T - the type of data returned from flush()
All Known Subinterfaces:
RequestFactoryEditorDriver<P,E>, SimpleBeanEditorDriver<T,E>
All Known Implementing Classes:
MockRequestFactoryEditorDriver, MockSimpleBeanEditorDriver

public interface EditorDriver<T>

Defines common capabilities of editor drivers.

The EditorDriver interface cannot be used with GWT.create() directly. Instead, use one of the specializations of this interface.

See Also:
SimpleBeanEditorDriver, RequestFactoryEditorDriver

Method Summary
 void accept(EditorVisitor visitor)
          Visit the Editor hierarchy controlled by the EditorDriver.
 T flush()
          Update the object being edited with the current state of the Editor.
 java.util.List<EditorError> getErrors()
          Returns any unconsumed EditorErrors from the last call to flush().
 boolean hasErrors()
          Indicates if the last call to flush() resulted in any errors.
 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).
 boolean setConstraintViolations(java.lang.Iterable<ConstraintViolation<?>> violations)
          Show ConstraintViolations generated through a Validator.
 

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)

setConstraintViolations

boolean setConstraintViolations(java.lang.Iterable<ConstraintViolation<?>> violations)
Show ConstraintViolations generated through a Validator. The violations will be converted into EditorError objects whose getUserData() method can be used to access the original ConstraintViolation object.

Parameters:
violations - an Iterable over ConstraintViolation instances
Returns:
true if there were any unconsumed EditorErrors which can be retrieved from getErrors()

GWT 2.7.0