org.tfe.console.Tables
Class AlertCollectionTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--org.tfe.console.Tables.AlertCollectionTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class AlertCollectionTableModel
extends javax.swing.table.AbstractTableModel

See Also:
Serialized Form

Field Summary
 int filterCol
          integer to keep track of which column by which we're filtering
 boolean filtering
          boolean telling whether or not table filtering is enabled.
 java.lang.String filterVal
          String to keep track of the value that we're filtering on
 boolean sortAsc
          boolean telling whether sorting is ascending or descending (true = ascending, false = descending.
 int sortCol
          integer to keep track of which column by which we're sorting
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
AlertCollectionTableModel()
           
 
Method Summary
 void addRow(java.lang.Object[] alertSummary)
          Adds a row.
 void addRows(java.util.ArrayList alertSummary)
          Adds rows.
 void filter(boolean filter, java.lang.String filterValue, int column)
          Enables/disables filtering on the table.
 int find(java.lang.String findStr, int startRow)
          Searches the table for a specified value.
 int find(java.lang.String findStr, int startRow, int column)
          Searches a particular column for a specified value.
 java.lang.Class getColumnClass(int c)
          Gets the datatype for each column.
 int getColumnCount()
          Gets the total number of columns in the table.
 java.lang.String getColumnName(int col)
          Gets the name of the column at the specified index.
 int getRowCount()
          Gets the total number of rows in the table.
 java.lang.Object getValueAt(int row, int col)
          Gets the value at the specified row and column in the table.
 boolean isCellEditable(int row, int col)
          Whether or not the cell at the specified row and column is editable.
 boolean isColorized()
          Whether or not the table is colorized.
 void removeAll()
          Removes all rows from the table.
 void removeRow(int index)
          Removes the row at the specified index.
 void removeRows(int[] rows)
          Removes a group of rows from the table.
 void setColorized(boolean colorized)
          Enables/disabled colorization of the table.
 void setValueAt(int row, int col, java.lang.Object val)
          Sets the value at the specified row and column in the table.
 void sort()
          Sorts the table.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sortAsc

public boolean sortAsc
boolean telling whether sorting is ascending or descending (true = ascending, false = descending.


filtering

public boolean filtering
boolean telling whether or not table filtering is enabled. (true = enabled, false = disabled.


sortCol

public int sortCol
integer to keep track of which column by which we're sorting


filterCol

public int filterCol
integer to keep track of which column by which we're filtering


filterVal

public java.lang.String filterVal
String to keep track of the value that we're filtering on

Constructor Detail

AlertCollectionTableModel

public AlertCollectionTableModel()
Method Detail

addRow

public void addRow(java.lang.Object[] alertSummary)
Adds a row.

Parameters:
alertSummary - a String array containing the values to be added to the table.

addRows

public void addRows(java.util.ArrayList alertSummary)
Adds rows.

Parameters:
alertSummary - an ArrayList of String arrays containing the values to be added to the table.

removeRow

public void removeRow(int index)
Removes the row at the specified index.

Parameters:
index - the index number of the row to be removed from the table.

removeRows

public void removeRows(int[] rows)
Removes a group of rows from the table.


removeAll

public void removeAll()
Removes all rows from the table.


getColumnClass

public java.lang.Class getColumnClass(int c)
Gets the datatype for each column.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
c - the column number.
Returns:
a Class type for that column's data.

getColumnCount

public int getColumnCount()
Gets the total number of columns in the table.

Returns:
an integer value representing the number of columns in the table.

getRowCount

public int getRowCount()
Gets the total number of rows in the table.

Returns:
an integer value representing the total number of rows in the table.

getColumnName

public java.lang.String getColumnName(int col)
Gets the name of the column at the specified index.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
col - the index of the column who's name is to be retrieved.
Returns:
a String value of the name of the column at the given index.

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Gets the value at the specified row and column in the table.

Parameters:
row - the row number containing the data to be retrieved.
col - the column number containing the data to be retrieved.
Returns:
a java.lang.Object representation of the data at the specified cell.

setValueAt

public void setValueAt(int row,
                       int col,
                       java.lang.Object val)
Sets the value at the specified row and column in the table.

Parameters:
row - the row number containing the cell to be modified.
col - the column number containing the cell to be modified.
val - the value to be entered into the specified cell.

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Whether or not the cell at the specified row and column is editable.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
row - the row containing the cell of interest.
col - the column containing the cell of interest
Returns:
true if the cell is editable, false if not.

setColorized

public void setColorized(boolean colorized)
Enables/disabled colorization of the table.

Parameters:
colorized - true to enable colorization, false to disable it.

isColorized

public boolean isColorized()
Whether or not the table is colorized.

Returns:
true if the table is colorized, false if it is not.

filter

public void filter(boolean filter,
                   java.lang.String filterValue,
                   int column)
Enables/disables filtering on the table.

Parameters:
filter - true to enable filtering, false to disable filtering.
filterValue - the value to search for when filtering.
column - the column on which to filter.

sort

public void sort()
Sorts the table.


find

public int find(java.lang.String findStr,
                int startRow)
Searches the table for a specified value.

Parameters:
findStr - a String value for which to search the table.
startRow - the starting row number (integer) of the search.
Returns:
the integer value of the row that the value was found in, or -1 if the value was not found.

find

public int find(java.lang.String findStr,
                int startRow,
                int column)
Searches a particular column for a specified value.

Parameters:
findStr - a String value for which to search the table.
startRow - the starting row number (integer) of the search.
Returns:
the integer value of the row that the value was found in, or -1 if the value was not found.