Package com.jk.core.model.table
Class JKDefaultTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
com.jk.core.model.table.JKDefaultTableModel
- All Implemented Interfaces:
Serializable
,TableModel
The Class JKDefaultTableModel.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Vector
The column identifiers.protected Vector
The data vector.Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new JK default table model.JKDefaultTableModel
(int rowCount, int columnCount) Instantiates a new JK default table model.JKDefaultTableModel
(Object[][] data, Object[] columnNames) Instantiates a new JK default table model.JKDefaultTableModel
(Object[] columnNames, int rowCount) Instantiates a new JK default table model.JKDefaultTableModel
(Vector columnNames, int rowCount) Instantiates a new JK default table model.JKDefaultTableModel
(Vector data, Vector columnNames) Instantiates a new JK default table model. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the column.void
Adds the column.void
Adds the column.void
Adds the row.void
Adds the row.protected static Vector
convertToVector
(Object[] anArray) Convert to vector.protected static Vector
convertToVector
(Object[][] anArray) Convert to vector.int
Gets the column count.getColumnName
(int column) Gets the column name.Gets the data vector.int
Gets the row count.getValueAt
(int row, int column) Gets the value at.void
Insert row.void
Insert row.boolean
isCellEditable
(int row, int column) Checks if is cell editable.void
moveRow
(int start, int end, int to) Move row.void
newDataAvailable
(TableModelEvent event) New data available.void
New rows added.removeRow
(int row) Removes the row.void
rowsRemoved
(TableModelEvent event) Rows removed.void
setColumnCount
(int columnCount) Sets the column count.void
setColumnIdentifiers
(Object[] newIdentifiers) Sets the column identifiers.void
setColumnIdentifiers
(Vector columnIdentifiers) Sets the column identifiers.void
setDataVector
(Object[][] dataVector, Object[] columnIdentifiers) Sets the data vector.void
setDataVector
(Vector dataVector, Vector columnIdentifiers) Sets the data vector.void
setNumRows
(int rowCount) Sets the num rows.void
setRowCount
(int rowCount) Sets the row count.void
setValueAt
(Object aValue, int row, int column) Sets the value at.Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
-
Field Details
-
dataVector
The data vector. -
columnIdentifiers
The column identifiers.
-
-
Constructor Details
-
JKDefaultTableModel
public JKDefaultTableModel()Instantiates a new JK default table model. -
JKDefaultTableModel
public JKDefaultTableModel(int rowCount, int columnCount) Instantiates a new JK default table model.- Parameters:
rowCount
- the row countcolumnCount
- the column count
-
JKDefaultTableModel
Instantiates a new JK default table model.- Parameters:
columnNames
- the column namesrowCount
- the row count
-
JKDefaultTableModel
Instantiates a new JK default table model.- Parameters:
data
- the datacolumnNames
- the column names
-
JKDefaultTableModel
Instantiates a new JK default table model.- Parameters:
columnNames
- the column namesrowCount
- the row count
-
JKDefaultTableModel
Instantiates a new JK default table model.- Parameters:
data
- the datacolumnNames
- the column names
-
-
Method Details
-
convertToVector
Convert to vector.- Parameters:
anArray
- the an array- Returns:
- the vector
-
convertToVector
Convert to vector.- Parameters:
anArray
- the an array- Returns:
- the vector
-
addColumn
Adds the column.- Parameters:
columnName
- the column name
-
addColumn
Adds the column.- Parameters:
columnName
- the column namecolumnData
- the column data
-
addColumn
Adds the column.- Parameters:
columnName
- the column namecolumnData
- the column data
-
addRow
Adds the row.- Parameters:
rowData
- the row data
-
addRow
Adds the row.- Parameters:
rowData
- the row data
-
getColumnCount
public int getColumnCount()Gets the column count.- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- the column count
-
getColumnName
Gets the column name.- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- Parameters:
column
- the column- Returns:
- the column name
-
getDataVector
Gets the data vector.- Returns:
- the data vector
-
getRowCount
public int getRowCount()Gets the row count.- Specified by:
getRowCount
in interfaceTableModel
- Returns:
- the row count
-
getValueAt
Gets the value at.- Specified by:
getValueAt
in interfaceTableModel
- Parameters:
row
- the rowcolumn
- the column- Returns:
- the value at
-
insertRow
Insert row.- Parameters:
row
- the rowrowData
- the row data
-
insertRow
Insert row.- Parameters:
row
- the rowrowData
- the row data
-
isCellEditable
public boolean isCellEditable(int row, int column) Checks if is cell editable.- Specified by:
isCellEditable
in interfaceTableModel
- Overrides:
isCellEditable
in classAbstractTableModel
- Parameters:
row
- the rowcolumn
- the column- Returns:
- true, if is cell editable
-
moveRow
public void moveRow(int start, int end, int to) Move row.- Parameters:
start
- the startend
- the endto
- the to
-
newDataAvailable
New data available.- Parameters:
event
- the event
-
newRowsAdded
New rows added.- Parameters:
e
- the e
-
removeRow
Removes the row.- Parameters:
row
- the row- Returns:
- the object
-
rowsRemoved
Rows removed.- Parameters:
event
- the event
-
setColumnCount
public void setColumnCount(int columnCount) Sets the column count.- Parameters:
columnCount
- the new column count
-
setColumnIdentifiers
Sets the column identifiers.- Parameters:
newIdentifiers
- the new column identifiers
-
setColumnIdentifiers
Sets the column identifiers.- Parameters:
columnIdentifiers
- the new column identifiers
-
setDataVector
Sets the data vector.- Parameters:
dataVector
- the data vectorcolumnIdentifiers
- the column identifiers
-
setDataVector
Sets the data vector.- Parameters:
dataVector
- the data vectorcolumnIdentifiers
- the column identifiers
-
setNumRows
public void setNumRows(int rowCount) Sets the num rows.- Parameters:
rowCount
- the new num rows
-
setRowCount
public void setRowCount(int rowCount) Sets the row count.- Parameters:
rowCount
- the new row count
-
setValueAt
Sets the value at.- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classAbstractTableModel
- Parameters:
aValue
- the a valuerow
- the rowcolumn
- the column
-