Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.geotools.gui.swing
Class LoggingTableModel  view LoggingTableModel download LoggingTableModel.java

java.lang.Object
  extended byjava.util.logging.Handler
      extended byorg.geotools.gui.swing.LoggingTableModel
All Implemented Interfaces:
javax.swing.table.TableModel

final class LoggingTableModel
extends java.util.logging.Handler
implements javax.swing.table.TableModel

A logging java.util.logging.Handler storing LogRecords as a javax.swing.table.TableModel. This model is used by LoggingPanel for displaying logging messages in a javax.swing.JTable.

Version:
$Id: LoggingTableModel.java,v 1.5 2003/02/09 23:38:11 lbruand Exp $

Field Summary
private  java.util.Map cache
          String representations of latest required records.
private  int capacity
          The maximum amount of records that can be stored in this logging panel.
private static int[] COLUMN_NAMES
          Resource keys for column names.
static java.lang.String CVSID
           
private  java.text.DateFormat dateFormat
          The format to use for formatting time.
private  javax.swing.event.EventListenerList listenerList
          The list of registered listeners.
private  int recordCount
          The total number of logging messages published by this panel.
private  java.util.logging.LogRecord[] records
          The last java.util.logging.LogRecords stored.
 
Fields inherited from class java.util.logging.Handler
 
Constructor Summary
LoggingTableModel()
          Construct the handler.
 
Method Summary
 void addTableModelListener(javax.swing.event.TableModelListener listener)
          Adds a listener that is notified each time a change to the data model occurs.
 void close()
          Close the Handler and free all associated resources.
private  void fireTableChanged(javax.swing.event.TableModelEvent event)
          Forwards the given notification event to all TableModelListeners.
 void flush()
          Flush any buffered output.
 int getCapacity()
          Returns the capacity.
 java.lang.Class getColumnClass(int columnIndex)
          Returns the most specific superclass for all the cell values in the column.
 int getColumnCount()
          Returns the number of columns in the model.
 java.lang.String getColumnName(int columnIndex)
          Returns the name of the column at columnIndex.
 java.util.logging.LogRecord getLogRecord(int row)
          Returns the log record for the specified row.
 int getRowCount()
          Returns the number of rows in the model.
private static java.lang.String getShortClassName(java.lang.String name)
          Returns the class name in a shorter form (without package).
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
          Returns the value for the cell at columnIndex and rowIndex.
 boolean isCellEditable(int rowIndex, int columnIndex)
          Returns false since cells are not editable.
 void publish(java.util.logging.LogRecord record)
          Publish a java.util.logging.LogRecord.
 void removeTableModelListener(javax.swing.event.TableModelListener listener)
          Removes a listener from the list that is notified each time a change occurs.
 void setCapacity(int capacity)
          Set the capacity.
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
          Do nothing since cells are not editable.
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CVSID

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

COLUMN_NAMES

private static final int[] COLUMN_NAMES
Resource keys for column names.


records

private java.util.logging.LogRecord[] records
The last java.util.logging.LogRecords stored. This array will grows as needed up to capacity 55 . Once the maximal capacity is reached, early records are discarted.


capacity

private int capacity
The maximum amount of records that can be stored in this logging panel. If more than capacity 55 messages are logged, early messages will be discarted.


recordCount

private int recordCount
The total number of logging messages published by this panel. This number may be greater than the amount of java.util.logging.LogRecord actually memorized, since early records may have been discarted. The slot in records where to write the next message can be computed by recordCount % capacity.


cache

private final java.util.Map cache
String representations of latest required records. Keys are java.util.logging.LogRecord objects and values are String[]. This is a cache for faster rendering.


listenerList

private final javax.swing.event.EventListenerList listenerList
The list of registered listeners.


dateFormat

private final java.text.DateFormat dateFormat
The format to use for formatting time.

Constructor Detail

LoggingTableModel

public LoggingTableModel()
Construct the handler.

Method Detail

getCapacity

public int getCapacity()
Returns the capacity. This is the maximum number of java.util.logging.LogRecords this handler can memorize. If more messages are logged, then the oldiest messages will be discarted.


setCapacity

public void setCapacity(int capacity)
Set the capacity. This is the maximum number of java.util.logging.LogRecords this handler can memorize. If more messages are logged, then the oldiest messages will be discarted.


publish

public void publish(java.util.logging.LogRecord record)
Publish a java.util.logging.LogRecord. If the maximal capacity has been reached, the oldiest record will be discarted.


getLogRecord

public java.util.logging.LogRecord getLogRecord(int row)
Returns the log record for the specified row.


getColumnCount

public int getColumnCount()
Returns the number of columns in the model.

Specified by:
getColumnCount in interface javax.swing.table.TableModel

getRowCount

public int getRowCount()
Returns the number of rows in the model.

Specified by:
getRowCount in interface javax.swing.table.TableModel

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Returns the most specific superclass for all the cell values in the column.

Specified by:
getColumnClass in interface javax.swing.table.TableModel

getColumnName

public java.lang.String getColumnName(int columnIndex)
Returns the name of the column at columnIndex.

Specified by:
getColumnName in interface javax.swing.table.TableModel

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Returns the value for the cell at columnIndex and rowIndex.

Specified by:
getValueAt in interface javax.swing.table.TableModel

getShortClassName

private static java.lang.String getShortClassName(java.lang.String name)
Returns the class name in a shorter form (without package).


setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
Do nothing since cells are not editable.

Specified by:
setValueAt in interface javax.swing.table.TableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Returns false since cells are not editable.

Specified by:
isCellEditable in interface javax.swing.table.TableModel

addTableModelListener

public void addTableModelListener(javax.swing.event.TableModelListener listener)
Adds a listener that is notified each time a change to the data model occurs.

Specified by:
addTableModelListener in interface javax.swing.table.TableModel

removeTableModelListener

public void removeTableModelListener(javax.swing.event.TableModelListener listener)
Removes a listener from the list that is notified each time a change occurs.

Specified by:
removeTableModelListener in interface javax.swing.table.TableModel

fireTableChanged

private void fireTableChanged(javax.swing.event.TableModelEvent event)
Forwards the given notification event to all TableModelListeners.


flush

public void flush()
Flush any buffered output.


close

public void close()
Close the Handler and free all associated resources.