Class JKDefaultTableModel

java.lang.Object
javax.swing.table.AbstractTableModel
com.jk.core.model.table.JKDefaultTableModel
All Implemented Interfaces:
Serializable, TableModel

public class JKDefaultTableModel extends AbstractTableModel implements Serializable
The Class JKDefaultTableModel.
See Also:
  • Field Details

    • dataVector

      protected Vector dataVector
      The data vector.
    • columnIdentifiers

      protected 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 count
      columnCount - the column count
    • JKDefaultTableModel

      public JKDefaultTableModel(Object[] columnNames, int rowCount)
      Instantiates a new JK default table model.
      Parameters:
      columnNames - the column names
      rowCount - the row count
    • JKDefaultTableModel

      public JKDefaultTableModel(Object[][] data, Object[] columnNames)
      Instantiates a new JK default table model.
      Parameters:
      data - the data
      columnNames - the column names
    • JKDefaultTableModel

      public JKDefaultTableModel(Vector columnNames, int rowCount)
      Instantiates a new JK default table model.
      Parameters:
      columnNames - the column names
      rowCount - the row count
    • JKDefaultTableModel

      public JKDefaultTableModel(Vector data, Vector columnNames)
      Instantiates a new JK default table model.
      Parameters:
      data - the data
      columnNames - the column names
  • Method Details

    • convertToVector

      protected static Vector convertToVector(Object[] anArray)
      Convert to vector.
      Parameters:
      anArray - the an array
      Returns:
      the vector
    • convertToVector

      protected static Vector convertToVector(Object[][] anArray)
      Convert to vector.
      Parameters:
      anArray - the an array
      Returns:
      the vector
    • addColumn

      public void addColumn(Object columnName)
      Adds the column.
      Parameters:
      columnName - the column name
    • addColumn

      public void addColumn(Object columnName, Object[] columnData)
      Adds the column.
      Parameters:
      columnName - the column name
      columnData - the column data
    • addColumn

      public void addColumn(Object columnName, Vector columnData)
      Adds the column.
      Parameters:
      columnName - the column name
      columnData - the column data
    • addRow

      public void addRow(Object[] rowData)
      Adds the row.
      Parameters:
      rowData - the row data
    • addRow

      public void addRow(Vector rowData)
      Adds the row.
      Parameters:
      rowData - the row data
    • getColumnCount

      public int getColumnCount()
      Gets the column count.
      Specified by:
      getColumnCount in interface TableModel
      Returns:
      the column count
    • getColumnName

      public String getColumnName(int column)
      Gets the column name.
      Specified by:
      getColumnName in interface TableModel
      Overrides:
      getColumnName in class AbstractTableModel
      Parameters:
      column - the column
      Returns:
      the column name
    • getDataVector

      public Vector getDataVector()
      Gets the data vector.
      Returns:
      the data vector
    • getRowCount

      public int getRowCount()
      Gets the row count.
      Specified by:
      getRowCount in interface TableModel
      Returns:
      the row count
    • getValueAt

      public Object getValueAt(int row, int column)
      Gets the value at.
      Specified by:
      getValueAt in interface TableModel
      Parameters:
      row - the row
      column - the column
      Returns:
      the value at
    • insertRow

      public void insertRow(int row, Object[] rowData)
      Insert row.
      Parameters:
      row - the row
      rowData - the row data
    • insertRow

      public void insertRow(int row, Vector rowData)
      Insert row.
      Parameters:
      row - the row
      rowData - the row data
    • isCellEditable

      public boolean isCellEditable(int row, int column)
      Checks if is cell editable.
      Specified by:
      isCellEditable in interface TableModel
      Overrides:
      isCellEditable in class AbstractTableModel
      Parameters:
      row - the row
      column - the column
      Returns:
      true, if is cell editable
    • moveRow

      public void moveRow(int start, int end, int to)
      Move row.
      Parameters:
      start - the start
      end - the end
      to - the to
    • newDataAvailable

      public void newDataAvailable(TableModelEvent event)
      New data available.
      Parameters:
      event - the event
    • newRowsAdded

      public void newRowsAdded(TableModelEvent e)
      New rows added.
      Parameters:
      e - the e
    • removeRow

      public Object removeRow(int row)
      Removes the row.
      Parameters:
      row - the row
      Returns:
      the object
    • rowsRemoved

      public void rowsRemoved(TableModelEvent event)
      Rows removed.
      Parameters:
      event - the event
    • setColumnCount

      public void setColumnCount(int columnCount)
      Sets the column count.
      Parameters:
      columnCount - the new column count
    • setColumnIdentifiers

      public void setColumnIdentifiers(Object[] newIdentifiers)
      Sets the column identifiers.
      Parameters:
      newIdentifiers - the new column identifiers
    • setColumnIdentifiers

      public void setColumnIdentifiers(Vector columnIdentifiers)
      Sets the column identifiers.
      Parameters:
      columnIdentifiers - the new column identifiers
    • setDataVector

      public void setDataVector(Object[][] dataVector, Object[] columnIdentifiers)
      Sets the data vector.
      Parameters:
      dataVector - the data vector
      columnIdentifiers - the column identifiers
    • setDataVector

      public void setDataVector(Vector dataVector, Vector columnIdentifiers)
      Sets the data vector.
      Parameters:
      dataVector - the data vector
      columnIdentifiers - 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

      public void setValueAt(Object aValue, int row, int column)
      Sets the value at.
      Specified by:
      setValueAt in interface TableModel
      Overrides:
      setValueAt in class AbstractTableModel
      Parameters:
      aValue - the a value
      row - the row
      column - the column