Class AbstractBasicTableModel

    • Constructor Detail

      • AbstractBasicTableModel

        public AbstractBasicTableModel()
    • Method Detail

      • getRowKey

        public Object getRowKey​(int row)
        Description copied from interface: AdapterBasicTableModel.BasicTableModel
        Retrieves the key (ie bean) used to uniquely identify this row.

        The usual implementation of this method would just return the row id passed in.

        However, if you are required to dynamically add/remove rows in the model, which would change the row index, then the implementation of this method needs to return an object that uniquely identifies this row.

        When rows have been added/removed to the model, the WTable.handleDataChanged() method on WTable needs to be called.

        Specified by:
        getRowKey in interface AdapterBasicTableModel.BasicTableModel
        Parameters:
        row - the row index
        Returns:
        the row index as the unique key for the row
      • sort

        public int[] sort​(int col,
                          boolean ascending)
        This model does not support the concept of sorting by default. Subclasses will need to override this method and isSortable(int) to support sorting.
        Specified by:
        sort in interface AdapterBasicTableModel.BasicTableModel
        Parameters:
        col - ignored.
        ascending - ignored.
        Returns:
        null
      • isDisabled

        public boolean isDisabled​(int row)
        This model does not support the concept of row disabling by default. Subclasses will need to override this method to support row disabling.
        Specified by:
        isDisabled in interface AdapterBasicTableModel.BasicTableModel
        Parameters:
        row - ignored.
        Returns:
        false.
      • isSelectable

        public boolean isSelectable​(int row)
        This model does not support the concept of row selectability by default. Subclasses will need to override this method disable selection of specific rows.
        Specified by:
        isSelectable in interface AdapterBasicTableModel.BasicTableModel
        Parameters:
        row - ignored.
        Returns:
        true.
      • sort

        protected int[] sort​(Comparator<Object> comparator,
                             int col,
                             boolean ascending)
        Calculates the sort order for the data, using the given column and comparator.
        Parameters:
        comparator - the comparator to use for sorting
        col - the column to sort on
        ascending - true for an ascending sort, false for descending.
        Returns:
        the row indices in sort order.