com.vaadin.ui.components.grid.
Interface Editor<T>
-
Type Parameters:
T
-All Superinterfaces:
All Known Implementing Classes:
public interface Editor<T> extends Serializable
An editor in a Grid.
Since:
8.0
Author:
Vaadin Ltd
-
-
Method Summary
All Methods Modifier and Type Method Description Registration
addCancelListener(EditorCancelListener<T> listener)
Adds an editor cancel
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
editRow(int rowNumber)
Opens the editor interface for the provided row.
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.
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.
-
-
-
Method Detail
-
setBinder
Editor<T> setBinder(Binder<T> binder)
Sets the underlying Binder to this Editor.
Parameters:
binder
- the binder for updating editor fields; notnull
Returns:
this editor
-
getBinder
Binder<T> getBinder()
Returns the underlying Binder from Editor.
Returns:
the binder; not
null
-
setBuffered
Editor<T> setBuffered(boolean buffered)
Sets the Editor buffered mode. When the editor is in buffered mode, edits are only committed when the user clicks the save button. In unbuffered mode valid changes are automatically committed.
Parameters:
buffered
-true
if editor should be buffered;false
if notReturns:
this editor
-
setEnabled
Editor<T> setEnabled(boolean enabled)
Enables or disabled the Editor. A disabled editor cannot be opened.
Parameters:
enabled
-true
if editor should be enabled;false
if notReturns:
this editor
-
isBuffered
boolean isBuffered()
Returns whether Editor is buffered or not.
Returns:
true
if editor is buffered;false
if notSee Also:
-
isEnabled
boolean isEnabled()
Returns whether Editor is enabled or not.
Returns:
true
if editor is enabled;false
if not
-
isOpen
boolean isOpen()
Returns whether Editor is open or not.
Returns:
true
if editor is open;false
if not
-
save
boolean save()
Saves any changes from the Editor fields to the edited bean.
Returns:
true
if save succeeded;false
if not
-
cancel
void cancel()
Close the editor discarding any unsaved changes.
-
editRow
void editRow(int rowNumber)
Opens the editor interface for the provided row. Scrolls the Grid to bring the row to view if it is not already visible. Note that any cell content rendered by a WidgetRenderer will not be visible in the editor row.
Parameters:
rowNumber
- the row number of the edited itemThrows:
IllegalStateException
- if the editor is not enabled, Grid is read-only, or already editing a different item in buffered modeIllegalArgumentException
- if therowNumber
is not in the backing data providerSince:
8.2
See Also:
-
setSaveCaption
Editor<T> setSaveCaption(String saveCaption)
Sets the caption of the save button in buffered mode.
Parameters:
saveCaption
- the save button captionReturns:
this editor
-
setCancelCaption
Editor<T> setCancelCaption(String cancelCaption)
Sets the caption of the cancel button in buffered mode.
Parameters:
cancelCaption
- the cancel button captionReturns:
this editor
-
getSaveCaption
String getSaveCaption()
Gets the caption of the save button in buffered mode.
Returns:
the save button caption
-
getCancelCaption
String getCancelCaption()
Gets the caption of the cancel button in buffered mode.
Returns:
the cancel button caption
-
setErrorGenerator
Editor<T> setErrorGenerator(EditorErrorGenerator<T> errorGenerator)
Sets the error message generator for this editor.
The default message is a concatenation of column field validation failures and bean validation failures.
Parameters:
errorGenerator
- the function to generate error messages; notnull
Returns:
this editor
See Also:
-
getErrorGenerator
EditorErrorGenerator<T> getErrorGenerator()
Gets the error message generator of this editor.
Returns:
the function that generates error messages; not
null
See Also:
-
addSaveListener
Registration addSaveListener(EditorSaveListener<T> listener)
Adds an editor save
listener
.Parameters:
listener
- save listenerReturns:
a registration object for removing the listener
-
addCancelListener
Registration addCancelListener(EditorCancelListener<T> listener)
Adds an editor cancel
listener
.Parameters:
listener
- cancel listenerReturns:
a registration object for removing the listener
-
addOpenListener
Registration addOpenListener(EditorOpenListener<T> listener)
Adds an editor open
listener
.Parameters:
listener
- open listenerReturns:
a registration object for removing the listener
Since:
8.1
-
-