|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.peace_tools.views.LogPane
public abstract class LogPane
This is an abstract base class that provides the core features for displaying log entries. The logging system has been developed using the Model-View-Controller (MVC) pattern. This class represents the core component of the "View" that provides a graphical view of the logs using the data stored in the "Model" (the Log class). The top-level Frame that contains the views acts as the "Controller".
Specifically, this base class provides the following features:
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
private static java.lang.String |
CHANGE_LOG_FILE_NAME
A string constant to ensure that the action command associated with a swing component and its action listener are consistently used without causing any issues. |
private static java.lang.String |
CHANGE_LOG_LEVEL
A string constant to ensure that the action command associated with a swing component and its action listener are consistently used without causing any issues. |
private javax.swing.JTextField |
fileNameDisplay
This is an internal text field that is used to display the file to which the logs are being currently written. |
private int |
FONT_SIZE_CHANGE
Constant to make the fonts in the controls in the tool bar a bit small because they look huge on Linux. |
protected Log |
log
This instance variable holds a reference to the actual log class from which this log pane is displaying log entries. |
private javax.swing.JComboBox |
logLevelList
A combo box to permit the user to set the level at which logs are to be saved by this logger. |
private javax.swing.JToggleButton |
saveLogsButton
A toggle button that can be in "on" or "off" state to indicate if logs are to be saved to the specified fileName (if it is not null) or not. |
private static long |
serialVersionUID
A serialization UID to keep compiler happy. |
private static java.lang.String |
TOGGLE_LOG_SAVING
A string constant to ensure that the action command associated with a swing component and its action listener are consistently used without causing any issues. |
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 |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
LogPane(Log log,
boolean createLevelControl)
A constructor for the LogPane. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
The event-callback handler for the "Choose..." button, the "SaveLogs" button, and the combo box. |
private void |
addLogFileNameControls(javax.swing.JToolBar toolBar)
This is a refactored utility method that is used in the constructor to create the log file display area, the "Change..." button, and the toggle button to enable/disabling writing logs to the file. |
private void |
addLogLevelChanger(javax.swing.JToolBar toolBar)
This is a utility method that is invoked just from the constructor to create a combo box that permits the user to change the log level. |
protected void |
finalize()
This method overrides the default implementation in the base class to remove the log pane from the list of log listeners to receive updates. |
void |
logChanged(boolean logsChanged,
boolean fileNameChanged,
boolean levelChanged)
This method implements the LogListener interface method to update the GUI to reflect the current state of the logger associated with this log pane. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final int FONT_SIZE_CHANGE
protected final Log log
private javax.swing.JTextField fileNameDisplay
private javax.swing.JToggleButton saveLogsButton
private javax.swing.JComboBox logLevelList
private static final java.lang.String CHANGE_LOG_FILE_NAME
private static final java.lang.String TOGGLE_LOG_SAVING
private static final java.lang.String CHANGE_LOG_LEVEL
private static final long serialVersionUID
Constructor Detail |
---|
public LogPane(Log log, boolean createLevelControl)
log
- The log from which entries are actually displayed by this
log pane.createLevelControl
- If this flag is true, then a control to change
the log level is created in the tool bar. This feature is used
only by the user log.Method Detail |
---|
private void addLogFileNameControls(javax.swing.JToolBar toolBar)
toolBar
- The tool bar to which the controls are to be added.private void addLogLevelChanger(javax.swing.JToolBar toolBar)
toolBar
- The tool bar to which the controls are to be added.public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
event
- The action event to be processed by this method.public void logChanged(boolean logsChanged, boolean fileNameChanged, boolean levelChanged)
logChanged
in interface LogListener
logsChanged
- This parameter is true if log entries were added
or removed from the logs. Typically this is the common scenario for
the call back to occur.fileNameChanged
- This parameter is true if the file name into
which logs are written was changed by the user (via some view).levelChanged
- This parameter is true if the current logging
level set for the log was changed by the user (via some view).protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |