|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
edu.neu.ccs.gui.JPTFrame
edu.neu.ccs.console.ConsoleWindow
A floating window containing a console text pane, with a menu providing access to functionality for the "activated" console object.
This class is used internally by the JPT and should not need to be used outside of the JPT console package.
In 2.6.0, fixed a bug in the close() method that was
pointed out by Frantisek Galcik. As part of this fix,
the constructor was changed from a default constructor
to one that passes in the ConsoleGateway
object that constructs this window.
This class no longer implements the interface
ConsoleAware since that is now unnecessary.
ConsoleTextPane,
ConsoleGateway| Nested Class Summary |
| Nested classes inherited from class javax.swing.JFrame |
JFrame.AccessibleJFrame |
| Nested classes inherited from class java.awt.Frame |
Frame.AccessibleAWTFrame |
| Nested classes inherited from class java.awt.Window |
Window.AccessibleAWTWindow |
| Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
private Hashtable |
actions
Table of available actions for the GUI. |
static int |
ERR
Constant index for the error stream. |
private ConsoleGateway |
gateway
The ConsoleGateway that constructed this ConsoleWindow. |
private static int |
heightDeduction
The amount to deduct from the screen height when sizing. |
static int |
IN
Constant index for the input stream. |
private Object |
inputmode_mutex
Mutex that is used to prevent input mode changes while fireConsoleInputPerformed is activated. |
private static int |
maxFontSize
The maximum font size for the font menu. |
private static int |
minFontSize
The minimum font size for the font menu. |
static int |
OUT
Constant index for the output stream. |
private Action |
save
The "save transcript" action. |
private File |
scriptFile
The file object for an open transcript record. |
private FileOutputStream |
scriptStream
The output stream for an open transcript record. |
private JScrollPane |
scroll
Scroll pane housing the console pane. |
private ConsoleTextPane |
tablet
Pane used for rendering console input and output. |
private Action |
transcript
The "start transcript record" action. |
private static int |
widthDeduction
The amount to deduct from the screen width when sizing. |
| Fields inherited from class edu.neu.ccs.gui.JPTFrame |
closeOperation, counter, DEFAULT_CLOSE_OPERATION, EXIT_ON_CLOSE, EXIT_ON_CLOSE_IF_LAST, screen_insets |
| Fields inherited from class javax.swing.JFrame |
accessibleContext, rootPane, rootPaneCheckingEnabled |
| Fields inherited from class java.awt.Frame |
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
| Fields inherited from class java.awt.Window |
|
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface edu.neu.ccs.util.JPTConstants |
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE |
| Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
ConsoleWindow(ConsoleGateway gateway)
Constructs a console window. |
|
| Method Summary | |
void |
close()
Performs the housekeeping necessary to close the window, then disposes of the window resources. |
void |
consoleInputPerformed(String text)
Handles input gathered from the console visualization. |
void |
consoleOutputPerformed(String text,
int stream)
Handles output for the text console. |
private Hashtable |
createActionsTable()
Creates and returns the table of available GUI actions. |
private JMenu |
createEditMenu()
Returns the edit menu. |
private JMenu |
createFileMenu()
Returns the file menu. |
private JMenu |
createFontMenu()
Returns the font menu. |
private JMenuBar |
createMenuBar()
Creates a menubar containing the available GUI actions. |
private void |
fireConsoleInputPerformed(String text)
Notifies registered listeners that an input String
was gathered by console input. |
private Action |
getAction(String name)
Returns the action with the given name retrieved from the table of available actions. |
Color |
getErrorColor()
Returns the error color for the console. |
String |
getFontFamilyName()
Returns the font family name of the console font. |
int |
getFontSize()
Returns the actual font size last set by the method setFontSize after any adjustments. |
Color |
getInputColor()
Returns the input color for the console. |
static int |
getMaximumFontSize()
Get the maximum font size that may be set for the console window. |
static int |
getMinimumFontSize()
Get the minimum font size that may be set for the console window. |
Color |
getOutputColor()
Returns the output color for the console. |
(package private) ConsoleTextPane |
getTextPane()
Returns the text pane contained by this window. |
private void |
readObject(ObjectInputStream in)
Extends the default deserialization process to restore transient data members upon instantiation. |
private void |
save()
Saves a transcript of the console IO session. |
void |
setErrorColor(Color c)
Sets the error color for the console to the given color. |
private SimpleAction |
setFontAction(int size)
Returns a menu item action to set the console to the given size. |
void |
setFontSize(int size)
Sets the font size for the console to the given size. |
void |
setInputColor(Color c)
Sets the input color for the console to the given color. |
void |
setInputMode(boolean input)
Sets whether or not the console is in input mode to the given value. |
void |
setOutputColor(Color c)
Sets the output color for the console to the given color. |
private void |
transcript()
Opens a transcript record file that is updated as IO operations are performed. |
| Methods inherited from class edu.neu.ccs.gui.JPTFrame |
addNotify, center, createQuickJPTFrame, createQuickJPTFrame, createQuickJPTFrame, createQuickJPTFrame, createQuickJPTFrame, createQuickJPTFrame, createQuickJPTFrame, createQuickJPTFrame, decrementCounter, dispose, frame, frame, frame, frame, frame, frame, getCounter, getDefaultCloseOperation, getJPTFrameCount, getScreenInsets, iconify, incrementCounter, installWindowAdapter, maximize, normal, setDefaultCloseOperation, setLocation, setLocation, toggle |
| Methods inherited from class javax.swing.JFrame |
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
| Methods inherited from class java.awt.Frame |
finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.awt.MenuContainer |
getFont, postEvent |
| Field Detail |
public static final int OUT
public static final int ERR
public static final int IN
private static int minFontSize
private static int maxFontSize
private static int widthDeduction
private static int heightDeduction
private Hashtable actions
private Action save
private Action transcript
private transient FileOutputStream scriptStream
private ConsoleGateway gateway
private File scriptFile
private JScrollPane scroll
private ConsoleTextPane tablet
private Object inputmode_mutex
| Constructor Detail |
public ConsoleWindow(ConsoleGateway gateway)
| Method Detail |
private void readObject(ObjectInputStream in)
throws IOException,
ClassNotFoundException
in - the deserialization input stream
IOException
ClassNotFoundExceptionpublic void consoleInputPerformed(String text)
text - the input text gathered from the stream
public void consoleOutputPerformed(String text,
int stream)
text - the output textstream - the output stream being "written"ConsoleInputListenerpublic void setInputMode(boolean input)
Sets whether or not the console is in input mode to the given value.
If the console is set to input mode, the console window is set to normal in case it had been iconified and the output streams are temporarily blocked.
input - whether or not the console is in input modepublic void setInputColor(Color c)
c - the desired input colorgetInputColor()public Color getInputColor()
setInputColor(Color)public void setOutputColor(Color c)
c - the desired output colorgetOutputColor()public Color getOutputColor()
setOutputColor(Color)public void setErrorColor(Color c)
c - the desired error colorgetErrorColor()public Color getErrorColor()
setErrorColor(Color)public final String getFontFamilyName()
public final int getFontSize()
Returns the actual font size last set by the method
setFontSize after any adjustments.
public static final int getMinimumFontSize()
public static final int getMaximumFontSize()
public final void setFontSize(int size)
Sets the font size for the console to the given size.
Point sizes smaller than 10 are set to 10 points.
Point sizes larger than 72 are set to 72 points.
Keep in mind that very large font sizes will lead to very few characters per line in the console window.
size - the desired font sizepublic void close()
ConsoleTextPane getTextPane()
private void fireConsoleInputPerformed(String text)
String
was gathered by console input.
text - the gathered input StringConsoleInputListenerprivate Hashtable createActionsTable()
private Action getAction(String name)
name - the name of the action to retrieveprivate JMenuBar createMenuBar()
private JMenu createFileMenu()
private JMenu createEditMenu()
private JMenu createFontMenu()
private SimpleAction setFontAction(int size)
size - the desired font size for the font menuprivate void save()
createMenuBar()private void transcript()
createMenuBar()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||