com.vaadin.client.widgets
Class Grid.Editor<T>

java.lang.Object
  extended by com.vaadin.client.widgets.Grid.Editor<T>
Enclosing class:
Grid<T>

protected static class Grid.Editor<T>
extends java.lang.Object

An editor UI for Grid rows. A single Grid row at a time can be opened for editing.


Nested Class Summary
protected static class Grid.Editor.State
           
 
Field Summary
static int KEYCODE_HIDE
           
static int KEYCODE_SHOW
           
 
Constructor Summary
Grid.Editor()
           
 
Method Summary
 void cancel()
          Cancels the currently active edit and hides the editor.
 void clearEditorColumnErrors()
           
protected  Element createCell(TableCellElement td)
          Creates an editor cell corresponding to the given table cell.
 void editRow(int rowIndex)
          Equivalent to editRow(rowIndex, -1).
 void editRow(int rowIndex, int columnIndex)
          Opens the editor over the row with the given index and attempts to focus the editor widget in the given column index.
 java.lang.String getCancelCaption()
           
 EditorHandler<T> getHandler()
          Returns the handler responsible for binding data and editor widgets to this editor.
 int getRow()
           
 java.lang.String getSaveCaption()
           
protected  Grid.Editor.State getState()
           
protected  Widget getWidget(Grid.Column<?,T> column)
          Returns the editor widget associated with the given column.
protected  void hideOverlay()
           
 boolean isEditorColumnError(Grid.Column<?,T> column)
           
 boolean isEnabled()
           
 void save()
          Saves any unsaved changes to the data source and hides the editor.
 void setCancelCaption(java.lang.String cancelCaption)
           
 void setEditorColumnError(Grid.Column<?,T> column, boolean hasError)
           
 void setEnabled(boolean enabled)
          Sets the enabled state of this editor.
 void setErrorMessage(java.lang.String errorMessage)
           
protected  void setGrid(Grid<T> grid)
           
protected  void setGridEnabled(boolean enabled)
           
 void setHandler(EditorHandler<T> rowHandler)
          Sets the handler responsible for binding data and editor widgets to this editor.
 void setSaveCaption(java.lang.String saveCaption)
           
protected  void setState(Grid.Editor.State state)
           
protected  void setStylePrimaryName(java.lang.String primaryName)
           
protected  void show()
           
protected  void showOverlay()
          Opens the editor overlay over the table row indicated by getRow().
protected  void showOverlay(TableRowElement unused)
          Deprecated. As of 7.5, use showOverlay() instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYCODE_SHOW

public static final int KEYCODE_SHOW

KEYCODE_HIDE

public static final int KEYCODE_HIDE
Constructor Detail

Grid.Editor

public Grid.Editor()
Method Detail

setErrorMessage

public void setErrorMessage(java.lang.String errorMessage)

getRow

public int getRow()

editRow

public void editRow(int rowIndex)
Equivalent to editRow(rowIndex, -1).

See Also:
editRow(int, int)

editRow

public void editRow(int rowIndex,
                    int columnIndex)
Opens the editor over the row with the given index and attempts to focus the editor widget in the given column index. Does not move focus if the widget is not focusable or if the column index is -1.

Parameters:
rowIndex - the index of the row to be edited
columnIndex - the column index of the editor widget that should be initially focused or -1 to not set focus
Throws:
java.lang.IllegalStateException - if this editor is not enabled
java.lang.IllegalStateException - if this editor is already in edit mode
Since:
7.5

cancel

public void cancel()
Cancels the currently active edit and hides the editor. Any changes that are not saved are lost.

Throws:
java.lang.IllegalStateException - if this editor is not enabled
java.lang.IllegalStateException - if this editor is not in edit mode

save

public void save()
Saves any unsaved changes to the data source and hides the editor.

Throws:
java.lang.IllegalStateException - if this editor is not enabled
java.lang.IllegalStateException - if this editor is not in edit mode

getHandler

public EditorHandler<T> getHandler()
Returns the handler responsible for binding data and editor widgets to this editor.

Returns:
the editor handler or null if not set

setHandler

public void setHandler(EditorHandler<T> rowHandler)
Sets the handler responsible for binding data and editor widgets to this editor.

Parameters:
rowHandler - the new editor handler
Throws:
java.lang.IllegalStateException - if this editor is currently in edit mode

isEnabled

public boolean isEnabled()

setEnabled

public void setEnabled(boolean enabled)
Sets the enabled state of this editor.

Parameters:
enabled - true if enabled, false otherwise
Throws:
java.lang.IllegalStateException - if in edit mode and trying to disable
java.lang.IllegalStateException - if the editor handler is not set

show

protected void show()

setGrid

protected void setGrid(Grid<T> grid)

getState

protected Grid.Editor.State getState()

setState

protected void setState(Grid.Editor.State state)

getWidget

protected Widget getWidget(Grid.Column<?,T> column)
Returns the editor widget associated with the given column. If the editor is not active or the column is not editable, returns null.

Parameters:
column - the column
Returns:
the widget if the editor is open and the column is editable, null otherwise

showOverlay

@Deprecated
protected void showOverlay(TableRowElement unused)
Deprecated. As of 7.5, use showOverlay() instead.

Equivalent to showOverlay(). The argument is ignored.

Parameters:
unused - ignored argument

showOverlay

protected void showOverlay()
Opens the editor overlay over the table row indicated by getRow().

Since:
7.5

hideOverlay

protected void hideOverlay()

setStylePrimaryName

protected void setStylePrimaryName(java.lang.String primaryName)

createCell

protected Element createCell(TableCellElement td)
Creates an editor cell corresponding to the given table cell. The returned element is empty and has the same dimensions and position as the table cell.

Parameters:
td - the table cell used as a reference
Returns:
an editor cell corresponding to the given cell

setGridEnabled

protected void setGridEnabled(boolean enabled)

setSaveCaption

public void setSaveCaption(java.lang.String saveCaption)
                    throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getSaveCaption

public java.lang.String getSaveCaption()

setCancelCaption

public void setCancelCaption(java.lang.String cancelCaption)
                      throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getCancelCaption

public java.lang.String getCancelCaption()

setEditorColumnError

public void setEditorColumnError(Grid.Column<?,T> column,
                                 boolean hasError)

clearEditorColumnErrors

public void clearEditorColumnErrors()

isEditorColumnError

public boolean isEditorColumnError(Grid.Column<?,T> column)


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.