Revision: 9733
Author: b...@google.com
Date: Mon Feb 14 06:55:18 2011
Log: Edited wiki page Editors through web user interface.
http://code.google.com/p/google-web-toolkit/source/detail?r=9733

Modified:
 /wiki/Editors.wiki

=======================================
--- /wiki/Editors.wiki  Wed Jan 19 12:01:06 2011
+++ /wiki/Editors.wiki  Mon Feb 14 06:55:18 2011
@@ -78,7 +78,7 @@
* _Editor_: An object that supports editing zero or more properties of a bean. * An Editor may be composed of an arbitrary number of sub-Editors that edit the properties of a bean. * Most Editors are Widgets, but the framework does not require this. It is possible to create "headless" Editors that perform solely programmatically-driven changes. - * _Driver_: The "top-level" controller used to attach a bean to an Editor. The driver is responsible for descending into the Editor hierarchy to propagate data. Examples include the `SimpleBeanEditorDriver` and the `RequestFactoryEditorDriver`. + * _Driver_: The "top-level" controller used to attach a bean to an Editor. The driver is responsible for descending into the Editor hierarchy to propagate data. Examples include the [http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/editor/client/SimpleBeanEditorDriver.java SimpleBeanEditorDriver] and the [http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/requestfactory/client/RequestFactoryEditorDriver.java RequestFactoryEditorDriver]. * _Adapter_: One of a number of provided types that provide "canned" behaviors for the Editor framework.

 == General workflow ==
@@ -190,6 +190,35 @@
* This driver type requires a `RequestContext` in order to automatically call `RequestContext.edit()` on any `EntityProxy` instances that are encountered. * Subscriptions are supported by listening for `EntityProxyChange` events on the `RequestFactory`'s `EventBus`.

+The top-level drivers extend a base interface, `EditorDriver`, which provides the following methods:
+  * `accept(EditorVisitor)` allows traversal of the Editor hierarchy.
+ * `getErrors()` returns all unconsumed errors generated during the last call to `flush()`.
+  * `hasErrors()` returns a boolean value.
+ * `isDirty()` returns `true` if any of the Editors in the hierarchy have been modified felative to the last value passed into `edit()`. + * `setConstraintViolations()` maps `ConstraintViolation` objects into the editor hierarchy.
+
+== !EditorVisitor ==
+
+The Editor framework provides for traversal of an Editor hierarchy via a visitor pattern. Each Editor in the hierarchy will be visited with a paired `visit(EditorContext) / endVisit(EditorContext)` call in the `EditorVisitor` passed into `EditorDriver.accept()`. The `EditorContext` object provides the following methods: + * `asXYZEditor()` is a convenience casting method which will return `null` if the current Editor does not conform to the desired interface.
+      {{{
+LeafValueEditor asLeaf = editorContext.asLeafValueEditor();
+if (asLeaf != null) {
+  doSomething(asLeaf.getValue());
+}
+}}}
+  * `canSetInModel()` returns `true` if `setInModel(Object)` can be called.
+ * `checkAssignment(Object)` avoids the need for an unsafe generic cast when using `setInModel`.
+  * `getAbsolutePath()` returns the absolute path of the current Editor.
+  * `getEditedtype()` returns the base type the Editor operates on.
+  * `getEditor()` returns the current Editor
+ * `getEditorDelegate()` will return the `EditorDelegate` associated with the current Editor, if it exists. Editors that only implement `LeafValueEditor` do not have `EditorDelegate` instances. + * `getFromModel()` queries the object graph being edited for the value the Editor should display. + * `setInModel()` updates the object graph being edited with a new value. This method should always be accompanied by a check of `canSetInModel()` since not all values may be mutable in the model graph. + * `traverseSyntheticCompositeEditor()` allows an editor created by `CompositeEditor.createEditorForTraversal()` to be traversed in order to examine the canonical structure of the composite Editors.
+
+As all of the built-in Editor framework behaviors are built in terms of `EditorVisitor`, it can be helpful to refer to [http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/editor/client/impl/Flusher.java implementation classes] for examples of how to implement additional behaviors.
+
 == FAQ ==

 === Editor vs. !IsEditor ==

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to