com.vaadin.client.ui.grid
Class EditorRow<T>

java.lang.Object
  extended by com.vaadin.client.ui.grid.EditorRow<T>

public class EditorRow<T>
extends java.lang.Object

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

Since:
Author:
Vaadin Ltd

Nested Class Summary
static class EditorRow.State
           
 
Field Summary
static int KEYCODE_HIDE
           
static int KEYCODE_SHOW
           
 
Constructor Summary
EditorRow()
           
 
Method Summary
 void cancel()
          Cancels the currently active edit and hides the editor.
 void commit()
          Commits any unsaved changes to the data source.
protected  Element createCell(TableCellElement td)
          Creates an editor row cell corresponding to the given table cell.
 void discard()
          Reloads row values from the data source, discarding any unsaved changes.
 void editRow(int rowIndex)
          Opens the editor over the row with the given index.
 EditorRowHandler<T> getHandler()
          Returns the handler responsible for binding data and editor widgets to this editor row.
 int getRow()
           
protected  EditorRow.State getState()
           
protected  Widget getWidget(GridColumn<?,T> column)
          Returns the editor widget associated with the given column.
protected  void hideOverlay()
           
 boolean isEnabled()
           
 void setEnabled(boolean enabled)
          Sets the enabled state of this editor row.
protected  void setGrid(Grid<T> grid)
           
 void setHandler(EditorRowHandler<T> rowHandler)
          Sets the handler responsible for binding data and editor widgets to this editor row.
protected  void setState(EditorRow.State state)
           
protected  void setStylePrimaryName(java.lang.String primaryName)
           
protected  void show()
           
protected  void showOverlay(TableRowElement tr)
          Opens the editor overlay over the given table row.
 
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

EditorRow

public EditorRow()
Method Detail

getRow

public int getRow()

editRow

public void editRow(int rowIndex)
Opens the editor over the row with the given index.

Parameters:
rowIndex - the index of the row to be edited
Throws:
java.lang.IllegalStateException - if this editor row is not enabled
java.lang.IllegalStateException - if this editor row is already in edit mode

cancel

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

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

commit

public void commit()
Commits any unsaved changes to the data source.

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

discard

public void discard()
Reloads row values from the data source, discarding any unsaved changes.

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

getHandler

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

Returns:
the editor row handler or null if not set

setHandler

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

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

isEnabled

public boolean isEnabled()

setEnabled

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

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 row handler is not set

show

protected void show()

setGrid

protected void setGrid(Grid<T> grid)

getState

protected EditorRow.State getState()

setState

protected void setState(EditorRow.State state)

getWidget

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

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

showOverlay

protected void showOverlay(TableRowElement tr)
Opens the editor overlay over the given table row.

Parameters:
tr - the row to be edited

hideOverlay

protected void hideOverlay()

setStylePrimaryName

protected void setStylePrimaryName(java.lang.String primaryName)

createCell

protected Element createCell(TableCellElement td)
Creates an editor row 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 row cell corresponding to the given cell


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