hicosim.components.frontend
Class MainWindow

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by hicosim.components.frontend.MainWindow
All Implemented Interfaces:
iListenerFrontend, IStatisticObserver, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class MainWindow
extends javax.swing.JFrame
implements iListenerFrontend, IStatisticObserver

Author:
Daniel Obermueller & Sebastian Minning
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
 
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
MainWindow(Engine engine, CommandProcessor cmdProcessor)
           
MainWindow(java.awt.GraphicsConfiguration arg0)
           
MainWindow(java.lang.String arg0)
           
MainWindow(java.lang.String arg0, java.awt.GraphicsConfiguration arg1)
           
 
Method Summary
 java.lang.String convertNumberIntoDecimalNumerative(java.lang.String value)
          This method converts numbers, passed as String-Object from several numeratives into the decimal numerative and returns them as String-Object.
 void deleteAllBr()
          This method deletes all breakpoints marks.
 void deleteBreakpointMarkAtDisassembledCode(int index)
          This method deletes a breakpoint mark from the JTextArea "jTextAreaDisassembledCode" the passed index, if it is in range, else it displays an error.
 void deleteBreakpointMarkAtSourceCode(int index)
          This method deletes a breakpoint mark from the JTextArea "jTextAreaSourceCode" the passed index, if it is in range, else it displays an error.
 void displayBreakpointAtAdress(java.lang.String text)
          This method displays the passed String-Object "text" in the JTextArea "jTextAreaBreakpointAtAdress".
 void displayBreakpointAtLabel(java.lang.String text)
          This method displays the passed String-Object "text" in the JTextArea "jTextAreaBreakpointAtLabel".
 void displayBreakpointAtLine(java.lang.String text)
          This method displays the passed String-Object "text" in the JTextArea "jTextAreaBreakpointAtLine".
 void displayConsoleError(java.lang.String message)
          This method displays an error message on the console, represented as a String-Object on the console jTextAreaConsole.
 void displayConsoleMessage(java.lang.String message)
          This method displays a message on the console, represented as a String-Object on the console jTextAreaConsole.
 void displayCpuConfiguration(java.util.HashMap<java.lang.String,java.lang.String> config)
          This method displays the passed HashMap "config", which represents the CPU configuration, in the jTable "jTableCpuConfiguration".
 void displayDisassembledCode(java.lang.String text)
          This method displays the String-Object "text" in the JTextArea "jTextAreaDisassembledCode".
 void displayInstructionPointer(int instructionPointer)
          This method displays the instruction pointer of the CPU in the jTable "jTableScalarCpuRegisterOverview".
 void displayScalarRegChanges(java.lang.Object valOfA, java.lang.Object valOfX, java.lang.Object valOfY)
          This method displays the passed Integer-Objects in the JTable "jTableScalarCpuRegisterOverview".
 void displaySingleValueOfVectorRegister(java.lang.Object value, int row, int column)
          This method displays a passed value of a specified vector register in the JTable "jTableVectorCpuRegisterOverview".
 void displaySourceCode(java.lang.String text)
          This method displays the String-Object "text" in the JTextArea "jTextAreaSourceCode".
 void displayStatusRegister(int carryBit, int zeroBit)
          This method displays the status registers of the CPU in the jTable "jTableScalarCpuRegisterOverview".
 void displayVectorRegChanges(int[][] regs)
          This method displays the passed Integer-Array, which contains the values of the vector registers, in the JTable "jTableVectorCpuRegisterOverview".
 void focusAtCommandline()
          This method requests and focuses the JTextField "JTextFieldCommandLine".
 void highlightLineOfDisassembledCode(int index)
          This method highlights a line of the JTextArea "jTextAreaDisassembledCode", which is specified by the passed Integer-Object "index".
 void highlightLineOfSourceCode(int index)
          This method highlights a line of the JTextArea "jTextAreaSourceCode", which is specified by the passed Integer-Object "index".
 void resetStats()
          resetStats - Resets the current stats.
 void setBreakpointMarkAtDisassembledCode(int index)
          This method sets a breakpoint mark at the JTextArea "jTextAreaDisassembledCode" at the passed index, if it is in range, else it displays an error.
 void setBreakpointMarkAtSourceCode(int index)
          This method sets a breakpoint mark at the JTextArea "jTextAreaSourceCode" at the passed index, if it is in range, else it displays an error.
 void setJTableVectorCpuRegisterOverviewSize(int rows, int columns)
          This method sets the size of the JTable "jTableVectorCpuRegisterOverview".
 void updateStatsObserver(java.lang.String comand, java.lang.String type)
          updateStatsComands - This method is invoked on every comand execution.
 
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, 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, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, 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, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, 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, getMousePosition, getMouseWheelListeners, getName, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

MainWindow

public MainWindow(Engine engine,
                  CommandProcessor cmdProcessor)
           throws java.awt.HeadlessException
Throws:
java.awt.HeadlessException

MainWindow

public MainWindow(java.awt.GraphicsConfiguration arg0)
Parameters:
arg0 -

MainWindow

public MainWindow(java.lang.String arg0)
           throws java.awt.HeadlessException
Parameters:
arg0 -
Throws:
java.awt.HeadlessException

MainWindow

public MainWindow(java.lang.String arg0,
                  java.awt.GraphicsConfiguration arg1)
Parameters:
arg0 -
arg1 -
Method Detail

displayBreakpointAtLabel

public void displayBreakpointAtLabel(java.lang.String text)
This method displays the passed String-Object "text" in the JTextArea "jTextAreaBreakpointAtLabel".

Specified by:
displayBreakpointAtLabel in interface iListenerFrontend
Parameters:
String - text

displayBreakpointAtLine

public void displayBreakpointAtLine(java.lang.String text)
This method displays the passed String-Object "text" in the JTextArea "jTextAreaBreakpointAtLine".

Specified by:
displayBreakpointAtLine in interface iListenerFrontend
Parameters:
String - text

setBreakpointMarkAtSourceCode

public void setBreakpointMarkAtSourceCode(int index)
This method sets a breakpoint mark at the JTextArea "jTextAreaSourceCode" at the passed index, if it is in range, else it displays an error.

Specified by:
setBreakpointMarkAtSourceCode in interface iListenerFrontend
Parameters:
int - index

deleteBreakpointMarkAtSourceCode

public void deleteBreakpointMarkAtSourceCode(int index)
This method deletes a breakpoint mark from the JTextArea "jTextAreaSourceCode" the passed index, if it is in range, else it displays an error.

Specified by:
deleteBreakpointMarkAtSourceCode in interface iListenerFrontend
Parameters:
int - index

setBreakpointMarkAtDisassembledCode

public void setBreakpointMarkAtDisassembledCode(int index)
This method sets a breakpoint mark at the JTextArea "jTextAreaDisassembledCode" at the passed index, if it is in range, else it displays an error.

Specified by:
setBreakpointMarkAtDisassembledCode in interface iListenerFrontend
Parameters:
int - index

deleteAllBr

public void deleteAllBr()
This method deletes all breakpoints marks.

Specified by:
deleteAllBr in interface iListenerFrontend

deleteBreakpointMarkAtDisassembledCode

public void deleteBreakpointMarkAtDisassembledCode(int index)
This method deletes a breakpoint mark from the JTextArea "jTextAreaDisassembledCode" the passed index, if it is in range, else it displays an error.

Specified by:
deleteBreakpointMarkAtDisassembledCode in interface iListenerFrontend
Parameters:
int - index

highlightLineOfSourceCode

public void highlightLineOfSourceCode(int index)
This method highlights a line of the JTextArea "jTextAreaSourceCode", which is specified by the passed Integer-Object "index".

Specified by:
highlightLineOfSourceCode in interface iListenerFrontend
Parameters:
int - index

highlightLineOfDisassembledCode

public void highlightLineOfDisassembledCode(int index)
This method highlights a line of the JTextArea "jTextAreaDisassembledCode", which is specified by the passed Integer-Object "index".

Specified by:
highlightLineOfDisassembledCode in interface iListenerFrontend
Parameters:
int - index

displayBreakpointAtAdress

public void displayBreakpointAtAdress(java.lang.String text)
This method displays the passed String-Object "text" in the JTextArea "jTextAreaBreakpointAtAdress".

Specified by:
displayBreakpointAtAdress in interface iListenerFrontend
Parameters:
String - text

displayStatusRegister

public void displayStatusRegister(int carryBit,
                                  int zeroBit)
This method displays the status registers of the CPU in the jTable "jTableScalarCpuRegisterOverview".

Specified by:
displayStatusRegister in interface iListenerFrontend
Parameters:
int - carryBit
int - zeroBit

displayInstructionPointer

public void displayInstructionPointer(int instructionPointer)
This method displays the instruction pointer of the CPU in the jTable "jTableScalarCpuRegisterOverview".

Specified by:
displayInstructionPointer in interface iListenerFrontend
Parameters:
int - instructionPointer

setJTableVectorCpuRegisterOverviewSize

public void setJTableVectorCpuRegisterOverviewSize(int rows,
                                                   int columns)
This method sets the size of the JTable "jTableVectorCpuRegisterOverview".

Specified by:
setJTableVectorCpuRegisterOverviewSize in interface iListenerFrontend
Parameters:
int - rows
int - columns

displaySingleValueOfVectorRegister

public void displaySingleValueOfVectorRegister(java.lang.Object value,
                                               int row,
                                               int column)
This method displays a passed value of a specified vector register in the JTable "jTableVectorCpuRegisterOverview".

Specified by:
displaySingleValueOfVectorRegister in interface iListenerFrontend
Parameters:
Object - value

displayCpuConfiguration

public void displayCpuConfiguration(java.util.HashMap<java.lang.String,java.lang.String> config)
This method displays the passed HashMap "config", which represents the CPU configuration, in the jTable "jTableCpuConfiguration".

Specified by:
displayCpuConfiguration in interface iListenerFrontend
Parameters:
HashMap - config

displayConsoleMessage

public void displayConsoleMessage(java.lang.String message)
This method displays a message on the console, represented as a String-Object on the console jTextAreaConsole.

Specified by:
displayConsoleMessage in interface iListenerFrontend
Parameters:
String - message

displayConsoleError

public void displayConsoleError(java.lang.String message)
This method displays an error message on the console, represented as a String-Object on the console jTextAreaConsole.

Specified by:
displayConsoleError in interface iListenerFrontend
Parameters:
String - message

convertNumberIntoDecimalNumerative

public java.lang.String convertNumberIntoDecimalNumerative(java.lang.String value)
                                                    throws java.lang.NumberFormatException
This method converts numbers, passed as String-Object from several numeratives into the decimal numerative and returns them as String-Object. If an unknown numerative or an invalid input was verified the method throws a NumberFormatException.

Parameters:
String - value
Returns:
String
Throws:
java.lang.NumberFormatException

focusAtCommandline

public void focusAtCommandline()
This method requests and focuses the JTextField "JTextFieldCommandLine".

Specified by:
focusAtCommandline in interface iListenerFrontend

displaySourceCode

public void displaySourceCode(java.lang.String text)
This method displays the String-Object "text" in the JTextArea "jTextAreaSourceCode".

Specified by:
displaySourceCode in interface iListenerFrontend
Parameters:
String - text

displayDisassembledCode

public void displayDisassembledCode(java.lang.String text)
This method displays the String-Object "text" in the JTextArea "jTextAreaDisassembledCode". *

Specified by:
displayDisassembledCode in interface iListenerFrontend
Parameters:
String - text

displayScalarRegChanges

public void displayScalarRegChanges(java.lang.Object valOfA,
                                    java.lang.Object valOfX,
                                    java.lang.Object valOfY)
This method displays the passed Integer-Objects in the JTable "jTableScalarCpuRegisterOverview".

Specified by:
displayScalarRegChanges in interface iListenerFrontend
Parameters:
int - valOfA
int - valOfX
int - valOfY

displayVectorRegChanges

public void displayVectorRegChanges(int[][] regs)
This method displays the passed Integer-Array, which contains the values of the vector registers, in the JTable "jTableVectorCpuRegisterOverview".

Specified by:
displayVectorRegChanges in interface iListenerFrontend
Parameters:
int[][] - regs

updateStatsObserver

public void updateStatsObserver(java.lang.String comand,
                                java.lang.String type)
Description copied from interface: IStatisticObserver
updateStatsComands - This method is invoked on every comand execution. The observers will only get the current executed comand as a String, so the implementation and the view must be done by the observers.

Specified by:
updateStatsObserver in interface IStatisticObserver
Parameters:
comand - (String, e.g. "ADD")
type - (String, e.g. "SKALARALU")

resetStats

public void resetStats()
Description copied from interface: IStatisticObserver
resetStats - Resets the current stats. Method is invoked on resetting the processor. Previously the statistics are set to zero (types) or the whole map is deleted (comands). Within the resetStats-method every observer has to ensure that the representation is also updated.

Specified by:
resetStats in interface IStatisticObserver