T
- The type of data being managedE
- The type of Editorpublic class ListEditor<T,E extends Editor<? super T>> extends Object implements CompositeEditor<List<T>,T,E>
The ListEditor will have no backing list until setValue(List)
is
called with a non-null value.
CompositeEditor.EditorChain<C,E extends Editor<? super C>>
Editor.Ignore, Editor.Path
Modifier | Constructor and Description |
---|---|
protected |
ListEditor(EditorSource<E> source)
Create a ListEditor backed by an EditorSource.
|
Modifier and Type | Method and Description |
---|---|
E |
createEditorForTraversal()
Creates a temporary sub-Editor to use for traversal.
|
void |
flush()
Indicates that the Editor cycle is finished.
|
List<E> |
getEditors()
Returns an unmodifiable, live view of the Editors managed by the
ListEditor.
|
List<T> |
getList()
Returns a live view of the ListEditor's backing data.
|
String |
getPathElement(E subEditor)
Used to implement
EditorDelegate.getPath() for the component
Editors. |
static <T,E extends Editor<? super T>> |
of(EditorSource<E> source)
Create a ListEditor backed by an EditorSource.
|
void |
onPropertyChange(String... paths)
Notifies the Editor that one or more value properties have changed.
|
void |
setDelegate(EditorDelegate<List<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(List<T> value)
Sets the ListEditor's backing data.
|
protected ListEditor(EditorSource<E> source)
source
- the EditorSource which will create sub-Editorspublic static <T,E extends Editor<? super T>> ListEditor<T,E> of(EditorSource<E> source)
T
- The type of data being managedE
- The type of Editorsource
- the EditorSource which will create sub-Editorspublic E createEditorForTraversal()
createEditorForTraversal
in interface CompositeEditor<List<T>,T,E extends Editor<? super T>>
Editor
of type Epublic void flush()
ValueAwareEditor
flush
in interface ValueAwareEditor<List<T>>
public List<E> getEditors()
The returned list will be live until the next call to setValue(List)
and shouldn't be used after that. Editors might (or might not) be reused
after a call to setValue(List)
.
If there is no backing list, an empty list will be returned.
Editors
of type Epublic List<T> getList()
The structure of the List may be mutated arbitrarily, subject to the
limitations of the backing List, but the elements themselves should not
be mutated except through getEditors()
to avoid data
inconsistency.
Returns null if there is no backing list, and edits cannot be made.
ListEditor<Foo, MyFooEditor> listEditor = ListEditor.of(...); listEditor.setValue(listOfFoo); // Usually called by EditorDriver listEditor.getList().set(1, new Foo()); listEditor.getEditors().get(1).getFooFieldEditor().setValue(....);
null
if there is no backing list.public String getPathElement(E subEditor)
CompositeEditor
EditorDelegate.getPath()
for the component
Editors.getPathElement
in interface CompositeEditor<List<T>,T,E extends Editor<? super T>>
subEditor
- an instance of the Editor type previously passed into
CompositeEditor.EditorChain.attach(C, E)
public void onPropertyChange(String... paths)
ValueAwareEditor
onPropertyChange
in interface ValueAwareEditor<List<T>>
paths
- a list of String pathspublic void setDelegate(EditorDelegate<List<T>> delegate)
HasEditorDelegate
setDelegate
in interface HasEditorDelegate<List<T>>
delegate
- an EditorDelegate
of type Tpublic void setEditorChain(CompositeEditor.EditorChain<T,E> chain)
CompositeEditor
CompositeEditor.EditorChain
.setEditorChain
in interface CompositeEditor<List<T>,T,E extends Editor<? super T>>
chain
- an CompositeEditor.EditorChain
instanceCopyright © 2016. All rights reserved.