com.sapportals.htmlb.table

Class JCOTableViewModel

java.lang.Object
  extended bycom.sapportals.htmlb.table.JCOTableViewModel
All Implemented Interfaces:
TableViewModel

public class JCOTableViewModel
extends Object
implements TableViewModel

Implementaion for the Interface TableViewModel. This model contains a JCOTable.

Copyright 2004 SAP AG


Field Summary
protected  ArrayList colspanForCells
           
protected  boolean columnAutoCreated
           
protected  Vector columns
           
 
Constructor Summary
JCOTableViewModel(JCO.Table table)
          constructs a table model from a jco table
JCOTableViewModel(JCO.Table table, boolean columnAutoCreated)
          constructs a table model from a jco table if columnAutoCreated is true, the columns will be automatically generated otherwise the columns have to be added to the table via method addColumn() later
 
Method Summary
 TableColumn addColumn(String columnName)
          adds a column with the name columnName to the table
 void addKeyColumn(int columnIndex)
          adds the column at columnIndex as one of the key columns
 TableColumn getColumnAt(int columnIndex)
          returns the column at columnIndex
 int getColumnCount()
          returns the number of visible columns in the table
 String getColumnName(int columnIndex)
          returns the title of the column with columnIndex
 Vector getColumns()
          returns the columns of the table
 IndexedLinkedList getKeyColumn()
          returns the key column
 int getRowCount()
          returns the number of rows in the model
 AbstractDataType getValueAt(int rowIndex, int columnIndex)
          Returns the value for the cell at columnIndex and rowIndex.
 AbstractDataType getValueAt(int rowIndex, String columnKey)
          returns the value in the column with columnKey at rowIndex
 boolean isColumnAutoCreated()
          returns if the columns should be created automatically
 void removeColumn(String columnName)
          removes a column named with columnName
 void setColumnAt(TableColumn column, int columnIndex)
          sets the column
 void setColumnName(String columnName, int columnIndex)
          sets the name of the column.
 void setKeyColumn(int columnIndex)
          sets the column at columnIndex as the key column The columnIndex is the absolute index of the column in the TableViewModel, beginning with 1.
 void setValueAt(AbstractDataType aValue, int rowIndex, int columnIndex)
          sets the value at the rowIndex and columnIndex Note: since it's impossible to change the values in a jco table, a exception will be raised here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columns

protected Vector columns

columnAutoCreated

protected boolean columnAutoCreated

colspanForCells

protected ArrayList colspanForCells
Constructor Detail

JCOTableViewModel

public JCOTableViewModel(JCO.Table table)
constructs a table model from a jco table


JCOTableViewModel

public JCOTableViewModel(JCO.Table table,
                         boolean columnAutoCreated)
constructs a table model from a jco table if columnAutoCreated is true, the columns will be automatically generated otherwise the columns have to be added to the table via method addColumn() later

Method Detail

addColumn

public TableColumn addColumn(String columnName)
adds a column with the name columnName to the table

Specified by:
addColumn in interface TableViewModel
Parameters:
columnName - the name of the column which should be added

removeColumn

public void removeColumn(String columnName)
removes a column named with columnName

Specified by:
removeColumn in interface TableViewModel
Parameters:
columnName - the name of the column which should be invisible

getRowCount

public int getRowCount()
returns the number of rows in the model

Specified by:
getRowCount in interface TableViewModel
Returns:
the number of rows in the model
See Also:
TableViewModel.getColumnCount()

getColumnCount

public int getColumnCount()
returns the number of visible columns in the table

Specified by:
getColumnCount in interface TableViewModel
Returns:
the number of columns in the model
See Also:
TableViewModel.getRowCount()

getColumnName

public String getColumnName(int columnIndex)
returns the title of the column with columnIndex

Specified by:
getColumnName in interface TableViewModel
Parameters:
columnIndex - the index of the column whose identifier should be retrieved
Returns:
the name of the column

setColumnName

public void setColumnName(String columnName,
                          int columnIndex)
sets the name of the column. The name of the column will be displayed as the table column header later

Specified by:
setColumnName in interface TableViewModel
Parameters:
columnName - the name of the column
columnIndex - the index of the column. It's the index of the column in the visible columns which are put in a vector, beginning with 1

getValueAt

public AbstractDataType getValueAt(int rowIndex,
                                   int columnIndex)
Returns the value for the cell at columnIndex and rowIndex.

Specified by:
getValueAt in interface TableViewModel
Parameters:
rowIndex - the row whose value is to be queried
columnIndex - the column whose value is to be queried
Returns:
the value Object at the specified cell
See Also:
AbstractDataType

getValueAt

public AbstractDataType getValueAt(int rowIndex,
                                   String columnKey)
returns the value in the column with columnKey at rowIndex

Specified by:
getValueAt in interface TableViewModel
Parameters:
rowIndex - the index of the row
columnKey - the key of the column
Returns:
the value at the specified cell

setValueAt

public void setValueAt(AbstractDataType aValue,
                       int rowIndex,
                       int columnIndex)
sets the value at the rowIndex and columnIndex Note: since it's impossible to change the values in a jco table, a exception will be raised here.

Specified by:
setValueAt in interface TableViewModel
Parameters:
aValue - the value that the object at rowIndex and columnIndex should have
rowIndex - the index of the row
columnIndex - the index of the column

getColumns

public Vector getColumns()
returns the columns of the table

Specified by:
getColumns in interface TableViewModel
Returns:
visible columns of the table
See Also:
TableColumn

getColumnAt

public TableColumn getColumnAt(int columnIndex)
returns the column at columnIndex

Specified by:
getColumnAt in interface TableViewModel
Parameters:
columnIndex - the index of the column
Returns:
the column at columnIndex
See Also:
TableColumn

setColumnAt

public void setColumnAt(TableColumn column,
                        int columnIndex)
sets the column

Parameters:
column -
See Also:
TableColumn

isColumnAutoCreated

public boolean isColumnAutoCreated()
returns if the columns should be created automatically


setKeyColumn

public void setKeyColumn(int columnIndex)
sets the column at columnIndex as the key column The columnIndex is the absolute index of the column in the TableViewModel, beginning with 1.

Specified by:
setKeyColumn in interface TableViewModel
Parameters:
columnIndex - the index of the key column

getKeyColumn

public IndexedLinkedList getKeyColumn()
returns the key column

Specified by:
getKeyColumn in interface TableViewModel
Returns:
the key columns
See Also:
IndexedLinkedList

addKeyColumn

public void addKeyColumn(int columnIndex)
adds the column at columnIndex as one of the key columns

Specified by:
addKeyColumn in interface TableViewModel
Parameters:
columnIndex - the index of the key column


Copyright 2006 SAP AG Complete Copyright Notice