jfrace.view
Class AddressBankViewer

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--jfrace.view.AddressBankViewer
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable

public class AddressBankViewer
extends java.awt.Canvas
implements java.lang.Runnable

A class visualizing the addressable units (i.e. cells) of an AddressSpace.

The cells are squares arrange in a square (if possible) with the first cell in the upper left corner and the last cell in the lower right corner.

Each cell is shown by small squares (minimum size: one pixel). Inactive cells are shown in light gray. If the activity of a cell is set (by the method setActivity) the color will be changed to a color coding the type of activity: Red for reading program statements, green for reading data, and blue for writing data. This color will decay in a few seconds.

If one moves the mouse pointer over a cell its address, its value, and the values of the three following cells are shown as hex numbers. If one clicks on a cell all registrated ActionListeners will be informed. The address of the cell will be stored in the event ID.

Author:
Franz-Josef ELmer
See Also:
AddressSpace, Serialized Form

Inner classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static int READ_DATA
          Type: Reading data
static int READ_PRG
          Type: Reading program
static int WRITE_DATA
          Type: Writing data
 
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
AddressBankViewer(AddressSpace anAddressSpace, int aFirstAddress, int aSize, int aCellSize)
          Create an instance for the given AddressSpace and starts the animation thread.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener al)
          Subscribe an action listener who is interested in receiving ActionEvents.
 void paint(java.awt.Graphics g)
           
 java.awt.Dimension preferredSize()
           
 void removeActionListener(java.awt.event.ActionListener al)
          Unsubscribe an action listener who is no longer interested in receiving ActionEvents.
 void run()
           
 void setActivity(int address, int type)
          Set the activity type of at a given address.
 void update(java.awt.Graphics g)
           
 
Methods inherited from class java.awt.Canvas
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, 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, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

READ_PRG

public static final int READ_PRG
Type: Reading program

READ_DATA

public static final int READ_DATA
Type: Reading data

WRITE_DATA

public static final int WRITE_DATA
Type: Writing data
Constructor Detail

AddressBankViewer

public AddressBankViewer(AddressSpace anAddressSpace,
                         int aFirstAddress,
                         int aSize,
                         int aCellSize)
Create an instance for the given AddressSpace and starts the animation thread.
Parameters:
anAddressSpace - The address space to be visualized.
aFirstAddress - The first address to be visualized.
aSize - The number of cells to be visualized.
aCellSize - The cell size in pixel
Method Detail

preferredSize

public java.awt.Dimension preferredSize()
Overrides:
preferredSize in class java.awt.Component

addActionListener

public void addActionListener(java.awt.event.ActionListener al)
Subscribe an action listener who is interested in receiving ActionEvents. Does nothing if the given action listener is already in the subscriber list.

removeActionListener

public void removeActionListener(java.awt.event.ActionListener al)
Unsubscribe an action listener who is no longer interested in receiving ActionEvents. Does nothing if the given action listener is not in the subscriber list.

setActivity

public void setActivity(int address,
                        int type)
Set the activity type of at a given address.
Parameters:
address - Address of the cell.
type - Type of activity. Possible values are READ_PRG, READ_DATA, and WRITE_DATA.

update

public void update(java.awt.Graphics g)
Overrides:
update in class java.awt.Component

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Canvas

run

public void run()
Specified by:
run in interface java.lang.Runnable