org.openstreetmap.josm.gui
Class MainMenu
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JMenuBar
org.openstreetmap.josm.gui.MainMenu
- All Implemented Interfaces:
- java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.MenuElement
public class MainMenu
- extends javax.swing.JMenuBar
This is the JOSM main menu bar. It is overwritten to initialize itself and provide all menu
entries as member variables (sort of collect them).
It also provides possibilities to attach new menu entries (used by plugins).
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class javax.swing.JMenuBar |
javax.swing.JMenuBar.AccessibleJMenuBar |
Nested classes/interfaces inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
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 |
Method Summary |
static javax.swing.JMenuItem |
add(javax.swing.JMenu menu,
JosmAction action)
Add a JosmAction at the end of a menu. |
static javax.swing.JMenuItem |
add(javax.swing.JMenu menu,
JosmAction action,
boolean isExpert)
Add a JosmAction at the end of a menu. |
static javax.swing.JMenuItem |
add(javax.swing.JMenu menu,
JosmAction action,
boolean isExpert,
java.lang.Integer index)
Add a JosmAction at the end of a menu. |
static
<E extends java.lang.Enum<E>>
javax.swing.JMenuItem |
|
add(javax.swing.JMenu menu,
JosmAction action,
java.lang.Enum<E> group)
Add a JosmAction to a menu. |
static javax.swing.JMenuItem |
addAfter(javax.swing.JMenu menu,
JosmAction actionToBeInserted,
boolean isExpert,
JosmAction existingMenuEntryAction)
Add the JosmAction actionToBeInserted directly below existingMenuEntryAction . |
javax.swing.JMenu |
addMenu(javax.swing.JMenu menu,
java.lang.String name,
int mnemonicKey,
int position,
java.lang.String relativeHelpTopic)
|
javax.swing.JMenu |
addMenu(java.lang.String name,
int mnemonicKey,
int position,
java.lang.String relativeHelpTopic)
|
static
<E extends java.lang.Enum<E>>
javax.swing.JCheckBoxMenuItem |
|
addWithCheckbox(javax.swing.JMenu menu,
JosmAction action,
java.lang.Enum<E> group)
Add a JosmAction to a menu and automatically prints accelerator if available. |
private static int |
getInsertionIndexForGroup(javax.swing.JMenu menu,
int group)
finds the correct insertion index for a given group and adds separators if necessary |
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, 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, transferFocusBackward, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
newAction
public final NewAction newAction
openFile
public final OpenFileAction openFile
recentlyOpened
public final RecentlyOpenedFilesMenu recentlyOpened
openLocation
public final OpenLocationAction openLocation
save
public final JosmAction save
saveAs
public final JosmAction saveAs
sessionLoad
public JosmAction sessionLoad
sessionSaveAs
public JosmAction sessionSaveAs
gpxExport
public final JosmAction gpxExport
download
public final DownloadAction download
downloadPrimitive
public final DownloadPrimitiveAction downloadPrimitive
downloadReferrers
public final DownloadReferrersAction downloadReferrers
closeChangesetAction
public final CloseChangesetAction closeChangesetAction
update
public final JosmAction update
updateSelection
public final JosmAction updateSelection
updateModified
public final JosmAction updateModified
upload
public final JosmAction upload
uploadSelection
public final JosmAction uploadSelection
exit
public final JosmAction exit
undo
public final UndoAction undo
redo
public final RedoAction redo
copy
public final JosmAction copy
copyCoordinates
public final JosmAction copyCoordinates
paste
public final PasteAction paste
pasteTags
public final JosmAction pasteTags
duplicate
public final JosmAction duplicate
delete
public final JosmAction delete
purge
public final JosmAction purge
merge
public final JosmAction merge
mergeSelected
public final JosmAction mergeSelected
selectAll
public final JosmAction selectAll
unselectAll
public final JosmAction unselectAll
search
public final JosmAction search
preferences
public final JosmAction preferences
wireFrameToggleAction
public final WireframeToggleAction wireFrameToggleAction
toggleGPXLines
public final JosmAction toggleGPXLines
info
public final InfoAction info
infoweb
public final InfoWebAction infoweb
historyinfo
public final HistoryInfoAction historyinfo
historyinfoweb
public final HistoryInfoWebAction historyinfoweb
splitWay
public final JosmAction splitWay
combineWay
public final JosmAction combineWay
reverseWay
public final JosmAction reverseWay
alignInCircle
public final JosmAction alignInCircle
alignInLine
public final JosmAction alignInLine
distribute
public final JosmAction distribute
ortho
public final OrthogonalizeAction ortho
orthoUndo
public final JosmAction orthoUndo
mirror
public final JosmAction mirror
addnode
public final AddNodeAction addnode
movenode
public final MoveNodeAction movenode
createCircle
public final JosmAction createCircle
mergeNodes
public final JosmAction mergeNodes
joinNodeWay
public final JosmAction joinNodeWay
unglueNodes
public final JosmAction unglueNodes
simplifyWay
public final JosmAction simplifyWay
joinAreas
public final JosmAction joinAreas
createMultipolygon
public final JosmAction createMultipolygon
followLine
public final JosmAction followLine
audioPlayPause
public final JosmAction audioPlayPause
audioNext
public final JosmAction audioNext
audioPrev
public final JosmAction audioPrev
audioFwd
public final JosmAction audioFwd
audioBack
public final JosmAction audioBack
audioFaster
public final JosmAction audioFaster
audioSlower
public final JosmAction audioSlower
help
public final HelpAction help
about
public final JosmAction about
statusreport
public final JosmAction statusreport
fileMenu
public final javax.swing.JMenu fileMenu
sessionMenu
public final javax.swing.JMenu sessionMenu
editMenu
public final javax.swing.JMenu editMenu
viewMenu
public final javax.swing.JMenu viewMenu
toolsMenu
public final javax.swing.JMenu toolsMenu
presetsMenu
public final javax.swing.JMenu presetsMenu
imageryMenu
public final ImageryMenu imageryMenu
windowMenu
public final javax.swing.JMenu windowMenu
- the window menu is split into several groups. The first is for windows that can be opened from
this menu any time, e.g. the changeset editor. The second group is for toggle dialogs and the third
group is for currently open windows that cannot be toggled, e.g. relation editors. It's recommended
to use WINDOW_MENU_GROUP to determine the group integer.
audioMenu
public javax.swing.JMenu audioMenu
helpMenu
public final javax.swing.JMenu helpMenu
defaultMenuPos
public final int defaultMenuPos
- See Also:
- Constant Field Values
moveUpAction
public final JosmAction moveUpAction
moveDownAction
public final JosmAction moveDownAction
moveLeftAction
public final JosmAction moveLeftAction
moveRightAction
public final JosmAction moveRightAction
jumpToAct
public final JumpToAction jumpToAct
presetSearchAction
public final TaggingPresetSearchAction presetSearchAction
fullscreenToggleAction
public FullscreenToggleAction fullscreenToggleAction
menuSeparatorHandler
public static final javax.swing.event.MenuListener menuSeparatorHandler
- this menu listener hides unnecessary JSeparators in a menu list but does not remove them.
If at a later time the separators are required, they will be made visible again. Intended
usage is make menus not look broken if separators are used to group the menu and some of
these groups are empty.
MainMenu
public MainMenu()
add
public static javax.swing.JMenuItem add(javax.swing.JMenu menu,
JosmAction action)
- Add a JosmAction at the end of a menu.
This method handles all the shortcut handling. It also makes sure that actions that are
handled by the OS are not duplicated on the menu.
- Parameters:
menu
- the menu to add the action toaction
- the action that should get a menu item
- Returns:
- the created menu item
add
public static javax.swing.JMenuItem add(javax.swing.JMenu menu,
JosmAction action,
boolean isExpert)
- Add a JosmAction at the end of a menu.
This method handles all the shortcut handling. It also makes sure that actions that are
handled by the OS are not duplicated on the menu.
- Parameters:
menu
- the menu to add the action toaction
- the action that should get a menu itemisExpert
- whether the entry should only be visible if the expert mode is activated
- Returns:
- the created menu item
add
public static javax.swing.JMenuItem add(javax.swing.JMenu menu,
JosmAction action,
boolean isExpert,
java.lang.Integer index)
- Add a JosmAction at the end of a menu.
This method handles all the shortcut handling. It also makes sure that actions that are
handled by the OS are not duplicated on the menu.
- Parameters:
menu
- the menu to add the action toaction
- the action that should get a menu itemisExpert
- whether the entry should only be visible if the expert mode is activatedindex
- an integer specifying the position at which to add the action
- Returns:
- the created menu item
addAfter
public static javax.swing.JMenuItem addAfter(javax.swing.JMenu menu,
JosmAction actionToBeInserted,
boolean isExpert,
JosmAction existingMenuEntryAction)
- Add the JosmAction
actionToBeInserted
directly below existingMenuEntryAction
.
This method handles all the shortcut handling. It also makes sure that actions that are
handled by the OS are not duplicated on the menu.
- Parameters:
menu
- the menu to add the action toactionToBeInserted
- the action that should get a menu item directly below existingMenuEntryAction
isExpert
- whether the entry should only be visible if the expert mode is activatedexistingMenuEntryAction
- an action already added to the menu menu
, the action actionToBeInserted
is added directly below
- Returns:
- the created menu item
add
public static <E extends java.lang.Enum<E>> javax.swing.JMenuItem add(javax.swing.JMenu menu,
JosmAction action,
java.lang.Enum<E> group)
- Add a JosmAction to a menu.
This method handles all the shortcut handling. It also makes sure that actions that are
handled by the OS are not duplicated on the menu.
- Parameters:
menu
- to add the action toaction
- the action that should get a menu itemgroup
- the item should be added to. Groups are split by a separator.
0 is the first group, -1 will add the item to the end.
addWithCheckbox
public static <E extends java.lang.Enum<E>> javax.swing.JCheckBoxMenuItem addWithCheckbox(javax.swing.JMenu menu,
JosmAction action,
java.lang.Enum<E> group)
- Add a JosmAction to a menu and automatically prints accelerator if available.
Also adds a checkbox that may be toggled.
- Parameters:
menu
- to add the action toaction
- the action that should get a menu itemgroup
- the item should be added to. Groups are split by a separator. Use
one of the enums that are defined for some of the menus to tell in which
group the item should go.
getInsertionIndexForGroup
private static int getInsertionIndexForGroup(javax.swing.JMenu menu,
int group)
- finds the correct insertion index for a given group and adds separators if necessary
addMenu
public javax.swing.JMenu addMenu(java.lang.String name,
int mnemonicKey,
int position,
java.lang.String relativeHelpTopic)
addMenu
public javax.swing.JMenu addMenu(javax.swing.JMenu menu,
java.lang.String name,
int mnemonicKey,
int position,
java.lang.String relativeHelpTopic)
JOSM