T - the grid bean typepublic class EditorImpl<T> extends Grid.AbstractGridExtension<T> implements Editor<T>
Editor interface.ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener| Constructor and Description |
|---|
EditorImpl(PropertySet<T> propertySet)
Constructor for internal implementation of the Editor.
|
| Modifier and Type | Method and Description |
|---|---|
Registration |
addCancelListener(EditorCancelListener<T> listener)
Adds an editor cancel
listener. |
Registration |
addSaveListener(EditorSaveListener<T> listener)
Adds an editor save
listener. |
void |
cancel()
Close the editor discarding any unsaved changes.
|
protected void |
doClose()
Handles clean up for closing the Editor.
|
protected void |
doEdit(T bean)
Handles editor component generation and adding them to the hierarchy of
the Grid.
|
void |
generateData(T item,
elemental.json.JsonObject jsonObject)
Adds custom data for the given item to its serialized
JsonObject
representation. |
Binder<T> |
getBinder()
Returns the underlying Binder from Editor.
|
String |
getCancelCaption()
Gets the caption of the cancel button in buffered mode.
|
EditorErrorGenerator<T> |
getErrorGenerator()
Gets the error message generator of this editor.
|
Grid<T> |
getGrid()
Gets the Grid instance which this editor belongs to.
|
String |
getSaveCaption()
Gets the caption of the save button in buffered mode.
|
protected EditorState |
getState()
Returns the shared state for this connector.
|
protected EditorState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
boolean |
isBuffered()
Returns whether Editor is buffered or not.
|
boolean |
isEnabled()
Returns whether Editor is enabled or not.
|
boolean |
isOpen()
Returns whether Editor is open or not.
|
boolean |
save()
Saves any changes from the Editor fields to the edited bean.
|
Editor<T> |
setBinder(Binder<T> binder)
Sets the underlying Binder to this Editor.
|
Editor<T> |
setBuffered(boolean buffered)
Sets the Editor buffered mode.
|
Editor<T> |
setCancelCaption(String cancelCaption)
Sets the caption of the cancel button in buffered mode.
|
Editor<T> |
setEnabled(boolean enabled)
Enables or disabled the Editor.
|
Editor<T> |
setErrorGenerator(EditorErrorGenerator<T> errorGenerator)
Sets the error message generator for this editor.
|
Editor<T> |
setSaveCaption(String saveCaption)
Sets the caption of the save button in buffered mode.
|
addComponentToGrid, extend, getInternalIdForColumn, getParent, removeComponentFromGridgetData, refresh, removeextend, getSupportedParentType, setParentaddAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, attach, beforeClientResponse, createState, detach, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isConnectorEnabled, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstateclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitdestroyAllData, destroyData, refreshDataaddAttachListener, addDetachListener, attach, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlergetConnectorIdpublic EditorImpl(PropertySet<T> propertySet)
propertySet - the property set to use for configuring the default binderpublic void generateData(T item, elemental.json.JsonObject jsonObject)
DataGeneratorJsonObject
representation. This JSON object will be sent to client-side
DataProvider.generateData in interface DataGenerator<T>item - the data item being serializedjsonObject - the JSON object being sent to the clientpublic Editor<T> setBinder(Binder<T> binder)
Editorpublic Binder<T> getBinder()
Editorpublic Editor<T> setBuffered(boolean buffered)
EditorsetBuffered in interface Editor<T>buffered - true if editor should be buffered; false if
notpublic Editor<T> setEnabled(boolean enabled)
EditorsetEnabled in interface Editor<T>enabled - true if editor should be enabled; false if notpublic boolean isBuffered()
EditorisBuffered in interface Editor<T>true if editor is buffered; false if notEditor.setBuffered(boolean)public boolean isEnabled()
Editorprotected void doEdit(T bean)
bean - the edited item; can't be nullpublic boolean save()
Editorpublic boolean isOpen()
Editorpublic void cancel()
Editorprotected void doClose()
public Editor<T> setSaveCaption(String saveCaption)
EditorsetSaveCaption in interface Editor<T>saveCaption - the save button captionpublic Editor<T> setCancelCaption(String cancelCaption)
EditorsetCancelCaption in interface Editor<T>cancelCaption - the cancel button captionpublic String getSaveCaption()
EditorgetSaveCaption in interface Editor<T>public String getCancelCaption()
EditorgetCancelCaption in interface Editor<T>protected EditorState getState()
AbstractClientConnector
As a side effect, marks the connector dirty so any changes done to the
state will be sent to the client. Use getState(false) to avoid
marking the connector as dirty.
getState in class Grid.AbstractGridExtension<T>protected EditorState getState(boolean markAsDirty)
AbstractClientConnectorgetState in class Grid.AbstractGridExtension<T>markAsDirty - true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()public Editor<T> setErrorGenerator(EditorErrorGenerator<T> errorGenerator)
EditorThe default message is a concatenation of column field validation failures and bean validation failures.
setErrorGenerator in interface Editor<T>errorGenerator - the function to generate error messages; not nullEditorErrorGeneratorpublic EditorErrorGenerator<T> getErrorGenerator()
EditorgetErrorGenerator in interface Editor<T>nullEditorErrorGeneratorpublic Registration addSaveListener(EditorSaveListener<T> listener)
Editorlistener.addSaveListener in interface Editor<T>listener - save listenerpublic Registration addCancelListener(EditorCancelListener<T> listener)
Editorlistener.addCancelListener in interface Editor<T>listener - cancel listenerCopyright © 2017 Vaadin Ltd. All rights reserved.