Class ContextMenuItem
- java.lang.Object
-
- com.microstrategy.web.app.gui.ContextMenuItem
-
public class ContextMenuItem extends java.lang.ObjectA 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
ContextMenuItemrepresents 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.contextMenusformal 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 thecontextMenusformal parameter.Programatically, users can create instances of a
ContextMenuItemand add them to an existingContextMenu. After creating the new object and before adding it to the correspondingContextMenu, users can control the actions and status of theContextMenuItemby setting properties in this class; once theContextMenuItemhas been appended to theContextMenuthese properties should not be changed.Optionally, for simple cases, a
ContextMenuItemcan be added by simply calling one of theaddItemmethods in theContextMenu.- Since:
- MicroStrategy Web 7.3.1 or earlier
- See Also:
ContextMenu,ContextMenuManager
-
-
Constructor Summary
Constructors Constructor Description ContextMenuItem(java.lang.String name)Class constructor.ContextMenuItem(java.lang.String name, int subtype)Class constructor.ContextMenuItem(java.lang.String name, int subType, java.lang.String subItemsKey)Deprecated.ContextMenuItems who use a subMenu should use thesetSubMenu(com.microstrategy.web.app.gui.ContextMenu)method to associate it.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddSupportedObjectType(java.lang.String objectType)When thisContextMenuItemis 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 thisContextMenuItemis available.voidcheckItem(java.lang.String checkJS)Sets a javascript to be executed before the item gets displayed.voidenableItem(java.lang.String enableJS)Sets a javascript to be executed before the item gets displayed.java.lang.StringgetContextMenuModelID()java.lang.StringgetContextMenuProcessingViewID()intgetDrillDisplayMode()java.lang.StringgetDrillKey()intgetDrillType()booleangetDrillWithin()intgetImageType()Returns the image type associated with thisContextMenuItem.java.lang.StringgetJSCode()Returns the javascript code associated with thisContextMenuItem.java.lang.StringgetKey()Deprecated.This method should only be used internally.java.lang.StringgetName()Returns the name of thisContextMenuItem.protected voidgetScriptOutput(MarkupOutput out)Deprecated.This method should only be used internally.java.lang.StringgetSubItemsKey()Deprecated.This method should only be used internally.ShortcutListElementgetSubItemsList()ContextMenugetSubMenu()If this ContextMenuItem has an associated submenu, this method return the instance of the correspondingContextMenu, otherwise it returns null.java.lang.StringgetSubMenuName()intgetSubType()Return the subtype of thisContextMenuItem.java.lang.StringgetTarget()This method returns the name of the browser's window that will be open when thisContextMenuItemis selected.java.lang.StringgetURL()Returns the URL associated with thisContextMenuItem.booleanisEvalURL()Deprecated.This method should only be used internally.booleanisIFrameEnabled()Returnstrueif thisContextMenuItemaction triggers an iFrame manipulation.voidsetContextMenuModelID(java.lang.String modelID)voidsetContextMenuProcessingViewID(java.lang.String viewID)voidsetDrillDisplayMode(int drillDisplayMode)voidsetDrillKey(java.lang.String drillKey)voidsetDrillType(int drillType)voidsetDrillWithin(boolean drillWithin)voidsetEvalURL(boolean evalURL)Deprecated.This method should only be used internally.voidsetImageType(int newValue)Associates an image with thisContextMenuItem.voidsetIsChecked(boolean checked)Marks this item as selected.voidsetIsDisabled(boolean disabled)Sets this item as disabled.voidsetIsIFrameEnabled(boolean newValue)Determines whether thisContextMenuItemaction will trigger an iFrame manipulation.voidsetJSCode(java.lang.String jsCode)Associates some javascript to be executed when thisContextMenuItemis selected.protected voidsetKey(java.lang.String key)voidsetName(java.lang.String name)Deprecated.The name of theContextMenuItemshould be provided as part of the constructor.voidsetSubItemsList(ShortcutListElement value)voidsetSubMenu(ContextMenu _menu)Sets this item's submenu.voidsetSubMenuName(java.lang.String unitID)voidsetSubType(int subType)Sets the subtype of thisContextMenuItem.voidsetTarget(java.lang.String target)If a URL has been set to thisContextMenuItem, this method can be used to open this URL in a different browser window.voidsetURL(java.lang.String url)Associates a URL (web-address) with thisContextMenuItem.voidshowItem(java.lang.String showJS)Sets a javascript to be executed before the item gets displayed.
-
-
-
Constructor Detail
-
ContextMenuItem
public ContextMenuItem(java.lang.String name)
Class constructor. Initializes a newContextMenuIteminstance 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 newContextMenuIteminstance 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 theEnumContextMenuItemsenumeration.
-
ContextMenuItem
@Deprecated public ContextMenuItem(java.lang.String name, int subType, java.lang.String subItemsKey)Deprecated.ContextMenuItems who use a subMenu should use thesetSubMenu(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 fromEnumContextMenuItems.subItemsKey- key identifier of theContextMenucontaining the subMenu associated with this Context Menu Item.
-
-
Method Detail
-
getScriptOutput
@Deprecated 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 thisContextMenuItem.
-
getSubItemsKey
@Deprecated 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 thisContextMenuItemis selected.- See Also:
setTarget(java.lang.String)
-
setTarget
public void setTarget(java.lang.String target)
If a URL has been set to thisContextMenuItem, 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 thisContextMenuItem.- See Also:
setImageType(int)
-
setImageType
public void setImageType(int newValue)
Associates an image with thisContextMenuItem. Available image types are those defined in theEnumMenuImagesenumeration.
-
getSubType
public int getSubType()
Return the subtype of thisContextMenuItem.- See Also:
setSubType(int)
-
setSubType
public void setSubType(int subType)
Sets the subtype of thisContextMenuItem. Available subtypes are those defined in theEnumContextMenuItemsenumeration
-
getURL
public java.lang.String getURL()
Returns the URL associated with thisContextMenuItem.- See Also:
setURL(java.lang.String)
-
setURL
public void setURL(java.lang.String url)
Associates a URL (web-address) with thisContextMenuItem. When a URL gets associated, this URL will be open when the users selects thisContextMenuItem.
Notice that this parameter will be ignored if a javascript has also been associated with thisContextMenuItemthrough thesetJSCode(java.lang.String), as the javascript will take precedence over the URL.
-
getName
public java.lang.String getName()
Returns the name of thisContextMenuItem. Notice the name actually corresponds to the text displayed to the end user.
-
setName
@Deprecated public void setName(java.lang.String name)
Deprecated.The name of theContextMenuItemshould be provided as part of the constructor.Set the name for theContextMenuItem.
-
getJSCode
public java.lang.String getJSCode()
Returns the javascript code associated with thisContextMenuItem.- See Also:
setJSCode(java.lang.String)
-
setJSCode
public void setJSCode(java.lang.String jsCode)
Associates some javascript to be executed when thisContextMenuItemis selected.
-
isEvalURL
@Deprecated 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:
trueif the URL will be treated as Javascript Code.- See Also:
setEvalURL(boolean)
-
setEvalURL
@Deprecated 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. Whenfalse, the URL will be enclosed in quotes (i.e. treat it as a string) and whentrueit's not (i.e. treat it as javascript code).
-
isIFrameEnabled
public boolean isIFrameEnabled()
Returnstrueif thisContextMenuItemaction triggers an iFrame manipulation.
-
setIsIFrameEnabled
public void setIsIFrameEnabled(boolean newValue)
Determines whether thisContextMenuItemaction will trigger an iFrame manipulation.
-
addSupportedObjectType
public void addSupportedObjectType(java.lang.String objectType)
When thisContextMenuItemis 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 thisContextMenuItemis 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
@Deprecated 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 correspondingContextMenu, 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 thisContextMenuItem- 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
-
-