Class UiLog
java.lang.Object
com.mcpdbwizard.pub.GenericLog
com.mcpdbwizard.pub.TextLog
com.mcpdbwizard.pub.UiLog
- All Implemented Interfaces:
LogInterface,AutoCloseable
This is an implementation of
LogInterface that uses a
javax.swing.JLabel field to display messages.
it also does modal messages and will log them if asked.
See LogInterface
Copyright 2003-2026 ATB Consultancy Services Ltd (formerly Orinda Software Ltd, Dublin, Ireland)
- Version:
- 7
- Author:
- [email protected]
-
Field Summary
Fields inherited from class com.mcpdbwizard.pub.TextLog
consoleOutput, howManyMessagesInThisFile, iAmBroken, LOG_FILE_EXTENSION, logFileDayFormat, logFileTimeFormat, MAX_MESSAGES_PER_FILE, theCurrentLogFile, theDirectoryFile, thePrefixFields inherited from class com.mcpdbwizard.pub.GenericLog
autoFlush, autoLog, debugMessagesPrinted, LOG_BEING_FLUSHED, printThreadIdFields inherited from interface com.mcpdbwizard.pub.LogInterface
DEBUG, DEFAULT_FIELD_DELIMITER, DEFAULT_FILENAME_DAY_FORMAT, DEFAULT_FILENAME_TIME_FORMAT, DEFAULT_TIME_FORMAT_STRING, ERROR, INFO, SYSERR, WARN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddJTextArea(JTextArea newTextArea, int lines) Set a new Text AreavoidClear the text areastatic intmapMessageType(String messageType) Map LogInterface message types to JOptionPane message typesvoiduseJTextArea(boolean useArea) Prevent or allow messages from being written to the text area as well as the log file.protected voidwriteMessage(String messageType, String messageText, boolean isModal, boolean isLogged) Format a message and write it to the JLabeltheLabel.Methods inherited from class com.mcpdbwizard.pub.TextLog
close, closeFile, flush, getConsoleOutput, getCurrentLog, getLogFileDate, getLogFileName, getLogFileTime, setConsoleOutputMethods inherited from class com.mcpdbwizard.pub.GenericLog
debug, debug, debugOff, debugOn, error, error, error, error, formatMessage, getDateFormat, getDebug, info, info, setAutoFlush, setAutoLog, syserror, syserror, syserror, syserror, warning, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.mcpdbwizard.pub.LogInterface
debug, debug, debugOff, debugOn, error, error, error, error, flush, getCurrentLog, getDateFormat, getDebug, info, info, setAutoFlush, setAutoLog, syserror, syserror, syserror, syserror, warning, warning
-
Constructor Details
-
UiLog
Create an instance of UiLog.- Parameters:
theDirectoryName- A string containing a logging directory path name. If the directory doesn't exist we'll attempt to create it. If we can't create it then we lose the ability to log messages.thePrefix- A string containing a the prefix used to name the log files.theLabel- A JLabel. We assume that it's a suitable location for a message, such as a line at the bottom of the screen.theFrame- The current application frame. We need to know this in order to refresh the graphics context so that messages will become visible to the end user.
-
-
Method Details
-
mapMessageType
Map LogInterface message types to JOptionPane message types- Parameters:
messageType- A valid LogInterface messageType, such asLogInterface.DEBUG, LogInterface.INFO, LogInterface.WARN, LogInterface.ERROR, LogInterface.SYSERR- Returns:
- A JOptionPane message type.
- See Also:
-
useJTextArea
public void useJTextArea(boolean useArea) Prevent or allow messages from being written to the text area as well as the log file. -
clearJTextArea
public void clearJTextArea()Clear the text area -
addJTextArea
Set a new Text Area -
writeMessage
protected void writeMessage(String messageType, String messageText, boolean isModal, boolean isLogged) Format a message and write it to the JLabeltheLabel.- Overrides:
writeMessagein classTextLog- Parameters:
messageType- should be one of the constants DEBUG, INFO, WARN, ERROR or SYSERR as defined in LogInterface.messageText- The message textisModal- Iftruethen a modal window will also appear and force the user to acknowledge the message.isLogged- Whether this message is written to a log file. Passed to the parent class.
-