org.argouml.ui.cmd
Class GenericArgoMenuBar

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JMenuBar
                  extended byorg.argouml.ui.cmd.GenericArgoMenuBar
All Implemented Interfaces:
Accessible, ArgoEventListener, ArgoModuleEventListener, EventListener, ImageObserver, MenuContainer, MenuElement, Serializable

public class GenericArgoMenuBar
extends JMenuBar
implements ArgoModuleEventListener

GenericArgoMenuBar defines the menubar for all operating systems which do not explicitely ask for a different kind of menu bar, such as Mac OS X.

Menu's and the mnemonics of menu's and the menuitems are separated in the PropertyResourceBundle menu.properties.

menuitems are separated in the PropertyResourceBundle action.properties.

The key's in menu.properties have the following structure:

 menu:                    [file].[name of menu]
  e.g:                    menu.file

 mnemonics of menu's:     [file].[name of menu].mnemonic
  e.g:                    menu.file.mnemonic

 mnemonics of menuitems:  [file].[flag for item].[name of menuitem].mnemonic
  e.g:                    menu.item.new.mnemonic
 

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JMenuBar
JMenuBar.AccessibleJMenuBar
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  ArgoJMenu arrange
          This should be invoked automatically when importing sources.
private  JMenu createDiagrams
          Toolbar:create diagram.
private  JToolBar createDiagramToolbar
           
private  ArgoJMenu critique
          The critique menu.
private  JMenu edit
          Edit menu.
private  JToolBar editToolbar
           
private  JToolBar fileToolbar
          The toolbars.
private  JMenu generate
          Supports java generation, modules for php and html/javadocs are planned feel free to contribute here!
private  JMenu help
          It needs it.
private  LastRecentlyUsedMenuList lruList
          lru project list.
private static String MENU
          Name and prepareKey-Strings of/for the i18n menu.properties.
private static String MENUITEM
          MENUITEM = Prefix for menuitem-keys.
private  JMenu select
          The Select menu is a submenu of Edit.
private  JMenu tools
          Currently disactivated.
private  ArgoJMenu view
          View under which is the Goto Diagram, Find, Zoom, Adjust grid etc.
private  JToolBar viewToolbar
           
 
Fields inherited from class javax.swing.JMenuBar
 
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.Container
 
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
GenericArgoMenuBar()
          The constructor.
 
Method Summary
 void addFileSaved(String filename)
          Adds the entry to the lru list.
private  void appendPluggableMenus(JMenuItem menuitem, String key)
          Scans through all loaded modules to see if it has an item to add in this diagram.
 JToolBar getCreateDiagramToolbar()
          Get the create diagram toolbar.
 JToolBar getEditToolbar()
          Get the edit toolbar.
 JToolBar getFileToolbar()
          Getter for the file toolbar.
 JMenu getTools()
          Getter for the Tools menu.
 JToolBar getViewToolbar()
          Getter for the view toolbar.
private  void initMenuArrange()
          Build the menu "Arrange".
private  void initMenuCreate()
          Build the menu "Create" and the toolbar for diagram creation.
private  void initMenuCritique()
          Build the menu "Critique".
private  void initMenuEdit(int mask)
          Build the menu "Edit".
private  void initMenuFile(int mask)
          Build the menu "File".
private  void initMenuGeneration()
          Build the menu "Generation".
private  void initMenuHelp()
          Build the menu "Help".
protected  void initMenus()
          Construct the ordinary all purpose Argo Menu Bar.
private  void initMenuTools()
          Build the menu "Tools".
private  void initMenuView(int mask)
          Build the menu "View".
protected static String menuLocalize(String key)
           
 void moduleDisabled(ArgoModuleEvent event)
          Invoked when a module has been disabled.
 void moduleEnabled(ArgoModuleEvent event)
          Invoked when a module has been enabled.
 void moduleLoaded(ArgoModuleEvent event)
          Invoked when a module has been loaded.
 void moduleUnloaded(ArgoModuleEvent event)
          Invoked when a module has been unloaded.
private static String prepareKey(String str)
          Prepares one part of the key for menu- or/and menuitem-mnemonics used in menu.properties.
(package private) static void setAccelerator(JMenuItem item, KeyStroke keystroke)
           
protected static void setMnemonic(JMenuItem item, String key)
          This should be a user specified option.
 
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, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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

MENU

private static final String MENU
Name and prepareKey-Strings of/for the i18n menu.properties. MENU = Prefix for menu-keys

See Also:
Constant Field Values

MENUITEM

private static final String MENUITEM
MENUITEM = Prefix for menuitem-keys.

See Also:
Constant Field Values

fileToolbar

private JToolBar fileToolbar
The toolbars.


editToolbar

private JToolBar editToolbar

viewToolbar

private JToolBar viewToolbar

createDiagramToolbar

private JToolBar createDiagramToolbar

lruList

private LastRecentlyUsedMenuList lruList
lru project list.


edit

private JMenu edit
Edit menu.


select

private JMenu select
The Select menu is a submenu of Edit.


view

private ArgoJMenu view
View under which is the Goto Diagram, Find, Zoom, Adjust grid etc.


createDiagrams

private JMenu createDiagrams
Toolbar:create diagram.


tools

private JMenu tools
Currently disactivated.


generate

private JMenu generate
Supports java generation, modules for php and html/javadocs are planned feel free to contribute here!


arrange

private ArgoJMenu arrange
This should be invoked automatically when importing sources.


critique

private ArgoJMenu critique
The critique menu.


help

private JMenu help
It needs it. Currently there is only system information and an about text. Hyperlinking to online docs at argouml.org is considered to be a basic improvement.

Constructor Detail

GenericArgoMenuBar

public GenericArgoMenuBar()
The constructor.

Method Detail

setMnemonic

protected static final void setMnemonic(JMenuItem item,
                                        String key)
This should be a user specified option. New laws for handicapped people who cannot use the mouse require software developers in US to make all components of User interface accessible through keyboard

Parameters:
item - is the JMenuItem to do this for.
key - is the key that we do this for.

menuLocalize

protected static final String menuLocalize(String key)
Parameters:
key - the key to localize
Returns:
the localized string

setAccelerator

static final void setAccelerator(JMenuItem item,
                                 KeyStroke keystroke)

appendPluggableMenus

private void appendPluggableMenus(JMenuItem menuitem,
                                  String key)
Scans through all loaded modules to see if it has an item to add in this diagram.

Parameters:
menuitem - The menuitem which this menuitem would attach to.
key - Non-localized string that tells the module where we are.

moduleLoaded

public void moduleLoaded(ArgoModuleEvent event)
Description copied from interface: ArgoModuleEventListener
Invoked when a module has been loaded.

Specified by:
moduleLoaded in interface ArgoModuleEventListener
Parameters:
event - the event
See Also:
ArgoModuleEventListener.moduleLoaded(ArgoModuleEvent)

moduleUnloaded

public void moduleUnloaded(ArgoModuleEvent event)
Description copied from interface: ArgoModuleEventListener
Invoked when a module has been unloaded.

Specified by:
moduleUnloaded in interface ArgoModuleEventListener
Parameters:
event - the event
See Also:
ArgoModuleEventListener.moduleUnloaded(ArgoModuleEvent)

moduleEnabled

public void moduleEnabled(ArgoModuleEvent event)
Description copied from interface: ArgoModuleEventListener
Invoked when a module has been enabled.

Specified by:
moduleEnabled in interface ArgoModuleEventListener
Parameters:
event - the event
See Also:
ArgoModuleEventListener.moduleEnabled(ArgoModuleEvent)

moduleDisabled

public void moduleDisabled(ArgoModuleEvent event)
Description copied from interface: ArgoModuleEventListener
Invoked when a module has been disabled.

Specified by:
moduleDisabled in interface ArgoModuleEventListener
Parameters:
event - the event
See Also:
ArgoModuleEventListener.moduleDisabled(ArgoModuleEvent)

initMenus

protected void initMenus()
Construct the ordinary all purpose Argo Menu Bar.


initMenuFile

private void initMenuFile(int mask)
Build the menu "File".

Parameters:
mask - menu shortcut key mask

initMenuEdit

private void initMenuEdit(int mask)
Build the menu "Edit".

Parameters:
mask - menu shortcut key mask

initMenuView

private void initMenuView(int mask)
Build the menu "View".

Parameters:
mask - menu shortcut key mask

initMenuCreate

private void initMenuCreate()
Build the menu "Create" and the toolbar for diagram creation. These are build together to guarantee that the same items are present in both, and in the same sequence.

The sequence of these items was determined by issue 1821.


initMenuArrange

private void initMenuArrange()
Build the menu "Arrange".


initMenuGeneration

private void initMenuGeneration()
Build the menu "Generation".


initMenuCritique

private void initMenuCritique()
Build the menu "Critique".


initMenuTools

private void initMenuTools()
Build the menu "Tools".


initMenuHelp

private void initMenuHelp()
Build the menu "Help".


getCreateDiagramToolbar

public JToolBar getCreateDiagramToolbar()
Get the create diagram toolbar.

Returns:
Value of property _createDiagramToolbar.

getEditToolbar

public JToolBar getEditToolbar()
Get the edit toolbar.

Returns:
the edit toolbar.

getFileToolbar

public JToolBar getFileToolbar()
Getter for the file toolbar.

Returns:
the file toolbar.

getViewToolbar

public JToolBar getViewToolbar()
Getter for the view toolbar.

Returns:
the view toolbar.

prepareKey

private static String prepareKey(String str)
Prepares one part of the key for menu- or/and menuitem-mnemonics used in menu.properties. The method changes the parameter str to lower cases. Spaces in the parameter str are changed to hyphens.

Parameters:
str -
Returns:
the prepared str

addFileSaved

public void addFileSaved(String filename)
Adds the entry to the lru list.

Parameters:
filename - of the project

getTools

public JMenu getTools()
Getter for the Tools menu.

Returns:
The Tools menu.


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook