Class ContextMenu.DefaultContextMenuItemBuilder

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ContextMenuItem createItem​(TransformContext context)
      Creates and populates a ContextMenuItem based on the information in the Shortcut used as defintion.
      ContextMenuItem createItem​(TransformContext context, java.lang.String name)
      Creates and populates a ContextMenuItem based on the information in the Shortcut used as defintion.
      protected Shortcut getDefinition()
      Get the definition of the <@link Shortcut> shortcut object
      java.lang.String getItemKey​(TransformContext context)
      Retrieve the key will be set on the context menu item corresponding to the context input.
      protected java.lang.String getScript​(java.lang.String baseBone, java.lang.String script)
      Adds "microstrategy.bone(id)." to the script if baseBone is not empty and the script doesn't start already with "microstrategy".
      boolean isItemAvailable​(TransformContext context)
      Returns true if the underlying Shortcut used as definition is available (based on the features defined on the <shortcut> xml.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultContextMenuItemBuilder

        public DefaultContextMenuItemBuilder​(Shortcut definition)
        Constructor
        Parameters:
        definition - the definition of the Shortcut object
    • Method Detail

      • isItemAvailable

        public boolean isItemAvailable​(TransformContext context)

        Returns true if the underlying Shortcut used as definition is available (based on the features defined on the <shortcut> xml.

        If this method returns false the context-menu-item should not be included as part of the available options in the menu.

        Specified by:
        isItemAvailable in interface ContextMenuItemBuilder
        Parameters:
        context - TransformContext with context information.
        Returns:
        true if the context-menu-item is available and should be included.
      • getItemKey

        public java.lang.String getItemKey​(TransformContext context)
        Retrieve the key will be set on the context menu item corresponding to the context input. The context menu item generated based on the same context input will have the same key. This method can be called by context menu before calling createItem(TransformContext) to check whether the item already exists in the menu to avoid unnecessary creation.
        Specified by:
        getItemKey in interface ContextMenuItemBuilder
        Parameters:
        context - The context for context menu item creation
        Returns:
        The key for the context menu item if created using the context. By default null will be return, which means build has no knowledge about the item key. Then context menu item may generate the key by itself. For builder who wants avoid unnecessary item creation should take advantage of this method by overriding with a meaningful implementation.
        Since:
        MicroStrategy Web 9.0.0
      • createItem

        public ContextMenuItem createItem​(TransformContext context)
        Creates and populates a ContextMenuItem based on the information in the Shortcut used as defintion.
        Specified by:
        createItem in interface ContextMenuItemBuilder
        Parameters:
        context - TransformContext with context information.
        Returns:
        a new instance of a ContextMenuItem.
      • createItem

        public ContextMenuItem createItem​(TransformContext context,
                                          java.lang.String name)
        Creates and populates a ContextMenuItem based on the information in the Shortcut used as defintion.
        Parameters:
        context - TransformContext with context information.
        name - The name of the context menu item.
        Returns:
        a new instance of a ContextMenuItem.
        Since:
        MicroStrategy Web 9.0.0
      • getDefinition

        protected Shortcut getDefinition()
        Get the definition of the <@link Shortcut> shortcut object
        Returns:
        the shortcut object defintion
      • getScript

        protected java.lang.String getScript​(java.lang.String baseBone,
                                             java.lang.String script)
        Adds "microstrategy.bone(id)." to the script if baseBone is not empty and the script doesn't start already with "microstrategy".
        Parameters:
        baseBone - String the id of the basebone
        script - String the name of the script
        Returns:
        the "microstrategy.bone(id).script" string