public class

OptionalFieldEditor

extends Object
implements CompositeEditor<T, C, E extends Editor<C>> LeafValueEditor<T>
java.lang.Object
   ↳ com.google.gwt.editor.client.adapters.OptionalFieldEditor<T, E extends com.google.gwt.editor.client.Editor<T>>

Class Overview

This adapter can be used when a type being edited has an optional field that may be nullified or reassigned as part of the editing process. This consumer of this adapter will typically expose it via the IsEditor interface:

 class FooSelector extends Composite implements IsEditor<OptionalFieldEditor<Foo, FooEditor>> {
   private OptionalFieldEditor<Foo, FooEditor> editor = OptionalFieldEditor.of(new FooEditor());
   public OptionalFieldEditor<Foo, FooEditor> asEditor() {
     return editor;
   }
 }
 

Summary

Protected Constructors
OptionalFieldEditor(E subEditor)
Construct an OptionalFieldEditor backed by the given sub-Editor.
Public Methods
E createEditorForTraversal()
Returns the sub-Editor that the OptionalFieldEditor was constructed with.
void flush()
Indicates that the Editor cycle is finished.
String getPathElement(E subEditor)
Returns an empty string because there is only ever one sub-editor used.
T getValue()
Returns the current value.
static <T, E extends Editor<T>> OptionalFieldEditor<T, E> of(E subEditor)
Construct an OptionalFieldEditor backed by the given sub-Editor.
void onPropertyChange(String... paths)
Notifies the Editor that one or more value properties have changed.
void setDelegate(EditorDelegate<T> delegate)
Called by the EditorDriver to provide access to the EditorDelegate the Editor is peered with.
void setEditorChain(EditorChain<T, E> chain)
void setValue(T value)
Called by the EditorDriver to set the object the Editor is peered with

ValueAwareEditors should preferentially use sub-editors to alter the properties of the object being edited.

[Expand]
Inherited Methods
From class java.lang.Object
From interface com.google.gwt.editor.client.CompositeEditor
From interface com.google.gwt.editor.client.HasEditorDelegate
From interface com.google.gwt.editor.client.ValueAwareEditor
From interface com.google.gwt.user.client.TakesValue

Protected Constructors

protected OptionalFieldEditor (E subEditor)

Construct an OptionalFieldEditor backed by the given sub-Editor.

Parameters
subEditor the sub-Editor that will be attached to the Editor hierarchy

Public Methods

public E createEditorForTraversal ()

Returns the sub-Editor that the OptionalFieldEditor was constructed with.

Returns

public void flush ()

Indicates that the Editor cycle is finished. This method will be called in a depth-first order by the EditorDriver, so Editors do not generally need to flush their sub-editors.

public String getPathElement (E subEditor)

Returns an empty string because there is only ever one sub-editor used.

Parameters
subEditor an instance of the Editor type previously passed into EditorChain#attach
Returns
  • the path element as a String

public T getValue ()

Returns the current value.

Returns
  • the value as an object of type V

public static OptionalFieldEditor<T, E> of (E subEditor)

Construct an OptionalFieldEditor backed by the given sub-Editor.

Parameters
subEditor the sub-Editor that will be attached to the Editor hierarchy
Returns
  • a new instance of OptionalFieldEditor

public void onPropertyChange (String... paths)

Notifies the Editor that one or more value properties have changed. Not all backing services support property-based notifications.

Parameters
paths a list of String paths

public void setDelegate (EditorDelegate<T> delegate)

Called by the EditorDriver to provide access to the EditorDelegate the Editor is peered with.

Parameters
delegate an EditorDelegate of type T

public void setEditorChain (EditorChain<T, E> chain)

public void setValue (T value)

Called by the EditorDriver to set the object the Editor is peered with

ValueAwareEditors should preferentially use sub-editors to alter the properties of the object being edited.

Parameters
value a value of type T