Class ListValidationEditor<T,E extends com.google.gwt.editor.client.Editor<? super T>>
- java.lang.Object
-
- de.knightsoftnet.validators.client.editor.impl.ListValidationEditor<T,E>
-
- Type Parameters:
T- The type of data being managedE- The type of Editor
- All Implemented Interfaces:
com.google.gwt.editor.client.CompositeEditor<List<T>,T,E>,com.google.gwt.editor.client.Editor<List<T>>,com.google.gwt.editor.client.HasEditorDelegate<List<T>>,com.google.gwt.editor.client.ValueAwareEditor<List<T>>,HasParentDriverSetter
public class ListValidationEditor<T,E extends com.google.gwt.editor.client.Editor<? super T>> extends Object implements com.google.gwt.editor.client.CompositeEditor<List<T>,T,E>, HasParentDriverSetter
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
com.google.gwt.editor.client.CompositeEditor.EditorChain<C extends Object,E extends com.google.gwt.editor.client.Editor<? super C>>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedListValidationEditor(com.google.gwt.editor.client.adapters.EditorSource<E> source)Create a ListEditor backed by an EditorSource.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EcreateEditorForTraversal()Creates a temporary sub-Editor to use for traversal.voidflush()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.StringgetPathElement(E subEditor)static <T,E extends com.google.gwt.editor.client.Editor<? super T>>
ListValidationEditor<T,E>of(com.google.gwt.editor.client.adapters.EditorSource<E> source)Create a ListEditor backed by an EditorSource.voidonPropertyChange(String... paths)voidsetDelegate(com.google.gwt.editor.client.EditorDelegate<List<T>> delegate)voidsetEditorChain(com.google.gwt.editor.client.CompositeEditor.EditorChain<T,E> chain)voidsetParentDriver(BeanValidationEditorDriver<?,?> pparentDriver)voidsetValue(List<T> value)Sets the ListEditor's backing data.
-
-
-
Constructor Detail
-
ListValidationEditor
protected ListValidationEditor(com.google.gwt.editor.client.adapters.EditorSource<E> source)
Create a ListEditor backed by an EditorSource.- Parameters:
source- the EditorSource which will create sub-Editors
-
-
Method Detail
-
of
public static <T,E extends com.google.gwt.editor.client.Editor<? super T>> ListValidationEditor<T,E> of(com.google.gwt.editor.client.adapters.EditorSource<E> source)
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
-
setParentDriver
public final void setParentDriver(BeanValidationEditorDriver<?,?> pparentDriver)
- Specified by:
setParentDriverin interfaceHasParentDriverSetter
-
createEditorForTraversal
public E createEditorForTraversal()
Creates a temporary sub-Editor to use for traversal.
-
flush
public void flush()
- Specified by:
flushin interfacecom.google.gwt.editor.client.ValueAwareEditor<T>
-
getEditors
public List<E> 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
public List<T> 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.
-
onPropertyChange
public void onPropertyChange(String... paths)
- Specified by:
onPropertyChangein interfacecom.google.gwt.editor.client.ValueAwareEditor<T>
-
setDelegate
public void setDelegate(com.google.gwt.editor.client.EditorDelegate<List<T>> delegate)
- Specified by:
setDelegatein interfacecom.google.gwt.editor.client.HasEditorDelegate<T>
-
setEditorChain
public void setEditorChain(com.google.gwt.editor.client.CompositeEditor.EditorChain<T,E> chain)
-
setValue
public void setValue(List<T> value)
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 interfacecom.google.gwt.editor.client.ValueAwareEditor<T>- Parameters:
value- a List of data objects of type T
-
-