Class ListEditor<T,E extends Editor<? super T>>
java.lang.Object
com.google.gwt.editor.client.adapters.ListEditor<T,E>
- Type Parameters:
T- The type of data being managedE- The type of Editor
- All Implemented Interfaces:
CompositeEditor<List<T>,,T, E> Editor<List<T>>,HasEditorDelegate<List<T>>,ValueAwareEditor<List<T>>
- Direct Known Subclasses:
HasDataEditor
public class ListEditor<T,E extends Editor<? super T>>
extends Object
implements CompositeEditor<List<T>,T,E>
Manages a list of objects and their associated Editors.
The ListEditor will have no backing list until setValue(List) is
called with a non-null value.
-
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
ConstructorsModifierConstructorDescriptionprotectedListEditor(EditorSource<E> source) Create a ListEditor backed by an EditorSource. -
Method Summary
Modifier and TypeMethodDescriptionCreates a temporary sub-Editor to use for traversal.voidflush()Indicates that the Editor cycle is finished.Returns an unmodifiable, live view of the Editors managed by the ListEditor.getList()Returns a live view of the ListEditor's backing data.getPathElement(E subEditor) Used to implementEditorDelegate.getPath()for the component Editors.static <T,E extends Editor<? super T>>
ListEditor<T, E> of(EditorSource<E> source) Create a ListEditor backed by an EditorSource.voidonPropertyChange(String... paths) Notifies the Editor that one or more value properties have changed.voidsetDelegate(EditorDelegate<List<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.voidSets the ListEditor's backing data.
-
Constructor Details
-
ListEditor
Create a ListEditor backed by an EditorSource.- Parameters:
source- the EditorSource which will create sub-Editors
-
-
Method Details
-
of
Create a ListEditor backed by an EditorSource.- Type Parameters:
T- The type of data being managedE- The type of Editor- Parameters:
source- the EditorSource which will create sub-Editors- Returns:
- a new instance of ListEditor
-
createEditorForTraversal
Creates a temporary sub-Editor to use for traversal.- Specified by:
createEditorForTraversalin interfaceCompositeEditor<List<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>
-
getEditors
Returns an unmodifiable, live view of the Editors managed by the ListEditor.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 tosetValue(List).If there is no backing list, an empty list will be returned.
- Returns:
- a List of
Editorsof type E
-
getList
Returns a live view of the ListEditor's backing data.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(....);
- Returns:
- a live view of the ListEditor's backing data, or
nullif there is no backing list.
-
getPathElement
Description copied from interface:CompositeEditorUsed to implementEditorDelegate.getPath()for the component Editors.- Specified by:
getPathElementin interfaceCompositeEditor<List<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
-
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<List<T>,T, E extends Editor<? super T>> - Parameters:
chain- anCompositeEditor.EditorChaininstance
-
setValue
Sets the ListEditor's backing data.If a null is passed in, the ListEditor will have no backing list and edits cannot be made.
- Specified by:
setValuein interfaceValueAwareEditor<T>- Parameters:
value- a List of data objects of type T
-