Class CheckableTableModel<T extends TableModel>

    • Field Detail

      • m_Model

        protected T extends TableModel m_Model
        the wrapped table model.
      • m_Selected

        protected boolean[] m_Selected
        whether a row got checked.
      • m_CheckColName

        protected String m_CheckColName
        the name for the "check" column.
    • Constructor Detail

      • CheckableTableModel

        public CheckableTableModel​(T model,
                                   String checkColName)
        Initializes the model.
        Parameters:
        model - the model to wrap
        checkColName - the name for the "check" column
    • Method Detail

      • getModel

        public T getModel()
        Returns the underlying model.
        Returns:
        the model
      • getRowCount

        public int getRowCount()
        Returns the number of rows in the model.
        Specified by:
        getRowCount in interface TableModel
        Returns:
        the number of rows
      • getColumnCount

        public int getColumnCount()
        Returns the number of columns in the table.
        Specified by:
        getColumnCount in interface TableModel
        Returns:
        the number of columns
      • getColumnClass

        public Class getColumnClass​(int columnIndex)
        Returns the class type of the column.
        Specified by:
        getColumnClass in interface TableModel
        Overrides:
        getColumnClass in class AbstractTableModel
        Parameters:
        columnIndex - the column to get the class for
        Returns:
        the class for the column
      • getValueAt

        public Object getValueAt​(int row,
                                 int column)
        Returns the value at the given position.
        Specified by:
        getValueAt in interface TableModel
        Parameters:
        row - the row
        column - the column
        Returns:
        the value
      • isCellEditable

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

        public void setValueAt​(Object aValue,
                               int rowIndex,
                               int columnIndex)
        Sets the value of the cell.
        Specified by:
        setValueAt in interface TableModel
        Overrides:
        setValueAt in class AbstractTableModel
        Parameters:
        aValue - the value to set
        rowIndex - the row
        columnIndex - the column
      • getCheckedAt

        public boolean getCheckedAt​(int row)
        Returns whether the row at the specified position is checked.
        Parameters:
        row - the (actual, not visible) position of the row
        Returns:
        true if checked
      • setCheckedAt

        public void setCheckedAt​(int row,
                                 boolean checked)
        Sets the checked state.
        Parameters:
        row - the row to update
        checked - the checked state
      • checkAll

        public void checkAll()
        Marks all rows as checked.
      • checkNone

        public void checkNone()
        Marks all rows as un-checked.
      • check

        protected void check​(boolean check)
        Marks all rows with the specified check state.
      • check

        public void check​(int[] rows)
        Marks the rows as checked.
      • uncheck

        public void uncheck​(int[] rows)
        Marks the rows as unchecked.
      • invertChecked

        public void invertChecked()
        Inverts the checked state.
      • getCheckedCount

        public int getCheckedCount()
        Returns how many rows are currently checked.
        Returns:
        the number of checked
      • clear

        public void clear()
        Clears the internal model.
        Specified by:
        clear in interface ClearableModel
      • isSearchMatch

        public boolean isSearchMatch​(SearchParameters params,
                                     int row)
        Tests whether the search matches the specified row.
        Specified by:
        isSearchMatch in interface CustomSearchTableModel
        Parameters:
        params - the search parameters
        row - the row of the underlying, unsorted model
        Returns:
        true if the search matches this row