org.bibalex.daf.commongui.datamodels
Class UICheckList

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.bibalex.daf.handlers.dbhandler.DataTable
          extended by org.bibalex.daf.commongui.datamodels.UICheckList
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class UICheckList
extends DataTable

This class holds a DataModel used in CheckBoxList, the data is retrieved from a DataTable. It supports 2 schemes. The 1st is to add a DataTable that doesn't define an IsSelected Column. This scheme stores the selection into a separete boolean array, and the other scheme is to define a specific column that indicates if the item is selected or not.

Author:
Fadi.Edward
See Also:
Serialized Form

Field Summary
protected  int colID
          The Column that represents the ID in the DataTable.
protected  int colSelected
          The column that defines if the Item is selected or not.
protected  int colVisible
          The Column to be displayed in the list.
protected  boolean[] isSelected
          A boolean array to save selection in case of 1st scheme.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
UICheckList(DataTable dataTable, int colID, int colVisible)
          Constructor.
UICheckList(DataTable dataTable, int colID, int colVisible, int colSelected)
          Constructor.
 
Method Summary
 java.util.Vector getCheckBoxVector()
          Retreives a vector containing all the CheckBoxes in the list.
 int getIDAt(int index)
          Retreives the DB ID at the given index.
 boolean isSelected(int index)
          Retreives the status of a given index, either it is selected or not.
 void setSelected(int index, boolean isSelected)
          Sets a specific CheckBox in the list to be either selected or not.
 
Methods inherited from class org.bibalex.daf.handlers.dbhandler.DataTable
addRow, addRow, addRowAt, addRowAt, deleteRow, elementAt, elementAt, ExportToExcel, getColumnCount, getColumnName, getDynamicColumnIndices, getNameOfColumn, getNoOfColumns, getNoOfRows, getRow, getRowCount, getValueAt, setArchivingMatrix, setDynamicColumnIndices, setDynamicTable, setNameOfColumn, setNoOfColumn, setValueAt
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

colID

protected int colID
The Column that represents the ID in the DataTable.


colVisible

protected int colVisible
The Column to be displayed in the list.


colSelected

protected int colSelected
The column that defines if the Item is selected or not.


isSelected

protected boolean[] isSelected
A boolean array to save selection in case of 1st scheme.

Constructor Detail

UICheckList

public UICheckList(DataTable dataTable,
                   int colID,
                   int colVisible)
Constructor. (1st Scheme)

Parameters:
dataTable - The DataTable to extract data from.
colID - The Column that represents the ID in the DataTable.
colVisible - The Column to be displayed in the list.

UICheckList

public UICheckList(DataTable dataTable,
                   int colID,
                   int colVisible,
                   int colSelected)
Constructor. (2nd Scheme)

Parameters:
dataTable - The DataTable to extract data from.
colID - The Column that represents the ID in the DataTable.
colVisible - The Column to be displayed in the list.
colSelected - The column that defines if the Item is selected or not.
Method Detail

getCheckBoxVector

public java.util.Vector getCheckBoxVector()
Retreives a vector containing all the CheckBoxes in the list. Used to initialize the list. Used in calling the Constructor of the JList.

Returns:
A vector containing all the CheckBoxes in the list

setSelected

public void setSelected(int index,
                        boolean isSelected)
Sets a specific CheckBox in the list to be either selected or not.

Parameters:
index - The index of the item in the List.
isSelected - true if selected, false otherwise.

isSelected

public boolean isSelected(int index)
Retreives the status of a given index, either it is selected or not.

Parameters:
index - The index of the item in question.
Returns:
true if the item is selected, false otherwise.

getIDAt

public int getIDAt(int index)
Retreives the DB ID at the given index.

Parameters:
index - The index of the item in question.
Returns:
The DB ID at the given index.