Package com.google.gwt.editor.client
Interface EditorDriver<T>
- Type Parameters:
T- the type of data returned fromflush()
- 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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(EditorVisitor visitor) Visit the Editor hierarchy controlled by the EditorDriver.flush()Update the object being edited with the current state of the Editor.Returns any unconsumed EditorErrors from the last call toflush().booleanIndicates if the last call toflush()resulted in any errors.booleanisDirty()Returnstrueif any of the Editors in the hierarchy have been modified relative to the last value passed intoSimpleBeanEditorDriver.edit(Object).booleansetConstraintViolations(Iterable<ConstraintViolation<?>> violations) ShowConstraintViolationsgenerated through aValidator.
-
Method Details
-
accept
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
List<EditorError> getErrors()Returns any unconsumed EditorErrors from the last call toflush().- Returns:
- a List of
EditorErrorinstances
-
hasErrors
boolean hasErrors()Indicates if the last call toflush()resulted in any errors.- Returns:
trueif errors are present
-
isDirty
boolean isDirty()Returnstrueif any of the Editors in the hierarchy have been modified relative to the last value passed intoSimpleBeanEditorDriver.edit(Object).This method is not affected by
flush()to support the following workflow:EditorDriver.edit()- The user edits the on-screen values
EditorDriver.flush()- The data in the edited object is validated:
- The validation fails, returning to step 2
- The validation succeeds and the editing UI is dismissed
isDirty()is correct for the above workflow. If theflush()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:
-
setConstraintViolations
ShowConstraintViolationsgenerated through aValidator. The violations will be converted intoEditorErrorobjects whosegetUserData()method can be used to access the original ConstraintViolation object.- Parameters:
violations- an Iterable overConstraintViolationinstances- Returns:
trueif there were any unconsumed EditorErrors which can be retrieved fromgetErrors()
-