T - the row type of the gridpublic static class Grid.Editor<T> extends Object implements DeferredWorker
| Modifier and Type | Class and Description |
|---|---|
static interface |
Grid.Editor.EventHandler<T>
A handler for events related to the Grid editor.
|
protected static class |
Grid.Editor.State
The internal state options for the editor.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
KEYCODE_HIDE
Deprecated.
use
DefaultEditorEventHandler.KEYCODE_CLOSE
instead |
static int |
KEYCODE_SHOW
Deprecated.
use
DefaultEditorEventHandler.KEYCODE_OPEN
instead |
| Constructor and Description |
|---|
Editor()
Constructs a new
Grid.Editor. |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancels the currently active edit and hides the editor.
|
void |
clearEditorColumnErrors()
Clears all editor error styles from the editor cells and clears the
error column collection.
|
protected com.google.gwt.dom.client.Element |
createCell(com.google.gwt.dom.client.TableCellElement td)
Creates an editor cell corresponding to the given table cell.
|
void |
editRow(int rowIndex)
If a cell of this Grid had focus once this editRow call was
triggered, the editor component at the previously focused column
index will be focused.
|
void |
editRow(int rowIndex,
int columnIndexDOM)
Opens the editor over the row with the given index and attempts to
focus the editor widget in the given column index.
|
String |
getCancelCaption()
Returns the caption of the cancel button.
|
protected int |
getElementColumn(com.google.gwt.dom.client.Element e)
Returns the column index of the editor cell that contains the given
element, or -1 if the element can't be found within the editor cells.
|
Grid.Editor.EventHandler<T> |
getEventHandler()
Returns the event handler of this Editor.
|
EditorHandler<T> |
getHandler()
Returns the handler responsible for binding data and editor widgets
to this editor.
|
int |
getRow()
Returns the index of the row that is currently assigned to the
editor.
|
String |
getSaveCaption()
Returns the caption of the save button.
|
protected Grid.Editor.State |
getState()
Returns the internal state of the editor.
|
protected com.google.gwt.user.client.ui.Widget |
getWidget(Grid.Column<?,T> column)
Returns the editor widget associated with the given column.
|
protected void |
hideOverlay()
Hides the editor overlay and clears its contents.
|
boolean |
isBuffered()
Returns whether this editor is buffered or not.
|
boolean |
isEditorColumnError(Grid.Column<?,T> column)
Returns true if the column has been listed as containing an error.
|
boolean |
isEnabled()
Returns the enabled state of this editor.
|
boolean |
isWorkPending()
Checks whether there are operations pending for this widget or connector
that must be executed before reaching a steady state.
|
void |
save()
Saves any unsaved changes to the data source and hides the editor.
|
void |
setBuffered(boolean buffered)
Sets the buffered mode.
|
void |
setCancelCaption(String cancelCaption)
Sets the caption of the cancel button.
|
void |
setEditorColumnError(Grid.Column<?,T> column,
boolean hasError)
If the given column is indicated to have an error in the editor, sets
the error styles to the corresponding editor cell and lists the
column as having an error.
|
void |
setEditorError(String errorMessage,
Collection<Grid.Column<?,T>> errorColumns)
Sets an error message for the editor, or removes it if the given
message is
null. |
void |
setEnabled(boolean enabled)
Sets the enabled state of this editor.
|
void |
setEventHandler(Grid.Editor.EventHandler<T> handler)
Sets the event handler for this Editor.
|
protected void |
setGrid(Grid<T> grid)
Sets the grid this editor belongs to.
|
protected void |
setGridEnabled(boolean enabled)
Sets the editor's buttons enabled.
|
void |
setHandler(EditorHandler<T> rowHandler)
Sets the handler responsible for binding data and editor widgets to
this editor.
|
void |
setSaveCaption(String saveCaption)
Sets the caption of the save button.
|
protected void |
setState(Grid.Editor.State state)
Sets the internal state of the editor.
|
protected void |
setStylePrimaryName(String primaryName)
Sets the editor's primary style name and updates all dependent style
names.
|
protected void |
show(int rowIndex,
int columnIndex)
If the Editor is still activating, proceeds to the binding phase.
|
protected void |
showOverlay()
Opens the editor overlay over the grid row indicated by
getRow(). |
protected void |
showOverlay(com.google.gwt.dom.client.TableRowElement unused)
Deprecated.
As of 7.5, use
showOverlay() instead. |
@Deprecated public static final int KEYCODE_SHOW
DefaultEditorEventHandler.KEYCODE_OPEN
instead@Deprecated public static final int KEYCODE_HIDE
DefaultEditorEventHandler.KEYCODE_CLOSE
insteadpublic Editor()
Grid.Editor.public void setEditorError(String errorMessage, Collection<Grid.Column<?,T>> errorColumns)
null. If the editor is in edit mode or currently
processing a save operation, updates the editor cells to show error
styles for the given columns and clears error styles from any other
columns.errorMessage - the message to set, or null if no message should
be shownerrorColumns - the columns that currently contain errorspublic int getRow()
public void editRow(int rowIndex)
editRow(rowIndex, -1).rowIndex - the index of the row to be editededitRow(int, int)public void editRow(int rowIndex,
int columnIndexDOM)
rowIndex - the index of the row to be editedcolumnIndexDOM - the column index (excluding hidden columns) of the editor
widget that should be initially focused or -1 to not set
focusIllegalStateException - if this editor is not enabledIllegalStateException - if this editor is already in edit mode and in buffered
modepublic void cancel()
saved are lost.IllegalStateException - if this editor is not enabledIllegalStateException - if this editor is not in edit modepublic void save()
IllegalStateException - if this editor is not enabledIllegalStateException - if this editor is not in edit modepublic EditorHandler<T> getHandler()
public void setHandler(EditorHandler<T> rowHandler)
rowHandler - the new editor handlerIllegalStateException - if this editor is currently in edit modepublic boolean isEnabled()
true if enabled, false otherwisepublic void setEnabled(boolean enabled)
enabled - true if enabled, false otherwiseIllegalStateException - if in edit mode and trying to disableIllegalStateException - if the editor handler is not setprotected void show(int rowIndex,
int columnIndex)
rowIndex - the index of the row to be editedcolumnIndex - the column index (excluding hidden columns) of the editor
widget that should be initially focused or -1 to not set
focusprotected void setGrid(Grid<T> grid)
grid - the parent gridprotected Grid.Editor.State getState()
protected void setState(Grid.Editor.State state)
state - the state to setprotected com.google.gwt.user.client.ui.Widget getWidget(Grid.Column<?,T> column)
editable, returns null.column - the column@Deprecated protected void showOverlay(com.google.gwt.dom.client.TableRowElement unused)
showOverlay() instead.showOverlay(). The argument is ignored.unused - ignored argumentprotected void showOverlay()
getRow().protected void hideOverlay()
protected void setStylePrimaryName(String primaryName)
primaryName - the new primary style nameprotected com.google.gwt.dom.client.Element createCell(com.google.gwt.dom.client.TableCellElement td)
td - the table cell used as a referenceprotected void setGridEnabled(boolean enabled)
enabled - true to enable the buttons, false to
disable thempublic void setSaveCaption(String saveCaption) throws IllegalArgumentException
null.saveCaption - the new caption textIllegalArgumentException - if the given text is nullpublic String getSaveCaption()
public void setCancelCaption(String cancelCaption) throws IllegalArgumentException
null.cancelCaption - the new caption textIllegalArgumentException - if the given text is nullpublic String getCancelCaption()
public void setEditorColumnError(Grid.Column<?,T> column, boolean hasError)
column - the column which should have its editor error status
updatedhasError - true if the cell should get error styles,
false if the error styles should be removed from
the cellpublic void clearEditorColumnErrors()
public boolean isEditorColumnError(Grid.Column<?,T> column)
column - the column whose error status is checkedtrue if the column is listed as containing an error,
false otherwisepublic void setBuffered(boolean buffered)
buffered - true if editor should be buffered, false
otherwisepublic boolean isBuffered()
true if editor is buffered, false otherwisesetBuffered(boolean)public void setEventHandler(Grid.Editor.EventHandler<T> handler)
handler - the new event handlerpublic Grid.Editor.EventHandler<T> getEventHandler()
public boolean isWorkPending()
DeferredWorkerisWorkPending in interface DeferredWorkerprotected int getElementColumn(com.google.gwt.dom.client.Element e)
e - the element to be locatedCopyright © 2023 Vaadin Ltd. All rights reserved.