turingmachine
Class CTMMenuBar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JMenuBar
                  extended by turingmachine.CTMMenuBar
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.MenuElement, java.io.Serializable

class CTMMenuBar
extends javax.swing.JMenuBar
implements java.awt.event.ActionListener

Application main menubar.


Nested Class Summary
 
Nested classes inherited from class javax.swing.JMenuBar
javax.swing.JMenuBar.AccessibleJMenuBar
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
private  CTMApplication mApplication
          The application this menubar belongs to.
private  javax.swing.JMenu menuFile
          Menu instance.
private  javax.swing.JMenuItem menuFile_Close
          Menu Option instance.
private  javax.swing.JMenuItem menuFile_CloseAll
          Menu Option instance.
private  javax.swing.JMenuItem menuFile_Exit
          Menu Option instance.
private  javax.swing.JMenuItem menuFile_Load
          Menu Option instance.
private  javax.swing.JMenuItem menuFile_New_TuringMachine
          Menu Option instance.
private  javax.swing.JMenuItem menuFile_Save
          Menu Option instance.
private  javax.swing.JMenuItem menuFile_SaveAs
          Menu Option instance.
private  javax.swing.JMenuItem menuHelp_About
          Menu Option instance.
private  javax.swing.JMenu menuTuringMachine
          Menu instance.
private  javax.swing.JMenuItem menuTuringMachine_Colours
          Menu Option instance.
private  javax.swing.JMenuItem menuTuringMachine_Properties
          Menu Option instance.
private  javax.swing.JMenuItem menuTuringMachine_Validate
          Menu Option instance.
private  javax.swing.JMenu menuWindow
          Menu instance.
private  javax.swing.JCheckBoxMenuItem menuWindow_Grid
           
private  javax.swing.JMenuItem menuWindow_GridSpacing
          Menu Option instance.
private  javax.swing.JMenuItem menuWindow_NewBrowser
          Menu Option instance.
private  javax.swing.JMenuItem menuWindow_NewView
          Menu Option instance.
private  javax.swing.JCheckBoxMenuItem menuWindow_SnapToGrid
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
CTMMenuBar(CTMApplication aApplication)
          Constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handle menu actions.
private  javax.swing.JCheckBoxMenuItem createCheckboxMenuItem(javax.swing.JMenu aMenu, java.lang.String aName, boolean aEnabled)
          Creates a checkbox menu item.
private  javax.swing.JMenuItem createMenuItem(javax.swing.JMenu aMenu, java.lang.String aName, boolean aEnabled)
          Creates a menuitem in aMenu.
private  CTMApplication getApplication()
          Get the application this menubar belongs to.
private  CTMFrame getApplicationFrame()
          Get the applications frame.
private  CTMInternalFrameView getSelectedFrame()
          Get the currently selected frame.
private  void menuFile_Close()
          Close the currently selected frame.
 void menuFile_CloseAll()
          Close all the currently open windows
private  void menuFile_Exit()
          File | Exit action performed.
private  void menuFile_Load()
          Display a load dialog.
private  void menuFile_New_TuringMachine(CTMDocument aDocument)
          Creates new view on document.
private  void menuHelp_About()
          Displays About dialog box.
private  void menuTuringMachine_Colours()
          Show the modify colours dialog for a document.
private  boolean menuTuringMachine_Properties()
          Show the modify properties dialog for a document.
private  void menuTuringMachine_Validate()
          Validate document menu item.
private  void menuWindow_Grid()
           
private  void menuWindow_GridSpacing()
           
private  void menuWindow_SnapToGrid()
           
 
Methods inherited from class javax.swing.JMenuBar
add, addNotify, getAccessibleContext, getComponent, getComponentAtIndex, getComponentIndex, getHelpMenu, getMargin, getMenu, getMenuCount, getSelectionModel, getSubElements, getUI, getUIClassID, isBorderPainted, isSelected, menuSelectionChanged, paintBorder, paramString, processKeyBinding, processKeyEvent, processMouseEvent, removeNotify, setBorderPainted, setHelpMenu, setMargin, setSelected, setSelectionModel, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mApplication

private CTMApplication mApplication
The application this menubar belongs to.


menuFile

private javax.swing.JMenu menuFile
Menu instance.


menuWindow

private javax.swing.JMenu menuWindow
Menu instance.


menuTuringMachine

private javax.swing.JMenu menuTuringMachine
Menu instance.


menuFile_New_TuringMachine

private javax.swing.JMenuItem menuFile_New_TuringMachine
Menu Option instance.


menuFile_Close

private javax.swing.JMenuItem menuFile_Close
Menu Option instance.


menuFile_CloseAll

private javax.swing.JMenuItem menuFile_CloseAll
Menu Option instance.


menuFile_Load

private javax.swing.JMenuItem menuFile_Load
Menu Option instance.


menuFile_Save

private javax.swing.JMenuItem menuFile_Save
Menu Option instance.


menuFile_SaveAs

private javax.swing.JMenuItem menuFile_SaveAs
Menu Option instance.


menuFile_Exit

private javax.swing.JMenuItem menuFile_Exit
Menu Option instance.


menuHelp_About

private javax.swing.JMenuItem menuHelp_About
Menu Option instance.


menuWindow_NewView

private javax.swing.JMenuItem menuWindow_NewView
Menu Option instance.


menuWindow_NewBrowser

private javax.swing.JMenuItem menuWindow_NewBrowser
Menu Option instance.


menuWindow_GridSpacing

private javax.swing.JMenuItem menuWindow_GridSpacing
Menu Option instance.


menuTuringMachine_Properties

private javax.swing.JMenuItem menuTuringMachine_Properties
Menu Option instance.


menuTuringMachine_Colours

private javax.swing.JMenuItem menuTuringMachine_Colours
Menu Option instance.


menuTuringMachine_Validate

private javax.swing.JMenuItem menuTuringMachine_Validate
Menu Option instance.


menuWindow_Grid

private javax.swing.JCheckBoxMenuItem menuWindow_Grid

menuWindow_SnapToGrid

private javax.swing.JCheckBoxMenuItem menuWindow_SnapToGrid
Constructor Detail

CTMMenuBar

public CTMMenuBar(CTMApplication aApplication)
Constructor. Make the menubar and menus.

Parameters:
aApplication - The application this menu belongs to.
Method Detail

createMenuItem

private javax.swing.JMenuItem createMenuItem(javax.swing.JMenu aMenu,
                                             java.lang.String aName,
                                             boolean aEnabled)
Creates a menuitem in aMenu.

Parameters:
aMenu - The menu to add the item to.
aName - The text for the menu item.
aEnabled - Whether or not this menu item is enabled.
Returns:
The new menu item.

createCheckboxMenuItem

private javax.swing.JCheckBoxMenuItem createCheckboxMenuItem(javax.swing.JMenu aMenu,
                                                             java.lang.String aName,
                                                             boolean aEnabled)
Creates a checkbox menu item.

Parameters:
aMenu - The menu to add the item to.
aName - The text for the menu item.
aEnabled - Whether or not this menu item is enabled.
Returns:
The new menu item.

getSelectedFrame

private CTMInternalFrameView getSelectedFrame()
Get the currently selected frame.

Returns:
The frontmost window in the application.

getApplicationFrame

private CTMFrame getApplicationFrame()
Get the applications frame.

Returns:
The application frame.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handle menu actions.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - The event holding the action information.

menuFile_Exit

private void menuFile_Exit()
File | Exit action performed.


menuFile_New_TuringMachine

private void menuFile_New_TuringMachine(CTMDocument aDocument)
Creates new view on document.

Parameters:
aDocument - The document to create a new view of.
If this is null a new document is created.

menuTuringMachine_Properties

private boolean menuTuringMachine_Properties()
Show the modify properties dialog for a document.

Returns:
True if the dialog was actioned with the OK button.

menuTuringMachine_Colours

private void menuTuringMachine_Colours()
Show the modify colours dialog for a document.


menuTuringMachine_Validate

private void menuTuringMachine_Validate()
Validate document menu item.


menuWindow_Grid

private void menuWindow_Grid()

menuWindow_SnapToGrid

private void menuWindow_SnapToGrid()

menuWindow_GridSpacing

private void menuWindow_GridSpacing()

menuFile_Load

private void menuFile_Load()
Display a load dialog.


menuFile_Close

private void menuFile_Close()
Close the currently selected frame.


menuFile_CloseAll

public void menuFile_CloseAll()
Close all the currently open windows


menuHelp_About

private void menuHelp_About()
Displays About dialog box.


getApplication

private CTMApplication getApplication()
Get the application this menubar belongs to.

Returns:
The application this menubar belongs to.