com.mindbright.terminal
Class DisplayAWT

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended bycom.mindbright.terminal.DisplayAWT
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.AdjustmentListener, java.awt.event.ComponentListener, DisplayView, java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public class DisplayAWT
extends java.awt.Canvas
implements DisplayView, java.awt.event.AdjustmentListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.ComponentListener, java.awt.event.FocusListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int MAX_COLS
           
static int MAX_ROWS
           
static int MIN_COLS
           
static int MIN_ROWS
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.mindbright.terminal.DisplayView
COLOR_BLACK, COLOR_BLUE, COLOR_CYAN, COLOR_GREEN, COLOR_I_BLACK, COLOR_I_BLUE, COLOR_I_CYAN, COLOR_I_GREEN, COLOR_I_MAGENTA, COLOR_I_RED, COLOR_I_WHITE, COLOR_I_YELLOW, COLOR_MAGENTA, COLOR_RED, COLOR_WHITE, COLOR_YELLOW, termColorNames, termColors
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DisplayAWT(java.awt.Frame ownerFrame)
           
 
Method Summary
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
           
 void componentHidden(java.awt.event.ComponentEvent e)
           
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
 void componentShown(java.awt.event.ComponentEvent e)
           
 void delKeyListener(java.awt.event.KeyListener keyListener)
           
 void doBell()
           
 void doBell(boolean visualBell)
           
 void emulateComponentShown()
           
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 java.awt.Component getAWTComponent()
           
 java.awt.Dimension getDimensionOfText(int rows, int cols)
           
 java.awt.Image getLogo()
           
 java.awt.Dimension getMaximumSize()
           
 java.awt.Dimension getMinimumSize()
           
 DisplayModel getModel()
           
 java.awt.Container getPanelWithScrollbar(java.lang.String scrollPos)
           
 java.awt.Dimension getPreferredSize()
           
static java.awt.Color getTermColor(java.lang.String name)
           
static java.awt.Color getTermRGBColor(java.lang.String value)
           
 void hideLogo()
           
 boolean isFocusTraversable()
           
 boolean isWide(char c)
          Check if the give character is wider than normal for the font.
 java.awt.Component mkButton(java.lang.String label, java.lang.String cmd, java.awt.event.ActionListener listener)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void moveScrollbar(java.lang.String scrollPos)
           
 void paint(java.awt.Graphics g)
           
 void repaint()
           
 void repaint(boolean force)
           
 void resetSelection()
           
 void reverseColors()
           
 void setBackgroundColor(java.awt.Color c)
           
 void setController(com.mindbright.terminal.DisplayController controller)
           
 void setCursorColor(java.awt.Color c)
           
 void setCursorPosition(int row, int col)
           
 void setFont(java.awt.Font font)
           
 void setFont(java.lang.String name, int size)
           
 void setForegroundColor(java.awt.Color c)
           
 void setGeometry(int row, int col)
           
 void setIgnoreClose()
           
 void setKeyListener(java.awt.event.KeyListener keyListener)
           
 void setLineSpaceDelta(int delta)
           
 void setLogo(java.awt.Image logoImg, int x, int y, int w, int h)
           
 void setModel(DisplayModel model)
           
 void setNoCursor()
           
 void setPendingVisTopChange(int visTop)
           
 void setPosition(int xPos, int yPos)
           
 void setSelection(int row1, int col1, int row2, int col2)
           
 void setVisTop(int visTop)
           
 void setVisTop(int visTop, boolean changeAllowed)
           
 void setVisTopChangeAllowed(boolean set)
           
 void setVisTopDelta(int delta)
           
 void setVisTopDelta(int delta, boolean changeAllowed)
           
 boolean showLogo()
           
 void update(java.awt.Graphics g)
           
 void updateDirtyArea(int top, int left, int bottom, int right)
           
 void updateScrollbarValues()
           
 void windowClosed()
           
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.mindbright.terminal.DisplayView
requestFocus
 

Field Detail

MIN_ROWS

public static final int MIN_ROWS
See Also:
Constant Field Values

MIN_COLS

public static final int MIN_COLS
See Also:
Constant Field Values

MAX_COLS

public static final int MAX_COLS
See Also:
Constant Field Values

MAX_ROWS

public static final int MAX_ROWS
See Also:
Constant Field Values
Constructor Detail

DisplayAWT

public DisplayAWT(java.awt.Frame ownerFrame)
Method Detail

setModel

public void setModel(DisplayModel model)
Specified by:
setModel in interface DisplayView

getModel

public DisplayModel getModel()
Specified by:
getModel in interface DisplayView

setController

public void setController(com.mindbright.terminal.DisplayController controller)
Specified by:
setController in interface DisplayView

setKeyListener

public void setKeyListener(java.awt.event.KeyListener keyListener)
Specified by:
setKeyListener in interface DisplayView

delKeyListener

public void delKeyListener(java.awt.event.KeyListener keyListener)
Specified by:
delKeyListener in interface DisplayView

setLogo

public void setLogo(java.awt.Image logoImg,
                    int x,
                    int y,
                    int w,
                    int h)
Specified by:
setLogo in interface DisplayView

getLogo

public java.awt.Image getLogo()
Specified by:
getLogo in interface DisplayView

showLogo

public boolean showLogo()
Specified by:
showLogo in interface DisplayView

hideLogo

public void hideLogo()
Specified by:
hideLogo in interface DisplayView

getTermRGBColor

public static java.awt.Color getTermRGBColor(java.lang.String value)
                                      throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

getTermColor

public static java.awt.Color getTermColor(java.lang.String name)
                                   throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

setFont

public void setFont(java.lang.String name,
                    int size)
Specified by:
setFont in interface DisplayView

setLineSpaceDelta

public void setLineSpaceDelta(int delta)
Specified by:
setLineSpaceDelta in interface DisplayView

setFont

public void setFont(java.awt.Font font)

setVisTopChangeAllowed

public void setVisTopChangeAllowed(boolean set)
Specified by:
setVisTopChangeAllowed in interface DisplayView

setVisTopDelta

public void setVisTopDelta(int delta)
Specified by:
setVisTopDelta in interface DisplayView

setVisTopDelta

public void setVisTopDelta(int delta,
                           boolean changeAllowed)
Specified by:
setVisTopDelta in interface DisplayView

setVisTop

public void setVisTop(int visTop)
Specified by:
setVisTop in interface DisplayView

setVisTop

public void setVisTop(int visTop,
                      boolean changeAllowed)
Specified by:
setVisTop in interface DisplayView

setPendingVisTopChange

public void setPendingVisTopChange(int visTop)
Specified by:
setPendingVisTopChange in interface DisplayView

updateScrollbarValues

public void updateScrollbarValues()
Specified by:
updateScrollbarValues in interface DisplayView

getPanelWithScrollbar

public java.awt.Container getPanelWithScrollbar(java.lang.String scrollPos)
Specified by:
getPanelWithScrollbar in interface DisplayView

moveScrollbar

public void moveScrollbar(java.lang.String scrollPos)
Specified by:
moveScrollbar in interface DisplayView

updateDirtyArea

public void updateDirtyArea(int top,
                            int left,
                            int bottom,
                            int right)
Specified by:
updateDirtyArea in interface DisplayView

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

isFocusTraversable

public boolean isFocusTraversable()

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

emulateComponentShown

public void emulateComponentShown()
Specified by:
emulateComponentShown in interface DisplayView

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Specified by:
componentShown in interface java.awt.event.ComponentListener

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

isWide

public boolean isWide(char c)
Description copied from interface: DisplayView
Check if the give character is wider than normal for the font. This is meant to catch certain asian characters which are double-width, even in a monospaced font:-(

Specified by:
isWide in interface DisplayView

getDimensionOfText

public java.awt.Dimension getDimensionOfText(int rows,
                                             int cols)

getPreferredSize

public java.awt.Dimension getPreferredSize()

getMinimumSize

public java.awt.Dimension getMinimumSize()

getMaximumSize

public java.awt.Dimension getMaximumSize()

repaint

public void repaint()
Specified by:
repaint in interface DisplayView

repaint

public void repaint(boolean force)
Specified by:
repaint in interface DisplayView

paint

public void paint(java.awt.Graphics g)

update

public void update(java.awt.Graphics g)

setPosition

public void setPosition(int xPos,
                        int yPos)
Specified by:
setPosition in interface DisplayView

setGeometry

public void setGeometry(int row,
                        int col)
Specified by:
setGeometry in interface DisplayView

resetSelection

public void resetSelection()
Specified by:
resetSelection in interface DisplayView

setSelection

public void setSelection(int row1,
                         int col1,
                         int row2,
                         int col2)
Specified by:
setSelection in interface DisplayView

setNoCursor

public void setNoCursor()
Specified by:
setNoCursor in interface DisplayView

setCursorPosition

public void setCursorPosition(int row,
                              int col)
Specified by:
setCursorPosition in interface DisplayView

setBackgroundColor

public void setBackgroundColor(java.awt.Color c)
Specified by:
setBackgroundColor in interface DisplayView

setForegroundColor

public void setForegroundColor(java.awt.Color c)
Specified by:
setForegroundColor in interface DisplayView

setCursorColor

public void setCursorColor(java.awt.Color c)
Specified by:
setCursorColor in interface DisplayView

reverseColors

public void reverseColors()
Specified by:
reverseColors in interface DisplayView

doBell

public void doBell()
Specified by:
doBell in interface DisplayView

doBell

public void doBell(boolean visualBell)
Specified by:
doBell in interface DisplayView

getAWTComponent

public java.awt.Component getAWTComponent()
Specified by:
getAWTComponent in interface DisplayView

setIgnoreClose

public void setIgnoreClose()
Specified by:
setIgnoreClose in interface DisplayView

windowClosed

public void windowClosed()
Specified by:
windowClosed in interface DisplayView

mkButton

public java.awt.Component mkButton(java.lang.String label,
                                   java.lang.String cmd,
                                   java.awt.event.ActionListener listener)
Specified by:
mkButton in interface DisplayView