waba.ui
Class Grid.CellController
java.lang.Object
|
+--waba.ui.Grid.CellController
- Enclosing class:
- Grid
- public abstract static class Grid.CellController
- extends java.lang.Object
Abstract class that must be implemented if you want to get a fine control of
each cell in the grid. Note that you must keep track of the state of each cell
in your code. How to proceed:
- Create a class that extends CellController and implement each of the methods.
Then call grid.setCellController passing an instance of the created class.
- Each time a cell is drawn, the getForeColor and getBackColor methods are called.
If you want to use the default values, return
null.
- If a column has choices activated (with setColumnChoices), each time the ComboBox
will be opened, the getChoices method is called. This way, you can dynamically change the
choices for each cell. If you want to use the default values, return
null.
- Each time a cell is clicked, the isEnabled method is called. If you return false to it,
the event is not generated; also, when trying to open the ComboBox or the Edit assigned to
the column, the control will not be activated. This is valid for a check column too.
Note that using a CellControler makes the grid drawings a bit slower. Also, if the user sorts the
columns, you may get scrambled. You can disable sort using grid.disableSort = true.
|
Method Summary |
abstract Color |
getBackColor(int row,
int col)
Must return the background color for the given cell. |
abstract java.lang.String[] |
getChoices(int row,
int col)
Must return the choices for a given line and column, if setColumnChoices was set to this
column. |
abstract Color |
getForeColor(int row,
int col)
Must return the foreground color for the given cell. |
abstract boolean |
isEnabled(int row,
int col)
Must return if the given cell is enabled, ie, can have input and can be selected.
|
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Grid.CellController
public Grid.CellController()
getForeColor
public abstract Color getForeColor(int row,
int col)
- Must return the foreground color for the given cell.
getBackColor
public abstract Color getBackColor(int row,
int col)
- Must return the background color for the given cell. Note that if the grid has a check,
the back color of the check cell will be requested passing col value as -1.
getChoices
public abstract java.lang.String[] getChoices(int row,
int col)
- Must return the choices for a given line and column, if setColumnChoices was set to this
column.
isEnabled
public abstract boolean isEnabled(int row,
int col)
- Must return if the given cell is enabled, ie, can have input and can be selected.
If the grid has a check column, returning false will disable the check state change.