MenuUtils

org.freeplane.core.util

## クラス MenuUtils

- java.lang.Object
- - org.freeplane.core.util.MenuUtils

-     public class MenuUtils
      extends java.lang.Object

  Utilities for dealing with the Freeplane menu: In scripts available as "global variable" menuUtils.

- - ### ネストされたクラスの概要

    ネストされたクラス
    修飾子とタイプ | クラスと説明
    --- | ---
    `static class` | `MenuUtils.MenuEntry` The userObject type for createMenuEntryTree().

  - ### コンストラクタの概要

    コンストラクタ
    コンストラクタと説明
    `MenuUtils()`

  - ### メソッドの概要

    メソッド
    修飾子とタイプ | メソッドと説明
    --- | ---
    `static javax.swing.tree.DefaultMutableTreeNode` | `createAcceleratebleMenuEntryTree(java.lang.String menuRootKey, org.freeplane.core.ui.MenuBuilder menuBuilder)` Used as the basis for dynamic generation of hotkey list.
    `static javax.swing.tree.DefaultMutableTreeNode` | `createMenuEntryTree(java.lang.String menuRootKey, org.freeplane.core.ui.MenuBuilder menuBuilder)` returns a tree of all `JMenuItem` nodes the menu contains (omitting Strings and Separators).
    `static void` | `executeMenuItems(java.util.List<java.lang.String> menuItemKeys)` to be used from scripts to execute menu items.
    `static org.freeplane.core.ui.IndexedTree.Node` | `findAssignedMenuItemNodeRecursively(javax.swing.tree.DefaultMutableTreeNode menubarNode, javax.swing.KeyStroke keystroke)` there are little reasons to use this in scripts.
    `static java.lang.String` | `formatKeyStroke(javax.swing.KeyStroke keyStroke)` pretty print a keystroke.
    `static javax.swing.Icon` | `getMenuItemIcon(java.lang.String menuItemKey)` returns the icon for a menuItemKey or null if it has none.
    `static void` | `insertAsNodeModelRecursively(org.freeplane.features.map.NodeModel nodeModel, java.util.Enumeration children, org.freeplane.features.map.MapController mapController)` Could be (but currently isn't) used to generate a mindmap representation of the menu.
    `static java.lang.String` | `makeAcceleratorKey(java.lang.String menuItemKey)` that's the key that is used to define keyboard accelerators, e.g. found in the auto.properties.

    - ### クラスから継承されたメソッド java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### コンストラクタの詳細

    - #### MenuUtils

          public MenuUtils()

  - ### メソッドの詳細

    - #### createMenuEntryTree

          public static javax.swing.tree.DefaultMutableTreeNode createMenuEntryTree(java.lang.String menuRootKey,
                                                                    org.freeplane.core.ui.MenuBuilder menuBuilder)

      returns a tree of all `JMenuItem` nodes the menu contains (omitting Strings and Separators). The tree is build from `DefaultMutableTreeNode` nodes having `MenuEntry` objects as their userObjects. Note that the root node may have null as userObject if the menu item at `menuRootKey` doesn't contain a `JMenuItem`!
      パラメータ:
        `menuRootKey` - the key of the node that should form the root of the output.
        `menuBuilder` - access point for the menu(s).

    - #### createAcceleratebleMenuEntryTree

          public static javax.swing.tree.DefaultMutableTreeNode createAcceleratebleMenuEntryTree(java.lang.String menuRootKey,
                                                                                 org.freeplane.core.ui.MenuBuilder menuBuilder)

      Used as the basis for dynamic generation of hotkey list. Same as `createMenuEntryTree(String, MenuBuilder)` but all MenuEntries without associated accelerator and (then) empty submenus are removed from the result.

    - #### insertAsNodeModelRecursively

          public static void insertAsNodeModelRecursively(org.freeplane.features.map.NodeModel nodeModel,
                                          java.util.Enumeration children,
                                          org.freeplane.features.map.MapController mapController)

      Could be (but currently isn't) used to generate a mindmap representation of the menu.
      パラメータ:
        `children` - Enumeration of DefaultMutableTreeNode from the menu tree.

    - #### formatKeyStroke

          public static java.lang.String formatKeyStroke(javax.swing.KeyStroke keyStroke)

      pretty print a keystroke.

    - #### findAssignedMenuItemNodeRecursively

          public static org.freeplane.core.ui.IndexedTree.Node findAssignedMenuItemNodeRecursively(javax.swing.tree.DefaultMutableTreeNode menubarNode,
                                                                                   javax.swing.KeyStroke keystroke)

      there are little reasons to use this in scripts.

    - #### makeAcceleratorKey

          public static java.lang.String makeAcceleratorKey(java.lang.String menuItemKey)

      that's the key that is used to define keyboard accelerators, e.g. found in the auto.properties.

    - #### executeMenuItems

          public static void executeMenuItems(java.util.List<java.lang.String> menuItemKeys)

      to be used from scripts to execute menu items. Find out the menuItemKey of a menu item with the devtools add-on. It contains a tool for that.

    - #### getMenuItemIcon

          public static javax.swing.Icon getMenuItemIcon(java.lang.String menuItemKey)

      returns the icon for a menuItemKey or null if it has none.