Class PGroupSharingTableModel

All Implemented Interfaces:
Serializable, TableModel

public final class PGroupSharingTableModel extends PAbstractSortingTableModel
This displays the sharings(discount(s)/sponsor(s)).
See Also:
  • Constructor Details

    • PGroupSharingTableModel

      public PGroupSharingTableModel(String sharingType, boolean selectionMode)
      Constructs an PGroupModel with the specified mode. If the selection mode is true this model will provide an extra column to give selection through check boxes.
      Parameters:
      sharingType - String the sharing type key
      selectionMode - boolean
  • Method Details

    • getValueForColumn

      public Object getValueForColumn(Object e, int columnIndex)
      Returns the cell value from the passed row data structure at columnIndex.
      Specified by:
      getValueForColumn in class PAbstractSortingTableModel
      Parameters:
      e - Object the row object
      columnIndex - int the column whose value is to be queried
      Returns:
      the value Object at the specified cell
    • getColumnName

      public String getColumnName(int col)
      Returns the name of the column at col. This is used to initialize the table's column header name. Note: this name does not need to be unique; two columns in a table can have the same name.
      Specified by:
      getColumnName in interface TableModel
      Overrides:
      getColumnName in class AbstractTableModel
      Parameters:
      col - the index of the column
      Returns:
      the name of the column
    • 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
    • isCellEditable

      public boolean isCellEditable(int rowIndex, int columnIndex)
      Returns true only for the selection column.
      Specified by:
      isCellEditable in interface TableModel
      Overrides:
      isCellEditable in class AbstractTableModel
      Parameters:
      rowIndex - the row being queried
      columnIndex - the column being queried
    • getColumnClass

      public Class getColumnClass(int columnIndex)
      Returns objects class with respect to columnIndex.
      Specified by:
      getColumnClass in interface TableModel
      Overrides:
      getColumnClass in class AbstractTableModel
      Parameters:
      columnIndex - the column being queried
    • setValueAt

      public void setValueAt(Object aValue, int rowIndex, int columnIndex)
      This will provide the implementation to set the selection of the sharing only. Because all other columns are 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
    • 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. This is overriden method of AbstractTableModel to re set the row heights.
      Overrides:
      fireTableDataChanged in class AbstractTableModel
    • setData

      public void setData(ArrayList l)
      Setting of data to the model. As well resetting the row height of a table for the updated data.
      Parameters:
      l - ArrayList the sharings
    • formatTable

      protected void formatTable(JTable table)
      Customizing the table according to derived class needs.
      Overrides:
      formatTable in class PAbstractSortingTableModel
      Parameters:
      table - JTable Subclasses should override this, but also call super.formatTable(table)
    • sortOnColumn

      protected void sortOnColumn(int sortColumn)
      This will sort the data structure on the passed column index sortColumn and fire the model to update the view. Subclasses should override this, but also call super.sortOnColumn(sortColumn) for simple sorring
      Overrides:
      sortOnColumn in class PAbstractSortingTableModel
      Parameters:
      sortColumn - int the column index on which sorting should happen.