Jadex 0.96-beta1

jadex.util.jtable
Class ObjectTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by jadex.util.jtable.ObjectTableModel
All Implemented Interfaces:
Serializable, TableModel

public class ObjectTableModel
extends AbstractTableModel

The object table model has associated an object with each row.

See Also:
Serialized Form

Constructor Summary
ObjectTableModel()
          Create a new object table model.
ObjectTableModel(String[] colnames)
          Create a new object table model.
 
Method Summary
 void addRow(ArrayList row, Object object)
          Add a row to the model.
 void addRow(Object[] row, Object object)
          Add a row to the model.
 void addRow(Object row, Object object)
          Add a row to the model.
 Class getColumnClass(int idx)
          Get the class of the column.
 int getColumnCount()
           
 String getColumnName(int column)
          Get a column name
 Object getObjectForRow(int rowcnt)
          Get the associated object for a row.
 int getRowCount()
           
 Object getValueAt(int row, int column)
          Get the value from a field.
 void insertRow(int rowcnt, List row, Object object)
          Insert a row at a position.
 void insertRow(int rowcnt, Object[] row, Object object)
          Insert a row at a position.
 boolean isCellEditable(int rowIndex, int columnIndex)
          Returns false.
 void modifyData(Object val, int rowcnt, int columncnt)
          Modify a row at a position.
 void removeAllRows()
          Remove all rows from the model.
 void removeRow(int cnt)
          Remove a row from the model.
 void removeRow(Object object)
          Remove a row from the model.
 void setColumnClass(Class clazz, int idx)
          Set the class of the column.
 void setColumnEditable(boolean editable, int col)
          Set if a column is editable.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectTableModel

public ObjectTableModel()
Create a new object table model.


ObjectTableModel

public ObjectTableModel(String[] colnames)
Create a new object table model.

Method Detail

addRow

public void addRow(Object row,
                   Object object)
Add a row to the model.

Parameters:
row - The row data.
object - The associated object.

addRow

public void addRow(ArrayList row,
                   Object object)
Add a row to the model.

Parameters:
row - The row data.
object - The associated object.

addRow

public void addRow(Object[] row,
                   Object object)
Add a row to the model.

Parameters:
row - The row data.
object - The associated object.

insertRow

public void insertRow(int rowcnt,
                      Object[] row,
                      Object object)
Insert a row at a position.

Parameters:
rowcnt - The row cnt.
row - The row data.
object - The object.

insertRow

public void insertRow(int rowcnt,
                      List row,
                      Object object)
Insert a row at a position.

Parameters:
rowcnt - The row cnt.
row - The row data.
object - The object.

removeRow

public void removeRow(Object object)
Remove a row from the model.

Parameters:
object - The associated object.

removeRow

public void removeRow(int cnt)
Remove a row from the model.

Parameters:
cnt - The row number.

removeAllRows

public void removeAllRows()
Remove all rows from the model.


modifyData

public void modifyData(Object val,
                       int rowcnt,
                       int columncnt)
Modify a row at a position.

Parameters:
val - The value.
rowcnt - The row.
columncnt - The column.

getObjectForRow

public Object getObjectForRow(int rowcnt)
Get the associated object for a row.

Parameters:
rowcnt - The row ccount.
Returns:
The object.

getColumnName

public String getColumnName(int column)
Get a column name

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
column - The number of the column.
Returns:
The column name.

getColumnClass

public Class getColumnClass(int idx)
Get the class of the column.

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
idx - the column being queried
Returns:
the Object.class

setColumnClass

public void setColumnClass(Class clazz,
                           int idx)
Set the class of the column.

Parameters:
clazz - The class.
idx - the column being queried

setColumnEditable

public void setColumnEditable(boolean editable,
                              int col)
Set if a column is editable.

Parameters:
editable - True, for editable.
col - The column.

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Returns false. This is the default implementation for all cells.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Parameters:
rowIndex - the row being queried
columnIndex - the column being queried
Returns:
false

getRowCount

public int getRowCount()
Returns:
The row count.

getColumnCount

public int getColumnCount()
Returns:
The column count.

getValueAt

public Object getValueAt(int row,
                         int column)
Get the value from a field.

Parameters:
row - The row index.
column - The column index.
Returns:
The value.

Jadex 0.96-beta1

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.