at.spardat.xma.mdl.table
Interface ITableWM

All Superinterfaces:
ISelectable
All Known Subinterfaces:
ITableWMClient
All Known Implementing Classes:
TableWM, TableWMClient

public interface ITableWM
extends ISelectable

A table widget model where the programmer is in full control on what rows the table has, both at the client and at the server side. Rows may be added, replaced or removed. Every row may have an additional image displayed with the row. Rows are stored in an ordered collection and may be accessed either by a unique String key or by a zero based row index.

Besides managing the rows, a single or multiple selection state is controlled (interface ISelectable). The selected rows are identified by their String keys.


Field Summary
static int S_LAST
          The numeric highest style constant used in this class
static int S_MULTI_SELECT
          Specify this style constant in the constructor if you want the table to allow multi selection.
static int S_ONE_WAY
          A one way table has the property that its rows are never transmitted from client to server.
 
Method Summary
 void clear()
          Removes all rows from the table and deselects all rows.
 boolean containsKey(java.lang.String key)
          Returns true if this table contains a row with the provided key.
 int getColumnCount()
          Returns the number of columns in this table.
 TableRow getRow(int rowIndex)
          Returns the table row at a provided zero based row index.
 TableRow getRow(java.lang.String key)
          Returns the table row for a provided key.
 int indexOf(java.lang.String key)
          Returns the index at which the row with the provided key is located or -1 if no row with key is here.
 boolean isOneWay()
          Returns if this table is one way.
 void removeRow(int rowIndex)
          Removes a row from this table at a provided index.
 boolean removeRow(java.lang.String key)
          Removes a row with a particular key.
 void selectByModelIndex(int index)
          Selects the row at the provided zero-based index.
 int size()
          Returns the number of rows in this table.
 
Methods inherited from interface at.spardat.xma.mdl.ISelectable
deselect, deselectAll, getSelected, getSelection, getSelectionCount, isMultiSelect, isSelected, isStrict, select
 

Field Detail

S_MULTI_SELECT

public static final int S_MULTI_SELECT
Specify this style constant in the constructor if you want the table to allow multi selection. The default is single selection.

See Also:
Constant Field Values

S_ONE_WAY

public static final int S_ONE_WAY
A one way table has the property that its rows are never transmitted from client to server. It supports the usual case of filling tables at the server side, transmitting them to the client but not the other way.

You should mark a table as one way, if u know that the contents of the table is only produced at the server and only consumed (read) at the client side of XMA. This saves memory at the server and eliminates the neccessity to transfer the rows back to the server in stateless pages.

The row set of a one way table may be changed at the server side. Then the row information is transmitted to the client. If it is not changed at the server side, the row information at the client is not changed after a server side event but remaines unchanged.

The one way property applies only to the row information in this, not to the selection information.

With one way tables, the selection need not to be necessarely strict. The server may view an empty row set in the course of executing a server side event (because rows are not transmitted to the server), although there are rows at the client side. Therefore the only action that makes sense at the server side is to fill the table with rows.

See Also:
Constant Field Values

S_LAST

public static final int S_LAST
The numeric highest style constant used in this class

See Also:
Constant Field Values
Method Detail

isOneWay

public boolean isOneWay()
Returns if this table is one way.

See Also:
S_ONE_WAY

size

public int size()
Returns the number of rows in this table.


containsKey

public boolean containsKey(java.lang.String key)
Returns true if this table contains a row with the provided key.


indexOf

public int indexOf(java.lang.String key)
Returns the index at which the row with the provided key is located or -1 if no row with key is here. This is a time consuming operation of O(n).

Parameters:
key - the key of the row that is looked up.
Returns:
zero based index of the key or -1 if this table does not contain a row with the provided key.

getRow

public TableRow getRow(java.lang.String key)
Returns the table row for a provided key.

The returned TableRow may be used to query and modify the row. It must not be cached outside for later reuse because the returned row becomes invalid if the table is modified in other ways.

Parameters:
key - the key whose row is wanted
Returns:
the TableRow or null, if there is no row with the provided key.

getRow

public TableRow getRow(int rowIndex)
Returns the table row at a provided zero based row index.

The returned TableRow may be used to query and modify the row. It must not be cached outside for later reuse because the returned row becomes invalid if the table is modified in other ways.

Parameters:
rowIndex - the index of the row
Returns:
a TableRow, never null
Throws:
java.lang.ArrayIndexOutOfBoundsException - if rowIndex invalid

removeRow

public void removeRow(int rowIndex)
Removes a row from this table at a provided index.

Parameters:
rowIndex - the zero based row index.
Throws:
java.lang.IndexOutOfBoundsException - if rowIndex invalid.

removeRow

public boolean removeRow(java.lang.String key)
Removes a row with a particular key.

Note that this method is of runtime order O(n). If performance matters, please use removeRow(int) instead.

Parameters:
key - the key whose row is to be removed.
Returns:
true if removed, false if this table does not contain a row for the provided key.

clear

public void clear()
Removes all rows from the table and deselects all rows.


getColumnCount

public int getColumnCount()
Returns the number of columns in this table.


selectByModelIndex

public void selectByModelIndex(int index)
Selects the row at the provided zero-based index. If index is less than zero or greater equal size(), this method does nothing.

Note that this method selects using an index of the table-model. At the XMA client, if the table has been sorted, this need not necessarely correspond to be the index you see in the SWT-table.

Parameters:
index - zero based index of the row to select.