Package rma.swing.logging
Class DialogLogHandler
java.lang.Object
java.util.logging.Handler
rma.swing.logging.DialogLogHandler
A custom log handler that will display logged messages in a window
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDont use this, use getInstance() instead to get at the singleton. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIgnoredLoggerName(String loggerNamePrefix) Adds a logger to the ignored list.voidaddIgnoredSourceClass(String stringPrefix) Adds a log record source class to the ignored list.voidConvenience method that will attach this log handler to the root logger.voidvoidclose()part of the logger api, not implemented.voidWill close and dispose of the dialog.voidflush()part of the logger api, not implemented.static DialogLogHandlerAccess to the handler singleton instance.Returns a reference to the inteface that handles logged records, there is typically a UI piece behind the interface.Returns the level that controls whether the window is displayed.getTitle()booleanisFrame()Is the window a frame or dialog?booleanisModal()If the window is a dialog, then it will be modal.voidAdd a log record to this handler.voidAny logged errors greater than level will be logged, then the dialog will be pushed to the front to notify the uservoidsetFrame(boolean isFrame) Determines if the window is a frame or dialog.voidvoidsetModal(boolean isModal) If the window is a dialog, controls if it is modal.voidsetParentWindow(Window parentWindow) Sets the parent window for the log handler window.voidsetShowDialogLevel(Level level) Controls the level which will cause the window to display.voidSets the title for the displayed window.voidShows the windowvoidshowErrorLogWindow(LogRecord logRecord) Adds the log record and shows the window.Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
-
Constructor Details
-
DialogLogHandler
public DialogLogHandler()Dont use this, use getInstance() instead to get at the singleton.
-
-
Method Details
-
setLogDisplayProvider
-
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
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
Adds the log record and shows the window.- Parameters:
logRecord-
-
setErrorLevelThatForcesDialogToFront
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
Add a log record to this handler. -
getShowDialogLevel
Returns the level that controls whether the window is displayed.- Returns:
-
setShowDialogLevel
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
Adds a logger to the ignored list.- Parameters:
loggerNamePrefix-
-
addIgnoredSourceClass
Adds a log record source class to the ignored list.- Parameters:
stringPrefix-
-
flush
public void flush()part of the logger api, not implemented. -
close
public void close()part of the logger api, not implemented. -
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
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
-
getLogRecordDisplay
Returns a reference to the inteface that handles logged records, there is typically a UI piece behind the interface.- Returns:
-