|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.event.WindowAdapter
com.mindbright.terminal.TerminalWin
The actual implementation of a terminal window. The terminal window may use AWT or Swing widgets depending on the owner frame type.
| Field Summary | |
static int |
LEFT_BUTTON
|
static int |
MIDDLE_BUTTON
|
static int |
RIGHT_BUTTON
|
static java.lang.String[] |
termColorNames
The names of the predefined colors |
static java.awt.Color[] |
termColors
Predefined colors |
static int |
UNKNOWN_BUTTON
|
| Constructor Summary | |
TerminalWin(java.awt.Frame ownerFrame)
Create a new terminal window with the default values of all properties. |
|
TerminalWin(java.awt.Frame ownerFrame,
java.util.Properties initProps)
Create a new terminal window with the given properties. |
|
TerminalWin(java.awt.Frame ownerFrame,
java.util.Properties initProps,
boolean setAsDefault)
Create a new terminal window with the given properties. |
|
| Method Summary | |
void |
addAsEntropyGenerator(RandomSeed seed)
Casuses this terminal window to send events to the specified random seed in order to extract entropy from them |
void |
addInputListener(TerminalInputListener inListener)
Add a input listener which listens to data from the user. |
void |
addOutputListener(TerminalOutputListener outListener)
Add a output listener which listens to data from the server. |
void |
attachPrinter(TerminalPrinter printer)
Attach a printer to this terminal. |
void |
clearLine()
This shortcut method clears the current line. |
void |
clearSaveLines()
Forgets any saved lines in the scrollback buffer. |
void |
clearScreen()
This shortcut method clears the screen. |
void |
clearSelection()
Removes the selection if there is one. |
int |
cols()
Get the number of columns shown. |
void |
detachPrinter()
Detach the previously attached printer. |
void |
displayDragResize(int newRows,
int newCols)
Resize the terminal during a drag operation. |
void |
displayResized(int newRows,
int newCols,
int vpixels,
int hpixels)
Claled when the terminal window has been resized. |
void |
doCopy()
Store a copy of the selection in the clipboard. |
void |
doPaste()
Paset the contents of the clipboard. |
void |
emulateComponentShown()
Generate a syntetic ComponentShown event. |
TerminalClipboardHandler |
getClipboard()
Get the clipboard used. |
java.lang.String |
getDefaultProperty(java.lang.String key)
Get the default value of the given property. |
DisplayView |
getDisplay()
Return the current display view object which handles the actual displaying of data in the terminal window. |
java.awt.Image |
getLogo()
Get the logo image. |
TerminalMenuHandler |
getMenus()
Return the menu handler which is responsible for the menus attached to this terminal window. |
TerminalOption[] |
getOptions()
Get the terminal options. |
java.awt.Container |
getPanelWithScrollbar()
Return the panel containing the actual terminal window, including the scrollbar. |
java.util.Properties |
getProperties()
Get the current terminal properties |
java.lang.String |
getProperty(java.lang.String key)
Get the value of a single property. |
static java.lang.String[] |
getPropertyNames()
Get the name of all properties the terminal emulator cares about. |
boolean |
getPropsChanged()
Check if any properties have changed. |
java.lang.String |
getSelection()
Get the current selection. |
static java.awt.Color |
getTermColor(java.lang.String name)
Get a predefined terminal color. |
static java.lang.String[] |
getTerminalTypes()
Get a list of terminal types this terminal can emulate. |
static java.awt.Color |
getTermRGBColor(java.lang.String value)
Get a color as specified by an R,G,B tuple. |
java.lang.String |
getTitle()
Get the title |
void |
hideLogo()
Hide the logo, that is do not show it. |
int |
hpixels()
Get the number of horizontal pixels used to represent the terminal. |
static boolean |
isProperty(java.lang.String key)
Check if the passed property name is a valid property for this terminal window. |
void |
keyPressed(java.awt.event.KeyEvent e)
|
void |
keyReleased(java.awt.event.KeyEvent e)
|
void |
keyTyped(java.awt.event.KeyEvent e)
|
void |
mouseClicked(int visTop,
int row,
int col,
int modifier,
int which)
Handle a mouse click event |
void |
mouseDragged(int visTop,
int mouseRow,
int mouseCol,
int modifier,
int which,
int delta)
Handle a mouse dragged event |
void |
mousePressed(int visTop,
int mouseRow,
int mouseCol,
int modifier,
int which,
int x,
int y)
Handle a mouse press event |
void |
mouseReleased(int visTop,
int mouseRow,
int mouseCol,
int modifier,
int which)
Handle a mouse release event |
void |
printScreen()
Dump the current screen to the attached printer. |
void |
removeInputListener(TerminalInputListener inListener)
Removes a previously added input listener |
void |
removeOutputListener(TerminalOutputListener outListener)
Removes a previously added output listener |
void |
requestFocus()
Causes the terminal emulator to request the focus. |
void |
reset()
Reset the terminal emulator to the default state. |
void |
resetProperty(java.lang.String key)
Reset a property back to its default value. |
void |
resetToDefaults()
Reset all properties to their default values. |
void |
ringBell()
This shortcut method rings the terminal bell. |
int |
rows()
Get the number of rows shown. |
void |
scrollDown()
|
void |
scrollUp()
|
SearchContext |
search(SearchContext lastContext,
java.lang.String key,
boolean reverse,
boolean caseSens)
Search for a string in the terminal window |
void |
selectAll()
Select all text |
void |
sendBreak()
Send a break singal to the server. |
void |
sendBytes(byte[] b)
May be called when the user pastes data. |
void |
sendBytesInt(byte[] b)
|
void |
sendString(java.lang.String s)
Simulate key events, just send the specified charascters |
void |
setAttributeBold(boolean set)
This shortcut menthod is used to enable/disable bold characters. |
void |
setClipboard(TerminalClipboardHandler clipboard)
Set the clipboard handler to use in this terminal window. |
void |
setCursorPos(int row,
int col)
This shortcut method moves the cursor to the given position. |
void |
setDumbMode(boolean dumb)
Enable/disable dumb mode. |
void |
setFont(java.awt.Font font)
Set the font to use. |
void |
setFont(java.lang.String name,
int size)
Set the font to use. |
void |
setGeometry(java.lang.String geometry)
Set the geometry to use, The geometry is a string which looks something like 80x24+23+42 which creates a window
which is 80 columns with 24 rows and which is placed at
x=23,y=24. |
void |
setIgnoreClose()
Set the frame to ignore window close events. |
void |
setInputCharset(java.lang.String charset)
Set the charset used to input text. |
void |
setLogo(java.awt.Image logoImg,
int x,
int y,
int w,
int h)
Set the logo to show on the login screen. |
void |
setMenus(TerminalMenuHandler menus)
Set the menu handler |
void |
setPopupButton(int buttonNum)
Set which mouse button should cause the popup menu to appear. |
void |
setProperties(java.util.Properties newProps,
boolean merge)
Set a bunch of terminal properties |
void |
setProperty(java.lang.String key,
java.lang.String value)
Set a single terminal property. |
void |
setProperty(java.lang.String key,
java.lang.String value,
boolean forceSet)
Set a property. |
void |
setPropsChanged(boolean value)
Change the properties changed flag. |
void |
setTitle(java.lang.String title)
Set title of terminal window. |
boolean |
showLogo()
Show the logo on the terminal. |
void |
signalWindowChanged(int rows,
int cols,
int vpixels,
int hpixels)
Tell all our input listeners that the terminal size has changed. |
void |
startPrinter()
Start dumping a log of everything which is printed on the terminal to the attached printer. |
void |
stopPrinter()
Stop printing. |
java.lang.String |
terminalType()
Get the terminal type which the window currently emulates. |
void |
typedChar(char c)
Called whn the user tpyes a character |
void |
typedCharInt(byte[] b)
|
void |
typedCharInt(char c)
|
void |
updateMenus()
Called when the menus should be updated. |
int |
vpixels()
Get the number of vertical pixels used to represent the terminal. |
void |
windowClosed(java.awt.event.WindowEvent e)
This is notified when the window is closed and is used to tell the display class to kill the repainter thread. |
void |
write(byte b)
Write a byte to the terminal. |
void |
write(byte[] c,
int off,
int len)
Write a bunch of bytes to the terminal. |
void |
write(char c)
Write a character to the terminal. |
void |
write(char[] c,
int off,
int len)
Write a bunch of characters to the terminal. |
void |
write(java.lang.String s)
Write a string to the terminal. |
| Methods inherited from class java.awt.event.WindowAdapter |
windowActivated, windowClosing, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.awt.Color[] termColors
public static final java.lang.String[] termColorNames
public static final int LEFT_BUTTON
public static final int MIDDLE_BUTTON
public static final int RIGHT_BUTTON
public static final int UNKNOWN_BUTTON
| Constructor Detail |
public TerminalWin(java.awt.Frame ownerFrame)
throws java.lang.IllegalArgumentException,
java.util.NoSuchElementException
Frame or
ownerFrame - frame used to determine if AWT or Swing
should be used.
public TerminalWin(java.awt.Frame ownerFrame,
java.util.Properties initProps)
throws java.lang.IllegalArgumentException
Frame or
ownerFrame - frame used to determine if AWT or Swing
should be used.initProps - initial properties
public TerminalWin(java.awt.Frame ownerFrame,
java.util.Properties initProps,
boolean setAsDefault)
throws java.lang.IllegalArgumentException
Frame or
ownerFrame - frame used to determine if AWT or Swing
should be used.initProps - initial propertiessetAsDefault - mark these properties as default and use
them if no others are specified in the future.| Method Detail |
public static java.lang.String[] getTerminalTypes()
public void emulateComponentShown()
ComponentShown event.
public void requestFocus()
public void setMenus(TerminalMenuHandler menus)
public TerminalMenuHandler getMenus()
public DisplayView getDisplay()
public void updateMenus()
public void setLogo(java.awt.Image logoImg,
int x,
int y,
int w,
int h)
logoImg - the actual logox - x position to show it aty - y position to show it onw - width of logo when shownh - height of logo when shownpublic java.awt.Image getLogo()
public boolean showLogo()
public void hideLogo()
public void setProperties(java.util.Properties newProps,
boolean merge)
throws java.lang.IllegalArgumentException
TerminalWindow
setProperties in interface TerminalWindownewProps - new propertiesmerge - if true the new properties are merged with any
previous properties. If false all old properties are deleted.
java.lang.IllegalArgumentExceptionpublic java.util.Properties getProperties()
TerminalWindow
getProperties in interface TerminalWindowpublic boolean getPropsChanged()
TerminalWindow
getPropsChanged in interface TerminalWindowpublic void setPropsChanged(boolean value)
TerminalWindow
setPropsChanged in interface TerminalWindowvalue - new value.public static boolean isProperty(java.lang.String key)
key - a property name
public void resetToDefaults()
TerminalWindow
resetToDefaults in interface TerminalWindowpublic static java.lang.String[] getPropertyNames()
public java.lang.String getProperty(java.lang.String key)
TerminalWindow
getProperty in interface TerminalWindowkey - name of perty to get value of
public java.lang.String getDefaultProperty(java.lang.String key)
key - name of peroperty
public void resetProperty(java.lang.String key)
key - name of property to reset
public void setProperty(java.lang.String key,
java.lang.String value)
throws java.lang.IllegalArgumentException,
java.util.NoSuchElementException
TerminalWindow
setProperty in interface TerminalWindowkey - property to setvalue - value to set it to
java.lang.IllegalArgumentException
java.util.NoSuchElementExceptionpublic TerminalOption[] getOptions()
TerminalWindow
getOptions in interface TerminalWindow
public void setProperty(java.lang.String key,
java.lang.String value,
boolean forceSet)
throws java.lang.IllegalArgumentException,
java.util.NoSuchElementException
key - name of propertyvalue - value of propertyforceSet - if true then the property os set event if the
key is not a valid terminal property name
java.lang.IllegalArgumentException
java.util.NoSuchElementException
public static java.awt.Color getTermRGBColor(java.lang.String value)
throws java.lang.NumberFormatException
value - a string with the R,G,B value of the form
0,0,0. Legal values for each element are 0-255.
java.lang.NumberFormatException
public static java.awt.Color getTermColor(java.lang.String name)
throws java.lang.IllegalArgumentException
name - name of desired color
java.lang.IllegalArgumentException
public void setGeometry(java.lang.String geometry)
throws java.lang.IllegalArgumentException
80x24+23+42 which creates a window
which is 80 columns with 24 rows and which is placed at
x=23,y=24. It is also possible to just specify the size or the
position and any of the position values can be preceded by a minus
sign in which case it is countyed from the right/bottom edge
instead.
geometry - string representing the geometry
java.lang.IllegalArgumentException
public void setFont(java.lang.String name,
int size)
name - name of fontsize - size of fontpublic void setFont(java.awt.Font font)
font - font to usepublic void setTitle(java.lang.String title)
TerminalWindow
setTitle in interface TerminalWindowtitle - the titlepublic java.lang.String getTitle()
TerminalWindow
getTitle in interface TerminalWindowpublic void setPopupButton(int buttonNum)
buttonNum - button number. One of InputEvent.BUTTON1_MASK,
InputEvent.BUTTON2_MASK or InputEvent.BUTTON3_MASKpublic java.awt.Container getPanelWithScrollbar()
public void clearSaveLines()
public void setInputCharset(java.lang.String charset)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic java.lang.String terminalType()
TerminalWindow
terminalType in interface TerminalWindowpublic int rows()
TerminalWindow
rows in interface TerminalWindowpublic int cols()
TerminalWindow
cols in interface TerminalWindowpublic int vpixels()
TerminalWindow
vpixels in interface TerminalWindowpublic int hpixels()
TerminalWindow
hpixels in interface TerminalWindowpublic void write(byte b)
TerminalWindow
write in interface TerminalWindowb - byte to writepublic void write(char c)
TerminalWindowThe character is assumed to be in the java internal encoding.
write in interface TerminalWindowc - character to write
public void write(char[] c,
int off,
int len)
TerminalWindowThe characters are assumed to be in the java internal encoding.
write in interface TerminalWindowc - array containg the characters to writeoff - index in array of first character to writelen - number of characters to write
public void write(byte[] c,
int off,
int len)
TerminalWindow
write in interface TerminalWindowc - array containg the characters to writeoff - index in array of first character to writelen - number of characters to writepublic void write(java.lang.String s)
TerminalWindow
write in interface TerminalWindows - string to writepublic void addInputListener(TerminalInputListener inListener)
TerminalWindow
addInputListener in interface TerminalWindowinListener - input listener to addpublic void removeInputListener(TerminalInputListener inListener)
TerminalWindow
removeInputListener in interface TerminalWindowinListener - input listener to removepublic void addOutputListener(TerminalOutputListener outListener)
TerminalWindow
addOutputListener in interface TerminalWindowoutListener - output listener to addpublic void removeOutputListener(TerminalOutputListener outListener)
TerminalWindow
removeOutputListener in interface TerminalWindowoutListener - output listener to removepublic void attachPrinter(TerminalPrinter printer)
TerminalWindow
attachPrinter in interface TerminalWindowprinter - printer to attachpublic void detachPrinter()
TerminalWindow
detachPrinter in interface TerminalWindowpublic void setClipboard(TerminalClipboardHandler clipboard)
clipboard - clipboard handler to usepublic TerminalClipboardHandler getClipboard()
public void typedChar(char c)
TerminalWindow
typedChar in interface TerminalWindowc - typed characterpublic void typedCharInt(char c)
public void typedCharInt(byte[] b)
public final void sendBytes(byte[] b)
TerminalWindow
sendBytes in interface TerminalWindowb - array of bytes representing characters to inputpublic final void sendBytesInt(byte[] b)
public final void sendBreak()
TerminalWindow
sendBreak in interface TerminalWindow
public void signalWindowChanged(int rows,
int cols,
int vpixels,
int hpixels)
rows - new number of rowscols - new number of columnsvpixels - new number of vertical pixelshpixels - new number of horizontal pixelspublic void reset()
TerminalWindow
reset in interface TerminalWindowpublic void printScreen()
TerminalWindow
printScreen in interface TerminalWindowpublic void startPrinter()
TerminalWindow
startPrinter in interface TerminalWindowpublic void stopPrinter()
TerminalWindow
stopPrinter in interface TerminalWindow
public SearchContext search(SearchContext lastContext,
java.lang.String key,
boolean reverse,
boolean caseSens)
TerminalWindow
search in interface TerminalWindowlastContext - used as a starying point, if not null, so
tha the search may continue from the last positionkey - string to search forreverse - if true the search is performed backwardscaseSens - if true the key is case sensitive
null if the key was not found.
public void displayDragResize(int newRows,
int newCols)
displayDragResize in interface com.mindbright.terminal.DisplayControllernewRows - new number of rowsnewCols - new number of columns
public void displayResized(int newRows,
int newCols,
int vpixels,
int hpixels)
displayResized in interface com.mindbright.terminal.DisplayControllernewRows - new number of rowsnewCols - new number of columnsvpixels - vertical pixeslhpixels - horizontal pixeslpublic void selectAll()
public void clearSelection()
public java.lang.String getSelection()
public void doCopy()
public void doPaste()
public void setDumbMode(boolean dumb)
dumb - true if dumb mode should be enabled.public void setIgnoreClose()
public void mouseClicked(int visTop,
int row,
int col,
int modifier,
int which)
mouseClicked in interface com.mindbright.terminal.DisplayControllervisTop - index of top visual linerow - row of character the mouse was pointing atcol - column of character the mouse was pointing atmodifier - modifiers active
public void mousePressed(int visTop,
int mouseRow,
int mouseCol,
int modifier,
int which,
int x,
int y)
mousePressed in interface com.mindbright.terminal.DisplayControllervisTop - index of top visual linemouseRow - row of character the mouse was pointing atmouseCol - column of character the mouse was pointing atmodifier - modifiers activex - x coordinate of mousey - y coordinate of mouse
public void mouseReleased(int visTop,
int mouseRow,
int mouseCol,
int modifier,
int which)
mouseReleased in interface com.mindbright.terminal.DisplayControllervisTop - index of top visual linemouseRow - row of character the mouse was pointing atmouseCol - column of character the mouse was pointing atmodifier - modifiers active
public void mouseDragged(int visTop,
int mouseRow,
int mouseCol,
int modifier,
int which,
int delta)
mouseDragged in interface com.mindbright.terminal.DisplayControllervisTop - index of top visual linemouseRow - row of character the mouse was pointing atmouseCol - column of character the mouse was pointing atmodifier - modifiers activepublic void scrollUp()
scrollUp in interface com.mindbright.terminal.DisplayControllerpublic void scrollDown()
scrollDown in interface com.mindbright.terminal.DisplayControllerpublic void sendString(java.lang.String s)
public void addAsEntropyGenerator(RandomSeed seed)
TerminalWindow
addAsEntropyGenerator in interface TerminalWindowseed - the random seed to send entropy topublic void setAttributeBold(boolean set)
TerminalWindowThe shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.
setAttributeBold in interface TerminalWindowset - if true turn on bold for subsequent characters.public void clearScreen()
TerminalWindowThe shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.
clearScreen in interface TerminalWindowpublic void ringBell()
TerminalWindowThe shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.
ringBell in interface TerminalWindow
public void setCursorPos(int row,
int col)
TerminalWindowThe shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.
setCursorPos in interface TerminalWindowrow - row to place cursor oncol - column to place cursor onpublic void clearLine()
TerminalWindowThe shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.
clearLine in interface TerminalWindowpublic void windowClosed(java.awt.event.WindowEvent e)
windowClosed in interface java.awt.event.WindowListenerpublic void keyPressed(java.awt.event.KeyEvent e)
keyPressed in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent e)
keyTyped in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent e)
keyReleased in interface java.awt.event.KeyListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||