org.apache.log4j.lf5.viewer
Class LogBrokerMonitor

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

public class LogBrokerMonitor
extends 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  List _columns
           
protected  ConfigurationManager _configurationManager
           
protected  String _currentView
           
protected  List _displayedLogBrokerProperties
           
protected  File _fileLocation
           
protected  String _fontName
           
protected  int _fontSize
           
protected  JComboBox _fontSizeCombo
           
protected  boolean _isDisposed
           
protected  Dimension _lastTableViewportSize
           
protected  LogLevel _leastSevereDisplayedLogLevel
           
protected  List _levels
           
protected  boolean _loadSystemFonts
           
protected  Object _lock
           
protected  Map _logLevelMenuItems
           
protected  JFrame _logMonitorFrame
           
protected  int _logMonitorFrameHeight
           
protected  int _logMonitorFrameWidth
           
protected  Map _logTableColumnMenuItems
           
protected  JScrollPane _logTableScrollPane
           
protected  MRUFileManager _mruFileManager
           
protected  String _NDCTextFilter
           
protected  String _searchText
           
protected  JLabel _statusLabel
           
protected  LogTable _table
           
protected  boolean _trackTableScrollPane
           
static String DETAILED_VIEW
           
 
Constructor Summary
LogBrokerMonitor(List logLevels)
          Construct a LogBrokerMonitor.
 
Method Summary
 void addDisplayedProperty(Object messageLine)
           
 void addMessage(LogRecord lr)
          Add a log record message to be displayed in the LogTable.
protected  void addTableModelProperties()
           
protected  void centerFrame(JFrame frame)
           
protected  int changeFontSizeCombo(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  JMenuItem createAllLogLevelsMenuItem()
           
protected  JMenuItem createAllLogTableColumnsMenuItem()
           
protected  JMenuItem createCloseMI()
           
protected  JMenuItem createConfigureMaxRecords()
           
protected  JMenu createConfigureMenu()
           
protected  JMenuItem createConfigureReset()
           
protected  JMenuItem createConfigureSave()
           
protected  JTextArea createDetailTextArea()
           
protected  JMenuItem createEditFindMI()
           
protected  JMenuItem createEditFindNextMI()
           
protected  JMenu createEditMenu()
           
protected  JMenuItem createEditRestoreAllNDCMI()
           
protected  JMenuItem createEditSortNDCMI()
           
protected  JMenuItem createExitMI()
           
protected  JMenu createFileMenu()
           
protected  JMenu createHelpMenu()
           
protected  JMenuItem createHelpProperties()
           
protected  JMenu createLogLevelColorMenu()
           
protected  JComboBox createLogLevelCombo()
           
protected  JMenu createLogLevelMenu()
           
protected  LogRecordFilter createLogRecordFilter()
           
protected  JCheckBoxMenuItem createLogTableColumnMenuItem(LogTableColumn column)
           
protected  JMenuBar createMenuBar()
           
protected  JCheckBoxMenuItem createMenuItem(LogLevel level)
           
protected  void createMRUFileListMI(JMenu menu)
          Creates a Most Recently Used file list to be displayed in the File menu
protected  LogRecordFilter createNDCLogRecordFilter(String text)
           
protected  JMenuItem createNoLogLevelsMenuItem()
           
protected  JMenuItem createNoLogTableColumnsMenuItem()
           
protected  JMenuItem createOpenMI()
          Menu item added to allow log files to be opened with the LF5 GUI.
protected  JMenuItem createOpenURLMI()
          Menu item added to allow log files loaded from a URL to be opened by the LF5 GUI.
protected  JMenuItem createResetLogLevelColorMenuItem()
           
protected  JPanel createStatusArea()
           
protected  JMenuItem createSubMenuItem(LogLevel level)
           
protected  JToolBar createToolBar()
           
protected  JMenu createViewMenu()
           
 void dispose()
          Dispose of the frame for the LogBrokerMonitor.
protected  int findRecord(int startRow, String searchText, List records)
           
protected  void findSearchText()
           
 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()
           
 Map getLogLevelMenuItems()
           
protected  Iterator getLogLevels()
           
protected  JCheckBoxMenuItem getLogTableColumnMenuItem(LogTableColumn column)
           
 Map getLogTableColumnMenuItems()
           
protected  Iterator getLogTableColumns()
           
protected  JCheckBoxMenuItem getMenuItem(LogLevel level)
           
 String getNDCTextFilter()
           
protected  String getRecordsDisplayedMessage()
           
protected  String getStatusText(int displayedRows, int totalRows)
           
 JCheckBoxMenuItem getTableColumnMenuItem(LogTableColumn column)
           
 void hide()
          Hide the frame for the LogBrokerMonitor.
protected  void initComponents()
           
protected  boolean loadLogFile(File file)
          Loads and parses a log file.
protected  boolean loadLogFile(URL url)
          Loads a parses a log file running on a server.
protected  void makeLogTableListenToCategoryExplorer()
           
protected  boolean matches(LogRecord record, String text)
          Check to see if the any records contain the search string.
protected  void pause(int millis)
           
protected  void refresh(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(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(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(String textFilter)
           
protected  void setNDCTextFilter(String text)
           
protected  void setSearchText(String text)
           
 void setTitle(String title)
           
protected  void setView(String viewString, LogTable table)
           
 void show()
           
 void show(int delay)
          Show the frame for the LogBrokerMonitor.
protected  void showLogLevelColorChangeDialog(JMenuItem result, LogLevel level)
           
protected  void showPropertiesDialog(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  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 String DETAILED_VIEW
See Also:
Constant Field Values

_logMonitorFrame

protected JFrame _logMonitorFrame

_logMonitorFrameWidth

protected int _logMonitorFrameWidth

_logMonitorFrameHeight

protected int _logMonitorFrameHeight

_table

protected LogTable _table

_categoryExplorerTree

protected CategoryExplorerTree _categoryExplorerTree

_searchText

protected String _searchText

_NDCTextFilter

protected String _NDCTextFilter

_leastSevereDisplayedLogLevel

protected LogLevel _leastSevereDisplayedLogLevel

_logTableScrollPane

protected JScrollPane _logTableScrollPane

_statusLabel

protected JLabel _statusLabel

_lock

protected Object _lock

_fontSizeCombo

protected JComboBox _fontSizeCombo

_fontSize

protected int _fontSize

_fontName

protected String _fontName

_currentView

protected String _currentView

_loadSystemFonts

protected boolean _loadSystemFonts

_trackTableScrollPane

protected boolean _trackTableScrollPane

_lastTableViewportSize

protected Dimension _lastTableViewportSize

_callSystemExitOnClose

protected boolean _callSystemExitOnClose

_displayedLogBrokerProperties

protected List _displayedLogBrokerProperties

_logLevelMenuItems

protected Map _logLevelMenuItems

_logTableColumnMenuItems

protected Map _logTableColumnMenuItems

_levels

protected List _levels

_columns

protected List _columns

_isDisposed

protected boolean _isDisposed

_configurationManager

protected ConfigurationManager _configurationManager

_mruFileManager

protected MRUFileManager _mruFileManager

_fileLocation

protected File _fileLocation
Constructor Detail

LogBrokerMonitor

public LogBrokerMonitor(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 JFrame getBaseFrame()

setTitle

public void setTitle(String title)

setFrameSize

public void setFrameSize(int width,
                         int height)

setFontSize

public void setFontSize(int fontSize)

addDisplayedProperty

public void addDisplayedProperty(Object messageLine)

getLogLevelMenuItems

public Map getLogLevelMenuItems()

getLogTableColumnMenuItems

public Map getLogTableColumnMenuItems()

getTableColumnMenuItem

public JCheckBoxMenuItem getTableColumnMenuItem(LogTableColumn column)

getCategoryExplorerTree

public CategoryExplorerTree getCategoryExplorerTree()

getNDCTextFilter

public String getNDCTextFilter()

setNDCLogRecordFilter

public void setNDCLogRecordFilter(String textFilter)

setSearchText

protected void setSearchText(String text)

setNDCTextFilter

protected void setNDCTextFilter(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,
                         String searchText,
                         List records)

matches

protected boolean matches(LogRecord record,
                          String text)
Check to see if the any records contain the search string. Searching now supports NDC messages and date.


refresh

protected void refresh(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(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(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(String text)

updateStatusLabel

protected void updateStatusLabel()

getRecordsDisplayedMessage

protected String getRecordsDisplayedMessage()

addTableModelProperties

protected void addTableModelProperties()

getStatusText

protected String getStatusText(int displayedRows,
                               int totalRows)

makeLogTableListenToCategoryExplorer

protected void makeLogTableListenToCategoryExplorer()

createStatusArea

protected JPanel createStatusArea()

createDetailTextArea

protected JTextArea createDetailTextArea()

createMenuBar

protected JMenuBar createMenuBar()

createLogLevelMenu

protected JMenu createLogLevelMenu()

createAllLogLevelsMenuItem

protected JMenuItem createAllLogLevelsMenuItem()

createNoLogLevelsMenuItem

protected JMenuItem createNoLogLevelsMenuItem()

createLogLevelColorMenu

protected JMenu createLogLevelColorMenu()

createResetLogLevelColorMenuItem

protected JMenuItem createResetLogLevelColorMenuItem()

selectAllLogLevels

protected void selectAllLogLevels(boolean selected)

getMenuItem

protected JCheckBoxMenuItem getMenuItem(LogLevel level)

createSubMenuItem

protected JMenuItem createSubMenuItem(LogLevel level)

showLogLevelColorChangeDialog

protected void showLogLevelColorChangeDialog(JMenuItem result,
                                             LogLevel level)

createMenuItem

protected JCheckBoxMenuItem createMenuItem(LogLevel level)

createViewMenu

protected JMenu createViewMenu()

getLogTableColumnMenuItem

protected JCheckBoxMenuItem getLogTableColumnMenuItem(LogTableColumn column)

createLogTableColumnMenuItem

protected JCheckBoxMenuItem createLogTableColumnMenuItem(LogTableColumn column)

updateView

protected List updateView()

createAllLogTableColumnsMenuItem

protected JMenuItem createAllLogTableColumnsMenuItem()

createNoLogTableColumnsMenuItem

protected JMenuItem createNoLogTableColumnsMenuItem()

selectAllLogTableColumns

protected void selectAllLogTableColumns(boolean selected)

createFileMenu

protected JMenu createFileMenu()

createOpenMI

protected JMenuItem createOpenMI()
Menu item added to allow log files to be opened with the LF5 GUI.


createOpenURLMI

protected JMenuItem createOpenURLMI()
Menu item added to allow log files loaded from a URL to be opened by the LF5 GUI.


createCloseMI

protected JMenuItem createCloseMI()

createMRUFileListMI

protected void createMRUFileListMI(JMenu menu)
Creates a Most Recently Used file list to be displayed in the File menu


createExitMI

protected JMenuItem createExitMI()

createConfigureMenu

protected JMenu createConfigureMenu()

createConfigureSave

protected JMenuItem createConfigureSave()

createConfigureReset

protected JMenuItem createConfigureReset()

createConfigureMaxRecords

protected JMenuItem createConfigureMaxRecords()

saveConfiguration

protected void saveConfiguration()

resetConfiguration

protected void resetConfiguration()

setMaxRecordConfiguration

protected void setMaxRecordConfiguration()

createHelpMenu

protected JMenu createHelpMenu()

createHelpProperties

protected JMenuItem createHelpProperties()

showPropertiesDialog

protected void showPropertiesDialog(String title)

createEditMenu

protected JMenu createEditMenu()

createEditFindNextMI

protected JMenuItem createEditFindNextMI()

createEditFindMI

protected JMenuItem createEditFindMI()

createEditSortNDCMI

protected JMenuItem createEditSortNDCMI()

createEditRestoreAllNDCMI

protected JMenuItem createEditRestoreAllNDCMI()

createToolBar

protected JToolBar createToolBar()

setView

protected void setView(String viewString,
                       LogTable table)

createLogLevelCombo

protected 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(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(ActionEvent e)
Opens a file in the MRU list.


requestExit

protected void requestExit()

closeAfterConfirm

protected void closeAfterConfirm()

getLogLevels

protected Iterator getLogLevels()

getLogTableColumns

protected Iterator getLogTableColumns()

loadLogFile

protected boolean loadLogFile(File file)
Loads and parses a log file.


loadLogFile

protected boolean loadLogFile(URL url)
Loads a parses a log file running on a server.



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