## org.apache.log4j.lf5.viewer
Class LogBrokerMonitor

    java.lang.Object
      org.apache.log4j.lf5.viewer.LogBrokerMonitor

    public class LogBrokerMonitor

extends java.lang.Object

LogBrokerMonitor .

Author:
  Michael J. Sikorsky, Robert Shaw, Brad Marlborough, Richard Wan, Brent Sprecher, Richard Hurst

Field Summary
`protected boolean` `_callSystemExitOnClose`
`protected CategoryExplorerTree` `_categoryExplorerTree`
`protected java.util.List` `_columns`
`protected ConfigurationManager` `_configurationManager`
`protected java.lang.String` `_currentView`
`protected java.util.List` `_displayedLogBrokerProperties`
`protected java.io.File` `_fileLocation`
`protected java.lang.String` `_fontName`
`protected int` `_fontSize`
`protected javax.swing.JComboBox` `_fontSizeCombo`
`protected boolean` `_isDisposed`
`protected java.awt.Dimension` `_lastTableViewportSize`
`protected LogLevel` `_leastSevereDisplayedLogLevel`
`protected java.util.List` `_levels`
`protected boolean` `_loadSystemFonts`
`protected java.lang.Object` `_lock`
`protected java.util.Map` `_logLevelMenuItems`
`protected javax.swing.JFrame` `_logMonitorFrame`
`protected int` `_logMonitorFrameHeight`
`protected int` `_logMonitorFrameWidth`
`protected java.util.Map` `_logTableColumnMenuItems`
`protected javax.swing.JScrollPane` `_logTableScrollPane`
`protected MRUFileManager` `_mruFileManager`
`protected java.lang.String` `_NDCTextFilter`
`protected java.lang.String` `_searchText`
`protected javax.swing.JLabel` `_statusLabel`
`protected LogTable` `_table`
`protected boolean` `_trackTableScrollPane`
`static java.lang.String` `DETAILED_VIEW`

Constructor Summary
`LogBrokerMonitor(java.util.List logLevels)` Construct a LogBrokerMonitor.

Method Summary
`void` `addDisplayedProperty(java.lang.Object messageLine)`
`void` `addMessage(LogRecord lr)` Add a log record message to be displayed in the LogTable.
`protected void` `addTableModelProperties()`
`protected void` `centerFrame(javax.swing.JFrame frame)`
`protected int` `changeFontSizeCombo(javax.swing.JComboBox box, int requestedSize)` Changes the font selection in the combo box and returns the size actually selected.
`protected void` `clearDetailTextArea()`
`protected void` `closeAfterConfirm()`
`protected javax.swing.JMenuItem` `createAllLogLevelsMenuItem()`
`protected javax.swing.JMenuItem` `createAllLogTableColumnsMenuItem()`
`protected javax.swing.JMenuItem` `createCloseMI()`
`protected javax.swing.JMenuItem` `createConfigureMaxRecords()`
`protected javax.swing.JMenu` `createConfigureMenu()`
`protected javax.swing.JMenuItem` `createConfigureReset()`
`protected javax.swing.JMenuItem` `createConfigureSave()`
`protected javax.swing.JTextArea` `createDetailTextArea()`
`protected javax.swing.JMenuItem` `createEditFindMI()`
`protected javax.swing.JMenuItem` `createEditFindNextMI()`
`protected javax.swing.JMenu` `createEditMenu()`
`protected javax.swing.JMenuItem` `createEditRestoreAllNDCMI()`
`protected javax.swing.JMenuItem` `createEditSortNDCMI()`
`protected javax.swing.JMenuItem` `createExitMI()`
`protected javax.swing.JMenu` `createFileMenu()`
`protected javax.swing.JMenu` `createHelpMenu()`
`protected javax.swing.JMenuItem` `createHelpProperties()`
`protected javax.swing.JMenu` `createLogLevelColorMenu()`
`protected javax.swing.JComboBox` `createLogLevelCombo()`
`protected javax.swing.JMenu` `createLogLevelMenu()`
`protected LogRecordFilter` `createLogRecordFilter()`
`protected javax.swing.JCheckBoxMenuItem` `createLogTableColumnMenuItem(LogTableColumn column)`
`protected javax.swing.JMenuBar` `createMenuBar()`
`protected javax.swing.JCheckBoxMenuItem` `createMenuItem(LogLevel level)`
`protected void` `createMRUFileListMI(javax.swing.JMenu menu)` Creates a Most Recently Used file list to be displayed in the File menu
`protected LogRecordFilter` `createNDCLogRecordFilter(java.lang.String text)`
`protected javax.swing.JMenuItem` `createNoLogLevelsMenuItem()`
`protected javax.swing.JMenuItem` `createNoLogTableColumnsMenuItem()`
`protected javax.swing.JMenuItem` `createOpenMI()` Menu item added to allow log files to be opened with the LF5 GUI.
`protected javax.swing.JMenuItem` `createOpenURLMI()` Menu item added to allow log files loaded from a URL to be opened by the LF5 GUI.
`protected javax.swing.JMenuItem` `createResetLogLevelColorMenuItem()`
`protected javax.swing.JPanel` `createStatusArea()`
`protected javax.swing.JMenuItem` `createSubMenuItem(LogLevel level)`
`protected javax.swing.JToolBar` `createToolBar()`
`protected javax.swing.JMenu` `createViewMenu()`
`void` `dispose()` Dispose of the frame for the LogBrokerMonitor.
`protected int` `findRecord(int startRow, java.lang.String searchText, java.util.List records)`
`protected void` `findSearchText()`
`javax.swing.JFrame` `getBaseFrame()`
`boolean` `getCallSystemExitOnClose()` Get the value of whether or not System.exit() will be called when the LogBrokerMonitor is closed.
`CategoryExplorerTree` `getCategoryExplorerTree()`
`DateFormatManager` `getDateFormatManager()` Get the DateFormatManager for formatting dates.
`protected int` `getFirstSelectedRow()`
`java.util.Map` `getLogLevelMenuItems()`
`protected java.util.Iterator` `getLogLevels()`
`protected javax.swing.JCheckBoxMenuItem` `getLogTableColumnMenuItem(LogTableColumn column)`
`java.util.Map` `getLogTableColumnMenuItems()`
`protected java.util.Iterator` `getLogTableColumns()`
`protected javax.swing.JCheckBoxMenuItem` `getMenuItem(LogLevel level)`
`java.lang.String` `getNDCTextFilter()`
`protected java.lang.String` `getRecordsDisplayedMessage()`
`protected java.lang.String` `getStatusText(int displayedRows, int totalRows)`
`javax.swing.JCheckBoxMenuItem` `getTableColumnMenuItem(LogTableColumn column)`
`void` `hide()` Hide the frame for the LogBrokerMonitor.
`protected void` `initComponents()`
`protected boolean` `loadLogFile(java.io.File file)` Loads and parses a log file.
`protected boolean` `loadLogFile(java.net.URL url)` Loads a parses a log file running on a server.
`protected void` `makeLogTableListenToCategoryExplorer()`
`protected boolean` `matches(LogRecord record, java.lang.String text)` Check to see if the any records contain the search string.
`protected void` `pause(int millis)`
`protected void` `refresh(javax.swing.JTextArea textArea)` When the fontsize of a JTextArea is changed, the word-wrapped lines may become garbled.
`protected void` `refreshDetailTextArea()`
`protected void` `requestClose()`
`protected void` `requestExit()`
`protected void` `requestOpen()` Uses a JFileChooser to select a file to opened with the LF5 GUI.
`protected void` `requestOpenMRU(java.awt.event.ActionEvent e)` Opens a file in the MRU list.
`protected void` `requestOpenURL()` Uses a Dialog box to accept a URL to a file to be opened with the LF5 GUI.
`protected void` `resetConfiguration()`
`protected void` `saveConfiguration()`
`protected void` `selectAllLogLevels(boolean selected)`
`protected void` `selectAllLogTableColumns(boolean selected)`
`protected void` `selectRow(int foundRow)`
`void` `setCallSystemExitOnClose(boolean callSystemExitOnClose)` Set the value of whether or not System.exit() will be called when the LogBrokerMonitor is closed.
`void` `setDateFormatManager(DateFormatManager dfm)` Set the date format manager for formatting dates.
`protected void` `setFontSize(java.awt.Component component, int fontSize)`
`void` `setFontSize(int fontSize)`
`protected void` `setFontSizeSilently(int fontSize)` Does not update gui or cause any events to be fired.
`void` `setFrameSize(int width, int height)`
`protected void` `setLeastSevereDisplayedLogLevel(LogLevel level)`
`void` `setMaxNumberOfLogRecords(int maxNumberOfLogRecords)`
`protected void` `setMaxRecordConfiguration()`
`void` `setNDCLogRecordFilter(java.lang.String textFilter)`
`protected void` `setNDCTextFilter(java.lang.String text)`
`protected void` `setSearchText(java.lang.String text)`
`void` `setTitle(java.lang.String title)`
`protected void` `setView(java.lang.String viewString, LogTable table)`
`void` `show()`
`void` `show(int delay)` Show the frame for the LogBrokerMonitor.
`protected void` `showLogLevelColorChangeDialog(javax.swing.JMenuItem result, LogLevel level)`
`protected void` `showPropertiesDialog(java.lang.String title)`
`protected void` `sortByNDC()`
`protected void` `trackTableScrollPane()` Deprecated. tracking is now done automatically.
`protected void` `updateFrameSize()`
`protected void` `updateMRUList()` Removes old file list and creates a new file list with the updated MRU list.
`protected void` `updateStatusLabel()`
`protected java.util.List` `updateView()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DETAILED_VIEW

    public static final java.lang.String DETAILED_VIEW

See Also:
  Constant Field Values

### _logMonitorFrame

    protected javax.swing.JFrame _logMonitorFrame

### _logMonitorFrameWidth

    protected int _logMonitorFrameWidth

### _logMonitorFrameHeight

    protected int _logMonitorFrameHeight

### _table

    protected LogTable _table

### _categoryExplorerTree

    protected CategoryExplorerTree _categoryExplorerTree

### _searchText

    protected java.lang.String _searchText

### _NDCTextFilter

    protected java.lang.String _NDCTextFilter

### _leastSevereDisplayedLogLevel

    protected LogLevel _leastSevereDisplayedLogLevel

### _logTableScrollPane

    protected javax.swing.JScrollPane _logTableScrollPane

### _statusLabel

    protected javax.swing.JLabel _statusLabel

### _lock

    protected java.lang.Object _lock

### _fontSizeCombo

    protected javax.swing.JComboBox _fontSizeCombo

### _fontSize

    protected int _fontSize

### _fontName

    protected java.lang.String _fontName

### _currentView

    protected java.lang.String _currentView

### _loadSystemFonts

    protected boolean _loadSystemFonts

### _trackTableScrollPane

    protected boolean _trackTableScrollPane

### _lastTableViewportSize

    protected java.awt.Dimension _lastTableViewportSize

### _callSystemExitOnClose

    protected boolean _callSystemExitOnClose

### _displayedLogBrokerProperties

    protected java.util.List _displayedLogBrokerProperties

### _logLevelMenuItems

    protected java.util.Map _logLevelMenuItems

### _logTableColumnMenuItems

    protected java.util.Map _logTableColumnMenuItems

### _levels

    protected java.util.List _levels

### _columns

    protected java.util.List _columns

### _isDisposed

    protected boolean _isDisposed

### _configurationManager

    protected ConfigurationManager _configurationManager

### _mruFileManager

    protected MRUFileManager _mruFileManager

### _fileLocation

    protected java.io.File _fileLocation

Constructor Detail

### LogBrokerMonitor

    public LogBrokerMonitor(java.util.List logLevels)

  Construct a LogBrokerMonitor.

Method Detail

### show

    public void show(int delay)

  Show the frame for the LogBrokerMonitor. Dispatched to the swing thread.

### show

    public void show()

### dispose

    public void dispose()

  Dispose of the frame for the LogBrokerMonitor.

### hide

    public void hide()

  Hide the frame for the LogBrokerMonitor.

### getDateFormatManager

    public DateFormatManager getDateFormatManager()

  Get the DateFormatManager for formatting dates.

### setDateFormatManager

    public void setDateFormatManager(DateFormatManager dfm)

  Set the date format manager for formatting dates.

### getCallSystemExitOnClose

    public boolean getCallSystemExitOnClose()

  Get the value of whether or not System.exit() will be called when the LogBrokerMonitor is closed.

### setCallSystemExitOnClose

    public void setCallSystemExitOnClose(boolean callSystemExitOnClose)

  Set the value of whether or not System.exit() will be called when the LogBrokerMonitor is closed.

### addMessage

    public void addMessage(LogRecord lr)

  Add a log record message to be displayed in the LogTable. This method is thread-safe as it posts requests to the SwingThread rather than processing directly.

### setMaxNumberOfLogRecords

    public void setMaxNumberOfLogRecords(int maxNumberOfLogRecords)

### getBaseFrame

    public javax.swing.JFrame getBaseFrame()

### setTitle

    public void setTitle(java.lang.String title)

### setFrameSize

    public void setFrameSize(int width,
                             int height)

### setFontSize

    public void setFontSize(int fontSize)

### addDisplayedProperty

    public void addDisplayedProperty(java.lang.Object messageLine)

### getLogLevelMenuItems

    public java.util.Map getLogLevelMenuItems()

### getLogTableColumnMenuItems

    public java.util.Map getLogTableColumnMenuItems()

### getTableColumnMenuItem

    public javax.swing.JCheckBoxMenuItem getTableColumnMenuItem(LogTableColumn column)

### getCategoryExplorerTree

    public CategoryExplorerTree getCategoryExplorerTree()

### getNDCTextFilter

    public java.lang.String getNDCTextFilter()

### setNDCLogRecordFilter

    public void setNDCLogRecordFilter(java.lang.String textFilter)

### setSearchText

    protected void setSearchText(java.lang.String text)

### setNDCTextFilter

    protected void setNDCTextFilter(java.lang.String text)

### sortByNDC

    protected void sortByNDC()

### findSearchText

    protected void findSearchText()

### getFirstSelectedRow

    protected int getFirstSelectedRow()

### selectRow

    protected void selectRow(int foundRow)

### findRecord

    protected int findRecord(int startRow,
                             java.lang.String searchText,
                             java.util.List records)

### matches

    protected boolean matches(LogRecord record,
                              java.lang.String text)

  Check to see if the any records contain the search string. Searching now supports NDC messages and date.

### refresh

    protected void refresh(javax.swing.JTextArea textArea)

  When the fontsize of a JTextArea is changed, the word-wrapped lines may become garbled. This method clears and resets the text of the text area.

### refreshDetailTextArea

    protected void refreshDetailTextArea()

### clearDetailTextArea

    protected void clearDetailTextArea()

### changeFontSizeCombo

    protected int changeFontSizeCombo(javax.swing.JComboBox box,
                                      int requestedSize)

  Changes the font selection in the combo box and returns the size actually selected.

  Returns:
    -1 if unable to select an appropriate font

### setFontSizeSilently

    protected void setFontSizeSilently(int fontSize)

  Does not update gui or cause any events to be fired.

### setFontSize

    protected void setFontSize(java.awt.Component component,
                               int fontSize)

### updateFrameSize

    protected void updateFrameSize()

### pause

    protected void pause(int millis)

### initComponents

    protected void initComponents()

### createLogRecordFilter

    protected LogRecordFilter createLogRecordFilter()

### createNDCLogRecordFilter

    protected LogRecordFilter createNDCLogRecordFilter(java.lang.String text)

### updateStatusLabel

    protected void updateStatusLabel()

### getRecordsDisplayedMessage

    protected java.lang.String getRecordsDisplayedMessage()

### addTableModelProperties

    protected void addTableModelProperties()

### getStatusText

    protected java.lang.String getStatusText(int displayedRows,
                                             int totalRows)

### makeLogTableListenToCategoryExplorer

    protected void makeLogTableListenToCategoryExplorer()

### createStatusArea

    protected javax.swing.JPanel createStatusArea()

### createDetailTextArea

    protected javax.swing.JTextArea createDetailTextArea()

### createMenuBar

    protected javax.swing.JMenuBar createMenuBar()

### createLogLevelMenu

    protected javax.swing.JMenu createLogLevelMenu()

### createAllLogLevelsMenuItem

    protected javax.swing.JMenuItem createAllLogLevelsMenuItem()

### createNoLogLevelsMenuItem

    protected javax.swing.JMenuItem createNoLogLevelsMenuItem()

### createLogLevelColorMenu

    protected javax.swing.JMenu createLogLevelColorMenu()

### createResetLogLevelColorMenuItem

    protected javax.swing.JMenuItem createResetLogLevelColorMenuItem()

### selectAllLogLevels

    protected void selectAllLogLevels(boolean selected)

### getMenuItem

    protected javax.swing.JCheckBoxMenuItem getMenuItem(LogLevel level)

### createSubMenuItem

    protected javax.swing.JMenuItem createSubMenuItem(LogLevel level)

### showLogLevelColorChangeDialog

    protected void showLogLevelColorChangeDialog(javax.swing.JMenuItem result,
                                                 LogLevel level)

### createMenuItem

    protected javax.swing.JCheckBoxMenuItem createMenuItem(LogLevel level)

### createViewMenu

    protected javax.swing.JMenu createViewMenu()

### getLogTableColumnMenuItem

    protected javax.swing.JCheckBoxMenuItem getLogTableColumnMenuItem(LogTableColumn column)

### createLogTableColumnMenuItem

    protected javax.swing.JCheckBoxMenuItem createLogTableColumnMenuItem(LogTableColumn column)

### updateView

    protected java.util.List updateView()

### createAllLogTableColumnsMenuItem

    protected javax.swing.JMenuItem createAllLogTableColumnsMenuItem()

### createNoLogTableColumnsMenuItem

    protected javax.swing.JMenuItem createNoLogTableColumnsMenuItem()

### selectAllLogTableColumns

    protected void selectAllLogTableColumns(boolean selected)

### createFileMenu

    protected javax.swing.JMenu createFileMenu()

### createOpenMI

    protected javax.swing.JMenuItem createOpenMI()

  Menu item added to allow log files to be opened with the LF5 GUI.

### createOpenURLMI

    protected javax.swing.JMenuItem createOpenURLMI()

  Menu item added to allow log files loaded from a URL to be opened by the LF5 GUI.

### createCloseMI

    protected javax.swing.JMenuItem createCloseMI()

### createMRUFileListMI

    protected void createMRUFileListMI(javax.swing.JMenu menu)

  Creates a Most Recently Used file list to be displayed in the File menu

### createExitMI

    protected javax.swing.JMenuItem createExitMI()

### createConfigureMenu

    protected javax.swing.JMenu createConfigureMenu()

### createConfigureSave

    protected javax.swing.JMenuItem createConfigureSave()

### createConfigureReset

    protected javax.swing.JMenuItem createConfigureReset()

### createConfigureMaxRecords

    protected javax.swing.JMenuItem createConfigureMaxRecords()

### saveConfiguration

    protected void saveConfiguration()

### resetConfiguration

    protected void resetConfiguration()

### setMaxRecordConfiguration

    protected void setMaxRecordConfiguration()

### createHelpMenu

    protected javax.swing.JMenu createHelpMenu()

### createHelpProperties

    protected javax.swing.JMenuItem createHelpProperties()

### showPropertiesDialog

    protected void showPropertiesDialog(java.lang.String title)

### createEditMenu

    protected javax.swing.JMenu createEditMenu()

### createEditFindNextMI

    protected javax.swing.JMenuItem createEditFindNextMI()

### createEditFindMI

    protected javax.swing.JMenuItem createEditFindMI()

### createEditSortNDCMI

    protected javax.swing.JMenuItem createEditSortNDCMI()

### createEditRestoreAllNDCMI

    protected javax.swing.JMenuItem createEditRestoreAllNDCMI()

### createToolBar

    protected javax.swing.JToolBar createToolBar()

### setView

    protected void setView(java.lang.String viewString,
                           LogTable table)

### createLogLevelCombo

    protected javax.swing.JComboBox createLogLevelCombo()

### setLeastSevereDisplayedLogLevel

    protected void setLeastSevereDisplayedLogLevel(LogLevel level)

### trackTableScrollPane

    protected void trackTableScrollPane()

  Deprecated. tracking is now done automatically.

  Ensures that the Table's ScrollPane Viewport will "track" with updates to the Table. When the vertical scroll bar is at its bottom anchor and tracking is enabled then viewport will stay at the bottom most point of the component. The purpose of this feature is to allow a developer to watch the table as messages arrive and not have to scroll after each new message arrives. When the vertical scroll bar is at any other location, then no tracking will happen.

### centerFrame

    protected void centerFrame(javax.swing.JFrame frame)

### requestOpen

    protected void requestOpen()

  Uses a JFileChooser to select a file to opened with the LF5 GUI.

### requestOpenURL

    protected void requestOpenURL()

  Uses a Dialog box to accept a URL to a file to be opened with the LF5 GUI.

### updateMRUList

    protected void updateMRUList()

  Removes old file list and creates a new file list with the updated MRU list.

### requestClose

    protected void requestClose()

### requestOpenMRU

    protected void requestOpenMRU(java.awt.event.ActionEvent e)

  Opens a file in the MRU list.

### requestExit

    protected void requestExit()

### closeAfterConfirm

    protected void closeAfterConfirm()

### getLogLevels

    protected java.util.Iterator getLogLevels()

### getLogTableColumns

    protected java.util.Iterator getLogTableColumns()

### loadLogFile

    protected boolean loadLogFile(java.io.File file)

  Loads and parses a log file.

### loadLogFile

    protected boolean loadLogFile(java.net.URL url)

  Loads a parses a log file running on a server.

Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.