client
Class CalendarTableModel

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended byclient.CalendarTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public final class CalendarTableModel
extends javax.swing.table.AbstractTableModel

This class defined the table model of the JTable of the main calendar client window. All table data and most of the table actions, like sorting or updating the content, go trough this class.

Author:
buetow
See Also:
Serialized Form

Field Summary
static java.lang.String CATEGORY_HEADER
           
static java.lang.String DATE_HEADER
           
static java.lang.String DESCRIPTION_HEADER
           
static java.lang.String PLACE_HEADER
           
 
Constructor Summary
CalendarTableModel(javax.swing.JTable jTable)
          Simple constructor, creates a calendar table model to be used with the JTable of the netcalendar client main window.
 
Method Summary
 java.lang.Class getColumnClass(int iCol)
          This method returns the class types of a specific table column.
 int getColumnCount()
          This method returns the number of columns of the JTable.
 java.lang.String getColumnName(int iCol)
          This method returns the column header of a specific table column.
 CalendarEvent getEvent(int iRow)
          This method returns the calendar event which belongs to a specific table row
 int getRowCount()
          This method retuns the number of rows of the JTable.
 java.lang.Object getValueAt(int iRow, int iCol)
          Gets a specific table value
 boolean isCellEditable(int iRow, int iCol)
          This method checks if a cell is editable or not.
 void reverseSortByCategory()
          Reverse sorts the table content by their category names.
 void reverseSortByCol(int iCol)
          Reverse sorts the table content by a specified table column.
 void reverseSortByDate()
          Reverse sorts the table content by their dates.
 void reverseSortByDescription()
          Reverse sorts the table content by their description texts.
 void reverseSortByPlace()
          Reverse sorts the table content by their places.
 void setEvents(java.util.Vector vecEvents)
          This method updates all the value objects (calendar events) of the table.
 void setRowCount(int iRows)
          This method sets the number of rows of the JTable.
 void setValueAt(java.lang.Object object, int iRow, int iCol)
          This function updates the data of the JTable.
 void sortByCategory()
          Sorts the table content by their category names.
 void sortByCol(int iCol)
          Sorts the table content by a specified table column.
 void sortByDate()
          Sorts the table content by their dates.
 void sortByDescription()
          Sorts the table content by their description texts.
 void sortByPlace()
          Sorts the table content by their places.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATE_HEADER

public static final java.lang.String DATE_HEADER
See Also:
Constant Field Values

CATEGORY_HEADER

public static final java.lang.String CATEGORY_HEADER
See Also:
Constant Field Values

DESCRIPTION_HEADER

public static final java.lang.String DESCRIPTION_HEADER
See Also:
Constant Field Values

PLACE_HEADER

public static final java.lang.String PLACE_HEADER
See Also:
Constant Field Values
Constructor Detail

CalendarTableModel

public CalendarTableModel(javax.swing.JTable jTable)
Simple constructor, creates a calendar table model to be used with the JTable of the netcalendar client main window.

Parameters:
jTable - Specifies the JTable object of this table model.
Method Detail

getColumnCount

public int getColumnCount()
This method returns the number of columns of the JTable.

Returns:
Returns the number of columns of the JTable.

getRowCount

public int getRowCount()
This method retuns the number of rows of the JTable.

Returns:
Returns the number of rows of the JTable.

setRowCount

public void setRowCount(int iRows)
This method sets the number of rows of the JTable.

Parameters:
iRows - Specifies the number of rows of the JTable.

isCellEditable

public boolean isCellEditable(int iRow,
                              int iCol)
This method checks if a cell is editable or not.

Parameters:
iRow - Specifies the tables row.
iCol - Specifies the tables column.
Returns:
Returns true if the cell is editable. Else, false will be returned.

getValueAt

public java.lang.Object getValueAt(int iRow,
                                   int iCol)
Gets a specific table value

Parameters:
iRow - Specifies the tables row
iCol - Specifies the tables column
Returns:
Returns the object at (row,column)

setValueAt

public void setValueAt(java.lang.Object object,
                       int iRow,
                       int iCol)
This function updates the data of the JTable.

Parameters:
object - Specifies the new value.
iRow - Specifies the row of the cell to be updated.
iCol - Specifies the column of the cell to be updated.

getColumnClass

public java.lang.Class getColumnClass(int iCol)
This method returns the class types of a specific table column.

Parameters:
iCol - Specifies the column index to get the class type for.
Returns:
Returns the class type of the specified column.

getColumnName

public java.lang.String getColumnName(int iCol)
This method returns the column header of a specific table column.

Parameters:
iCol - Specifies the column index to get the column header for.
Returns:
Returns the header string of the specified column.

getEvent

public CalendarEvent getEvent(int iRow)
This method returns the calendar event which belongs to a specific table row

Parameters:
iRow - Specifies the table row index
Returns:
Returns the calendar event

setEvents

public void setEvents(java.util.Vector vecEvents)
This method updates all the value objects (calendar events) of the table.

Parameters:
vecEvents - Specifies the vector of the events to be used.

sortByCol

public void sortByCol(int iCol)
Sorts the table content by a specified table column.

Parameters:
iCol - Specifies the table column to sort against.

reverseSortByCol

public void reverseSortByCol(int iCol)
Reverse sorts the table content by a specified table column.

Parameters:
iCol - Specifies the table column to reverse sort against.

sortByDate

public void sortByDate()
Sorts the table content by their dates.


sortByCategory

public void sortByCategory()
Sorts the table content by their category names.


sortByDescription

public void sortByDescription()
Sorts the table content by their description texts.


sortByPlace

public void sortByPlace()
Sorts the table content by their places.


reverseSortByDate

public void reverseSortByDate()
Reverse sorts the table content by their dates.


reverseSortByCategory

public void reverseSortByCategory()
Reverse sorts the table content by their category names.


reverseSortByDescription

public void reverseSortByDescription()
Reverse sorts the table content by their description texts.


reverseSortByPlace

public void reverseSortByPlace()
Reverse sorts the table content by their places.