de.qfs.apps.qflog.logview
Class LogLevelView

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

public class LogLevelView
extends javax.swing.JPanel

A view for display and manipulation of the log levels of an application.

A LogLevelView may be used either as a separate component, integrated into an applications GUI, to give visual feedback and access to the application's log levels, or as part of the LogView component, that integrates the LogLevelView with other logging related views.

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

The LogLevelView does not have any Configurable parts except for its LogLevelTreeModel, which must be handled by the caller if its state should be saved, unless the LogLevelView is used as part of a LogView.

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

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
LogLevelView(LogLevelTreeModel model)
          Create a new LogLevelView.
 
Method Summary
 void cleanup()
          Try to remove everything that might prevent the LogLevelView from being garbage collected.
 void fillMenu(javax.swing.JMenu menu)
          Fill a JMenu with menu items for the LogLevelView.
 void fillMenu(javax.swing.JPopupMenu menu)
          Fill a JPopupMenu with menu items for the LogLevelView.
 void finalize()
          Finalize the LogLevelView.
 LogLevelTreeModel getModel()
          Get the view's associated LogLevelTreeModel.
 javax.swing.JTree getTree()
          Get the JTree component of the view.
 void init()
          Initialize the components of the view.
 void setLoggingEnabled(boolean enable)
          Enable or disable logging output caused directly or indirectly by LogLevelView methods.
 void setResources(java.util.ResourceBundle rb)
          Override the default resources used by the LogLevelView.
 void showSetLevels()
          Expand or collapse tree nodes so that all nodes with a non-null level are displayed.
 
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

LogLevelView

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

setLoggingEnabled

public final void setLoggingEnabled(boolean enable)
Enable or disable logging output caused directly or indirectly by LogLevelView 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.

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, befor the view is initialized.

cleanup

public void cleanup()
Try to remove everything that might prevent the LogLevelView from being garbage collected.

finalize

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

getModel

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

getTree

public final javax.swing.JTree getTree()
Get the JTree component of the view.
Returns:
The tree.

fillMenu

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

fillMenu

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

setResources

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

showSetLevels

public void showSetLevels()
Expand or collapse tree nodes so that all nodes with a non-null level are displayed.