http://www.jpicedt.org

jpicedt.ui.internal
Class PEMenuBar

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 jpicedt.ui.internal.PEMenuBar
All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, MenuElement

public class PEMenuBar
extends JMenuBar
implements PropertyChangeListener

The main menu bar. Several updateXXX() methods are provided, which make it easy to keep the GUI state synchronized with the current content of the desktop (in terms e.g. of saved/dirty boards, …)

This menubar can listen to property-change events triggered e.g. from an activated PEDrawingBoard.

Since:
PicEdt 1.0
Version:
$Id: PEMenuBar.java,v 1.26 2013/03/27 06:51:11 vincentb1 Exp $
Author:
Sylvain Reynal
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JMenuBar
JMenuBar.AccessibleJMenuBar
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
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
PEMenuBar()
          Creates the application main menu bar
 
Method Summary
static PEMenu createPEMenu(String name)
          Creates a PEMenu from the given String, using JPicEdt's default ActionLocalizer to fetch the associated label (ie "name") and mnemonic ("name.mnemonic").
 JMenuItem[] getMenuItems()
          Return an array containing all the menu-items components attached to this menubar
 void propertyChange(PropertyChangeEvent e)
          Implementation of PropertyChangeListener interface Allows this menu-bar to get notified of change from the target EditorKit, e.g. when a right-click switches the current EditorKit's mousetool back to "select-tool", or when a new mousetool gets selected from the "Tools" palette or from a BSH script.
 void updateAccelerators()
          Update JMenuItem's accelerators from the key/value pairs stored in JPicEdt's preferences
 void updateFragmentsMenu()
          Updates the "fragments" menu items
 void updateMenuBar()
          Update the content (i.e.
 void updateRecentFilesSubmenu()
          Updates the "recent files" sub-menu items after a frame was saved or opened.
 void updateScriptsMenu()
          Updates the "script" menu items
 void updateUndoRedoMenus(String undoName, String redoName)
          update "undo" and "redo" text
 void updateWindowMenu()
          Updates the Window menu as soon as an internal frame is opened or closed (this menu keeps tracks of every open internal frames so that the user can activate them quickly by use of a shortcut)
 
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, getBaseline, getBaselineResizeBehavior, 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, isPaintingForPrint, 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
 

Constructor Detail

PEMenuBar

public PEMenuBar()
          throws MissingResourceException
Creates the application main menu bar

Throws:
MissingResourceException
Method Detail

createPEMenu

public static PEMenu createPEMenu(String name)
                           throws MissingResourceException
Creates a PEMenu from the given String, using JPicEdt's default ActionLocalizer to fetch the associated label (ie "name") and mnemonic ("name.mnemonic").

Parameters:
name - the name of the menu, used to determine : Example : createPEMenu("File") create a menu with label "File" and mnemonic = first char of "File.mnemonic"
Throws:
MissingResourceException

getMenuItems

public JMenuItem[] getMenuItems()
Return an array containing all the menu-items components attached to this menubar


updateAccelerators

public void updateAccelerators()
Update JMenuItem's accelerators from the key/value pairs stored in JPicEdt's preferences


updateMenuBar

public void updateMenuBar()
Update the content (i.e. PEMenu's) of the menu-bar depending on the current state of the MDIManager.


updateRecentFilesSubmenu

public void updateRecentFilesSubmenu()
Updates the "recent files" sub-menu items after a frame was saved or opened.

Since:
PicEdt 1.1

updateScriptsMenu

public void updateScriptsMenu()
Updates the "script" menu items

Since:
jpicedt 1.3.2

updateFragmentsMenu

public void updateFragmentsMenu()
Updates the "fragments" menu items

Since:
jpicedt 1.3.2

updateUndoRedoMenus

public void updateUndoRedoMenus(String undoName,
                                String redoName)
update "undo" and "redo" text

Since:
jpicedt 1.3.2

updateWindowMenu

public void updateWindowMenu()
                      throws MissingResourceException
Updates the Window menu as soon as an internal frame is opened or closed (this menu keeps tracks of every open internal frames so that the user can activate them quickly by use of a shortcut)

Throws:
MissingResourceException
Since:
PicEdt 1.1

propertyChange

public void propertyChange(PropertyChangeEvent e)
Implementation of PropertyChangeListener interface Allows this menu-bar to get notified of change from the target EditorKit, e.g. when a right-click switches the current EditorKit's mousetool back to "select-tool", or when a new mousetool gets selected from the "Tools" palette or from a BSH script.

This DockablePanel gets registered as a PropertyChangeListener (with events sourced from EditorKit's) from inside MDIManager whenever a new Board is added.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
e - the PropertyChangeEvent ; only the "getNewValue()" method is used here.

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org