Package com.jk.core.model.table
Class JKTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
com.jk.core.model.table.JKTableModel
- All Implemented Interfaces:
Serializable
,TableModel
- Direct Known Subclasses:
JKMapTableModel
The Class JKTableModel.
- See Also:
-
Field Summary
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the JK table column.void
addJKTableColumn
(String keyLabel) Adds the JK table column.Adds the record.void
addRecord
(JKTableRecord record) Adds the record.void
Clear records.protected JKTableRecord
Creates the empty record.deleteRow
(int selectedRow) Delete row.void
deleteRows
(int[] rows) Delete rows.void
fireTableColumnDataChanged
(int col) Fire table column data changed.int
Gets the actual column count.int
getActualColumnIndexFromVisible
(int visibleIndex) Gets the actual column index from visible.getActualColumnName
(int index) Gets the actual column name.getCellEditor
(int column) Gets the cell editor.getCellRenderer
(int column) Gets the cell renderer.getColumnClass
(int columnIndex) Gets the column class.int
Gets the column count.getColumnName
(int visibleColumnIndex) Gets the column name.int
getColumnType
(int col) Gets the column type.int
getColunmIndex
(String name) Gets the colunm index.int
getColunmIndexByName
(String colName) Gets the colunm index by name.double
getColunmSum
(int col) Gets the colunm sum.Gets the deleted records.Gets the deleted records as data vector.getFormatter
(int col) Gets the formatter.int
getIntegerColunmSum
(int col) Gets the integer colunm sum.int
getPrefferedWidth
(int column) Gets the preffered width.getRecord
(int row) Gets the record.Gets the records.Gets the records as data vector.int
Gets the row count.getTableColumn
(int visibleColumnIndex) Gets the table column.getTableColumn
(int col, boolean visibleIndex) Gets the table column.getValueAt
(int row, int visibleColumnIndex) Gets the value at.double
getValueAtAsDouble
(int row, int col) Gets the value at as double.float
getValueAtAsFloat
(int row, int col) Gets the value at as float.int
getValueAtAsInteger
(int row, int col) Gets the value at as integer.int
getVisibleColumnIndexFromActual
(int actualIndex) Gets the visible column index from actual.void
insertRecord
(int selectedRow) Insert record.void
insertRecord
(int row, JKTableRecord record) Insert record.boolean
Checks if is all data valid.boolean
Checks if is allow delete.boolean
Checks if is data modified.boolean
Checks if is editable.boolean
isEditable
(int column) Checks if is editable.boolean
isEditable
(int row, int column) Checks if is editable.boolean
isNumericClumn
(int visibleColIndex) Checks if is numeric clumn.protected boolean
isValidTableColumnIndex
(int actualIndex) Checks if is valid table column index.boolean
isVisible
(int col) Checks if is visible.void
Refresh visibility.removeRecord
(int row) Removes the record.void
Reset records.void
setAllowDelete
(boolean allowDelete) Sets the allow delete.void
setColumnValue
(int row, int col, Object value, boolean visibleIndex) Sets the column value.void
setEditable
(boolean editable) Sets the editable.void
setEditable
(int column, boolean editable) Sets the editable.void
setEditable
(int row, int col, boolean enable) Sets the editable.void
setEditor
(int colunm, TableCellEditor cellEditor) Sets the editor.void
setFormatter
(int col, Format formatter) Sets the formatter.void
setPreferredWidth
(int col, int width) Sets the preferred width.void
setRenderer
(int col, TableCellRenderer cellRenderer) Sets the renderer.void
setRequired
(int col, boolean required) Sets the required.void
setValueAt
(Object value, int rowIndex, int visibleIndex) Sets the value at.void
setVisible
(int col, boolean visible) Sets the visible.void
setVisibleByActualIndex
(int colunmIndex, boolean visible) Sets the visible by actual index.Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener
-
Constructor Details
-
JKTableModel
public JKTableModel()Instantiates a new JK table model.
-
-
Method Details
-
addJKTableColumn
Adds the JK table column.- Parameters:
col
- the col
-
addRecord
Adds the record.- Returns:
- the JK table record
-
addRecord
Adds the record.- Parameters:
record
- the record
-
clearRecords
public void clearRecords()Clear records. -
createEmptyRecord
Creates the empty record.- Returns:
- the JK table record
-
deleteRow
Delete row.- Parameters:
selectedRow
- the selected row- Returns:
- the JK table record
-
deleteRows
public void deleteRows(int[] rows) Delete rows.- Parameters:
rows
- the rows
-
fireTableColumnDataChanged
public void fireTableColumnDataChanged(int col) Fire table column data changed.- Parameters:
col
- the col
-
getActualColumnCount
public int getActualColumnCount()Gets the actual column count.- Returns:
- the actual column count
-
getActualColumnIndexFromVisible
public int getActualColumnIndexFromVisible(int visibleIndex) Gets the actual column index from visible.- Parameters:
visibleIndex
- the visible index- Returns:
- the actual column index from visible
-
getActualColumnName
Gets the actual column name.- Parameters:
index
- the index- Returns:
- the actual column name
-
getCellEditor
Gets the cell editor.- Parameters:
column
- the column- Returns:
- the cell editor
-
getCellRenderer
Gets the cell renderer.- Parameters:
column
- the column- Returns:
- the cell renderer
-
getColumnClass
Gets the column class.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- Parameters:
columnIndex
- the column index- Returns:
- the column class
-
getColumnCount
public int getColumnCount()Gets the column count.- Returns:
- the column count
-
getColumnName
Gets the column name.- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- Parameters:
visibleColumnIndex
- the visible column index- Returns:
- the column name
-
getColumnType
public int getColumnType(int col) Gets the column type.- Parameters:
col
- the col- Returns:
- the column type
-
getColunmIndex
Gets the colunm index.- Parameters:
name
- the name- Returns:
- the colunm index
-
getColunmIndexByName
Gets the colunm index by name.- Parameters:
colName
- the col name- Returns:
- the colunm index by name
-
getColunmSum
public double getColunmSum(int col) Gets the colunm sum.- Parameters:
col
- the col- Returns:
- the colunm sum
-
getDeletedRecords
Gets the deleted records.- Returns:
- the deleted records
-
getDeletedRecordsAsDataVector
Gets the deleted records as data vector.- Returns:
- the deleted records as data vector
-
getFormatter
Gets the formatter.- Parameters:
col
- the col- Returns:
- the formatter
-
getIntegerColunmSum
public int getIntegerColunmSum(int col) Gets the integer colunm sum.- Parameters:
col
- the col- Returns:
- the integer colunm sum
-
getPrefferedWidth
public int getPrefferedWidth(int column) Gets the preffered width.- Parameters:
column
- the column- Returns:
- the preffered width
-
getRecord
Gets the record.- Parameters:
row
- the row- Returns:
- the record
-
getRecords
Gets the records.- Returns:
- the records
-
getRecordsAsDataVector
Gets the records as data vector.- Returns:
- the records as data vector
-
getRowCount
public int getRowCount()Gets the row count.- Returns:
- the row count
-
getTableColumn
Gets the table column.- Parameters:
visibleColumnIndex
- the visible column index- Returns:
- the table column
-
getTableColumn
Gets the table column.- Parameters:
col
- the colvisibleIndex
- the visible index- Returns:
- the table column
-
getValueAt
Gets the value at.- Parameters:
row
- the rowvisibleColumnIndex
- the visible column index- Returns:
- the value at
-
getValueAtAsDouble
public double getValueAtAsDouble(int row, int col) Gets the value at as double.- Parameters:
row
- the rowcol
- the col- Returns:
- the value at as double
-
getValueAtAsFloat
public float getValueAtAsFloat(int row, int col) Gets the value at as float.- Parameters:
row
- the rowcol
- the col- Returns:
- the value at as float
-
getValueAtAsInteger
public int getValueAtAsInteger(int row, int col) Gets the value at as integer.- Parameters:
row
- the rowcol
- the col- Returns:
- the value at as integer
-
getVisibleColumnIndexFromActual
public int getVisibleColumnIndexFromActual(int actualIndex) Gets the visible column index from actual.- Parameters:
actualIndex
- the actual index- Returns:
- the visible column index from actual
-
insertRecord
public void insertRecord(int selectedRow) Insert record.- Parameters:
selectedRow
- the selected row
-
insertRecord
Insert record.- Parameters:
row
- the rowrecord
- the record
-
isAllDataValid
public boolean isAllDataValid()Checks if is all data valid.- Returns:
- true, if is all data valid
-
isAllowDelete
public boolean isAllowDelete()Checks if is allow delete.- Returns:
- true, if is allow delete
-
isDataModified
public boolean isDataModified()Checks if is data modified.- Returns:
- true, if is data modified
-
isEditable
public boolean isEditable()Checks if is editable.- Returns:
- true, if is editable
-
isEditable
public boolean isEditable(int column) Checks if is editable.- Parameters:
column
- the column- Returns:
- true, if is editable
-
isEditable
public boolean isEditable(int row, int column) Checks if is editable.- Parameters:
row
- the rowcolumn
- the column- Returns:
- true, if is editable
-
isNumericClumn
public boolean isNumericClumn(int visibleColIndex) Checks if is numeric clumn.- Parameters:
visibleColIndex
- the visible col index- Returns:
- true, if is numeric clumn
-
isValidTableColumnIndex
protected boolean isValidTableColumnIndex(int actualIndex) Checks if is valid table column index.- Parameters:
actualIndex
- the actual index- Returns:
- true, if is valid table column index
-
isVisible
public boolean isVisible(int col) Checks if is visible.- Parameters:
col
- the col- Returns:
- true, if is visible
-
refreshVisibility
public void refreshVisibility()Refresh visibility. -
removeRecord
Removes the record.- Parameters:
row
- the row- Returns:
- the JK table record
-
resetRecords
public void resetRecords()Reset records. -
setAllowDelete
public void setAllowDelete(boolean allowDelete) Sets the allow delete.- Parameters:
allowDelete
- the new allow delete
-
setColumnValue
Sets the column value.- Parameters:
row
- the rowcol
- the colvalue
- the valuevisibleIndex
- the visible index
-
setEditable
public void setEditable(boolean editable) Sets the editable.- Parameters:
editable
- the new editable
-
setEditable
public void setEditable(int column, boolean editable) Sets the editable.- Parameters:
column
- the columneditable
- the editable
-
setEditable
public void setEditable(int row, int col, boolean enable) Sets the editable.- Parameters:
row
- the rowcol
- the colenable
- the enable
-
setEditor
Sets the editor.- Parameters:
colunm
- the colunmcellEditor
- the cell editor
-
setFormatter
Sets the formatter.- Parameters:
col
- the colformatter
- the formatter
-
setPreferredWidth
public void setPreferredWidth(int col, int width) Sets the preferred width.- Parameters:
col
- the colwidth
- the width
-
setRenderer
Sets the renderer.- Parameters:
col
- the colcellRenderer
- the cell renderer
-
setRequired
public void setRequired(int col, boolean required) Sets the required.- Parameters:
col
- the colrequired
- the required
-
setValueAt
Sets the value at.- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classAbstractTableModel
- Parameters:
value
- the valuerowIndex
- the row indexvisibleIndex
- the visible index
-
setVisible
public void setVisible(int col, boolean visible) Sets the visible.- Parameters:
col
- the colvisible
- the visible
-
setVisibleByActualIndex
public void setVisibleByActualIndex(int colunmIndex, boolean visible) Sets the visible by actual index.- Parameters:
colunmIndex
- the colunm indexvisible
- the visible
-
addJKTableColumn
Adds the JK table column.- Parameters:
keyLabel
- the key label
-