Ontimize 5.2072EN

com.ontimize.gui
Class MenuItem

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.AbstractButton
                  extended byjavax.swing.JMenuItem
                      extended bycom.ontimize.gui.MenuItem
All Implemented Interfaces:
javax.accessibility.Accessible, FormComponent, HasPreferenceComponent, IdentifiedElement, IDynamicItem, java.awt.image.ImageObserver, Internationalization, java.awt.ItemSelectable, java.awt.MenuContainer, javax.swing.MenuElement, SecureElement, java.io.Serializable, StatusComponent, javax.swing.SwingConstants

public class MenuItem
extends javax.swing.JMenuItem
implements FormComponent, IdentifiedElement, SecureElement, StatusComponent, HasPreferenceComponent, IDynamicItem

The main class to create an item of a menu, where attribute parameter is the actionCommand.

Author:
Imatia Innovation
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JMenuItem
javax.swing.JMenuItem.AccessibleJMenuItem
 
Nested classes inherited from class javax.swing.AbstractButton
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener
 
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  java.lang.String attribute
          The menu item attribute.
protected  boolean dialog
          True when the form is opened in a dialog
protected  boolean dynamic
           
protected  java.lang.String formManagerName
          The name of the FormManager
protected  java.lang.String formName
          The form name to show
static java.lang.String MENU_ACCELERATOR
          The key of a menu accelerator.
protected  boolean restricted
          The condition of restricted.
protected  java.lang.String shortcut
          The reference to shortcut.
protected  java.lang.String statusText
          The status text reference.
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
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 com.ontimize.gui.SecureElement
DESACTIVATE_COMPONENT_BY_PERMISSION_TIP
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MenuItem(java.util.Hashtable parameters)
          The class constructor.
 
Method Summary
protected  void finalize()
           
 void free()
          Removes all listener menu items.
protected  java.lang.String getAcceleratorPreferencesKey()
          Gets the accelerator preference key.
 java.lang.Object getAttribute()
          Gets the object attribute.
 java.lang.Object getConstraints(java.awt.LayoutManager layout)
          Description method to return the constraints component to place correctly in parent container.
 java.lang.String getFormManagerName()
           
 java.lang.String getFormName()
           
 java.lang.String getStatusText()
          Gets the StatusText variable.
 java.util.Vector getTextsToTranslate()
          Adds the attribute parameter to the vector to translate.
 void init(java.util.Hashtable parameters)
          Initializes parameters.
 void initPermissions()
          Initializes the permissions.
 void initPreferences(ApplicationPreferences aPrefs, java.lang.String user)
          Initializes the application preferences.
 boolean isDialog()
           
 boolean isDynamic()
           
 boolean isRestricted()
          Gets the restricted condition.
 void setAccelerator(javax.swing.KeyStroke ks)
           
 void setComponentLocale(java.util.Locale l)
          Sets the component locale.
 void setDialog(boolean dialog)
           
 void setDynamic(boolean dynamic)
           
 void setEnabled(boolean enabled)
          Description method to set enabled or not the component according the boolean condition in parameter.
 void setFormName(java.lang.String formName)
           
 void setResourceBundle(java.util.ResourceBundle resources)
          Sets the language resource bundle.
 void setVisible(boolean vis)
          Description method to set visible or not the component according the boolean condition in parameter.
 
Methods inherited from class javax.swing.JMenuItem
addMenuDragMouseListener, addMenuKeyListener, configurePropertiesFromAction, createActionPropertyChangeListener, fireMenuDragMouseDragged, fireMenuDragMouseEntered, fireMenuDragMouseExited, fireMenuDragMouseReleased, fireMenuKeyPressed, fireMenuKeyReleased, fireMenuKeyTyped, getAccelerator, getAccessibleContext, getComponent, getMenuDragMouseListeners, getMenuKeyListeners, getSubElements, getUIClassID, init, isArmed, menuSelectionChanged, paramString, processKeyEvent, processMenuDragMouseEvent, processMenuKeyEvent, processMouseEvent, removeMenuDragMouseListener, removeMenuKeyListener, setArmed, setUI, updateUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, 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, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, 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, 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
 

Field Detail

MENU_ACCELERATOR

public static final java.lang.String MENU_ACCELERATOR
The key of a menu accelerator.

See Also:
Constant Field Values

statusText

protected java.lang.String statusText
The status text reference. By default, null.


attribute

protected java.lang.String attribute
The menu item attribute. By default, null.


shortcut

protected java.lang.String shortcut
The reference to shortcut. By default,"".


formName

protected java.lang.String formName
The form name to show


dialog

protected boolean dialog
True when the form is opened in a dialog


formManagerName

protected java.lang.String formManagerName
The name of the FormManager


dynamic

protected boolean dynamic

restricted

protected boolean restricted
The condition of restricted. By default, false.

Constructor Detail

MenuItem

public MenuItem(java.util.Hashtable parameters)
The class constructor. It initializes parameters, sets margin and register status component.

Parameters:
parameters - The hashtable with parameters
Method Detail

getConstraints

public java.lang.Object getConstraints(java.awt.LayoutManager layout)
Description copied from interface: FormComponent
Description method to return the constraints component to place correctly in parent container.

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

init

public void init(java.util.Hashtable parameters)
Initializes parameters.

Specified by:
init in interface FormComponent
Parameters:
parameters - the Hashtable with parameters

attribute values default required meaning
attr yes The attribute.
status attr no The text showed in status bar application. MainApplication translates this text according to the bundle.
icon no Specifies the file name of button icon. Complete path from Ontimize class location, for example, if an icon is stored in com/ontimize/gui/images/item.gif, it would be correct to specify the path like: 'images/item.gif'
shortcut no The reference to shortcut (for example: 'ctrl + C')
mnemonic no Mnemonic letter. NOTE: This parameter has not been Internationalized yet
form no The form name to be opened
showdialog yes/no If the 'form' parameter is established the default values is 'yes'.Otherwise the default value is 'no' no Established whether the form is opened in a dialog
formmanager no no The name of FormManager to show. If this parameter isn't established the value is taking from 'attr' parameter

getAttribute

public java.lang.Object getAttribute()
Description copied from interface: IdentifiedElement
Gets the object attribute. This attribute allows to identify the object

Specified by:
getAttribute in interface IdentifiedElement

getTextsToTranslate

public java.util.Vector getTextsToTranslate()
Adds the attribute parameter to the vector to translate.

Specified by:
getTextsToTranslate in interface Internationalization
Returns:
the vector with attribute parameter.

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)
Sets the component locale.

Specified by:
setComponentLocale in interface Internationalization
Parameters:
l - the locale to set

free

public void free()
Removes all listener menu items.


finalize

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

setVisible

public void setVisible(boolean vis)
Description copied from interface: FormComponent
Description method to set visible or not the component according the boolean condition in parameter.

Specified by:
setVisible in interface FormComponent

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: FormComponent
Description method to set enabled or not the component according the boolean condition in parameter.

Specified by:
setEnabled in interface FormComponent

initPermissions

public void initPermissions()
Initializes the permissions.

Specified by:
initPermissions in interface SecureElement

getStatusText

public java.lang.String getStatusText()
Gets the StatusText variable.

Specified by:
getStatusText in interface StatusComponent
Returns:
the status text

isRestricted

public boolean isRestricted()
Gets the restricted condition.

Specified by:
isRestricted in interface SecureElement
Returns:
the restricted variable value.

setAccelerator

public void setAccelerator(javax.swing.KeyStroke ks)

initPreferences

public void initPreferences(ApplicationPreferences aPrefs,
                            java.lang.String user)
Initializes the application preferences.

Specified by:
initPreferences in interface HasPreferenceComponent
Parameters:
aPrefs - the application preferences
user - the user reference

getAcceleratorPreferencesKey

protected java.lang.String getAcceleratorPreferencesKey()
Gets the accelerator preference key.

Returns:
the union of menu_accelerator key with attribute.

getFormName

public java.lang.String getFormName()

setFormName

public void setFormName(java.lang.String formName)

isDialog

public boolean isDialog()

setDialog

public void setDialog(boolean dialog)

getFormManagerName

public java.lang.String getFormManagerName()

isDynamic

public boolean isDynamic()
Specified by:
isDynamic in interface IDynamicItem

setDynamic

public void setDynamic(boolean dynamic)

Ontimize