T - the grid bean typepublic class EditorImpl<T> extends Grid.AbstractGridExtension<T> implements Editor<T>
Editor interface.| Constructor and Description |
|---|
EditorImpl(Grid<T> grid,
PropertySet<T> propertySet) |
| Modifier and Type | Method and Description |
|---|---|
Registration |
addCancelListener(EditorCancelListener<T> listener)
Adds an editor cancel
listener. |
Registration |
addCloseListener(EditorCloseListener<T> listener)
Adds an editor close
listener. |
Registration |
addOpenListener(EditorOpenListener<T> listener)
Adds an editor open
listener. |
Registration |
addSaveListener(EditorSaveListener<T> listener)
Adds an editor save
listener. |
void |
cancel()
Cancel will discard any changes made in editor fields for a buffered
editor.
|
void |
closeEditor()
Closes the editor when in unbuffered mode and fires an
EditorCloseEvent if the edited item is not null. |
void |
editItem(T item)
Opens the editor component for the provided item and fires an
EditorOpenEvent. |
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.
|
Grid<T> |
getGrid()
Gets the Grid this extension extends.
|
T |
getItem()
Gets the current item being edited, if any.
|
boolean |
isBuffered()
Returns whether Editor is buffered or not.
|
boolean |
isOpen()
Returns whether Editor is open or not.
|
void |
refresh()
Refreshes the editor components for the current item being edited.
|
boolean |
save()
In buffered mode calling save will validate bean and will save any
changes made to the Editor fields to the edited bean if all validators
pass.
|
Editor<T> |
setBinder(Binder<T> binder)
Sets the underlying Binder to this Editor.
|
Editor<T> |
setBuffered(boolean buffered)
Sets the Editor buffered mode.
|
extend, refresh, removeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdestroyAllData, destroyData, refreshDatapublic EditorImpl(Grid<T> grid, PropertySet<T> propertySet)
public 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 boolean isBuffered()
EditorisBuffered in interface Editor<T>true if editor is buffered; false if notEditor.setBuffered(boolean)public boolean isOpen()
Editorpublic boolean save()
Editor
A successful write will fire an EditorSaveEvent and close the
editor that will fire an EditorCloseEvent.
If the write fails then there will be no events and the editor will stay open.
Note! For an unbuffered editor calling save will have no effect and
always return false.
public void cancel()
Editor
Calling cancel will fire an EditorCancelEvent and close the
editor that will fire an EditorCloseEvent if the edited item is
not null.
public void closeEditor()
EditorEditorCloseEvent if the edited item is not null.
For buffered mode calling close editor will throw an
UnsupportedOperationException as either Editor.save() or
Editor.cancel() should be used.
closeEditor in interface Editor<T>public void editItem(T item)
EditorEditorOpenEvent.
In case there is an open editor an EditorCloseEvent will also be
fired.
public void refresh()
EditorThis is useful when the state of the item is changed while the editor is open.
refresh in interface Editor<T>Editor.isOpen()public T getItem()
Editor
The item being edited is always null while the editor is
closed. The item is not null during Editor.save() and
Editor.cancel() operations, but become null as soon as the
editor is closed.
getItem in interface Editor<T>null if none is being
editedEditor.editItem(Object)public Grid<T> getGrid()
Grid.AbstractGridExtensionpublic 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 Registration addSaveListener(EditorSaveListener<T> listener)
EditoraddSaveListener in interface Editor<T>listener - save listenerpublic Registration addCancelListener(EditorCancelListener<T> listener)
EditoraddCancelListener in interface Editor<T>listener - cancel listenerpublic Registration addOpenListener(EditorOpenListener<T> listener)
Editorlistener. EditorOpenEvent is fired
when the editor is opened through Editor.editItem(java.lang.Object)addOpenListener in interface Editor<T>listener - open listenerpublic Registration addCloseListener(EditorCloseListener<T> listener)
Editorlistener. Close events are sent every time
the editor is closed, no matter if it is due to a close, save or to a
cancel operation.
When a successful Editor.save() operation is performed, two listeners
are triggered: save and close listeners. Likewise, when a
Editor.cancel() operation is performed, two listeners are triggered,
cancel and close listeners.
addCloseListener in interface Editor<T>listener - close listenerCopyright © 2025. All rights reserved.