|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthades.gui.Console
A simple message console.
To save memory and workaround the JDK memory-allocation problems with java.awt.TextField, the maximum number of lines in the console can be limited. See the documentation for getDefaultFonts() for a list of user-configurable GUI settings.
Additionally, class Console supports file logging of messages. Logging is controlled either interactively or via the SetupManager properties "Hades.Console.LogFileName" and "Hades.Console.LogEnable"
Nested Class Summary | |
(package private) class |
Console.LogManager
|
(package private) class |
Console.WindowCloser
|
Field Summary | |
protected boolean |
logfileEnable
|
protected java.lang.String |
logfileName
|
protected Console.LogManager |
logManager
|
protected java.io.PrintWriter |
logStream
|
protected int |
max_lines
|
protected int |
messagePopupLevel
|
static int |
MSG_ERROR
|
static int |
MSG_FATAL
|
static int |
MSG_INFO
|
static int |
MSG_UNKNOWN
|
static int |
MSG_WARNING
|
protected int |
n_lines
|
static int |
POPUP_ALWAYS
|
static int |
POPUP_ERROR
|
static int |
POPUP_FATAL
|
static int |
POPUP_INFO
|
static int |
POPUP_NEVER
|
static int |
POPUP_WARNING
|
protected boolean |
useAWT
|
Constructor Summary | |
|
Console()
|
|
Console(java.lang.String title)
create a new text or GUI based Console to print messages. |
protected |
Console(java.lang.String DONT,
java.lang.String CALL,
java.lang.String ME)
HACK: a dummy constructor used by JConsole. |
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
|
void |
checkShouldSetVisible(java.lang.String s)
parse the first chars of message string 's' to check whether it is an info, warning, error, or fatal message: "-I-", "-W-", "-E-", "-F-" If the message level is greater than the 'popup level', make the console visible and bring in toFront(). |
void |
cleanup()
an utility method to limit the number of lines. |
void |
closeFlushLogStream()
|
void |
consoleMessage(java.lang.String msg)
|
int |
countLines()
count the number of lines in the console window. |
static Console |
createNewConsole()
|
void |
destroy()
|
void |
enableFileLoggingGUI(boolean b)
|
void |
finalize()
|
static Console |
getConsole()
get a reference to a message Console. |
java.awt.Frame |
getFrame()
return a reference to the Frame window used by this Console. |
void |
getIcon()
load and set the icon image for this frame. |
java.lang.String |
getLogFileName()
|
int |
getMaxLines()
|
void |
initialize(java.lang.String s)
initialize Console position and size from a String in xywh format |
static void |
main(java.lang.String[] argv)
|
void |
message(java.lang.String s)
|
void |
openLogStream()
|
void |
println(java.lang.String s)
|
void |
setDefaultLogFileNameAndEnable()
|
void |
setLogFileEnable(boolean b)
|
void |
setLogFileName(java.lang.String name)
|
void |
setMaxLines(int m)
|
void |
setMessagePopupLevel(int i)
|
void |
setText(java.lang.String s)
|
void |
setVisible(boolean b)
|
void |
show()
|
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MSG_UNKNOWN
public static final int MSG_INFO
public static final int MSG_WARNING
public static final int MSG_ERROR
public static final int MSG_FATAL
public static final int POPUP_ALWAYS
public static final int POPUP_INFO
public static final int POPUP_WARNING
public static final int POPUP_ERROR
public static final int POPUP_FATAL
public static final int POPUP_NEVER
protected int messagePopupLevel
protected int n_lines
protected int max_lines
protected boolean logfileEnable
protected java.lang.String logfileName
protected java.io.PrintWriter logStream
protected Console.LogManager logManager
protected boolean useAWT
Constructor Detail |
public Console()
public Console(java.lang.String title)
protected Console(java.lang.String DONT, java.lang.String CALL, java.lang.String ME)
Method Detail |
public static Console getConsole()
In order to support three different modes (no-GUI, traditional-AWT, and Swing), we use the following algorithm. First, we check the SetupManager "Hades.UseSwingGUI" property. If this evaluates to true, we construct a hades.gui.JConsole and return a reference to it. Otherwise, we directly call the hades.gui.Console constructor, which in turn examines the "Hades.Console.UseAWT" property to decide between AWT or text-only mode.
public static Console createNewConsole()
public void destroy()
public java.awt.Frame getFrame()
public void show()
public void setVisible(boolean b)
public void getIcon()
public void initialize(java.lang.String s)
public void enableFileLoggingGUI(boolean b)
public void setMaxLines(int m)
public int getMaxLines()
public java.lang.String getLogFileName()
public void setDefaultLogFileNameAndEnable()
public void setLogFileName(java.lang.String name)
public void setLogFileEnable(boolean b)
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void openLogStream()
public void closeFlushLogStream()
public void finalize()
public void println(java.lang.String s)
public void checkShouldSetVisible(java.lang.String s)
public void setMessagePopupLevel(int i)
public void consoleMessage(java.lang.String msg)
consoleMessage
in interface ConsoleMessage
public void message(java.lang.String s)
public void setText(java.lang.String s)
public void cleanup()
public int countLines()
public static void main(java.lang.String[] argv)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |