|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Window | +--java.awt.Frame | +--javax.swing.JFrame | +--mars.tools.AbstractMarsToolAndApplication
An abstract class that provides generic components to facilitate implementation of a MarsTool and/or stand-alone Mars-based application. Provides default definitions of both the action() method required to implement MarsTool and the go() method conventionally used to launch a Mars-based stand-alone application. It also provides generic definitions for interactively controlling the application. The generic controls for MarsTools are 3 buttons: connect/disconnect to MIPS resource (memory and/or registers), reset, and close (exit). The generic controls for stand-alone Mars apps include: button that triggers a file open dialog, a text field to display status messages, the run-speed slider to control execution rate when running a MIPS program, a button that assembles and runs the current MIPS program, a button to interrupt the running MIPS program, a reset button, and an exit button. Pete Sanderson, 14 November 2006.
Nested Class Summary | |
protected class |
AbstractMarsToolAndApplication.ConnectButton
|
protected class |
AbstractMarsToolAndApplication.EnterKeyListener
|
Field Summary | |
protected AbstractMarsToolAndApplication.ConnectButton |
connectButton
|
protected boolean |
isBeingUsedAsAMarsTool
|
protected java.awt.Window |
theWindow
|
protected AbstractMarsToolAndApplication |
thisMarsApp
|
Fields inherited from class javax.swing.JFrame |
accessibleContext, EXIT_ON_CLOSE, 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.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
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 | |
protected |
AbstractMarsToolAndApplication(java.lang.String title,
java.lang.String heading)
Simple constructor |
Method Summary | |
void |
action()
Required MarsTool method to carry out Tool functions. |
protected void |
addAsObserver()
Add this app/tool as an Observer of desired MIPS Observables (memory and registers). |
protected void |
addAsObserver(int lowEnd,
int highEnd)
Add this app/tool as an Observer of the specified subrange of MIPS memory. |
protected void |
addAsObserver(Register reg)
Add this app/tool as an Observer of the specified MIPS register. |
protected javax.swing.JComponent |
buildButtonAreaMarsTool()
The MarsTool default set of controls has one row of 3 buttons. |
protected javax.swing.JComponent |
buildButtonAreaStandAlone()
The Mars stand-alone app default set of controls has two rows of controls. |
protected javax.swing.JComponent |
buildHeadingArea()
Constructs GUI header as label with default positioning and font. |
protected abstract javax.swing.JComponent |
buildMainDisplayArea()
Abstract method that must be instantiated by subclass to build the main display area of the GUI. |
protected void |
deleteAsObserver()
Delete this app/tool as an Observer of MIPS Observables (memory and registers). |
protected void |
deleteAsObserver(Register reg)
Delete this app/tool as an Observer of the specified MIPS register |
protected javax.swing.JComponent |
getHelpComponent()
Override this method to provide a JComponent (probably a JButton) of your choice to be placed just left of the Close/Exit button. |
abstract java.lang.String |
getName()
Required MarsTool method to return Tool name. |
void |
go()
Run the simulator as stand-alone application. |
protected void |
initializePostGUI()
Method that will be called once just after the GUI is constructed in the go() and action() methods. |
protected void |
initializePreGUI()
Method that will be called once just before the GUI is constructed in the go() and action() methods. |
protected boolean |
isObserving()
Query method to let you know if the tool/app is (or could be) currently "observing" any MIPS resources. |
protected void |
performSpecialClosingDuties()
This method is called when tool/app is exited either through the close/exit button or the window's X box. |
protected void |
processMIPSUpdate(java.util.Observable resource,
AccessNotice notice)
Override this method to process a received notice from MIPS Observable (memory or register) It will only be called if the notice was generated as the result of MIPS instruction execution. |
protected void |
reset()
Method that will be called each time the default Reset button is clicked. |
void |
update(java.util.Observable resource,
java.lang.Object accessNotice)
Called when receiving notice of access to MIPS memory or registers. |
protected void |
updateDisplay()
Override this method to implement updating of GUI after each MIPS instruction is executed, while running in "timed" mode (user specifies execution speed on the slider control). |
Methods inherited from class javax.swing.JFrame |
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.awt.Frame |
addNotify, 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.awt.Window |
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle |
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 |
protected boolean isBeingUsedAsAMarsTool
protected AbstractMarsToolAndApplication thisMarsApp
protected java.awt.Window theWindow
protected AbstractMarsToolAndApplication.ConnectButton connectButton
Constructor Detail |
protected AbstractMarsToolAndApplication(java.lang.String title, java.lang.String heading)
title
- String containing title bar textMethod Detail |
public abstract java.lang.String getName()
getName
in interface MarsTool
getName
in class java.awt.Component
protected abstract javax.swing.JComponent buildMainDisplayArea()
public void go()
public void action()
action
in interface MarsTool
protected void initializePreGUI()
protected void initializePostGUI()
protected void reset()
protected javax.swing.JComponent buildHeadingArea()
protected javax.swing.JComponent buildButtonAreaMarsTool()
protected javax.swing.JComponent buildButtonAreaStandAlone()
public void update(java.util.Observable resource, java.lang.Object accessNotice)
update
in interface java.util.Observer
resource
- the attached MIPS resourceaccessNotice
- AccessNotice information provided by the resourceprotected void processMIPSUpdate(java.util.Observable resource, AccessNotice notice)
protected void performSpecialClosingDuties()
protected void addAsObserver()
protected void addAsObserver(int lowEnd, int highEnd)
lowEnd
- low end of memory address range.highEnd
- high end of memory address range; must be >= lowEndprotected void addAsObserver(Register reg)
protected void deleteAsObserver()
protected void deleteAsObserver(Register reg)
protected boolean isObserving()
protected void updateDisplay()
protected javax.swing.JComponent getHelpComponent()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |