public class

ContextMenuItem

extends Object
java.lang.Object
   ↳ com.microstrategy.web.app.gui.ContextMenuItem

Class Overview

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 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.

Summary

Public Constructors
ContextMenuItem(String name)
Class constructor.
ContextMenuItem(String name, int subtype)
Class constructor.
ContextMenuItem(String name, int subType, String subItemsKey)
This constructor is deprecated. ContextMenuItems who use a subMenu should use the setSubMenu(ContextMenu) method to associate it.
Public Methods
void addSupportedObjectType(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(String checkJS)
Sets a javascript to be executed before the item gets displayed.
void enableItem(String enableJS)
Sets a javascript to be executed before the item gets displayed.
String getContextMenuModelID()
String getContextMenuProcessingViewID()
int getDrillDisplayMode()
String getDrillKey()
int getDrillType()
boolean getDrillWithin()
int getImageType()
Returns the image type associated with this ContextMenuItem.
String getJSCode()
Returns the javascript code associated with this ContextMenuItem.
String getKey()
This method is deprecated. This method should only be used internally. It will be marked as private in future versions.
String getName()
Returns the name of this ContextMenuItem.
String getSubItemsKey()
This method is deprecated. This method should only be used internally. It will be marked as private in future versions.
ShortcutListElement getSubItemsList()
ContextMenu getSubMenu()
If this ContextMenuItem has an associated submenu, this method return the instance of the corresponding ContextMenu, otherwise it returns null.
String getSubMenuName()
int getSubType()
Return the subtype of this ContextMenuItem.
String getTarget()
This method returns the name of the browser's window that will be open when this ContextMenuItem is selected.
String getURL()
Returns the URL associated with this ContextMenuItem.
boolean isEvalURL()
This method is deprecated. This method should only be used internally. It will be marked as private in future versions.
boolean isIFrameEnabled()
Returns true if this ContextMenuItem action triggers an iFrame manipulation.
void setContextMenuModelID(String modelID)
void setContextMenuProcessingViewID(String viewID)
void setDrillDisplayMode(int drillDisplayMode)
void setDrillKey(String drillKey)
void setDrillType(int drillType)
void setDrillWithin(boolean drillWithin)
void setEvalURL(boolean evalURL)
This method is deprecated. This method should only be used internally. It will be marked as private in future versions.
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(String jsCode)
Associates some javascript to be executed when this ContextMenuItem is selected.
void setName(String name)
This method is 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(String unitID)
void setSubType(int subType)
Sets the subtype of this ContextMenuItem.
void setTarget(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(String url)
Associates a URL (web-address) with this ContextMenuItem.
void showItem(String showJS)
Sets a javascript to be executed before the item gets displayed.
Protected Methods
void getScriptOutput(MarkupOutput out)
This method is deprecated. This method should only be used internally. It will be marked as private in future versions.
void setKey(String key)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ContextMenuItem (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.

public ContextMenuItem (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.

public ContextMenuItem (String name, int subType, String subItemsKey)

This constructor is deprecated.
ContextMenuItems who use a subMenu should use the setSubMenu(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.

Public Methods

public void addSupportedObjectType (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.

public void checkItem (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).

public void enableItem (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).

public String getContextMenuModelID ()

public String getContextMenuProcessingViewID ()

public int getDrillDisplayMode ()

public String getDrillKey ()

public int getDrillType ()

public boolean getDrillWithin ()

public int getImageType ()

Returns the image type associated with this ContextMenuItem.

public String getJSCode ()

Returns the javascript code associated with this ContextMenuItem.

public String getKey ()

This method is 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.

public String getName ()

Returns the name of this ContextMenuItem. Notice the name actually corresponds to the text displayed to the end user.

public String getSubItemsKey ()

This method is deprecated.
This method should only be used internally. It will be marked as private in future versions.

Returns the key of the subitems.

public ShortcutListElement getSubItemsList ()

public ContextMenu getSubMenu ()

If this ContextMenuItem has an associated submenu, this method return the instance of the corresponding ContextMenu, otherwise it returns null.

public String getSubMenuName ()

public int getSubType ()

Return the subtype of this ContextMenuItem.

See Also

public String getTarget ()

This method returns the name of the browser's window that will be open when this ContextMenuItem is selected.

public String getURL ()

Returns the URL associated with this ContextMenuItem.

See Also

public boolean isEvalURL ()

This method is 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.

public boolean isIFrameEnabled ()

Returns true if this ContextMenuItem action triggers an iFrame manipulation.

public void setContextMenuModelID (String modelID)

public void setContextMenuProcessingViewID (String viewID)

public void setDrillDisplayMode (int drillDisplayMode)

public void setDrillKey (String drillKey)

public void setDrillType (int drillType)

public void setDrillWithin (boolean drillWithin)

public void setEvalURL (boolean evalURL)

This method is 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).

public void setImageType (int newValue)

Associates an image with this ContextMenuItem. Available image types are those defined in the EnumMenuImages enumeration.

public void setIsChecked (boolean checked)

Marks this item as selected. When selected, a checkbox image is displayed along with this item.

public void setIsDisabled (boolean disabled)

Sets this item as disabled. When disabled, the item still gets displayed but the user cannot select it.

public void setIsIFrameEnabled (boolean newValue)

Determines whether this ContextMenuItem action will trigger an iFrame manipulation.

public void setJSCode (String jsCode)

Associates some javascript to be executed when this ContextMenuItem is selected.

public void setName (String name)

This method is deprecated.
The name of the ContextMenuItem should be provided as part of the constructor.

Set the name for the ContextMenuItem.

public void setSubItemsList (ShortcutListElement value)

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

public void setSubMenuName (String unitID)

public void setSubType (int subType)

Sets the subtype of this ContextMenuItem. Available subtypes are those defined in the EnumContextMenuItems enumeration

public void setTarget (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.

public void setURL (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(String), as the javascript will take precedence over the URL.

public void showItem (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.

Protected Methods

protected void getScriptOutput (MarkupOutput out)

This method is deprecated.
This method should only be used internally. It will be marked as private in future versions.

Returns the javascript information of this ContextMenuItem.

protected void setKey (String key)