Module tvbrowser

Class ContextMenuManager


  • public class ContextMenuManager
    extends java.lang.Object
    A class that handles the program context menu.
    Author:
    René Mach
    • Method Detail

      • init

        public void init()
      • getInstance

        public static ContextMenuManager getInstance()
        Returns the instance of this class. If the instance is null a new will be created.
        Returns:
        The instance of this class.
      • getContextMenuForSingleClick

        public ContextMenuManager.ContextMenuAction getContextMenuForSingleClick​(java.awt.event.MouseEvent e)
        Gets the ContextMenuAction for a single mouse click.
        Parameters:
        e - The MouseEvent to get the ContextMenuIf for.
        Returns:
        The ContextMenuAction for a single mouse click that matches the mouse event or null if there is no single mouse click ContextMenuIf for the mouse event. since 3.3.1 with return type ContextMenuIf
        Since:
        3.4.5 with return type ContextMenuActionS
      • getContextMenuArrayForModifierEx

        public ContextMenuManager.ContextMenuAction getContextMenuArrayForModifierEx​(int modifierEx,
                                                                                     boolean leftMouseButton,
                                                                                     boolean singleClick)
        Gets the ContextMenuAction for a mouse click and modifier.
        Parameters:
        modifierEx - The modifier for the mouse event.
        leftMouseButton - If the ContextMenuAction for the left mouse button should be gotten.
        singleClick - If the ContextMenuAction for a single mouse click should be gotten.
        Returns:
        The ContextMenuIf for a mouse click that matches given values or null if there is no single mouse click ContextMenuIf.
        Since:
        3.3.1
      • getContextMenuForDoubleClick

        public ContextMenuManager.ContextMenuAction getContextMenuForDoubleClick​(java.awt.event.MouseEvent e)
        Gets the ContextMenuAction for a double mouse click.
        Parameters:
        e - The MouseEvent to get the ContextMenuIf for.
        Returns:
        The ContextMenuAction for a double mouse click that matches the mouse event or null if there is no double mouse click ContextMenuAction for the mouse event.
      • getContextMenuIfForId

        public static ContextMenuIf getContextMenuIfForId​(java.lang.String id)
        Returns the ContextMenuIf for the id.
        Parameters:
        id - The id to get the ContextMenuIf for.
        Returns:
        The ContextMenuIf for the id or null if id wasn't found.
      • getAvailableContextMenuIfs

        public ContextMenuIf[] getAvailableContextMenuIfs​(boolean includingDisabledItems,
                                                          boolean cleanSeparator)
        Returns all available ContextMenuItems
        Parameters:
        includingDisabledItems - If true the List also contains all disabled Items
        cleanSeparator - If true, all Separators that follow directly another Separator will be removed
        Returns:
        The available context menu interfaces.
      • createContextMenuItems

        public javax.swing.JMenu createContextMenuItems​(ContextMenuIf callerIf,
                                                        Program program)
        Creates the context menu items.
        Parameters:
        callerIf - The caller Context menu interface.
        program - The program to show the context menu for.
        Returns:
        The menu items of the context menu.
      • createContextMenuItems

        public javax.swing.JMenu createContextMenuItems​(ContextMenuIf callerIf,
                                                        Program program,
                                                        ActionMenu callerMenu)
        Creates the context menu items.
        Parameters:
        callerIf - The caller Context menu interface.
        program - The program to show the context menu for.
        callerMenu - The menu to show for the callerIf.
        Returns:
        The menu items of the context menu.
        Since:
        4.2.2
      • getPluginContextMenu

        public javax.swing.JMenuItem getPluginContextMenu​(Program program,
                                                          java.lang.String id)
        Creates a context menu for the given program containing all plugins.
        Parameters:
        program - The program to create the context menu for
        id - The id of the plugin to get the context menu for
        Returns:
        a context menu item for the given program for the plugin with the id id or null if the plugin doesn't exits or has no context menu entry for the given program.
        Since:
        4.2.1
      • getDisabledContextMenuIfs

        public static java.util.List<ContextMenuIf> getDisabledContextMenuIfs()
        Returns a List with all disabled ContextMenuIfs
        Returns:
        disabled ContextMenuIfs
      • getDisabledSubMenuMap

        public static java.util.HashMap<ContextMenuIf,​java.util.HashSet<java.lang.Integer>> getDisabledSubMenuMap()
        Returns:
        A map with the disabled context menu action ids for each ContextMenuIf
        Since:
        3.4.5
      • createRemovedProgramContextMenu

        public javax.swing.JPopupMenu createRemovedProgramContextMenu​(Program program)
      • loadActionMenu

        public static ActionMenu loadActionMenu​(ActionMenu actionMenu,
                                                int actionMenuId)