org.apache.pivot.wtk.content
Class TableViewRowEditor

java.lang.Object
  extended by org.apache.pivot.wtk.content.TableViewRowEditor
All Implemented Interfaces:
Editor, TableView.RowEditor

public class TableViewRowEditor
extends Object
implements TableView.RowEditor

Default table view row editor.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TableView.RowEditor
TableView.RowEditor.RowEditorListenerList
 
Constructor Summary
TableViewRowEditor()
           
 
Method Summary
 void cancelEdit()
          Cancels an edit that is in progress by reverting any edits the user has made.
 void editRow(TableView tableView, int rowIndex, int columnIndex)
          Notifies the editor that editing should begin.
 Dictionary<String,Component> getCellEditors()
          Gets this row editor's cell editor dictionary.
 CardPaneSkin.SelectionChangeEffect getEditEffect()
          Gets the effect that this editor uses when changing from a read-only row to an editable row.
 int getEditEffectDuration()
          Gets the effect duration that this editor uses when changing from a read-only row to an editable row.
 ListenerList<TableView.RowEditorListener> getRowEditorListeners()
          Gets the row editor listener list.
 boolean isEditing()
          Tells whether or not an edit is currently in progress.
 void saveChanges()
          Saves an edit that is in progress by updating the appropriate data object.
 void setEditEffect(CardPaneSkin.SelectionChangeEffect editEffect)
          Sets the effect that this editor uses when changing from a read-only row to an editable row.
 void setEditEffect(String editEffect)
          Sets the effect that this editor uses when changing from a read-only row to an editable row.
 void setEditEffectDuration(int effectDuration)
          Sets the effect duration that this editor uses when changing from a read-only row to an editable row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableViewRowEditor

public TableViewRowEditor()
Method Detail

getCellEditors

public Dictionary<String,Component> getCellEditors()
Gets this row editor's cell editor dictionary. The caller may specify explicit editor components and place them in this dictionary by their table view column names. Any column that does not have an entry in this dictionary will have a TextInput implicitly associated with it during editing.

This row editor uses data binding to populate the cell editor components and to get the data back out of those components, so it is the caller's responsibility to set up the data binding keys in each component they specify in this dictionary. The data binding key should equal the column name that the cell editor serves.

Returns:
The cell editor dictionary.

getEditEffect

public CardPaneSkin.SelectionChangeEffect getEditEffect()
Gets the effect that this editor uses when changing from a read-only row to an editable row. By default, this editor uses no effect.

Returns:
The edit effect, or null if no effect is being used.

setEditEffect

public void setEditEffect(CardPaneSkin.SelectionChangeEffect editEffect)
Sets the effect that this editor uses when changing from a read-only row to an editable row.

Parameters:
editEffect - The edit effect, or null to not use an effect.

setEditEffect

public void setEditEffect(String editEffect)
Sets the effect that this editor uses when changing from a read-only row to an editable row.

Parameters:
editEffect - The edit effect, or null to not use an effect.
See Also:
setEditEffect(CardPaneSkin.SelectionChangeEffect)

getEditEffectDuration

public int getEditEffectDuration()
Gets the effect duration that this editor uses when changing from a read-only row to an editable row. The default value is 250 milliseconds.

Returns:
The effect duration in milliseconds.

setEditEffectDuration

public void setEditEffectDuration(int effectDuration)
Sets the effect duration that this editor uses when changing from a read-only row to an editable row.

Parameters:
effectDuration - Effect duration in milliseconds

editRow

public void editRow(TableView tableView,
                    int rowIndex,
                    int columnIndex)
Notifies the editor that editing should begin. If the editor is currently installed on the table view, the skin may call this method when the user executes the appropriate gesture (as defined by the skin).

Specified by:
editRow in interface TableView.RowEditor
Parameters:
tableView - The table view
rowIndex - The row index of the cell to edit
columnIndex - The column index of the cell to edit
See Also:
TableView.setRowEditor(RowEditor)

isEditing

public boolean isEditing()
Tells whether or not an edit is currently in progress.

Specified by:
isEditing in interface Editor

saveChanges

public void saveChanges()
Saves an edit that is in progress by updating the appropriate data object. It is up to implementations to define the behavior when isEditing() == false.

Specified by:
saveChanges in interface Editor

cancelEdit

public void cancelEdit()
Cancels an edit that is in progress by reverting any edits the user has made. It is up to implementations to define the behavior when isEditing() == false.

Specified by:
cancelEdit in interface Editor

getRowEditorListeners

public ListenerList<TableView.RowEditorListener> getRowEditorListeners()
Gets the row editor listener list.

Specified by:
getRowEditorListeners in interface TableView.RowEditor