org.lyra.Widgets
Class OrganiserTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by javax.swing.table.DefaultTableModel
          extended by org.lyra.Widgets.OrganiserTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class OrganiserTableModel
extends javax.swing.table.DefaultTableModel

This is a wrapper to the DefaultTableModel which alters behaviour to match our needs in certain areas. Primarily we need a table model that will prevent users from making modifications unless explicitly desired.

Version:
1.0.5, %Revision, 174%, %LastChangedDate, 27/10/12 3:33PM%
Author:
Martin Foster
See Also:
Serialized Form

Field Summary
private static int FILE_COLUMN
           
private  Comptroller Manager
           
private  java.util.Set<java.lang.Integer> myEdits
           
private  java.lang.String myFilter
           
private static long serialVersionUID
           
 
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
OrganiserTableModel(Comptroller manager, java.lang.Object[][] dataset, int cols, java.lang.Integer... editable)
          Default constructor for the class which has an option of allowing edits on certain rows if they are passed on.
OrganiserTableModel(Comptroller manager, java.lang.Object[][] dataset, java.lang.Object[] titles, java.lang.Integer... editable)
          Constructor which will provide all the information necessary in order to display a proper header.
OrganiserTableModel(java.lang.Object[][] dataset, int cols, java.lang.Integer... editable)
          Default constructor for the class which has an option of allowing edits on certain rows if they are passed on.
OrganiserTableModel(java.lang.Object[][] dataset, java.lang.Object[] titles, java.lang.Integer... editable)
          Constructor which will provide all the information necessary in order to display a proper header.
 
Method Summary
 void addCellEditable(int column)
          Add in a new column which will be enabled for editing.
 int charFindFirst(int col, char key)
          Is used to find the first row that contains information like that we have at the moment.
 int chopFindFirst(int col)
          Removes the last character from the filter and searches based on that.
 void clearFindFirst()
          Clear out the filtering for another pass.
 boolean isCellEditable(int row, int column)
           
 void removeCellEditable(int column)
          Remove a column which was formerly enabled for editing.
 void setValueAt(java.lang.Object aValue, int row, int column)
           
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, getRowCount, getValueAt, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

Manager

private Comptroller Manager

myEdits

private java.util.Set<java.lang.Integer> myEdits

myFilter

private java.lang.String myFilter

FILE_COLUMN

private static final int FILE_COLUMN
See Also:
Constant Field Values
Constructor Detail

OrganiserTableModel

public OrganiserTableModel(Comptroller manager,
                           java.lang.Object[][] dataset,
                           int cols,
                           java.lang.Integer... editable)
Default constructor for the class which has an option of allowing edits on certain rows if they are passed on.

Parameters:
manager - Comptroller instance to track changes.
dataset - Multi-dimension array containing the entire data set.
cols - Columns that exist within this data set.
editable - Integer containing columns that can be edited.

OrganiserTableModel

public OrganiserTableModel(Comptroller manager,
                           java.lang.Object[][] dataset,
                           java.lang.Object[] titles,
                           java.lang.Integer... editable)
Constructor which will provide all the information necessary in order to display a proper header.

Parameters:
manager - Comptroller instance to track changes.
dataset - Multi-dimension array containing the entire data set.
titles - Array containing all of the column titles.
editable - Integer containing columns that can be edited.

OrganiserTableModel

public OrganiserTableModel(java.lang.Object[][] dataset,
                           int cols,
                           java.lang.Integer... editable)
Default constructor for the class which has an option of allowing edits on certain rows if they are passed on.

Parameters:
dataset - Multi-dimension array containing the entire data set.
cols - Columns that exist within this data set.
editable - Integer containing columns that can be edited.

OrganiserTableModel

public OrganiserTableModel(java.lang.Object[][] dataset,
                           java.lang.Object[] titles,
                           java.lang.Integer... editable)
Constructor which will provide all the information necessary in order to display a proper header.

Parameters:
dataset - Multi-dimension array containing the entire data set.
titles - Array containing all of the column titles.
editable - Integer containing columns that can be edited.
Method Detail

addCellEditable

public void addCellEditable(int column)
Add in a new column which will be enabled for editing.

Parameters:
column - Column number to enable editing.

removeCellEditable

public void removeCellEditable(int column)
Remove a column which was formerly enabled for editing.

Parameters:
column - Column number to disable editing.

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.DefaultTableModel

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int row,
                       int column)
Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.DefaultTableModel

charFindFirst

public int charFindFirst(int col,
                         char key)
Is used to find the first row that contains information like that we have at the moment.

Parameters:
col - Column to search against.
key - Character to add to the selection.
Returns:
Integer matching the row to move too.

chopFindFirst

public int chopFindFirst(int col)
Removes the last character from the filter and searches based on that.

Parameters:
col - Column to search against.
Returns:
Integer matching the row to move too.

clearFindFirst

public void clearFindFirst()
Clear out the filtering for another pass. Triggered when we make use of the escape character.