T
- the type of object being editedE
- the type of editorpublic abstract class AbstractEditorDelegate<T,E extends Editor<T>> extends Object implements EditorDelegate<T>
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractEditorDelegate.Chain<R,S extends Editor<R>>
The machinery for attaching and detaching editors from the hierarchy via a
CompositeEditor . |
Constructor and Description |
---|
AbstractEditorDelegate() |
Modifier and Type | Method and Description |
---|---|
abstract void |
accept(EditorVisitor visitor) |
protected <R,S extends Editor<R>> |
addSubDelegate(AbstractEditorDelegate<R,S> subDelegate,
String path,
S subEditor)
Initialize a sub-delegate whenever one is added to the editor hierarchy.
|
protected String |
appendPath(String path) |
protected static String |
appendPath(String prefix,
String path) |
protected <R,S extends Editor<R>> |
createChain(Class<R> composedElementType) |
protected AbstractEditorDelegate<?,?> |
createComposedDelegate()
Only implemented by delegates for a
CompositeEditor . |
protected EditorVisitor |
createInitializerVisitor() |
protected <Q> Q |
ensureMutable(Q object) |
protected abstract E |
getEditor() |
protected AbstractEditorDelegate.Chain<?,?> |
getEditorChain() |
protected List<EditorError> |
getErrors() |
abstract T |
getObject() |
String |
getPath()
Returns the Editor's path, relative to the root object.
|
protected void |
initialize(String pathSoFar,
E editor) |
protected abstract void |
initializeSubDelegates() |
boolean |
isDirty()
Just returns the last value passed to
setDirty(boolean) . |
void |
recordError(String message,
Object value,
Object userData)
This method should be called from
ValueAwareEditor.flush() or
TakesValue.getValue() to record an error that will be reported
to the nearest super-Editor that implements the HasEditorErrors
interface. |
void |
recordError(String message,
Object value,
Object userData,
String extraPath,
Editor<?> leafEditor) |
void |
setDirty(boolean dirty)
Toggle the dirty-state flag for the Editor.
|
protected abstract void |
setEditor(E editor) |
protected abstract void |
setObject(T object) |
protected boolean |
shouldFlush()
Indicates whether or not calls to
#flush are expected as part of
normal operation. |
abstract HandlerRegistration |
subscribe()
Register for notifications if object being edited is updated.
|
public abstract void accept(EditorVisitor visitor)
public abstract T getObject()
public String getPath()
EditorDelegate
getPath
in interface EditorDelegate<T>
public boolean isDirty()
setDirty(boolean)
.public void recordError(String message, Object value, Object userData)
EditorDelegate
ValueAwareEditor.flush()
or
TakesValue.getValue()
to record an error that will be reported
to the nearest super-Editor that implements the HasEditorErrors
interface.recordError
in interface EditorDelegate<T>
message
- a textual description of the errorvalue
- the value to be returned by EditorError.getValue()
or
null
if the value currently associated with the
Editor should be useduserData
- an arbitrary object, possibly null
, that can
be retrieved with EditorError.getUserData()
public void recordError(String message, Object value, Object userData, String extraPath, Editor<?> leafEditor)
public void setDirty(boolean dirty)
EditorDelegate
The dirty state of an Editor will be automatically cleared any time the
Driver's edit()
or flush()
methods are called.
The dirty state will be automatically calculated for
LeafValueEditor
instances based on an Object.equals(Object)
comparison of TakesValue.getValue()
and the value last passed
to TakesValue.setValue(Object)
, however a clean state can be
overridden by calling setDirty(true)
.
setDirty
in interface EditorDelegate<T>
dirty
- the dirty state of the Editorpublic abstract HandlerRegistration subscribe()
EditorDelegate
null
.
The notification will occur via ValueAwareEditor.onPropertyChange(java.lang.String...)
if the backend supports in-place property updates, otherwise updates will
be passed via ValueAwareEditor.setValue(T)
.
subscribe
in interface EditorDelegate<T>
null
if the delegate does not support subscriptionprotected <R,S extends Editor<R>> void addSubDelegate(AbstractEditorDelegate<R,S> subDelegate, String path, S subEditor)
protected AbstractEditorDelegate<?,?> createComposedDelegate()
CompositeEditor
.protected EditorVisitor createInitializerVisitor()
protected <Q> Q ensureMutable(Q object)
protected abstract E getEditor()
protected AbstractEditorDelegate.Chain<?,?> getEditorChain()
protected List<EditorError> getErrors()
protected abstract void initializeSubDelegates()
protected abstract void setEditor(E editor)
protected abstract void setObject(T object)
protected boolean shouldFlush()
#flush
are expected as part of
normal operation.Copyright © 2018. All rights reserved.