com.nonesole.swing.plaf.basic.table.utable.tablemodel
Class AbstractListXTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.nonesole.swing.plaf.basic.table.utable.tablemodel.AbstractListXTableModel
All Implemented Interfaces:
TableModelExtension, java.io.Serializable, javax.swing.table.TableModel
Direct Known Subclasses:
MapTableModel, ObjectTableModel

public abstract class AbstractListXTableModel
extends javax.swing.table.AbstractTableModel
implements TableModelExtension

Table model which uses List as data source.

Version:
1.0 - build in 2009-11-05
Author:
JACK LEE
See Also:
Serialized Form

Field Summary
static int FALSE
           
static int TRUE
           
 
Constructor Summary
AbstractListXTableModel(java.lang.String[] columnIds, java.lang.String[] columnNames)
           
 
Method Summary
 void addData(java.lang.Object obj)
          Add data
 void addRow(java.lang.Object obj)
          Add row and set object
 java.lang.Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int columnIndex)
           
 java.util.List<?> getData()
          Get data
 int getRowCount()
           
 java.lang.Object getRowData(int rowIndex)
          Get data at rowIndex
 void insertRowAt(java.lang.Object obj, int rowIndex)
          Insert row at rowIndex and set object
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 void removeRowAt(int rowIndex)
          Delete row and it's object at rowIndex
 void setCellEditable(int row, int column, boolean isEditable)
          Sets the editing status of cell at rowIndex and columnIndex.
If rowIndex is -1 and columnIndex > -1,it means all cells in same column at columnIndex can be edited.
 void setColumnEditable(int column, boolean isEditable)
          Sets the editing status of cells in same row at columnIndex.
 void setColumnIds(java.lang.String[] ids)
          Set columns' id
 void setColumnNames(java.lang.String[] names)
          Set columns' name
 void setData(java.lang.Object obj)
          Set data
 void setRowEditable(int row, boolean isEditable)
          Sets the editing status of cells in same column at rowIndex.
 void updateRowAt(java.lang.Object obj, int rowIndex)
          Update object at rowIndex
 
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
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getValueAt, removeTableModelListener, setValueAt
 

Field Detail

TRUE

public static final int TRUE
See Also:
Constant Field Values

FALSE

public static final int FALSE
See Also:
Constant Field Values
Constructor Detail

AbstractListXTableModel

public AbstractListXTableModel(java.lang.String[] columnIds,
                               java.lang.String[] columnNames)
Method Detail

setRowEditable

public void setRowEditable(int row,
                           boolean isEditable)
Description copied from interface: TableModelExtension
Sets the editing status of cells in same column at rowIndex. If rowIndex is -1,it means all cells can be edited.

Specified by:
setRowEditable in interface TableModelExtension

setColumnEditable

public void setColumnEditable(int column,
                              boolean isEditable)
Description copied from interface: TableModelExtension
Sets the editing status of cells in same row at columnIndex. If columnIndex is -1,it means all cells can be edited.

Specified by:
setColumnEditable in interface TableModelExtension

setCellEditable

public void setCellEditable(int row,
                            int column,
                            boolean isEditable)
Description copied from interface: TableModelExtension
Sets the editing status of cell at rowIndex and columnIndex.
If rowIndex is -1 and columnIndex > -1,it means all cells in same column at columnIndex can be edited.
If columnIndex is -1 and rowIndex > -1,it means all cells in same row at rowIdnex can be edited.
If rowIndex is -1 and columnIndex is -1,it means all cells in the table can be edited.

Specified by:
setCellEditable in interface TableModelExtension

setData

public void setData(java.lang.Object obj)
Description copied from interface: TableModelExtension
Set data

Specified by:
setData in interface TableModelExtension

addData

public void addData(java.lang.Object obj)
Description copied from interface: TableModelExtension
Add data

Specified by:
addData in interface TableModelExtension

getData

public java.util.List<?> getData()
Description copied from interface: TableModelExtension
Get data

Specified by:
getData in interface TableModelExtension
Returns:
Object

getColumnClass

public java.lang.Class<?> getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface javax.swing.table.TableModel

getColumnName

public java.lang.String getColumnName(int columnIndex)
Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface javax.swing.table.TableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel

setColumnIds

public void setColumnIds(java.lang.String[] ids)
Description copied from interface: TableModelExtension
Set columns' id

Specified by:
setColumnIds in interface TableModelExtension

setColumnNames

public void setColumnNames(java.lang.String[] names)
Description copied from interface: TableModelExtension
Set columns' name

Specified by:
setColumnNames in interface TableModelExtension
Parameters:
names - String[]

addRow

public void addRow(java.lang.Object obj)
Description copied from interface: TableModelExtension
Add row and set object

Specified by:
addRow in interface TableModelExtension

insertRowAt

public void insertRowAt(java.lang.Object obj,
                        int rowIndex)
Description copied from interface: TableModelExtension
Insert row at rowIndex and set object

Specified by:
insertRowAt in interface TableModelExtension

removeRowAt

public void removeRowAt(int rowIndex)
Description copied from interface: TableModelExtension
Delete row and it's object at rowIndex

Specified by:
removeRowAt in interface TableModelExtension

updateRowAt

public void updateRowAt(java.lang.Object obj,
                        int rowIndex)
Description copied from interface: TableModelExtension
Update object at rowIndex

Specified by:
updateRowAt in interface TableModelExtension

getRowData

public java.lang.Object getRowData(int rowIndex)
Description copied from interface: TableModelExtension
Get data at rowIndex

Specified by:
getRowData in interface TableModelExtension
Returns:
Object