Class ActionsMenuCreator

java.lang.Object
com.nomagic.actions.ActionsMenuCreator

@OpenApiAll public class ActionsMenuCreator extends Object
Class for creating GUI menu items from actions.
  • Field Details

  • Constructor Details

    • ActionsMenuCreator

      public ActionsMenuCreator()
  • Method Details

    • createPopupMenu

      public final JPopupMenu createPopupMenu(ActionsManager manager)
      Creates popup menu for given actions manager
      Parameters:
      manager - manager
      Returns:
      popup menu
    • createPopupMenu

      public final JPopupMenu createPopupMenu(ActionsManager manager, Supplier<JPopupMenu> factory)
      Creates popup menu for given actions manager
      Parameters:
      manager - manager
      factory - new popup menu factory
      Returns:
      popup menu
    • appendMenuItems

      public final void appendMenuItems(JPopupMenu popup, ActionsManager manager)
      Appends menu items to the given pop up menu. Adds separator before new items if given pop up is not empty.
      Parameters:
      popup - where items will be appended
      manager - manager from which actions menu items will be created
    • appendMenuItems

      public final void appendMenuItems(JPopupMenu popup, ActionsManager manager, boolean addSeparator)
      Appends menu items to given popup.
      Parameters:
      popup - where items will be appended
      manager - manager from which actions menu items will be created
      addSeparator - add separator after last item in the given popup or not
    • internalAppendMenuItems

      protected void internalAppendMenuItems(JPopupMenu popup, ActionsManager manager, boolean addSeparator)
    • appendMenuItems

      public final void appendMenuItems(Container container, ActionsManager manager)
      Appends menu items to given container.
      Parameters:
      container - container where items will be appended
      manager - manager from which actions items will be created
    • createActionsVisitor

      protected ActionsVisitor createActionsVisitor()
    • internalAppendMenuItems

      protected void internalAppendMenuItems(Container container, ActionsManager manager)
    • addJMenuItem

      protected void addJMenuItem(Component item, NMAction action)
      Adds menu item, according to index item will be added to end when index less than 0, or to specified by index position.
      Parameters:
      item - item to add.
      action - action
    • setPropertiesToMenuItem

      public static void setPropertiesToMenuItem(JMenuItem item, NMAction action)
      Sets properties to given JMenuItem from given action.
      Parameters:
      item - item to set properties.
      action - for getting properties.
    • setUseMenuListener

      public void setUseMenuListener(boolean useMenuListener)
      Do we need to use MenuListener on category? This flag should be set to true only if software is running on mac and using -Dapple.laf.useScreenMenuBar=true system property.
      Parameters:
      useMenuListener - true if need to use.
    • getFactory

      public com.nomagic.actions.MenuComponentFactory getFactory()
      Return menu component factory
      Returns:
      factory
    • setFactory

      public void setFactory(com.nomagic.actions.MenuComponentFactory factory)
      Set menu component factory
      Parameters:
      factory - factory
    • isSeparatorComponent

      public static boolean isSeparatorComponent(@CheckForNull Component component)
    • addCleanupParticipant

      protected void addCleanupParticipant(Runnable participant)