Package com.portal.app.cc.sharing
Class PGroupSharingTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
com.portal.app.cc.sharing.PAbstractSortingTableModel
com.portal.app.cc.sharing.PGroupSharingTableModel
- All Implemented Interfaces:
Serializable,TableModel
This displays the sharings(discount(s)/sponsor(s)).
- See Also:
-
Field Summary
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList -
Constructor Summary
ConstructorsConstructorDescriptionPGroupSharingTableModel(String sharingType, boolean selectionMode) Constructs anPGroupModelwith the specified mode. -
Method Summary
Modifier and TypeMethodDescriptionvoidNotifies all listeners that all cell values in the table's rows may have changed.protected voidformatTable(JTable table) Customizing the table according to derived class needs.getColumnClass(int columnIndex) Returns objects class with respect tocolumnIndex.intReturns the number of columns in the model.getColumnName(int col) Returns the name of the column atcol.getValueForColumn(Object e, int columnIndex) Returns the cell value from the passed row data structure atcolumnIndex.booleanisCellEditable(int rowIndex, int columnIndex) Returnstrueonly for the selection column.voidSetting of data to the model.voidsetValueAt(Object aValue, int rowIndex, int columnIndex) This will provide the implementation to set the selection of the sharing only.protected voidsortOnColumn(int sortColumn) This will sort the data structure on the passed column indexsortColumnand fire the model to update the view.Methods inherited from class com.portal.app.cc.sharing.PAbstractSortingTableModel
getLastClickedColumn, getRowAt, getRowCount, getSelectedData, getSelectedDataArray, getTable, getValueAt, setAscending, setData, sortOnColumnOfRangeMethods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Constructor Details
-
PGroupSharingTableModel
Constructs anPGroupModelwith 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 keyselectionMode- boolean
-
-
Method Details
-
getValueForColumn
Returns the cell value from the passed row data structure atcolumnIndex.- Specified by:
getValueForColumnin classPAbstractSortingTableModel- Parameters:
e- Object the row objectcolumnIndex- int the column whose value is to be queried- Returns:
- the value Object at the specified cell
-
getColumnName
Returns the name of the column atcol. 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:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel- 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. AJTableuses 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) Returnstrueonly for the selection column.- Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classAbstractTableModel- Parameters:
rowIndex- the row being queriedcolumnIndex- the column being queried
-
getColumnClass
Returns objects class with respect tocolumnIndex.- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel- Parameters:
columnIndex- the column being queried
-
setValueAt
This will provide the implementation to set the selection of the sharing only. Because all other columns are not editable.- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classAbstractTableModel- Parameters:
aValue- value to assign to cellrowIndex- row of cellcolumnIndex- 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 theJTableshould 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 ofAbstractTableModelto re set the row heights.- Overrides:
fireTableDataChangedin classAbstractTableModel
-
setData
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
Customizing the table according to derived class needs.- Overrides:
formatTablein classPAbstractSortingTableModel- 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 indexsortColumnand fire the model to update the view. Subclasses should override this, but also call super.sortOnColumn(sortColumn) for simple sorring- Overrides:
sortOnColumnin classPAbstractSortingTableModel- Parameters:
sortColumn- int the column index on which sorting should happen.
-