Class ContextMenuItem


  • public class ContextMenuItem
    extends java.lang.Object

    A context menu is displayed when the end user makes click using the right mouse button on an element in the interface; the menu displays a list with different actions associated with that element. A ContextMenuItem represents a single option of such a context menu.

    Context menus can and should be configured using external xml files. All Microstrategy Web transforms that display context-menus have their AbstractAppTransform.contextMenus formal parameter assigned in the style catalog. Even those transforms that display no context menus out of the box can be configured to display them simply by creating a new xml definition file and setting the contextMenus formal parameter.

    Programatically, users can create instances of a ContextMenuItem and add them to an existing ContextMenu. After creating the new object and before adding it to the corresponding ContextMenu, users can control the actions and status of the ContextMenuItem by setting properties in this class; once the ContextMenuItem has been appended to the ContextMenu these properties should not be changed.

    Optionally, for simple cases, a ContextMenuItem can be added by simply calling one of the addItem methods in the ContextMenu.

    Since:
    MicroStrategy Web 7.3.1 or earlier
    See Also:
    ContextMenu, ContextMenuManager
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addSupportedObjectType​(java.lang.String objectType)
      When this ContextMenuItem is used in the context where the user can select multiple objects using javascript (for example, in report services documents), this method can be used to indicate those object types for which this ContextMenuItem is available.
      void checkItem​(java.lang.String checkJS)
      Sets a javascript to be executed before the item gets displayed.
      void enableItem​(java.lang.String enableJS)
      Sets a javascript to be executed before the item gets displayed.
      java.lang.String getContextMenuModelID()  
      java.lang.String getContextMenuProcessingViewID()  
      int getDrillDisplayMode()  
      java.lang.String getDrillKey()  
      int getDrillType()  
      boolean getDrillWithin()  
      int getImageType()
      Returns the image type associated with this ContextMenuItem.
      java.lang.String getJSCode()
      Returns the javascript code associated with this ContextMenuItem.
      java.lang.String getKey()
      Deprecated.
      This method should only be used internally.
      java.lang.String getName()
      Returns the name of this ContextMenuItem.
      protected void getScriptOutput​(MarkupOutput out)
      Deprecated.
      This method should only be used internally.
      java.lang.String getSubItemsKey()
      Deprecated.
      This method should only be used internally.
      ShortcutListElement getSubItemsList()  
      ContextMenu getSubMenu()
      If this ContextMenuItem has an associated submenu, this method return the instance of the corresponding ContextMenu, otherwise it returns null.
      java.lang.String getSubMenuName()  
      int getSubType()
      Return the subtype of this ContextMenuItem.
      java.lang.String getTarget()
      This method returns the name of the browser's window that will be open when this ContextMenuItem is selected.
      java.lang.String getURL()
      Returns the URL associated with this ContextMenuItem.
      boolean isEvalURL()
      Deprecated.
      This method should only be used internally.
      boolean isIFrameEnabled()
      Returns true if this ContextMenuItem action triggers an iFrame manipulation.
      void setContextMenuModelID​(java.lang.String modelID)  
      void setContextMenuProcessingViewID​(java.lang.String viewID)  
      void setDrillDisplayMode​(int drillDisplayMode)  
      void setDrillKey​(java.lang.String drillKey)  
      void setDrillType​(int drillType)  
      void setDrillWithin​(boolean drillWithin)  
      void setEvalURL​(boolean evalURL)
      Deprecated.
      This method should only be used internally.
      void setImageType​(int newValue)
      Associates an image with this ContextMenuItem.
      void setIsChecked​(boolean checked)
      Marks this item as selected.
      void setIsDisabled​(boolean disabled)
      Sets this item as disabled.
      void setIsIFrameEnabled​(boolean newValue)
      Determines whether this ContextMenuItem action will trigger an iFrame manipulation.
      void setJSCode​(java.lang.String jsCode)
      Associates some javascript to be executed when this ContextMenuItem is selected.
      protected void setKey​(java.lang.String key)  
      void setName​(java.lang.String name)
      Deprecated.
      The name of the ContextMenuItem should be provided as part of the constructor.
      void setSubItemsList​(ShortcutListElement value)  
      void setSubMenu​(ContextMenu _menu)
      Sets this item's submenu.
      void setSubMenuName​(java.lang.String unitID)  
      void setSubType​(int subType)
      Sets the subtype of this ContextMenuItem.
      void setTarget​(java.lang.String target)
      If a URL has been set to this ContextMenuItem, this method can be used to open this URL in a different browser window.
      void setURL​(java.lang.String url)
      Associates a URL (web-address) with this ContextMenuItem.
      void showItem​(java.lang.String showJS)
      Sets a javascript to be executed before the item gets displayed.
      • Methods inherited from class java.lang.Object

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

      • ContextMenuItem

        public ContextMenuItem​(java.lang.String name)
        Class constructor. Initializes a new ContextMenuItem instance with the given name. Notice the name actually represents the text displayed to the user.
        Parameters:
        name - the text to display for this option.
      • ContextMenuItem

        public ContextMenuItem​(java.lang.String name,
                               int subtype)
        Class constructor. Initializes a new ContextMenuItem instance with the given name and sub-type. Notice the name actually represents the text displayed to the user.
        Parameters:
        name - the text to display for this option.
        subtype - a value from the EnumContextMenuItems enumeration.
      • ContextMenuItem

        public ContextMenuItem​(java.lang.String name,
                               int subType,
                               java.lang.String subItemsKey)
        Deprecated.
        ContextMenuItems who use a subMenu should use the setSubMenu(com.microstrategy.web.app.gui.ContextMenu) method to associate it.
        Class constructor. Initializes a new instance of the ContextMenuItem class with the information given as parameters. In this case it will create a Contect Menu item with the specified name, item sub type and item sub key.
        Parameters:
        name - the text to display for this option.
        subType - item subtype from EnumContextMenuItems.
        subItemsKey - key identifier of the ContextMenu containing the subMenu associated with this Context Menu Item.
    • Method Detail

      • getScriptOutput

        protected void getScriptOutput​(MarkupOutput out)
        Deprecated.
        This method should only be used internally. It will be marked as private in future versions.
        Returns the javascript information of this ContextMenuItem.
      • getSubItemsKey

        public java.lang.String getSubItemsKey()
        Deprecated.
        This method should only be used internally. It will be marked as private in future versions.
        Returns the key of the subitems.
      • getTarget

        public java.lang.String getTarget()
        This method returns the name of the browser's window that will be open when this ContextMenuItem is selected.
        See Also:
        setTarget(java.lang.String)
      • setTarget

        public void setTarget​(java.lang.String target)
        If a URL has been set to this ContextMenuItem, this method can be used to open this URL in a different browser window. Typically, a browser will open a new window if there is no window defined for the given name.
        Parameters:
        target - The name of target window.
      • getImageType

        public int getImageType()
        Returns the image type associated with this ContextMenuItem.
        See Also:
        setImageType(int)
      • setImageType

        public void setImageType​(int newValue)
        Associates an image with this ContextMenuItem. Available image types are those defined in the EnumMenuImages enumeration.
      • getSubType

        public int getSubType()
        Return the subtype of this ContextMenuItem.
        See Also:
        setSubType(int)
      • setSubType

        public void setSubType​(int subType)
        Sets the subtype of this ContextMenuItem. Available subtypes are those defined in the EnumContextMenuItems enumeration
      • getURL

        public java.lang.String getURL()
        Returns the URL associated with this ContextMenuItem.
        See Also:
        setURL(java.lang.String)
      • setURL

        public void setURL​(java.lang.String url)
        Associates a URL (web-address) with this ContextMenuItem. When a URL gets associated, this URL will be open when the users selects this ContextMenuItem.
        Notice that this parameter will be ignored if a javascript has also been associated with this ContextMenuItem through the setJSCode(java.lang.String), as the javascript will take precedence over the URL.
      • getName

        public java.lang.String getName()
        Returns the name of this ContextMenuItem. Notice the name actually corresponds to the text displayed to the end user.
      • setName

        public void setName​(java.lang.String name)
        Deprecated.
        The name of the ContextMenuItem should be provided as part of the constructor.
        Set the name for the ContextMenuItem.
      • getJSCode

        public java.lang.String getJSCode()
        Returns the javascript code associated with this ContextMenuItem.
        See Also:
        setJSCode(java.lang.String)
      • setJSCode

        public void setJSCode​(java.lang.String jsCode)
        Associates some javascript to be executed when this ContextMenuItem is selected.
      • isEvalURL

        public boolean isEvalURL()
        Deprecated.
        This method should only be used internally. It will be marked as private in future versions.
        Determine if the URL should be enclosed in quotes (i.e. treat it as a string) or not (i.e. treat it as javascript code).
        Returns:
        true if the URL will be treated as Javascript Code.
        See Also:
        setEvalURL(boolean)
      • setEvalURL

        public void setEvalURL​(boolean evalURL)
        Deprecated.
        This method should only be used internally. It will be marked as private in future versions.
        Set whether to evaluate the URL as javascript code. When false, the URL will be enclosed in quotes (i.e. treat it as a string) and when true it's not (i.e. treat it as javascript code).
      • isIFrameEnabled

        public boolean isIFrameEnabled()
        Returns true if this ContextMenuItem action triggers an iFrame manipulation.
      • setIsIFrameEnabled

        public void setIsIFrameEnabled​(boolean newValue)
        Determines whether this ContextMenuItem action will trigger an iFrame manipulation.
      • addSupportedObjectType

        public void addSupportedObjectType​(java.lang.String objectType)
        When this ContextMenuItem is used in the context where the user can select multiple objects using javascript (for example, in report services documents), this method can be used to indicate those object types for which this ContextMenuItem is available.
        Since:
        MicroStrategy Web 8.0.0
      • showItem

        public void showItem​(java.lang.String showJS)
        Sets a javascript to be executed before the item gets displayed. If the javacript function returns false, the item will not be displayed.
        Since:
        MicroStrategy Web 8.0.0
      • checkItem

        public void checkItem​(java.lang.String checkJS)
        Sets a javascript to be executed before the item gets displayed. This item will then appeared as selected (will have a checkbox) or not depending on the result value of the function (selected=true; not-selected otherwise).
        Since:
        MicroStrategy Web 8.0.0
      • enableItem

        public void enableItem​(java.lang.String enableJS)
        Sets a javascript to be executed before the item gets displayed. This item will then be enabled (i.e. it can be selected by the user) based on the result value of the function (enabled=true; disabled otherwise).
        Since:
        MicroStrategy Web 8.0.0
      • setIsDisabled

        public void setIsDisabled​(boolean disabled)
        Sets this item as disabled. When disabled, the item still gets displayed but the user cannot select it.
        Since:
        MicroStrategy Web 8.0.0
      • setIsChecked

        public void setIsChecked​(boolean checked)
        Marks this item as selected. When selected, a checkbox image is displayed along with this item.
        Since:
        MicroStrategy Web 8.0.1
      • getKey

        public java.lang.String getKey()
        Deprecated.
        This method should only be used internally. It will be marked as private in future versions.
        Returns the internal key used to identify this item.
        Since:
        MicroStrategy Web 8.0.0
      • setKey

        protected void setKey​(java.lang.String key)
        Since:
        MicroStrategy Web 9.0.0
      • getSubMenu

        public ContextMenu getSubMenu()
        If this ContextMenuItem has an associated submenu, this method return the instance of the corresponding ContextMenu, otherwise it returns null.
        Since:
        MicroStrategy Web 8.0.1
      • setSubMenu

        public void setSubMenu​(ContextMenu _menu)
        Sets this item's submenu. When a non-null submenu gets associates, it is displayed when the user selects this ContextMenuItem
        Since:
        MicroStrategy Web 8.0.1
      • setSubItemsList

        public void setSubItemsList​(ShortcutListElement value)
        Since:
        MicroStrategy Web 9.0.0
      • getSubItemsList

        public ShortcutListElement getSubItemsList()
        Since:
        MicroStrategy Web 9.0.0
      • getContextMenuModelID

        public java.lang.String getContextMenuModelID()
        Since:
        MicroStrategy Web 9.0.0
      • setContextMenuModelID

        public void setContextMenuModelID​(java.lang.String modelID)
        Since:
        MicroStrategy Web 9.0.0
      • getSubMenuName

        public java.lang.String getSubMenuName()
        Since:
        MicroStrategy Web 9.0.0
      • setSubMenuName

        public void setSubMenuName​(java.lang.String unitID)
        Since:
        MicroStrategy Web 9.0.0
      • getContextMenuProcessingViewID

        public java.lang.String getContextMenuProcessingViewID()
        Since:
        MicroStrategy Web 9.0.0
      • setContextMenuProcessingViewID

        public void setContextMenuProcessingViewID​(java.lang.String viewID)
        Since:
        MicroStrategy Web 9.0.0
      • getDrillKey

        public java.lang.String getDrillKey()
        Since:
        MicroStrategy Web 10.3.0
      • setDrillKey

        public void setDrillKey​(java.lang.String drillKey)
        Since:
        MicroStrategy Web 10.3.0
      • getDrillWithin

        public boolean getDrillWithin()
        Since:
        MicroStrategy Web 10.3.0
      • setDrillWithin

        public void setDrillWithin​(boolean drillWithin)
        Since:
        MicroStrategy Web 10.3.0
      • getDrillDisplayMode

        public int getDrillDisplayMode()
        Since:
        MicroStrategy Web 10.3.0
      • setDrillDisplayMode

        public void setDrillDisplayMode​(int drillDisplayMode)
        Since:
        MicroStrategy Web 10.3.0
      • getDrillType

        public int getDrillType()
        Since:
        MicroStrategy Web 10.3.0
      • setDrillType

        public void setDrillType​(int drillType)
        Since:
        MicroStrategy Web 10.3.0