Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## superwaba.ext.xplat.ui
Class Grid

    java.lang.Object
      |
      +--waba.ui.Control
            |
            +--waba.ui.Container
                  |
                  +--superwaba.ext.xplat.ui.Grid

public class Grid
extends Container

A light variant of the standard Grid.
Demands a table model (GridModel) to work
Supports editing (of course), selection by row, column or single cell and toggle of borders
Note: this grid does not support scrollbars. If you add support for them, please share your enhancements with the community: send the sources to classes@superwaba.org

Ver 1.0.2 With a quicker update when selecting/editing
Ver 1.0.3. Lots of bugfixes,including the keyboard error

See Also:
  `GridModel`

Field Summary
`static int` | `SELECT_BY_CELL` Constant used to specify selection by cell
`static int` | `SELECT_BY_COLUMN` Constant used to specify selection by column
`static int` | `SELECT_BY_ROW` Constant used to specify selection by row

Fields inherited from class waba.ui.Container
`BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_SIMPLE, children, lastH, lastW, lastX, lastY, parentWindow, tail`

Fields inherited from class waba.ui.Control
`AFTER, appId, asContainer, asWindow, backColor, backDis, BEFORE, BOTTOM, CENTER, enabled, FILL, FIT, fm, fmH, focusLess, font, foreColor, foreDis, height, LEFT, parent, PREFERRED, RANGE, RIGHT, SAME, TOP, visible, width, x, x2, y, y2`

Constructor Summary
`Grid(GridModel dm)` Constructs a Grid that is initialized with dm as the data model.

Method Summary
`boolean` | `getBordered()` Returns if the table is bordered or not
`boolean` | `getOneClickEditMode()` Indicates if a user is allowed to start editing a cell without selecting it first.
`Object` | `getSelected()` Returns the currently selected item in the table
`int` | `getSelectedColumn()` Returns the currently selected row
`int` | `getSelectedRow()` Returns the currently selected row
`int` | `getSelectMode()` Returns the mode of selection.
`GridModel` | `getTableModel()` Returns the table model
`void` | `onEvent(Event event)` Handels events passed to the table
`void` | `onPaint(Graphics g)` Called by the system to draw the table, will lay out the rows and columns.
`void` | `setBordered(boolean bordered)` Sets if the table should be bordered or not.
`void` | `setOneClickEditMode(boolean oneClickEditMode)` Sets if a user is allowed to start editing a cell without selecting it first. When the user clicks a cell, it is selected for her. Default is false.
`void` | `setSelectMode(int selMode)` Sets the table's selection mode to allow for selection by single cell, row or column.
`void` | `setSpace(int space)` Sets the spacing between texts.
`void` | `setTableModel(GridModel newModel)` Set the table model

Methods inherited from class waba.ui.Container
`add, add, add, broadcastEvent, findChild, getChildren, getClientRect, onColorsChanged, onStart, paintChildren, remove, setBorderStyle, setEnabled`

Methods inherited from class waba.ui.Control
`addTimer, contains, createGraphics, getAbsoluteRect, getBackColor, getFont, getFontMetrics, getForeColor, getNext, getParent, getParentWindow, getPos, getPreferredHeight, getPreferredWidth, getRect, getSize, isDisplayed, isEnabled, isVisible, onBoundsChanged, onFontChanged, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, requestFocus, setBackColor, setBackForeColors, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setVisible`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, toString, wait, wait`

Field Detail

### SELECT_BY_ROW

    public static final int SELECT_BY_ROW

  Constant used to specify selection by row

### SELECT_BY_COLUMN

    public static final int SELECT_BY_COLUMN

  Constant used to specify selection by column

### SELECT_BY_CELL

    public static final int SELECT_BY_CELL

  Constant used to specify selection by cell

Constructor Detail

### Grid

    public Grid(GridModel dm)

  Constructs a Grid that is initialized with dm as the data model.
  Parameters:
    `dm` - The tablemodel

Method Detail

### getBordered

    public boolean getBordered()

  Returns if the table is bordered or not
  Returns:
    true if the table is bordered

### getOneClickEditMode

    public boolean getOneClickEditMode()

  Indicates if a user is allowed to start editing a cell without selecting it first.
  Returns:
    true if one click editing is allowed

### getSelected

    public Object getSelected()

  Returns the currently selected item in the table
  Returns:
    the value that is associated with the currently selected cell

### getSelectedColumn

    public int getSelectedColumn()

  Returns the currently selected row
  Returns:
    the row that is selected

### getSelectedRow

    public int getSelectedRow()

  Returns the currently selected row
  Returns:
    the row that is selected

### getSelectMode

    public int getSelectMode()

  Returns the mode of selection. Value will be one of 3 legal values: SELECT_BY_CELL, SELECT_BY_ROW, SELECT_BY_COLUMN
  Returns:
    the mode of selection
  See Also:
    `SELECT_BY_CELL`, `SELECT_BY_ROW`, `SELECT_BY_COLUMN`

### getTableModel

    public GridModel getTableModel()

  Returns the table model
  Returns:
    the tablemodel for this table

### onEvent

    public void onEvent(Event event)

  Handels events passed to the table
  Overrides:
    onEvent in class Control
  Parameters:
    `event` - the event

### onPaint

    public void onPaint(Graphics g)

  Called by the system to draw the table, will lay out the rows and columns.
  Overrides:
    onPaint in class Container
  Parameters:
    `g` - The Graphic object to paint on

### setBordered

    public void setBordered(boolean bordered)

  Sets if the table should be bordered or not.
  Parameters:
    `bordered` - If true, the table is drawn with lines between cells

### setOneClickEditMode

    public void setOneClickEditMode(boolean oneClickEditMode)

  Sets if a user is allowed to start editing a cell without selecting it first.
  When the user clicks a cell, it is selected for her.
  Default is false.
  Parameters:
    `oneClickEditMode` - if true, one click editing is allowed

### setSelectMode

    public void setSelectMode(int selMode)

  Sets the table's selection mode to allow for selection by single cell, row or column. Default mode is SELECT_BY_ROW
  Parameters:
    `selMode` - One of 3 legal values: SELECT_BY_CELL, SELECT_BY_ROW, SELECT_BY_COLUMN
  See Also:
    `SELECT_BY_CELL`, `SELECT_BY_ROW`, `SELECT_BY_COLUMN`

### setSpace

    public void setSpace(int space)

  Sets the spacing between texts. Note: Future versions should support seperate vertical and horizontal spacing attributes
  Parameters:
    `space` - The space in pixels beween the text and the cell border

### setTableModel

    public void setTableModel(GridModel newModel)

  Set the table model
  Parameters:
    `newModel` - GridModel

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD