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()
Close the editor discarding any unsaved changes.
|
void |
editItem(T item)
Opens the editor interface for the provided item.
|
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.
|
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.
|
extend, refresh, remove
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
destroyAllData, destroyData, refreshData
public EditorImpl(Grid<T> grid, PropertySet<T> propertySet)
public Editor<T> setBinder(Binder<T> binder)
Editor
public Binder<T> getBinder()
Editor
public Editor<T> setBuffered(boolean buffered)
Editor
setBuffered
in interface Editor<T>
buffered
- true
if editor should be buffered; false
if
notpublic boolean isBuffered()
Editor
isBuffered
in interface Editor<T>
true
if editor is buffered; false
if notEditor.setBuffered(boolean)
public boolean isOpen()
Editor
public boolean save()
Editor
public void cancel()
Editor
public void editItem(T item)
Editor
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.AbstractGridExtension
public void generateData(T item, elemental.json.JsonObject jsonObject)
DataGenerator
JsonObject
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)
Editor
listener
.addSaveListener
in interface Editor<T>
listener
- save listenerpublic Registration addCancelListener(EditorCancelListener<T> listener)
Editor
listener
.addCancelListener
in interface Editor<T>
listener
- cancel listenerpublic Registration addOpenListener(EditorOpenListener<T> listener)
Editor
listener
.addOpenListener
in interface Editor<T>
listener
- open listenerpublic Registration addCloseListener(EditorCloseListener<T> listener)
Editor
listener
. Close events are sent every time
the editor is closed, no matter if it is due to a 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 © 2018. All rights reserved.