T
- The type of data being managedE
- The type of Editorpublic class OptionalFieldEditor<T,E extends Editor<? super T>> extends java.lang.Object implements CompositeEditor<T,T,E>, LeafValueEditor<T>
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; } }
CompositeEditor.EditorChain<C,E extends Editor<? super C>>
Editor.Ignore, Editor.Path
Modifier | Constructor and Description |
---|---|
protected |
OptionalFieldEditor(E subEditor)
Construct an OptionalFieldEditor backed by the given sub-Editor.
|
Modifier and Type | Method and Description |
---|---|
E |
createEditorForTraversal()
Returns the sub-Editor that the OptionalFieldEditor was constructed
with.
|
void |
flush()
Indicates that the Editor cycle is finished.
|
java.lang.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<? super T>> |
of(E subEditor)
Construct an OptionalFieldEditor backed by the given sub-Editor.
|
void |
onPropertyChange(java.lang.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(CompositeEditor.EditorChain<T,E> chain)
Called by the Editor framework to provide the
CompositeEditor.EditorChain . |
void |
setValue(T value)
Called by the EditorDriver to set the object the Editor is peered with
|
protected OptionalFieldEditor(E subEditor)
subEditor
- the sub-Editor that will be attached to the Editor
hierarchypublic static <T,E extends Editor<? super T>> OptionalFieldEditor<T,E> of(E subEditor)
T
- The type of data being managedE
- The type of EditorsubEditor
- the sub-Editor that will be attached to the Editor
hierarchypublic E createEditorForTraversal()
createEditorForTraversal
in interface CompositeEditor<T,T,E extends Editor<? super T>>
Editor
of type Epublic void flush()
ValueAwareEditor
flush
in interface ValueAwareEditor<T>
public java.lang.String getPathElement(E subEditor)
getPathElement
in interface CompositeEditor<T,T,E extends Editor<? super T>>
subEditor
- an instance of the Editor type previously passed into
CompositeEditor.EditorChain.attach(C, E)
public T getValue()
TakesValue
getValue
in interface TakesValue<T>
TakesValue.setValue(V)
public void onPropertyChange(java.lang.String... paths)
ValueAwareEditor
onPropertyChange
in interface ValueAwareEditor<T>
paths
- a list of String pathspublic void setDelegate(EditorDelegate<T> delegate)
HasEditorDelegate
setDelegate
in interface HasEditorDelegate<T>
delegate
- an EditorDelegate
of type Tpublic void setEditorChain(CompositeEditor.EditorChain<T,E> chain)
CompositeEditor
CompositeEditor.EditorChain
.setEditorChain
in interface CompositeEditor<T,T,E extends Editor<? super T>>
chain
- an CompositeEditor.EditorChain
instancepublic void setValue(T value)
ValueAwareEditor
ValueAwareEditors should preferentially use sub-editors to alter the properties of the object being edited.
setValue
in interface ValueAwareEditor<T>
setValue
in interface TakesValue<T>
value
- a value of type TTakesValue.getValue()