Class OptionalFieldEditor<T,E extends Editor<? super T>>
java.lang.Object
com.google.gwt.editor.client.adapters.OptionalFieldEditor<T,E>
- Type Parameters:
T- The type of data being managedE- The type of Editor
- All Implemented Interfaces:
CompositeEditor<T,,T, E> Editor<T>,HasEditorDelegate<T>,LeafValueEditor<T>,ValueAwareEditor<T>,TakesValue<T>
public class OptionalFieldEditor<T,E extends Editor<? super T>>
extends Object
implements CompositeEditor<T,T,E>, LeafValueEditor<T>
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;
}
}
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.gwt.editor.client.CompositeEditor
CompositeEditor.EditorChain<C,E extends Editor<? super C>> Nested classes/interfaces inherited from interface com.google.gwt.editor.client.Editor
Editor.Ignore, Editor.Path -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOptionalFieldEditor(E subEditor) Construct an OptionalFieldEditor backed by the given sub-Editor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the sub-Editor that the OptionalFieldEditor was constructed with.voidflush()Indicates that the Editor cycle is finished.getPathElement(E subEditor) Returns an empty string because there is only ever one sub-editor used.getValue()Returns the current value.static <T,E extends Editor<? super T>>
OptionalFieldEditor<T,E> of(E subEditor) Construct an OptionalFieldEditor backed by the given sub-Editor.voidonPropertyChange(String... paths) Notifies the Editor that one or more value properties have changed.voidsetDelegate(EditorDelegate<T> delegate) Called by the EditorDriver to provide access to the EditorDelegate the Editor is peered with.voidsetEditorChain(CompositeEditor.EditorChain<T, E> chain) Called by the Editor framework to provide theCompositeEditor.EditorChain.voidCalled by the EditorDriver to set the object the Editor is peered with
-
Constructor Details
-
OptionalFieldEditor
Construct an OptionalFieldEditor backed by the given sub-Editor.- Parameters:
subEditor- the sub-Editor that will be attached to the Editor hierarchy
-
-
Method Details
-
of
Construct an OptionalFieldEditor backed by the given sub-Editor.- Type Parameters:
T- The type of data being managedE- The type of Editor- Parameters:
subEditor- the sub-Editor that will be attached to the Editor hierarchy- Returns:
- a new instance of OptionalFieldEditor
-
createEditorForTraversal
Returns the sub-Editor that the OptionalFieldEditor was constructed with.- Specified by:
createEditorForTraversalin interfaceCompositeEditor<T,T, E extends Editor<? super T>> - Returns:
- an
Editorof type E
-
flush
public void flush()Description copied from interface:ValueAwareEditorIndicates 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.- Specified by:
flushin interfaceValueAwareEditor<T>
-
getPathElement
Returns an empty string because there is only ever one sub-editor used.- Specified by:
getPathElementin interfaceCompositeEditor<T,T, E extends Editor<? super T>> - Parameters:
subEditor- an instance of the Editor type previously passed intoCompositeEditor.EditorChain.attach(C, E)- Returns:
- the path element as a String
-
getValue
Description copied from interface:TakesValueReturns the current value.- Specified by:
getValuein interfaceTakesValue<T>- Returns:
- the value as an object of type V
- See Also:
-
onPropertyChange
Description copied from interface:ValueAwareEditorNotifies the Editor that one or more value properties have changed. Not all backing services support property-based notifications.- Specified by:
onPropertyChangein interfaceValueAwareEditor<T>- Parameters:
paths- a list of String paths
-
setDelegate
Description copied from interface:HasEditorDelegateCalled by the EditorDriver to provide access to the EditorDelegate the Editor is peered with.- Specified by:
setDelegatein interfaceHasEditorDelegate<T>- Parameters:
delegate- anEditorDelegateof type T
-
setEditorChain
Description copied from interface:CompositeEditorCalled by the Editor framework to provide theCompositeEditor.EditorChain.- Specified by:
setEditorChainin interfaceCompositeEditor<T,T, E extends Editor<? super T>> - Parameters:
chain- anCompositeEditor.EditorChaininstance
-
setValue
Description copied from interface:ValueAwareEditorCalled by the EditorDriver to set the object the Editor is peered withValueAwareEditors should preferentially use sub-editors to alter the properties of the object being edited.
- Specified by:
setValuein interfaceTakesValue<T>- Specified by:
setValuein interfaceValueAwareEditor<T>- Parameters:
value- a value of type T- See Also:
-