Ontimize 5.2071EN

com.ontimize.gui
Class ApplicationMenuBar

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JMenuBar
                  extended bycom.ontimize.gui.ApplicationMenuBar
All Implemented Interfaces:
javax.accessibility.Accessible, FormComponent, Freeable, HasHelpIdComponent, HasPreferenceComponent, java.awt.image.ImageObserver, Internationalization, java.awt.MenuContainer, javax.swing.MenuElement, java.io.Serializable

public class ApplicationMenuBar
extends javax.swing.JMenuBar
implements FormComponent, Freeable, HasHelpIdComponent, HasPreferenceComponent

Basic implementation of the application menu bar.

Version:
1.0
See Also:
Serialized Form

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
protected  boolean dynamicloaded
           
protected  java.util.Hashtable menuItemList
           
 
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 com.ontimize.gui.field.FormComponent
DEBUG
 
Fields inherited from interface com.ontimize.gui.i18n.Internationalization
DEBUG_LANGUAGE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ApplicationMenuBar(java.util.Hashtable parameters)
           
 
Method Summary
static java.lang.String acceleratorMessageFromKeystroke(javax.swing.KeyStroke accelerator)
          This method convert a keystroke in a String with this structure: i.e.
static java.lang.String acceleratorToString(javax.swing.KeyStroke accelerator)
          This method convert a keystroke in a String with this structure: 'modifiers keycode'.
 void add(RadioItemGroup buttonsGroup)
          Method used to store a reference to the RadioItemGroup elements
 void addConfigurableKeyStrokeGroup(java.lang.String groupName, java.util.List keyBindings)
           
 void clearItemList()
           
protected  void createMenuShortcutsConfigurationDialog()
           
protected  void finalize()
           
 void free()
          Makes the object to release the resources.
 java.util.Vector getAllItems()
          Create a vector with all the menu elements
 java.util.Vector getButtonGroup()
          Gets an vector with the reference to the RadioItemGroup elements
 java.lang.Object getConstraints(java.awt.LayoutManager layout)
          Return always null
 java.lang.String getHelpIdString()
           
 javax.swing.JMenuItem getMenuItem(java.lang.String attribute)
          Get a reference to the component with the specified attribute.
 java.util.Vector getTextsToTranslate()
          Returns all the texts in the element suitable for being translated.
 void init(java.util.Hashtable parameters)
          Main method to init an object from parameters hashtable.
 void initPreferences(ApplicationPreferences prefs, java.lang.String user)
           
 void installHelpId()
           
 void loadDynamicItems()
           
 void removeDynamicItems()
           
 void setComponentLocale(java.util.Locale l)
           
 void setItemMenuEnabled(java.lang.String attribute, boolean enabled)
          Enables or disables the element with the specified attribute.
 void setResourceBundle(java.util.ResourceBundle resources)
          Sets the language resource bundle.
 void showMenuShortcutsConfigurationDialog()
           
 
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, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ontimize.gui.field.FormComponent
isEnabled, setEnabled, setVisible
 

Field Detail

menuItemList

protected java.util.Hashtable menuItemList

dynamicloaded

protected boolean dynamicloaded
Constructor Detail

ApplicationMenuBar

public ApplicationMenuBar(java.util.Hashtable parameters)
Method Detail

init

public void init(java.util.Hashtable parameters)
Description copied from interface: FormComponent
Main method to init an object from parameters hashtable.

Specified by:
init in interface FormComponent
Parameters:
parameters - the hashtable with pairs (Key,Value). For example:

Key Value
align center
attr attribute
... ...

getConstraints

public java.lang.Object getConstraints(java.awt.LayoutManager layout)
Return always null

Specified by:
getConstraints in interface FormComponent
Parameters:
layout - the parent container reference
Returns:
the constraints for the component

add

public void add(RadioItemGroup buttonsGroup)
Method used to store a reference to the RadioItemGroup elements

Parameters:
buttonsGroup -

getMenuItem

public javax.swing.JMenuItem getMenuItem(java.lang.String attribute)
Get a reference to the component with the specified attribute. The element can be a Menu or a Menu Item

Parameters:
attribute -
Returns:
Element reference or null if there are not elements with the specified attribute

setItemMenuEnabled

public void setItemMenuEnabled(java.lang.String attribute,
                               boolean enabled)
Enables or disables the element with the specified attribute. If there are no components with this attribute nothing is done

Parameters:
attribute -
enabled -

clearItemList

public void clearItemList()

getAllItems

public java.util.Vector getAllItems()
Create a vector with all the menu elements

Returns:
A Vector with all the menu elements

getTextsToTranslate

public java.util.Vector getTextsToTranslate()
Description copied from interface: Internationalization
Returns all the texts in the element suitable for being translated.

Specified by:
getTextsToTranslate in interface Internationalization
Returns:
all the texts in the element suitable for being translated.

setResourceBundle

public void setResourceBundle(java.util.ResourceBundle resources)
Description copied from interface: Internationalization
Sets the language resource bundle. When the application changes the configured language, for all the objects that implement this interface this method must be called with the new file.
The method must translate all the elements that have texts in the GUI

Specified by:
setResourceBundle in interface Internationalization
Parameters:
resources - the new language bundle.

setComponentLocale

public void setComponentLocale(java.util.Locale l)
Specified by:
setComponentLocale in interface Internationalization

free

public void free()
Description copied from interface: Freeable
Makes the object to release the resources.

Specified by:
free in interface Freeable

getButtonGroup

public java.util.Vector getButtonGroup()
Gets an vector with the reference to the RadioItemGroup elements

Returns:

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable

getHelpIdString

public java.lang.String getHelpIdString()
Specified by:
getHelpIdString in interface HasHelpIdComponent

installHelpId

public void installHelpId()
Specified by:
installHelpId in interface HasHelpIdComponent

createMenuShortcutsConfigurationDialog

protected void createMenuShortcutsConfigurationDialog()

showMenuShortcutsConfigurationDialog

public void showMenuShortcutsConfigurationDialog()

addConfigurableKeyStrokeGroup

public void addConfigurableKeyStrokeGroup(java.lang.String groupName,
                                          java.util.List keyBindings)

acceleratorToString

public static java.lang.String acceleratorToString(javax.swing.KeyStroke accelerator)
This method convert a keystroke in a String with this structure: 'modifiers keycode'.
For example:

For keystroke correspondent to: 'Ctrl + Alt + a' , method will return:
'650 65'. '650' is the code for modifiers 'Ctrl + Alt' and '65' is the code for 'a'.
Shorcuts will be stored in preferences in this way. Note: Method that makes the opposite is

Parameters:
accelerator - keystroke to convert
Returns:
A String with numeric values of keystroke.

acceleratorMessageFromKeystroke

public static java.lang.String acceleratorMessageFromKeystroke(javax.swing.KeyStroke accelerator)
This method convert a keystroke in a String with this structure: i.e. 'Ctrl + Alt + a'. Modifiers (Ctrl + Alt ) are also internazionalized for avoiding problems with jvm locale-dependent method: getKeyStroke.

Parameters:
accelerator - keystroke to convert
Returns:
A String with text for keystroke or directly the codes for keystroke when it does not exist in bundle.

initPreferences

public void initPreferences(ApplicationPreferences prefs,
                            java.lang.String user)
Specified by:
initPreferences in interface HasPreferenceComponent

loadDynamicItems

public void loadDynamicItems()

removeDynamicItems

public void removeDynamicItems()

Ontimize