Class DialogLogHandler

java.lang.Object
java.util.logging.Handler
rma.swing.logging.DialogLogHandler

public final class DialogLogHandler extends Handler
A custom log handler that will display logged messages in a window
  • Constructor Details

    • DialogLogHandler

      public DialogLogHandler()
      Dont use this, use getInstance() instead to get at the singleton.
  • Method Details

    • setLogDisplayProvider

      public void setLogDisplayProvider(DialogLogHandler.LogRecordDisplayProvider provider)
    • getInstance

      public static DialogLogHandler getInstance()
      Access to the handler singleton instance.
      Returns:
    • attachToRootLogger

      public void attachToRootLogger()
      Convenience method that will attach this log handler to the root logger.
    • setParentWindow

      public void setParentWindow(Window parentWindow)
      Sets the parent window for the log handler window. Setting this value will have no effect until the current window is closed with disposeWindow(). A new window will subsequently be built as needed using this setting.
      Parameters:
      parentWindow -
    • disposeWindow

      public void disposeWindow()
      Will close and dispose of the dialog. A new one will be created if necessary.
    • bringLogWindowToFront

      public void bringLogWindowToFront()
    • showErrorLogWindow

      public void showErrorLogWindow()
      Shows the window
    • showErrorLogWindow

      public void showErrorLogWindow(LogRecord logRecord)
      Adds the log record and shows the window.
      Parameters:
      logRecord -
    • setErrorLevelThatForcesDialogToFront

      public void setErrorLevelThatForcesDialogToFront(Level level)
      Any logged errors greater than level will be logged, then the dialog will be pushed to the front to notify the user
      Parameters:
      level -
    • publish

      public void publish(LogRecord record)
      Add a log record to this handler.
      Specified by:
      publish in class Handler
    • getShowDialogLevel

      public Level getShowDialogLevel()
      Returns the level that controls whether the window is displayed.
      Returns:
    • setShowDialogLevel

      public void setShowDialogLevel(Level level)
      Controls the level which will cause the window to display. A log record with a level equal to or greater than the show dialog level will cause the window to be displayed when the record is logged.
      Parameters:
      level -
    • addIgnoredLoggerName

      public void addIgnoredLoggerName(String loggerNamePrefix)
      Adds a logger to the ignored list.
      Parameters:
      loggerNamePrefix -
    • addIgnoredSourceClass

      public void addIgnoredSourceClass(String stringPrefix)
      Adds a log record source class to the ignored list.
      Parameters:
      stringPrefix -
    • flush

      public void flush()
      part of the logger api, not implemented.
      Specified by:
      flush in class Handler
    • close

      public void close()
      part of the logger api, not implemented.
      Specified by:
      close in class Handler
    • isModal

      public boolean isModal()
      If the window is a dialog, then it will be modal.
      Returns:
    • setModal

      public void setModal(boolean isModal)
      If the window is a dialog, controls if it is modal. Changing this value has no effect on an already instantiated window. Call disposeWindow to force the current window to be closed and disposed of. A new window will be instantiated as needed using the new settings.
      Parameters:
      isModal -
    • isFrame

      public boolean isFrame()
      Is the window a frame or dialog?
      Returns:
    • setFrame

      public void setFrame(boolean isFrame)
      Determines if the window is a frame or dialog. Changing this value has no effect on an already instantiated window. Call disposeWindow to force the current window to be closed and disposed of. A new window will be instantiated as needed using the new settings.
      Parameters:
      isFrame -
    • setTitle

      public void setTitle(String title)
      Sets the title for the displayed window. Changing this value has no effect on an already instantiated window. Call disposeWindow to force the current window to be closed and disposed of. A new window will be instantiated as needed using the new settings.
      Parameters:
      title -
    • getTitle

      public String getTitle()
    • getLogRecordDisplay

      public ILogRecordDisplay getLogRecordDisplay()
      Returns a reference to the inteface that handles logged records, there is typically a UI piece behind the interface.
      Returns: