hades.gui
Class StimuliEditorCanvas

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended byhades.gui.StimuliEditorCanvas
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.KeyListener, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public class StimuliEditorCanvas
extends java.awt.Canvas
implements java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

StimuliEditorCanvas - display and edit simulation stimuli.

This class provides a simple editor for simulation stimuli in the IEEE std_logic_1164 logic model realized by values of class hades.models.StdLogic1164. The canvas manages and displays a user-specified number of separate outputs, one output per row. Each row consists of a user-specified number of time steps, with one StdLogic1164 value per output per time-step.

See the (minimal) external documentation provided in /hades/doc/help/StimuliEditor.txt for the list of mouse and key commands recognized by StimuliEditor.

StimuliEditorCanvas is not resizable. The correct size is calculated during GUI construction based on the selected text font and the number of visible rows and time steps. The dimension is updated by calling setTextFont() followed by an invalidate()/layout().

Optionally, the StimuliEditorCanvas may be used together with an external Scrollbar to manage scrolling through the stimuli data when the total number of time steps is larger than the number of visible time steps. Just register the Scrollbar by calling setScroller().

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
(package private) static java.awt.Color[] _colorTable
           
(package private) static java.awt.Color _darkBlue
           
protected  java.util.Hashtable actionListenerTable
           
protected  java.lang.String[] addrCache
           
protected  java.awt.Color backgroundColor
           
protected  int baseline
           
protected  int border_height
           
protected  int border_width
           
protected  int char_height
           
protected  int char_width
           
protected  java.awt.Point currentMousePosition
           
protected  int cursor_x
           
protected  int cursor_y
           
protected  java.awt.Color cursorColor
           
protected  java.lang.String[] dataCache
           
protected  java.awt.Color dataColor
           
static boolean debug
           
protected  java.awt.Point dragStartPosition
           
protected  int dx_data
           
protected  int end_address
           
protected  int height
           
protected  int lastDragCycle
           
protected  int n_chars
           
protected  int n_chars_per_addr
           
protected  int n_chars_per_cycle
           
protected  int n_columns
           
protected  int n_cursor
           
protected  int n_cycles
           
protected  int n_cycles_per_row
           
protected  int n_outputs
           
protected  int n_rows
           
protected  java.awt.Image offscreenBuffer
           
protected  java.awt.Graphics offscreenGraphics
           
protected  int readHighlightAddress
           
protected  java.awt.Color readHighlightColor
           
protected  java.awt.Point regionEndPoint
           
protected  java.awt.Point regionStartPoint
           
protected  java.awt.Scrollbar scroller
           
protected  java.awt.Color signalNameColor
           
protected  int start_cycle
           
protected  Stimulus stimulus
           
protected  java.awt.Font textFont
           
protected  java.awt.Color timeColor
           
protected  int value
           
protected  int width
           
protected  int writeHighlightAddress
           
protected  java.awt.Color writeHighlightColor
           
protected  int x0_addr
           
protected  int x0_data
           
protected  int x0_time
           
protected  int y0_addr
           
protected  int y0_data
           
protected  int y0_time
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
StimuliEditorCanvas(Stimulus stimulus, int n_cycles_per_row)
           
 
Method Summary
 void addActionListener(java.awt.event.ActionListener AL)
           
 void backSpace()
           
 void blitOffscreenBuffer(java.awt.Graphics g)
           
 void changeDataAtMousePosition(char c)
          insert char c at the current cursor postion, then move the cursor to the right.
 int clip(int currentValue, int minValue, int maxValue)
           
protected  void createOffscreenBuffer()
           
 void decrementValue()
           
 void deleteDataAtCursor()
           
 void editStartAddress(char c)
           
 java.awt.Color getAddrColor()
           
 java.awt.Color getBackground()
           
 int getCursorAddrIndex()
           
 int getCursorCycle()
           
 int getCursorRow()
           
protected  int getCursorX(int mouse_x)
           
protected  int getCursorY(int mouse_y)
           
 int getCycleFromCursorPosition()
           
 java.awt.Color getDataColor()
           
 java.awt.Color getDataColor1164(int value)
           
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
 java.awt.Color getReadHightlightColor()
           
 int getRelativeDataCursor()
          this method returns the relative cursor position for the data value value nearest to the cursor.
 java.awt.Font getTextFont()
           
 java.awt.Color getTimeColor()
           
 java.awt.Color getWriteHightlightColor()
           
 void incrementValue()
           
 void incrementValueAll1164()
           
 void insertDataAtCursor()
           
 boolean isCursorInAddrArea()
           
 boolean isCursorInDataArea()
          the cursor is always in the data area...
 boolean isDataVisibleAtAddress(int addr)
           
static boolean isHexDigit(char c)
           
 void keyPressed(java.awt.event.KeyEvent ke)
           
 void keyReleased(java.awt.event.KeyEvent ke)
           
 void keyTyped(java.awt.event.KeyEvent ke)
           
static void main(java.lang.String[] argv)
           
 void makeDataVisibleAtAddress(int addr)
           
 void mouseClicked(java.awt.event.MouseEvent me)
           
 void mouseDragged(java.awt.event.MouseEvent me)
           
 void mouseEntered(java.awt.event.MouseEvent me)
           
 void mouseExited(java.awt.event.MouseEvent me)
           
 void mouseMoved(java.awt.event.MouseEvent me)
           
 void mousePressed(java.awt.event.MouseEvent me)
          mousePressed: On the first mouse click at a position, we simply position the cursor to the corresponding output and cycle, but don't modify the data value at (output,cycle) On the second and subsequent clicks at the same position, we toggle through the values X-0-1 On the second and subsequent clicks with the SHIFT-key held down, we toggle through the full StdLogic1164 values, U-X-0-1-Z-L-H-W-D When dragging the mouse, the data value at the drag start position is copied onto all intermediate cycle covered by the mouse drag.
 void mouseReleased(java.awt.event.MouseEvent me)
           
 void moveCursorDown()
           
 void moveCursorLeft()
          move the cursor left, and scroll left if necessary (and possible)
 void moveCursorRight()
          move the cursor right, and scroll right if necessary (and possible)
 void moveCursorTo(int x, int y)
           
 void moveCursorToDataAtAddr(int addr)
           
 void moveCursorUp()
           
 void moveEnd()
           
 void moveHome()
           
 void moveLineDown()
           
 void moveLineUp()
           
 void movePageDown()
           
 void movePageUp()
           
 void moveTabNext()
           
 void moveTabPrev()
           
 void moveToCycle(int start)
           
 void moveToCycle(int start, boolean notify)
           
static void msg(java.lang.String msg)
           
protected  void notifyListeners(int addr, long value)
           
 void notifyScroller()
           
 java.lang.String padToWidth(java.lang.String s, int maxWidth)
           
 void paint(java.awt.Graphics systemGraphics)
          paint: a text-based waveform display for the stimuli data.
 void paintAllData(java.awt.Graphics g)
           
 void paintBackgroundAndBorder(java.awt.Graphics g)
           
 void paintCursor(java.awt.Graphics g)
           
 void paintHighlighting(java.awt.Graphics g)
           
 void paintSignalNames(java.awt.Graphics g)
           
 void paintStringAtAddr(java.awt.Graphics g, int addr, java.lang.String s)
           
 void paintTimeScale(java.awt.Graphics g)
           
protected  void prepareGUI()
           
 void removeActionListener(java.awt.event.ActionListener AL)
           
 void setAddrColor(java.awt.Color c)
           
 void setBackground(java.awt.Color c)
           
 void setCursor(int x, int y)
           
 void setCursorColor(java.awt.Color c)
           
 void setCursorFromMousePosition(java.awt.event.MouseEvent me)
           
 void setDataColor(java.awt.Color c)
           
 void setDigitAtMousePosition(char c)
           
 void setReadHighlightColor(java.awt.Color c)
           
 void setRegionEndPoint(int cycle, int row)
           
 void setRegionStartPoint(int cycle, int row)
           
 void setScroller(java.awt.Scrollbar scroller)
           
 void setTextFont(java.awt.Font f)
           
 void setTimeColor(java.awt.Color c)
           
 void setWriteHighlightColor(java.awt.Color c)
           
 void update(java.awt.Graphics g)
           
 void updateLimits()
           
 
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, 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, getMaximumSize, 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, isFocusTraversable, 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, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, 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
 

Field Detail

debug

public static boolean debug

stimulus

protected Stimulus stimulus

n_cycles

protected int n_cycles

n_outputs

protected int n_outputs

addrCache

protected java.lang.String[] addrCache

dataCache

protected java.lang.String[] dataCache

actionListenerTable

protected java.util.Hashtable actionListenerTable

textFont

protected java.awt.Font textFont

backgroundColor

protected java.awt.Color backgroundColor

dataColor

protected java.awt.Color dataColor

signalNameColor

protected java.awt.Color signalNameColor

timeColor

protected java.awt.Color timeColor

readHighlightColor

protected java.awt.Color readHighlightColor

writeHighlightColor

protected java.awt.Color writeHighlightColor

cursorColor

protected java.awt.Color cursorColor

offscreenBuffer

protected java.awt.Image offscreenBuffer

offscreenGraphics

protected java.awt.Graphics offscreenGraphics

scroller

protected java.awt.Scrollbar scroller

n_columns

protected int n_columns

n_rows

protected int n_rows

n_cycles_per_row

protected int n_cycles_per_row

n_chars_per_cycle

protected int n_chars_per_cycle

n_chars_per_addr

protected int n_chars_per_addr

char_width

protected int char_width

char_height

protected int char_height

baseline

protected int baseline

x0_addr

protected int x0_addr

x0_data

protected int x0_data

y0_addr

protected int y0_addr

y0_data

protected int y0_data

dx_data

protected int dx_data

x0_time

protected int x0_time

y0_time

protected int y0_time

border_width

protected int border_width

border_height

protected int border_height

width

protected int width

height

protected int height

start_cycle

protected int start_cycle

end_address

protected int end_address

cursor_x

protected int cursor_x

cursor_y

protected int cursor_y

n_cursor

protected int n_cursor

n_chars

protected int n_chars

value

protected int value

dragStartPosition

protected java.awt.Point dragStartPosition

currentMousePosition

protected java.awt.Point currentMousePosition

lastDragCycle

protected int lastDragCycle

regionStartPoint

protected java.awt.Point regionStartPoint

regionEndPoint

protected java.awt.Point regionEndPoint

readHighlightAddress

protected int readHighlightAddress

writeHighlightAddress

protected int writeHighlightAddress

_colorTable

static java.awt.Color[] _colorTable

_darkBlue

static java.awt.Color _darkBlue
Constructor Detail

StimuliEditorCanvas

public StimuliEditorCanvas(Stimulus stimulus,
                           int n_cycles_per_row)
Method Detail

updateLimits

public void updateLimits()

setBackground

public void setBackground(java.awt.Color c)

setDataColor

public void setDataColor(java.awt.Color c)

setTimeColor

public void setTimeColor(java.awt.Color c)

setAddrColor

public void setAddrColor(java.awt.Color c)

setReadHighlightColor

public void setReadHighlightColor(java.awt.Color c)

setWriteHighlightColor

public void setWriteHighlightColor(java.awt.Color c)

setCursorColor

public void setCursorColor(java.awt.Color c)

getBackground

public java.awt.Color getBackground()

getTimeColor

public java.awt.Color getTimeColor()

getDataColor

public java.awt.Color getDataColor()

getDataColor1164

public java.awt.Color getDataColor1164(int value)

getAddrColor

public java.awt.Color getAddrColor()

getReadHightlightColor

public java.awt.Color getReadHightlightColor()

getWriteHightlightColor

public java.awt.Color getWriteHightlightColor()

notifyListeners

protected void notifyListeners(int addr,
                               long value)

addActionListener

public void addActionListener(java.awt.event.ActionListener AL)

removeActionListener

public void removeActionListener(java.awt.event.ActionListener AL)

prepareGUI

protected void prepareGUI()

getTextFont

public java.awt.Font getTextFont()

setTextFont

public void setTextFont(java.awt.Font f)

createOffscreenBuffer

protected void createOffscreenBuffer()

blitOffscreenBuffer

public void blitOffscreenBuffer(java.awt.Graphics g)

paintBackgroundAndBorder

public void paintBackgroundAndBorder(java.awt.Graphics g)

paintSignalNames

public void paintSignalNames(java.awt.Graphics g)

paintTimeScale

public void paintTimeScale(java.awt.Graphics g)

paintAllData

public void paintAllData(java.awt.Graphics g)

paintStringAtAddr

public void paintStringAtAddr(java.awt.Graphics g,
                              int addr,
                              java.lang.String s)

paintHighlighting

public void paintHighlighting(java.awt.Graphics g)

paintCursor

public void paintCursor(java.awt.Graphics g)

update

public void update(java.awt.Graphics g)

paint

public void paint(java.awt.Graphics systemGraphics)
paint: a text-based waveform display for the stimuli data.


padToWidth

public java.lang.String padToWidth(java.lang.String s,
                                   int maxWidth)

getMinimumSize

public java.awt.Dimension getMinimumSize()

getPreferredSize

public java.awt.Dimension getPreferredSize()

setCursor

public void setCursor(int x,
                      int y)

getCursorRow

public int getCursorRow()

getCursorCycle

public int getCursorCycle()

getCursorX

protected int getCursorX(int mouse_x)

getCursorY

protected int getCursorY(int mouse_y)

setCursorFromMousePosition

public void setCursorFromMousePosition(java.awt.event.MouseEvent me)

getCycleFromCursorPosition

public int getCycleFromCursorPosition()

setRegionStartPoint

public void setRegionStartPoint(int cycle,
                                int row)

setRegionEndPoint

public void setRegionEndPoint(int cycle,
                              int row)

isCursorInDataArea

public boolean isCursorInDataArea()
the cursor is always in the data area...


isCursorInAddrArea

public boolean isCursorInAddrArea()

isDataVisibleAtAddress

public boolean isDataVisibleAtAddress(int addr)

makeDataVisibleAtAddress

public void makeDataVisibleAtAddress(int addr)

getRelativeDataCursor

public int getRelativeDataCursor()
this method returns the relative cursor position for the data value value nearest to the cursor.


getCursorAddrIndex

public int getCursorAddrIndex()

clip

public int clip(int currentValue,
                int minValue,
                int maxValue)

insertDataAtCursor

public void insertDataAtCursor()

deleteDataAtCursor

public void deleteDataAtCursor()

backSpace

public void backSpace()

moveCursorTo

public void moveCursorTo(int x,
                         int y)

moveCursorRight

public void moveCursorRight()
move the cursor right, and scroll right if necessary (and possible)


moveCursorLeft

public void moveCursorLeft()
move the cursor left, and scroll left if necessary (and possible)


moveCursorUp

public void moveCursorUp()

moveCursorDown

public void moveCursorDown()

movePageUp

public void movePageUp()

movePageDown

public void movePageDown()

moveLineUp

public void moveLineUp()

moveLineDown

public void moveLineDown()

moveHome

public void moveHome()

moveEnd

public void moveEnd()

moveToCycle

public void moveToCycle(int start)

moveToCycle

public void moveToCycle(int start,
                        boolean notify)

moveCursorToDataAtAddr

public void moveCursorToDataAtAddr(int addr)

moveTabNext

public void moveTabNext()

moveTabPrev

public void moveTabPrev()

notifyScroller

public void notifyScroller()

setScroller

public void setScroller(java.awt.Scrollbar scroller)

incrementValue

public void incrementValue()

incrementValueAll1164

public void incrementValueAll1164()

decrementValue

public void decrementValue()

setDigitAtMousePosition

public void setDigitAtMousePosition(char c)

editStartAddress

public void editStartAddress(char c)

changeDataAtMousePosition

public void changeDataAtMousePosition(char c)
insert char c at the current cursor postion, then move the cursor to the right. If the cursor is at the rightmost position, we begin to shift the current value to the left.

If the cursor is in the address field instead of the data field, we jump to the corresponding address (that is, display the corres- ponding area of the memory).


isHexDigit

public static boolean isHexDigit(char c)

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
mousePressed:

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

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

mouseClicked

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

mouseExited

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

mouseEntered

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

mouseMoved

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

mouseDragged

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

keyPressed

public void keyPressed(java.awt.event.KeyEvent ke)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent ke)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent ke)
Specified by:
keyTyped in interface java.awt.event.KeyListener

msg

public static void msg(java.lang.String msg)

main

public static void main(java.lang.String[] argv)