fi.hu.cs.titokone
Class GUI

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended byfi.hu.cs.titokone.GUI
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

public class GUI
extends javax.swing.JFrame
implements java.awt.event.ActionListener

Class GUI is namely the class that implements the Graphical User Interface. It uses methods in GUIBrain to fire certain actions, such as compiling and running the programs. If GUIBrain wants to inform GUI about something, like new register values or about a new symbol in symbol table, then an Event of some kind if fired. Various ActionListeners are added here to catch those events. This GUI has three views hardcoded, one for the state when no file has been opened, one for the state when a symbolic code file has been opened and one one for the state when a binary code file has been opened. The view can be changed with setView(int) method and once it is launched, the GUI's view is changed into the selected view's basic state. A basic state for a view means which of the buttons are enabled and which of the menuselections are enabled for a certain view.

See Also:
Serialized Form

Nested Class Summary
private  class GUI.SetMemSizeActionListener
           
 
Nested classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
(package private)  javax.swing.JMenuItem about
           
private  java.awt.event.ActionListener aboutActionListener
           
private  GUIHTMLDialog aboutDialog
           
private  int activeView
           
(package private)  Animator animator
           
static int ANIMATOR_SPEED_MAX
           
static int ANIMATOR_SPEED_MIN
           
(package private)  javax.swing.JButton animatorContinueButton
           
(package private)  javax.swing.JFrame animatorFrame
           
(package private)  javax.swing.JSlider animatorSpeedSlider
           
private  javax.swing.filechooser.FileFilter B91FileFilter
           
private  javax.swing.border.Border blacklined
           
private static int cellMargin
           
private  javax.swing.filechooser.FileFilter classFileFilter
           
static short CODE_TABLE
          Code table - used in centerToLine(), selectRow() and setGUIView() methods
static short CODE_TABLE_EDITING
           
(package private)  JTableX codeTable
          This table is used to visualize the K91 source code.
(package private)  java.lang.Object[] codeTableIdentifiers
           
(package private)  javax.swing.JScrollPane codeTableScrollPane
          This holds (@link codeTable codeTable).
private static int COMMENT_LIST_SIZE
           
(package private)  javax.swing.JList commentList
          The comments are shown here.
(package private)  javax.swing.JScrollPane commentListScrollPane
          This holds (@link commentList commentList).
static short COMPILE_COMMAND
           
(package private)  javax.swing.JButton compileButton
           
private  java.awt.event.ActionListener compileCommandActionListener
           
(package private)  javax.swing.JMenuItem compileMenuItem
           
(package private)  javax.swing.JMenu configureFileSystem
           
static short CONTINUE_COMMAND
           
static short CONTINUE_WITHOUT_PAUSES_COMMAND
           
(package private)  javax.swing.JButton continueButton
           
private  java.awt.event.ActionListener continueCommandActionListener
           
(package private)  javax.swing.JMenuItem continueMenuItem
           
(package private)  javax.swing.JButton continueToEndButton
           
private  java.awt.event.ActionListener continueToEndCommandActionListener
           
(package private)  javax.swing.JMenuItem continueToEndMenuItem
           
(package private)  javax.swing.JSplitPane dataAndInstructionsTableSplitPane
          This holds (@link instructionsTableScrollPane instructionsTableScrollPane) and (@link dataTableScrollPane dataTableScrollPane).
(package private)  JTableX dataTable
          This table is used to visualize the data side of Titokone's memory by showing its numeric contents and their symbolic equivalencies.
(package private)  java.lang.Object[] dataTableIdentifiers
           
(package private)  javax.swing.JPopupMenu dataTablePopupMenu
           
(package private)  javax.swing.JScrollPane dataTableScrollPane
          This holds (@link dataTable dataTable).
(package private)  javax.swing.JButton enterNumberButton
          This sends the number to GUIBrain, which checks if it's valid and then sends it to Titokone.
private  java.awt.event.ActionListener enterNumberButtonActionListener
           
(package private)  javax.swing.JLabel enterNumberLabel
          This is used to show for example errors, when an invalid number is given etc.
(package private)  javax.swing.JMenuItem eraseMem
           
private  java.awt.event.ActionListener eraseMemoryActionListener
           
(package private)  javax.swing.JMenu fileMenu
           
static short FP
           
private  javax.swing.JFileChooser generalFileDialog
           
(package private)  GUIBrain guibrain
           
(package private)  javax.swing.JMenu helpMenu
           
static short INPUT_FIELD
           
(package private)  javax.swing.JTextField inputField
          The number that will be sent to Titokone as KBD data is given here.
(package private)  javax.swing.JPanel inputPanel
          This holds (@link enterNumberLabel enterNumberLabel), (@link inputField inputField) and (@link enterNumberButton enterNumberButton).
static short INSTRUCTIONS_AND_DATA_TABLE
          Instructions and data table - used in centerToLine(), selectRow() and setGUIView() methods
(package private)  JTableX instructionsTable
          This table is used to visualize the instructions side of Titokone's memory by showing its numeric contents and their symbolic equivalencies.
(package private)  java.lang.Object[] instructionsTableIdentifiers
           
(package private)  javax.swing.JScrollPane instructionsTableScrollPane
          This holds (@link instructionsTable instructionsTable)
(package private)  javax.swing.JPanel ioPanel
          This holds (@link inputPanel) and (@link outputPanel).
private  javax.swing.filechooser.FileFilter K91FileFilter
           
(package private)  javax.swing.JPanel leftPanel
          What this holds, depends on the view of this gui.
(package private)  javax.swing.JToggleButton lineByLineToggleButton
           
private static int lineColumnSize
           
private  java.util.logging.Logger logger
           
(package private)  javax.swing.JSplitPane mainSplitPane
          This holds (@link rightSplitPane rightSplitPane) and (@link leftPane leftPane).
(package private)  javax.swing.JMenuItem manual
           
private  java.awt.event.ActionListener manualActionListener
           
private  GUIHTMLDialog manualDialog
           
static short NONE
          No table - used in setGUIView() method
private static int numericValueColumnSize
           
static short OPEN_FILE_COMMAND
           
private  java.awt.event.ActionListener openCommandActionListener
           
(package private)  javax.swing.JMenuItem openFile
           
(package private)  javax.swing.JButton openFileButton
           
static short OPTION_COMPILING_COMMENTED
          commented compiling - used in setSelected() method
static short OPTION_COMPILING_PAUSED
          paused compiling - used in setSelected() method
static short OPTION_RUNNING_ANIMATED
          animated running - used in setSelected() method
static short OPTION_RUNNING_COMMENTED
          commented running - used in setSelected() method
static short OPTION_RUNNING_PAUSED
          paused running - used in setSelected() method
(package private)  javax.swing.JMenu optionsMenu
           
(package private)  javax.swing.JPanel outputPanel
          This holds (@link outputScrollPane).
(package private)  javax.swing.JScrollPane outputScrollPane
          This holds (@link outputTextArea).
(package private)  javax.swing.JTextArea outputTextArea
          This text area is used to visualize the output data that Titokone sends to CRT.
static short PC
           
(package private)  javax.swing.JMenuItem quit
           
private  java.awt.event.ActionListener quitActionListener
           
static short R0
           
static short R1
           
static short R2
           
static short R3
           
static short R4
           
static short R5
           
static short R6
           
static short R7
           
(package private)  JTableX registersTable
          This table is used to visualize the contents of Titokone's registers.
(package private)  java.lang.Object[] registersTableIdentifiers
           
(package private)  javax.swing.JScrollPane registersTableScrollPane
          This holds @link registersTable.
static java.lang.String resourceHomeDir
           
(package private)  javax.swing.JSplitPane rightSplitPane
          This holds (@link upperRightPanel upperRightPanel) and (@link commentListScrollPane commentListScrollPane).
static short RUN_COMMAND
           
(package private)  javax.swing.JButton runButton
           
private  java.awt.event.ActionListener runCommandActionListener
           
(package private)  javax.swing.JMenuItem runMenuItem
           
(package private)  javax.swing.JMenuItem selectDefaultStdinFile
           
(package private)  javax.swing.JMenuItem selectDefaultStdoutFile
           
(package private)  javax.swing.JMenuItem selectLanguageFromFile
           
private  java.awt.event.ActionListener selectLanguageFromFileActionListener
           
private  java.awt.event.ActionListener selectStdinFileActionListener
           
private  java.awt.event.ActionListener selectStdoutFileActionListener
           
(package private)  javax.swing.JMenuItem setCompilingOptions
           
private  java.awt.event.ActionListener setCompilingOptionsCommandActionListener
           
private  GUICompileSettingsDialog setCompilingOptionsDialog
           
(package private)  javax.swing.JMenu setLanguage
           
private  java.awt.event.ActionListener setLanguageActionListener
           
(package private)  javax.swing.JMenu setMemSize
           
(package private)  javax.swing.JMenuItem setRunningOptions
           
private  java.awt.event.ActionListener setRunningOptionsCommandActionListener
           
private  GUIRunSettingsDialog setRunningOptionsDialog
           
(package private)  javax.swing.JToggleButton showAnimationToggleButton
           
(package private)  javax.swing.JToggleButton showCommentsToggleButton
           
static short SP
           
(package private)  javax.swing.JLabel statusBar
           
static short STOP_COMMAND
           
(package private)  javax.swing.JButton stopButton
           
private  java.awt.event.ActionListener stopCommandActionListener
           
(package private)  javax.swing.JMenuItem stopMenuItem
           
(package private)  java.util.HashMap symbolsHashMap
          This has symbol name as key and its row in the symbolTable as value.
(package private)  JTableX symbolTable
          This table is used to visualize the symbols that are declared in source code, and their values.
(package private)  java.lang.Object[] symbolTableIdentifiers
           
(package private)  javax.swing.JScrollPane symbolTableScrollPane
          This holds (@link symbolTable symbolTable).
private  java.awt.Font tableFont
           
(package private)  GUI thisGUI
           
(package private)  javax.swing.JPanel upperRightPanel
          This holds (@link registersTableScrollPane registersTableScrollPane), (@link symbolTableScrollPane symbolTableScrollPane) and (@link ioPanel ioPanel).
 
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.Window
 
Fields inherited from class java.awt.Container
 
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
GUI()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          This is called when ActionEvent of some kind is fired.
 void addComment(java.lang.String comment)
          Adds a comment into the comment list.
 void addOutputData(int outputValue)
          Adds a number into the text area on the right side of the screen.
 boolean centerToLine(int line, short table)
          Sets the viewport of a certain table so that the given line is visible.
 void changeTextInEnterNumberLabel(java.lang.String newText)
          Changes the text which is shown in KBD-frame above the text field.
 void disable(short command)
          Disables a command.
 void enable(short command)
          Enables a command.
private  void enterInput()
           
 java.lang.String[] getCodeTableContents()
           
 void hideAnimator()
           
private  void initAnimator()
           
private  void initGUI()
          This is just a private assistance method for the creator.
private  void insertMenuBar(javax.swing.JFrame destFrame)
          Inserts the menu into main window.
 boolean insertSymbolTable(java.lang.String[][] symbolsAndValues)
          Inserts symbols and their values into symbol table.
 void insertToCodeTable(java.lang.String[] src)
          Inserts data into code table.
 void insertToDataTable(int[] data, java.lang.String[] symbolic)
          Functionally this is exactly similar to insertToDataTable(String[]), but this just takes int[] as parameter.
 void insertToDataTable(java.lang.String[] dataContents)
          Inserts data into data table.
 boolean insertToInstructionsTable(int[] binaryCommand, java.lang.String[] symbolicCommand)
          Functionality of this method is exactly similar to insertToInstructionsTable(String[],String[]), but here the first parameter's type is int[].
 boolean insertToInstructionsTable(java.lang.String[] symbolicCommand)
          Functionality of this method is exactly similar to insertToInstructionsTable(String[],String[]), but here the first parameter would be an array of empty Strings.
 boolean insertToInstructionsTable(java.lang.String[] binaryCommand, java.lang.String[] symbolicCommand)
          Inserts data to instructionsTable.
private  javax.swing.JToolBar makeToolBar()
          This creates the toolbar of this program and returns it.
private  void print(java.lang.String message)
          This method prints out startup messages.
 void resetAll()
          GUIBrain can call this method to reset GUI, which means that all tables (except registers table) are emptied and all their rows are unselected.
 void selectLine(int line, short table)
          Selects a row from code table or from instructions and data table.
 void setEnabled(short command, boolean b)
          Enables or disables a given command.
 void setGUIView(int view)
           
 void setSelected(short option, boolean b)
          Sets a certain option selected or unselected in GUI.
 void showAnimator()
           
 void showError(java.lang.String errorMsg)
          Shows an error in a message dialog.
private  int showOpenFileDialog()
          This method uses the generalFileDialog as a k91/b91 file opening dialog.
private  int showSelectLanguageFileDialog()
          This method uses the generalFileDialog as a language file choosing dialog.
private  int showSelectStdinDialog()
          This method uses the generalFileDialog as a default stdin file choosing dialog.
private  int showSelectStdoutDialog()
          This method uses the generalFileDialog as a default stdout file choosing dialog.
 void unselectAll()
          Unselects all selected rows in every table.
 void updateAllTexts()
          Updates all texts that are shown in GUI to be shown in current language.
 boolean updateInstructionsAndDataTableLine(int lineNumber, int binaryCommand)
          Functionality of this method is otherwise similar to updateInstructionsAndDataTableLine(int,int,String), but this one doesn't change the third column.
 boolean updateInstructionsAndDataTableLine(int lineNumber, int binaryCommand, java.lang.String symbolicCommand)
          Updates contents of a line in either instructions table or data table.
 void updateReg(short reg, int newValue)
          Updates a value of a register in registersTable.
 void updateReg(short reg, java.lang.Integer newValue)
          Updates a register value.
 void updateRowInSymbolTable(java.lang.String symbolName, java.lang.Integer symbolValue)
          Updates the value of a symbol if it already exists, or adds a new row and inserts the symbol and its value there.
 void updateStatusBar(java.lang.String str)
          Inserts a text into status bar at the bottom of the screen.
 
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, 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, 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

thisGUI

GUI thisGUI

guibrain

GUIBrain guibrain

mainSplitPane

javax.swing.JSplitPane mainSplitPane
This holds (@link rightSplitPane rightSplitPane) and (@link leftPane leftPane).


leftPanel

javax.swing.JPanel leftPanel
What this holds, depends on the view of this gui. If it's 1, then this is empty. If it's 2, then this holds (@link codeTableScrollPane codeTableScrollPane). If it's 3, then this holds (@link dataAndInstructionsTableSplitPane dataAndInstructionsTableSplitPane).


rightSplitPane

javax.swing.JSplitPane rightSplitPane
This holds (@link upperRightPanel upperRightPanel) and (@link commentListScrollPane commentListScrollPane).


upperRightPanel

javax.swing.JPanel upperRightPanel
This holds (@link registersTableScrollPane registersTableScrollPane), (@link symbolTableScrollPane symbolTableScrollPane) and (@link ioPanel ioPanel).


codeTableScrollPane

javax.swing.JScrollPane codeTableScrollPane
This holds (@link codeTable codeTable).


codeTable

JTableX codeTable
This table is used to visualize the K91 source code.


codeTableIdentifiers

java.lang.Object[] codeTableIdentifiers

instructionsTableScrollPane

javax.swing.JScrollPane instructionsTableScrollPane
This holds (@link instructionsTable instructionsTable)


instructionsTable

JTableX instructionsTable
This table is used to visualize the instructions side of Titokone's memory by showing its numeric contents and their symbolic equivalencies.


instructionsTableIdentifiers

java.lang.Object[] instructionsTableIdentifiers

dataTableScrollPane

javax.swing.JScrollPane dataTableScrollPane
This holds (@link dataTable dataTable).


dataTable

JTableX dataTable
This table is used to visualize the data side of Titokone's memory by showing its numeric contents and their symbolic equivalencies.


dataTableIdentifiers

java.lang.Object[] dataTableIdentifiers

dataAndInstructionsTableSplitPane

javax.swing.JSplitPane dataAndInstructionsTableSplitPane
This holds (@link instructionsTableScrollPane instructionsTableScrollPane) and (@link dataTableScrollPane dataTableScrollPane).


registersTableScrollPane

javax.swing.JScrollPane registersTableScrollPane
This holds @link registersTable.


registersTable

JTableX registersTable
This table is used to visualize the contents of Titokone's registers. There's one row for each of there registers: R0, R1, R2, R3, R4, R5, SP, FP and PC.


registersTableIdentifiers

java.lang.Object[] registersTableIdentifiers

symbolTableScrollPane

javax.swing.JScrollPane symbolTableScrollPane
This holds (@link symbolTable symbolTable).


symbolTable

JTableX symbolTable
This table is used to visualize the symbols that are declared in source code, and their values. There's one row for each symbol.


symbolTableIdentifiers

java.lang.Object[] symbolTableIdentifiers

symbolsHashMap

java.util.HashMap symbolsHashMap
This has symbol name as key and its row in the symbolTable as value. Thus it's easy to find out if a symbol is already included in symbolTable and a new row is not needed.


ioPanel

javax.swing.JPanel ioPanel
This holds (@link inputPanel) and (@link outputPanel).


outputPanel

javax.swing.JPanel outputPanel
This holds (@link outputScrollPane).


outputScrollPane

javax.swing.JScrollPane outputScrollPane
This holds (@link outputTextArea).


outputTextArea

javax.swing.JTextArea outputTextArea
This text area is used to visualize the output data that Titokone sends to CRT.


inputPanel

javax.swing.JPanel inputPanel
This holds (@link enterNumberLabel enterNumberLabel), (@link inputField inputField) and (@link enterNumberButton enterNumberButton).


enterNumberLabel

javax.swing.JLabel enterNumberLabel
This is used to show for example errors, when an invalid number is given etc.


inputField

javax.swing.JTextField inputField
The number that will be sent to Titokone as KBD data is given here.


enterNumberButton

javax.swing.JButton enterNumberButton
This sends the number to GUIBrain, which checks if it's valid and then sends it to Titokone.


commentListScrollPane

javax.swing.JScrollPane commentListScrollPane
This holds (@link commentList commentList).


commentList

javax.swing.JList commentList
The comments are shown here.


openFileButton

javax.swing.JButton openFileButton

compileButton

javax.swing.JButton compileButton

runButton

javax.swing.JButton runButton

continueButton

javax.swing.JButton continueButton

continueToEndButton

javax.swing.JButton continueToEndButton

stopButton

javax.swing.JButton stopButton

lineByLineToggleButton

javax.swing.JToggleButton lineByLineToggleButton

showCommentsToggleButton

javax.swing.JToggleButton showCommentsToggleButton

showAnimationToggleButton

javax.swing.JToggleButton showAnimationToggleButton

statusBar

javax.swing.JLabel statusBar

dataTablePopupMenu

javax.swing.JPopupMenu dataTablePopupMenu

fileMenu

javax.swing.JMenu fileMenu

openFile

javax.swing.JMenuItem openFile

compileMenuItem

javax.swing.JMenuItem compileMenuItem

runMenuItem

javax.swing.JMenuItem runMenuItem

continueMenuItem

javax.swing.JMenuItem continueMenuItem

continueToEndMenuItem

javax.swing.JMenuItem continueToEndMenuItem

stopMenuItem

javax.swing.JMenuItem stopMenuItem

eraseMem

javax.swing.JMenuItem eraseMem

quit

javax.swing.JMenuItem quit

optionsMenu

javax.swing.JMenu optionsMenu

setMemSize

javax.swing.JMenu setMemSize

configureFileSystem

javax.swing.JMenu configureFileSystem

selectDefaultStdinFile

javax.swing.JMenuItem selectDefaultStdinFile

selectDefaultStdoutFile

javax.swing.JMenuItem selectDefaultStdoutFile

setCompilingOptions

javax.swing.JMenuItem setCompilingOptions

setRunningOptions

javax.swing.JMenuItem setRunningOptions

selectLanguageFromFile

javax.swing.JMenuItem selectLanguageFromFile

setLanguage

javax.swing.JMenu setLanguage

helpMenu

javax.swing.JMenu helpMenu

manual

javax.swing.JMenuItem manual

about

javax.swing.JMenuItem about

animatorFrame

javax.swing.JFrame animatorFrame

animator

Animator animator

animatorSpeedSlider

javax.swing.JSlider animatorSpeedSlider

animatorContinueButton

javax.swing.JButton animatorContinueButton

ANIMATOR_SPEED_MIN

public static final int ANIMATOR_SPEED_MIN
See Also:
Constant Field Values

ANIMATOR_SPEED_MAX

public static final int ANIMATOR_SPEED_MAX
See Also:
Constant Field Values

R0

public static final short R0
See Also:
Constant Field Values

R1

public static final short R1
See Also:
Constant Field Values

R2

public static final short R2
See Also:
Constant Field Values

R3

public static final short R3
See Also:
Constant Field Values

R4

public static final short R4
See Also:
Constant Field Values

R5

public static final short R5
See Also:
Constant Field Values

R6

public static final short R6
See Also:
Constant Field Values

R7

public static final short R7
See Also:
Constant Field Values

SP

public static final short SP
See Also:
Constant Field Values

FP

public static final short FP
See Also:
Constant Field Values

PC

public static final short PC
See Also:
Constant Field Values

COMPILE_COMMAND

public static final short COMPILE_COMMAND
See Also:
Constant Field Values

RUN_COMMAND

public static final short RUN_COMMAND
See Also:
Constant Field Values

STOP_COMMAND

public static final short STOP_COMMAND
See Also:
Constant Field Values

CONTINUE_COMMAND

public static final short CONTINUE_COMMAND
See Also:
Constant Field Values

CONTINUE_WITHOUT_PAUSES_COMMAND

public static final short CONTINUE_WITHOUT_PAUSES_COMMAND
See Also:
Constant Field Values

INPUT_FIELD

public static final short INPUT_FIELD
See Also:
Constant Field Values

CODE_TABLE_EDITING

public static final short CODE_TABLE_EDITING
See Also:
Constant Field Values

OPEN_FILE_COMMAND

public static final short OPEN_FILE_COMMAND
See Also:
Constant Field Values

activeView

private int activeView

generalFileDialog

private javax.swing.JFileChooser generalFileDialog

setRunningOptionsDialog

private GUIRunSettingsDialog setRunningOptionsDialog

setCompilingOptionsDialog

private GUICompileSettingsDialog setCompilingOptionsDialog

aboutDialog

private GUIHTMLDialog aboutDialog

manualDialog

private GUIHTMLDialog manualDialog

tableFont

private java.awt.Font tableFont

blacklined

private javax.swing.border.Border blacklined

COMMENT_LIST_SIZE

private static final int COMMENT_LIST_SIZE
See Also:
Constant Field Values

logger

private java.util.logging.Logger logger

resourceHomeDir

public static final java.lang.String resourceHomeDir
See Also:
Constant Field Values

lineColumnSize

private static final int lineColumnSize
See Also:
Constant Field Values

numericValueColumnSize

private static final int numericValueColumnSize
See Also:
Constant Field Values

cellMargin

private static final int cellMargin
See Also:
Constant Field Values

OPTION_COMPILING_PAUSED

public static final short OPTION_COMPILING_PAUSED
paused compiling - used in setSelected() method

See Also:
Constant Field Values

OPTION_COMPILING_COMMENTED

public static final short OPTION_COMPILING_COMMENTED
commented compiling - used in setSelected() method

See Also:
Constant Field Values

OPTION_RUNNING_PAUSED

public static final short OPTION_RUNNING_PAUSED
paused running - used in setSelected() method

See Also:
Constant Field Values

OPTION_RUNNING_COMMENTED

public static final short OPTION_RUNNING_COMMENTED
commented running - used in setSelected() method

See Also:
Constant Field Values

OPTION_RUNNING_ANIMATED

public static final short OPTION_RUNNING_ANIMATED
animated running - used in setSelected() method

See Also:
Constant Field Values

NONE

public static final short NONE
No table - used in setGUIView() method

See Also:
Constant Field Values

CODE_TABLE

public static final short CODE_TABLE
Code table - used in centerToLine(), selectRow() and setGUIView() methods

See Also:
Constant Field Values

INSTRUCTIONS_AND_DATA_TABLE

public static final short INSTRUCTIONS_AND_DATA_TABLE
Instructions and data table - used in centerToLine(), selectRow() and setGUIView() methods

See Also:
Constant Field Values

openCommandActionListener

private java.awt.event.ActionListener openCommandActionListener

selectStdinFileActionListener

private java.awt.event.ActionListener selectStdinFileActionListener

selectStdoutFileActionListener

private java.awt.event.ActionListener selectStdoutFileActionListener

compileCommandActionListener

private java.awt.event.ActionListener compileCommandActionListener

runCommandActionListener

private java.awt.event.ActionListener runCommandActionListener

continueCommandActionListener

private java.awt.event.ActionListener continueCommandActionListener

continueToEndCommandActionListener

private java.awt.event.ActionListener continueToEndCommandActionListener

setRunningOptionsCommandActionListener

private java.awt.event.ActionListener setRunningOptionsCommandActionListener

setCompilingOptionsCommandActionListener

private java.awt.event.ActionListener setCompilingOptionsCommandActionListener

stopCommandActionListener

private java.awt.event.ActionListener stopCommandActionListener

eraseMemoryActionListener

private java.awt.event.ActionListener eraseMemoryActionListener

setLanguageActionListener

private java.awt.event.ActionListener setLanguageActionListener

selectLanguageFromFileActionListener

private java.awt.event.ActionListener selectLanguageFromFileActionListener

aboutActionListener

private java.awt.event.ActionListener aboutActionListener

manualActionListener

private java.awt.event.ActionListener manualActionListener

enterNumberButtonActionListener

private java.awt.event.ActionListener enterNumberButtonActionListener

quitActionListener

private java.awt.event.ActionListener quitActionListener

B91FileFilter

private javax.swing.filechooser.FileFilter B91FileFilter

K91FileFilter

private javax.swing.filechooser.FileFilter K91FileFilter

classFileFilter

private javax.swing.filechooser.FileFilter classFileFilter
Constructor Detail

GUI

public GUI()
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
This is called when ActionEvent of some kind is fired.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

setGUIView

public void setGUIView(int view)

resetAll

public void resetAll()
GUIBrain can call this method to reset GUI, which means that all tables (except registers table) are emptied and all their rows are unselected.


unselectAll

public void unselectAll()
Unselects all selected rows in every table.


updateStatusBar

public void updateStatusBar(java.lang.String str)
Inserts a text into status bar at the bottom of the screen.

Parameters:
str - The text to be inserted.

updateReg

public void updateReg(short reg,
                      int newValue)
Updates a value of a register in registersTable.

Parameters:
reg - The register to be updated. Valid values are R1, R2, R3, R3, R4, R5, R6, R7, SP and FP. (R6==SP and R7==FP).
newValue - The new value.

updateReg

public void updateReg(short reg,
                      java.lang.Integer newValue)
Updates a register value.

Parameters:
reg - The register to be updated.
newValue - The new value.

insertToCodeTable

public void insertToCodeTable(java.lang.String[] src)
Inserts data into code table. The data must be provided as a String-array, where one element corresponds to one line of original data. One element will be shown as one row in GUI.

Parameters:
src - The data to be shown and one element corresponds to one line.

insertToInstructionsTable

public boolean insertToInstructionsTable(java.lang.String[] binaryCommand,
                                         java.lang.String[] symbolicCommand)
Inserts data to instructionsTable. The data must be provided so that the dimension of both parameter is same. If they aren't, then false is returned and no insertion made. The second column will be filled with binaryCommand's contents and the third column with symbolicCommand's contents. The first column will contain line numbers which are 0...N, where N is size of the table.

Parameters:
binaryCommand - Contents of the second column.
symbolicCommand - Contents of the third column.
Returns:
True if operation was successful. False if the dimension of the parameters is not same.

insertToInstructionsTable

public boolean insertToInstructionsTable(int[] binaryCommand,
                                         java.lang.String[] symbolicCommand)
Functionality of this method is exactly similar to insertToInstructionsTable(String[],String[]), but here the first parameter's type is int[]. That's for convenience, because otherwise it would require an additional for-loop to convert int[] to String[].

Parameters:
binaryCommand - Contents of the second column.
symbolicCommand - Contents of the third column.
Returns:
True if operation was successful. False if the dimension of the parameters is not same.

insertToInstructionsTable

public boolean insertToInstructionsTable(java.lang.String[] symbolicCommand)
Functionality of this method is exactly similar to insertToInstructionsTable(String[],String[]), but here the first parameter would be an array of empty Strings. Thus the second column will empty after calling this method.

Parameters:
symbolicCommand - Contents of the third column.
Returns:
True if operation was successful. False if the dimension of the parameters is not same.

updateInstructionsAndDataTableLine

public boolean updateInstructionsAndDataTableLine(int lineNumber,
                                                  int binaryCommand,
                                                  java.lang.String symbolicCommand)
Updates contents of a line in either instructions table or data table. Parameter lineNumber decides which one to update - lines 0...N are rows in instructionsTable and lines N+1...N+P are rows in dataTable, where N is the row count of instructionsTable and P is the row count of dataTable.

Parameters:
lineNumber - The line number of the row to update. Lines 0...N are rows in instructionsTable and lines N+1...N+P are rows in dataTable, where N is the row count of instructionsTable and P is the row count of dataTable.
binaryCommand - The content of the node in the second column.
symbolicCommand - The content of the node in the third column.

updateInstructionsAndDataTableLine

public boolean updateInstructionsAndDataTableLine(int lineNumber,
                                                  int binaryCommand)
Functionality of this method is otherwise similar to updateInstructionsAndDataTableLine(int,int,String), but this one doesn't change the third column. This version is useful during compilation, where the contents of the third column are set, but the second column is empty at first and as the compilation goes on, it's contents are updated.

Parameters:
lineNumber - The line number of the row to update. Lines 0...N are rows in instructionsTable and lines N+1...N+P are rows in dataTable, where N is the row count of instructionsTable and P is the row count of dataTable.
binaryCommand - The content of the node in the second column.
Returns:
True if the operation was successful. False is there's was no such line as lineNumber.

insertToDataTable

public void insertToDataTable(java.lang.String[] dataContents)
Inserts data into data table. Parameter dataContents is inserted into the second column and the third column will be left empty. The first column holds numbers, which are line numbers. They will be calculated so that the first element will be one greater than the last element of instructionsTable. Because of this, this method should only be called AFTER calling insertToInstructionsTable() or otherwise line numbers will not be correct.

Parameters:
dataContents - Contents of the second column.

insertToDataTable

public void insertToDataTable(int[] data,
                              java.lang.String[] symbolic)
Functionally this is exactly similar to insertToDataTable(String[]), but this just takes int[] as parameter. This is here just for convenience, because converting a String-table to int-table would require an extra for-loop. The data array determines the length of the contents to be inserted. If symbolic is shorter than data, the remaining spaces are filled with empty strings.

Parameters:
data - Contents of the second column.

insertSymbolTable

public boolean insertSymbolTable(java.lang.String[][] symbolsAndValues)
Inserts symbols and their values into symbol table. A symbol's name is given in symbolsAndValues[x][0] and its value in symbolsAndValues[x][1]. This method first makes the table and its HashMap empty and then enters the symbol and the values into both the table and its HashMap.

Parameters:
symbolsAndValues - A symbol's name is given in symbolsAndValues[x][0] and its value in symbolsAndValues[x][1]. This can be null, in which case symbol table will be set empty.
Returns:
Returns false if parameter is not of correct form. It MUST be of such type where the size of the second dimension is precisely two. It can however be null, which means an empty symbol table.

updateRowInSymbolTable

public void updateRowInSymbolTable(java.lang.String symbolName,
                                   java.lang.Integer symbolValue)
Updates the value of a symbol if it already exists, or adds a new row and inserts the symbol and its value there.


addComment

public void addComment(java.lang.String comment)
Adds a comment into the comment list.


addOutputData

public void addOutputData(int outputValue)
Adds a number into the text area on the right side of the screen.


setEnabled

public void setEnabled(short command,
                       boolean b)
Enables or disables a given command.

Parameters:
command - The command to be set. It can be RUN_COMMAND, STOP_COMMAND, COMPILE_COMMAND, CONTINUE_COMMAND, CONTINUE_WITHOUT_PAUSES_COMMAND INPUT_FIELD.
b - 'True' to enable the command. 'False' to disable it.

enable

public void enable(short command)
Enables a command.

Parameters:
command - The command to be enabled. It can be RUN_COMMAND, STOP_COMMAND, COMPILE_COMMAND, CONTINUE_COMMAND, CONTINUE_WITHOUT_PAUSES_COMMAND INPUT_FIELD.

disable

public void disable(short command)
Disables a command.

Parameters:
command - The command to be Disabled. It can be RUN_COMMAND, STOP_COMMAND, COMPILE_COMMAND, CONTINUE_COMMAND, CONTINUE_WITHOUT_PAUSES_COMMAND INPUT_FIELD.

setSelected

public void setSelected(short option,
                        boolean b)
Sets a certain option selected or unselected in GUI. Note that this doesn't take any position on what the options does. GUIBrain uses this method to to synchronize GUI for settings loaded from settings file.


centerToLine

public boolean centerToLine(int line,
                            short table)
Sets the viewport of a certain table so that the given line is visible.

Parameters:
line - Number of the line, that is wanted to be visible.
table - The table. Valid values for this parameter are CODE_TABLE and INSTRUCTIONS_AND_DATA_TABLE
Returns:
True if the operation was successful. False if the line number was not valid - ie there's no such line in the table or there's no such table.

selectLine

public void selectLine(int line,
                       short table)
Selects a row from code table or from instructions and data table. Instructions and data table, although two tables, are treated as one. Suppose that instructions table is n rows and data table is m rows. This is treated as one table of length n+m rows and its n first rows are same as instruction table's rows and m next rows are same as data table's rows.

Parameters:
table - The desired table. Proper values are CODE_TABLE and INSTRUCTIONS_AND_DATA_TABLE.
line - Line to be selected.

showAnimator

public void showAnimator()

hideAnimator

public void hideAnimator()

changeTextInEnterNumberLabel

public void changeTextInEnterNumberLabel(java.lang.String newText)
Changes the text which is shown in KBD-frame above the text field. If the new text is an empty string, then the label will disappear.

Parameters:
newText - The new text to be shown. If this is empty, then the label will disappear.

updateAllTexts

public void updateAllTexts()
Updates all texts that are shown in GUI to be shown in current language. If language hasn't changed since last call of this method, then nothing will happen, but if it has, then all the text will appear in it. GUIBrain calls this method in setLanguage() method.


showError

public void showError(java.lang.String errorMsg)
Shows an error in a message dialog.

Parameters:
errorMsg - The message to be shown.

getCodeTableContents

public java.lang.String[] getCodeTableContents()

initGUI

private void initGUI()
This is just a private assistance method for the creator. This prepares all the graphical tables,lists and such as well as puts them into the main frame. This won't be accessed but once in the creator method.


enterInput

private void enterInput()

initAnimator

private void initAnimator()

insertMenuBar

private void insertMenuBar(javax.swing.JFrame destFrame)
Inserts the menu into main window.

Parameters:
destFrame - The frame the menu bar will be inserted.

makeToolBar

private javax.swing.JToolBar makeToolBar()
This creates the toolbar of this program and returns it.


showOpenFileDialog

private int showOpenFileDialog()
This method uses the generalFileDialog as a k91/b91 file opening dialog.

Returns:
Whatever generalFileDialog.showOpenDialog(thisGUI) returns.

showSelectStdinDialog

private int showSelectStdinDialog()
This method uses the generalFileDialog as a default stdin file choosing dialog.

Returns:
Whatever generalFileDialog.showOpenDialog(thisGUI) returns.

showSelectStdoutDialog

private int showSelectStdoutDialog()
This method uses the generalFileDialog as a default stdout file choosing dialog.

Returns:
Whatever generalFileDialog.showOpenDialog(thisGUI) returns.

showSelectLanguageFileDialog

private int showSelectLanguageFileDialog()
This method uses the generalFileDialog as a language file choosing dialog.

Returns:
Whatever generalFileDialog.showOpenDialog(thisGUI) returns.

print

private void print(java.lang.String message)
This method prints out startup messages. It exists to make it easier to decide whether they should be shown to the user or not.