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.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(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()
.boolean
Indicates if the last call toflush()
resulted in any errors.boolean
isDirty()
Returnstrue
if any of the Editors in the hierarchy have been modified relative to the last value passed intoSimpleBeanEditorDriver.edit(Object)
.boolean
setConstraintViolations
(Iterable<ConstraintViolation<?>> violations) ShowConstraintViolations
generated 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
EditorError
instances
-
hasErrors
boolean hasErrors()Indicates if the last call toflush()
resulted in any errors.- Returns:
true
if errors are present
-
isDirty
boolean isDirty()Returnstrue
if 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
ShowConstraintViolations
generated through aValidator
. The violations will be converted intoEditorError
objects whosegetUserData()
method can be used to access the original ConstraintViolation object.- Parameters:
violations
- an Iterable overConstraintViolation
instances- Returns:
true
if there were any unconsumed EditorErrors which can be retrieved fromgetErrors()
-