Class TableEditorModel

    • Constructor Detail

      • TableEditorModel

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

      • 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()
      • 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:
        getRowCount()
      • 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)
      • 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:
        TableModelEvent, EventListenerList
      • 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:
        TableModelEvent, EventListenerList
      • 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:
        TableModelEvent, EventListenerList
      • 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:
        TableModelEvent, EventListenerList
      • 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:
        TableModelEvent, EventListenerList
      • isSuspendEvents

        public boolean isSuspendEvents()
      • setSuspendEvents

        public void setSuspendEvents​(boolean suspendEvents)
      • copyInto

        public void copyInto​(TableModel model)