org.tfe.console.Tables
Class AlertsTableModel

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

public class AlertsTableModel
extends javax.swing.table.AbstractTableModel

See Also:
Serialized Form

Field Summary
 int filterCol
          the column by which we're filtering.
 boolean filtering
          filtering enabled(true) or disabled(false)
 java.lang.String filterVal
          String to keep track of the value that we're filtering on
 boolean sortAsc
          sorting ascending(true) or descending(false)
 int sortCol
          the column by which we're sorting.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
AlertsTableModel()
           
 
Method Summary
 void addRow(java.lang.Object[] alertSummary)
          Adds a row to the table.
 void addRows(java.util.ArrayList alertSummary)
          Adds rows to the table.
 void filter(boolean filter, java.lang.String filterValue, int column)
          Filters 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 the table for a specified value.
 java.lang.Class getColumnClass(int c)
          Gets the Class types for the data in a specified column.
 int getColumnCount()
          Gets the total number of columns in the table.
 java.lang.String getColumnName(int col)
          Gets the name of a specified column.
 int getRowCount()
          Gets the total number of rows in the table.
 java.lang.Object getValueAt(int row, int col)
          Gets the value of the data at a particular table cell.
 boolean isCellEditable(int row, int col)
          Whether or not the specified cell is editable.
 boolean isColorized()
          Whether or not the table is colorized.
 void removeAll()
          Removes all rows from the table.
 void removeRow(int index)
          Removes a row from the table.
 void setColorized(boolean colorized)
          Enable/disable table colorization.
 void sort()
          Sorts the table.
 void updateRow(int rowNum, java.lang.Object[] alertSummary)
          Updates a row's data.
 
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
sorting ascending(true) or descending(false)


filtering

public boolean filtering
filtering enabled(true) or disabled(false)


sortCol

public int sortCol
the column by which we're sorting.


filterCol

public int filterCol
the 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

AlertsTableModel

public AlertsTableModel()
Method Detail

addRow

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

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

addRows

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

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

removeRow

public void removeRow(int index)
Removes a row from the table.

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

removeAll

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


updateRow

public void updateRow(int rowNum,
                      java.lang.Object[] alertSummary)
Updates a row's data.

Parameters:
rowNum - the row number to update
alertSummary - a 7-element String array containing the data with which to update the row.

getColumnClass

public java.lang.Class getColumnClass(int c)
Gets the Class types for the data in a specified column.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
c - the column number for which to retrieve the Class type.
Returns:
the Class type of the data in the specified column.

getColumnCount

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

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

getRowCount

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

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

getColumnName

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

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
col - the column number for which to retrieve the name.
Returns:
String value of the name of the specified column.

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Gets the value of the data at a particular table cell.

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 in the specified cell.

isCellEditable

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

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Returns:
true if the cell is editable, false if not.

setColorized

public void setColorized(boolean colorized)
Enable/disable table colorization.

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 not.

filter

public void filter(boolean filter,
                   java.lang.String filterValue,
                   int column)
Filters the table.

Parameters:
filter - true to enable filtering, false to disable it.
filterValue - the value to look for when filtering.
column - the column in which to look for filterValue when filtering.

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 - the String value for which to search.
startRow - the row at which to begin the search.
Returns:
integer value of the row at which the value was found, or -1 if the value was not found.

find

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

Parameters:
findStr - the String value for which to search.
startRow - the row at which to begin the search.
column - the column in which to search for the findStr.
Returns:
integer value of the row at which the value was found, or -1 if the value was not found.