Class TableEditorModel

java.lang.Object
javax.swing.table.AbstractTableModel
org.pentaho.reporting.ui.datasources.table.TableEditorModel
All Implemented Interfaces:
Serializable, TableModel

public class TableEditorModel extends AbstractTableModel
See Also:
  • Constructor Details

    • TableEditorModel

      public TableEditorModel()
      Constructs a default DefaultTableModel which is a table of zero columns and zero rows.
  • Method Details

    • setColumnName

      public void setColumnName(int index, String identifier)
    • removeColumn

      public void removeColumn(int column)
    • removeRow

      public void removeRow(int row)
    • addColumn

      public void addColumn(String name, Class type)
    • addRow

      public void addRow()
    • addRow

      public void addRow(int idx)
    • getColumnName

      public String getColumnName(int column)
      Returns a default name for the column using spreadsheet conventions: A, B, C, ... Z, AA, AB, etc. If column cannot be found, returns an empty string.
      Specified by:
      getColumnName in interface TableModel
      Overrides:
      getColumnName in class AbstractTableModel
      Parameters:
      column - the column being queried
      Returns:
      a string containing the default name of column
    • getColumnClass

      public Class<?> getColumnClass(int columnIndex)
      Returns Object.class regardless of columnIndex.
      Specified by:
      getColumnClass in interface TableModel
      Overrides:
      getColumnClass in class AbstractTableModel
      Parameters:
      columnIndex - the column being queried
      Returns:
      the Object.class
    • getRowCount

      public int getRowCount()
      Returns the number of rows in the model. A JTable uses this method to determine how many rows it should display. This method should be quick, as it is called frequently during rendering.
      Returns:
      the number of rows in the model
      See Also:
    • getColumnCount

      public int getColumnCount()
      Returns the number of columns in the model. A JTable uses this method to determine how many columns it should create and display by default.
      Returns:
      the number of columns in the model
      See Also:
    • getValueAt

      public Object getValueAt(int rowIndex, int columnIndex)
      Returns the value for the cell at columnIndex and rowIndex.
      Parameters:
      rowIndex - the row whose value is to be queried
      columnIndex - the column whose value is to be queried
      Returns:
      the value Object at the specified cell
    • 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
    • setValueAt

      public void setValueAt(Object aValue, int rowIndex, int columnIndex)
      This empty implementation is provided so users don't have to implement this method if their data model is not editable.
      Specified by:
      setValueAt in interface TableModel
      Overrides:
      setValueAt in class AbstractTableModel
      Parameters:
      aValue - value to assign to cell
      rowIndex - row of cell
      columnIndex - column of cell
    • clear

      public void clear()
    • setColumnClass

      public void setColumnClass(int index, Class type)
    • fireTableDataChanged

      public void fireTableDataChanged()
      Notifies all listeners that all cell values in the table's rows may have changed. The number of rows may also have changed and the JTable should redraw the table from scratch. The structure of the table (as in the order of the columns) is assumed to be the same.
      Overrides:
      fireTableDataChanged in class AbstractTableModel
      See Also:
    • fireTableStructureChanged

      public void fireTableStructureChanged()
      Notifies all listeners that the table's structure has changed. The number of columns in the table, and the names and types of the new columns may be different from the previous state. If the JTable receives this event and its autoCreateColumnsFromModel flag is set it discards any table columns that it had and reallocates default columns in the order they appear in the model. This is the same as calling setModel(TableModel) on the JTable.
      Overrides:
      fireTableStructureChanged in class AbstractTableModel
      See Also:
    • fireTableRowsInserted

      public void fireTableRowsInserted(int firstRow, int lastRow)
      Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been inserted.
      Overrides:
      fireTableRowsInserted in class AbstractTableModel
      Parameters:
      firstRow - the first row
      lastRow - the last row
      See Also:
    • fireTableRowsUpdated

      public void fireTableRowsUpdated(int firstRow, int lastRow)
      Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been updated.
      Overrides:
      fireTableRowsUpdated in class AbstractTableModel
      Parameters:
      firstRow - the first row
      lastRow - the last row
      See Also:
    • fireTableRowsDeleted

      public void fireTableRowsDeleted(int firstRow, int lastRow)
      Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been deleted.
      Overrides:
      fireTableRowsDeleted in class AbstractTableModel
      Parameters:
      firstRow - the first row
      lastRow - the last row
      See Also:
    • fireTableCellUpdated

      public void fireTableCellUpdated(int row, int column)
      Notifies all listeners that the value of the cell at [row, column] has been updated.
      Overrides:
      fireTableCellUpdated in class AbstractTableModel
      Parameters:
      row - row of cell which has been updated
      column - column of cell which has been updated
      See Also:
    • fireTableChanged

      public void fireTableChanged(TableModelEvent e)
      Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table model.
      Overrides:
      fireTableChanged in class AbstractTableModel
      Parameters:
      e - the event to be forwarded
      See Also:
    • isSuspendEvents

      public boolean isSuspendEvents()
    • setSuspendEvents

      public void setSuspendEvents(boolean suspendEvents)
    • copyInto

      public void copyInto(TableModel model)
    • createModel

      public TableModel createModel()