de.qfs.apps.qflog.logview
Class LogTableView

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--de.qfs.apps.qflog.logview.LogTableView

public class LogTableView
extends javax.swing.JPanel
implements java.util.Observer

This is a view that displays log messages in a table. The table can be filtered and sorted in various ways. Also included is a detail view for the currently selected message. A LogTableView is usually used as part of the LogView component, that integrates the LogTableView with other logging related views.

The LogTableView must be initialized by a call to init after creation. It uses its own resources for localization, which can be modified via setResources.

The Configurable members of the LogTableView are collected in a Configurator. They include the table layout, the sort order and the state and location of the detail view. The Configurator can be retrieved via getConfigurator and must be registered by the caller, unless the LogTableView is part of a LogView.

Version:
$Revision: 1.21 $
Author:
Gregor Schmid
See Also:
Serialized Form

Inner Class Summary
protected  class LogTableView.CellSelectionListener
          Listener for changes in the table's selection or model contents that updates the detail view accordingly.
 class LogTableView.LevelRenderer
          Renderer that displays the icons for the level column and draws a black border around the selected cell instead of the default border.
protected  class LogTableView.TableKeyListener
          A listener for key presses on the table.
 
Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
LogTableView(LogTableModel model)
          Create a new LogTableView.
 
Method Summary
 void cleanup()
          Clear everything that might prevent garbage collection.
 void clearAll()
          Remove all rows from the table model.
 void copyAllToClipboard()
          Copy the messages from all visible or invisible rows of the table to the clipboard.
 void copySelectedToClipboard()
          Copy the messages in the selected rows of the table to the clipboard.
 void copyVisibleToClipboard()
          Copy the messages from all visible rows of the table to the clipboard.
 void fillMenu(javax.swing.JMenu menu)
          Fill a JMenu with menu items for the LogTableView.
 void fillMenu(javax.swing.JPopupMenu menu)
          Fill a JPopupMenu with menu items for the LogTableView.
 void finalize()
          Finalize the LogTableView.
 de.qfs.lib.config.Configurator getConfigurator()
          Get a Configurator for the LogTableView.
 LogTableModel getModel()
          Get the view's associated LogTableModel.
 de.qfs.lib.gui.MultiPane getMultiPane()
          Get the MultiPane used for the display of the table and the detail view.
 de.qfs.lib.option.OptionSet getOptions()
          Get the options of the LogTableView.
 javax.swing.JTable getTable()
          Get the JTable component of the view.
 void init()
          Initialize the components of the view.
 void reduceToVisible()
          Remove all invisible rows from the table model.
 void removeVisible()
          Remove all visible rows from the table model.
 void setCommandDistributor(de.qfs.lib.command.CommandDistributor cd)
          Set the CommandDistributor to use for command dispatch.
 void setFilter(de.qfs.lib.gui.TableModelFilter filter)
          Set the filter for the table.
 void setLoggingEnabled(boolean enable)
          Enable or disable logging output caused directly or indirectly by LogTableView methods.
 void setResources(java.util.ResourceBundle rb)
          Override the default resources used by the LogTableView.
 void setStatusLine(de.qfs.lib.gui.StatusLine statusLine)
          Set the StatusLine to use for informative display.
 void showDetail(boolean show)
          Tell the LogTableView whether the detail view should be displayed.
 void update(java.util.Observable obj, java.lang.Object arg)
          Notify the LogTableView that one of its Observables has changed.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LogTableView

public LogTableView(LogTableModel model)
Create a new LogTableView.
Parameters:
model - The mode to use for the tree.
Method Detail

init

public void init()
Initialize the components of the view. This method is not called by the constructor to enable further configuration like setting the resources, before the view is initialized.

cleanup

public void cleanup()
Clear everything that might prevent garbage collection.

finalize

public void finalize()
Finalize the LogTableView.
Overrides:
finalize in class java.lang.Object

getModel

public final LogTableModel getModel()
Get the view's associated LogTableModel.
Returns:
The model of the view.

getTable

public final javax.swing.JTable getTable()
Get the JTable component of the view.
Returns:
The table.

getMultiPane

public final de.qfs.lib.gui.MultiPane getMultiPane()
Get the MultiPane used for the display of the table and the detail view.
Returns:
The MultiPane used by the LogTableView.

fillMenu

public void fillMenu(javax.swing.JMenu menu)
Fill a JMenu with menu items for the LogTableView.
Parameters:
menu - The JMenu to fill.

fillMenu

public void fillMenu(javax.swing.JPopupMenu menu)
Fill a JPopupMenu with menu items for the LogTableView.
Parameters:
menu - The JPopupMenu to fill.

getConfigurator

public de.qfs.lib.config.Configurator getConfigurator()
Get a Configurator for the LogTableView.
Returns:
The Configurator for the LogTableView.

getOptions

public final de.qfs.lib.option.OptionSet getOptions()
Get the options of the LogTableView.
Returns:
The options of the LogTableView.

setLoggingEnabled

public final void setLoggingEnabled(boolean enable)
Enable or disable logging output caused directly or indirectly by LogTableView methods. If logging is disabled, all calls to methods that might create log messages will be protected with de.qfs.lib.log.Log.excludeThread. This is necessary, if the LogFilterTreeModel is used inside the application whose logs it is supposed to filter.

The default value is false.

Parameters:
enable - True to enable logging, false to disable it.

setStatusLine

public void setStatusLine(de.qfs.lib.gui.StatusLine statusLine)
Set the StatusLine to use for informative display.
Parameters:
statusLine -  

setCommandDistributor

public void setCommandDistributor(de.qfs.lib.command.CommandDistributor cd)
Set the CommandDistributor to use for command dispatch.
Parameters:
cd - The CommandDistributor to use.

setResources

public void setResources(java.util.ResourceBundle rb)
Override the default resources used by the LogTableView. If this method is not called, the LogTableView will use its default resource settings.
Parameters:
rb - ResourceBundle containing the resources to use.

setFilter

public final void setFilter(de.qfs.lib.gui.TableModelFilter filter)
Set the filter for the table.
Parameters:
filter - The new filter.

copySelectedToClipboard

public void copySelectedToClipboard()
Copy the messages in the selected rows of the table to the clipboard.

copyVisibleToClipboard

public void copyVisibleToClipboard()
Copy the messages from all visible rows of the table to the clipboard.

copyAllToClipboard

public void copyAllToClipboard()
Copy the messages from all visible or invisible rows of the table to the clipboard.

clearAll

public void clearAll()
Remove all rows from the table model.

reduceToVisible

public void reduceToVisible()
Remove all invisible rows from the table model.

removeVisible

public void removeVisible()
Remove all visible rows from the table model.

showDetail

public void showDetail(boolean show)
Tell the LogTableView whether the detail view should be displayed.
Parameters:
show - True to display the details.

update

public void update(java.util.Observable obj,
                   java.lang.Object arg)
Notify the LogTableView that one of its Observables has changed.
Specified by:
update in interface java.util.Observer
Parameters:
obj - The Observable that changed.
arg - Details about the change.