Class ResultsTable

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable

public class ResultsTable extends JTable
Displays the results returned from a search in a table. The first two columns are reserved for a DataTemplate that represents an event object and a checkbox to mark an event.
Version:
%version: 24 % %date_modified: Mon Nov 26 14:33:46 2001 %
Author:
Monica Gaines
See Also:
  • Constructor Details

    • ResultsTable

      public ResultsTable()
      Creates a new ResultsTable instance.
    • ResultsTable

      public ResultsTable(ResourceBundle res)
      Creates a new ResultsTable instance.
      Parameters:
      res - resource bundle
  • Method Details

    • getMarkedModel

      public ListTableModel getMarkedModel()
      Returns the model that stores the information for marked items.
      Returns:
      the marked item model
    • getResultsModel

      public ListTableModel getResultsModel()
      Returns the model that stores the information for table that contains all the items - marked and unmarked.
      Returns:
      the table model
    • addMarkedItemListener

      public void addMarkedItemListener(ItemListener l)
      Adds the given listener to received notification for selection of marked rows.
      Parameters:
      l - the item listener to be added
    • removeMarkedItemListener

      public void removeMarkedItemListener(ItemListener l)
      Removes the given listener for recieving notificat for marked rows.
      Parameters:
      l - the item listener to be removed
    • setResources

      public void setResources(ResourceBundle res)
      Sets the resource bundle to the current object.
      Parameters:
      res - resource bundle
    • getRealSelectedRow

      public int getRealSelectedRow()
      Because this table is sorted, the row that is selected is not necessarily the orignal row that was put into the model. This method returns the original unsorted row from the model.
      Returns:
      the original unsorted row from the model.
    • getDataAt

      public ArrayList getDataAt(int row)
      Returns a list of data at the given row.
      Parameters:
      row - the row whose dat is to be looked up from model
      Returns:
      the list of data at the given row
    • getRealSelectedRows

      public int[] getRealSelectedRows()
      Because this table is sorted, the rows that are selected are not necessarily the orignal rows that was put into the model. This method returns the original unsorted rows from the model.
      Returns:
      the original unsorted rows from the model.
    • markRow

      public void markRow()
      Marks all selected rows.
    • markRow

      public void markRow(int row)
      Marks the given row.
      Parameters:
      row - the row to mark
    • unmarkRow

      public void unmarkRow()
      Unmarks the currently selected row.
    • unmarkRow

      public void unmarkRow(int row)
      Unmarks the given row.
      Parameters:
      row - the row to unmark
    • unmarkRows

      public void unmarkRows(int[] rows)
      Unmarks all the rows passed in the given array.
      Parameters:
      rows - the rows to unmark
    • markAllRows

      public void markAllRows()
      Marks all the rows in the table.
    • unmarkAllRows

      public void unmarkAllRows()
      Unmarks all the rows in the table.
    • getMarkedRows

      public ArrayList getMarkedRows()
      Returns an ArrayList of the marked rows.
    • setColumnHeaders

      public void setColumnHeaders(String[] labels)
      Sets the column headers to the given labels.
      Parameters:
      labels - an array of labels for the column headers
    • setTableData

      public void setTableData(ArrayList data, ArrayList headers)
      Replaces the table data with the new information.
      Parameters:
      data - a vector of the table data
      headers - a vector of the column header labels
    • addTableData

      public void addTableData(ArrayList data)
      Adds the given data to the end of the table.
      Parameters:
      data - the new table data
    • addTableDataBatch

      public void addTableDataBatch(ArrayList data)
    • clear

      public void clear()
      Clears the table of all data.
    • clearMarkedModel

      public void clearMarkedModel()
      Clears the table of all marked data.
    • clearMarkedRows

      public void clearMarkedRows()
      Clears the table of all marked rows.
    • clearSelection

      public void clearSelection()
      Clears the current selection in the table.
      Overrides:
      clearSelection in class JTable
    • addNotify

      public void addNotify()
      Sets the size of the columns and the background of the table.
      Overrides:
      addNotify in class JTable
    • showMarkedItems

      public void showMarkedItems(ArrayList data, ArrayList headers)
      Display only the marked items in the table.
    • showAllItems

      public void showAllItems()
      Display all items, marked and unmarked, in the table.
    • sortByColumn

      public void sortByColumn(int col)
      Sort the table by the given column.
    • setTableColumnWidths

      public void setTableColumnWidths()