org.zaval.lw.grid
Class LwDefEditors

java.lang.Object
  |
  +--org.zaval.lw.grid.LwDefEditors
All Implemented Interfaces:
LwEditorProvider

public class LwDefEditors
extends java.lang.Object
implements LwEditorProvider

This class is very simple implementation of LwEditorProvider interface where a grid cells are edited with a text field component.


Constructor Summary
LwDefEditors()
           
 
Method Summary
 java.lang.Object fetchEditedValue(int row, int col, LwComponent editor)
          Fetches the value from the editor component of the specified cell.
 LwComponent getEditor(int row, int col, java.lang.Object o)
          Gets the editor component for the specified cell and the given data model value.
 boolean shouldStartEdit(int row, int col, LwAWTEvent e)
          Tests if the specified event should perform editing process for the specified cell.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LwDefEditors

public LwDefEditors()
Method Detail

getEditor

public LwComponent getEditor(int row,
                             int col,
                             java.lang.Object o)
Gets the editor component for the specified cell and the given data model value. The method can return null if the cell has not an appropriate editor component. In this case the editing process will not be initiated. The implementation returns single line text field component as the cell editor with the fixed size (150 characters).
Specified by:
getEditor in interface LwEditorProvider
Parameters:
row - the specified cell row.
col - the specified cell column.
o - the specified data model value for the grid cell.
Returns:
an editor component.

fetchEditedValue

public java.lang.Object fetchEditedValue(int row,
                                         int col,
                                         LwComponent editor)
Fetches the value from the editor component of the specified cell. The returned value will be used to update appropriate grid data model value. The implementation expects that the editor component is LwTextField component and returns a string value (that is fetched from the text model of the component) as the result.
Specified by:
fetchEditedValue in interface LwEditorProvider
Parameters:
row - the specified cell row.
col - the specified cell column.
editor - the specified component editor that has been used to edit the cell value.
Returns:
a value to update the grid data model.

shouldStartEdit

public boolean shouldStartEdit(int row,
                               int col,
                               LwAWTEvent e)
Tests if the specified event should perform editing process for the specified cell. The implementation indicates that editing process can be started whenever mouse pressed event has occured and a mouse button has been clicked twice.
Specified by:
shouldStartEdit in interface LwEditorProvider
Parameters:
row - the specified cell row.
col - the specified cell column.
e - the specified event.
Returns:
true if the editing process should be performed; otherwise false.


Copyright © Zaval Creative Engineering Group, 2000-2005.
http://www.zaval.org