Class ContextMenuItem
- java.lang.Object
-
- com.microstrategy.web.app.gui.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 thecontextMenus
formal parameter.Programatically, users can create instances of a
ContextMenuItem
and 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 theContextMenuItem
by setting properties in this class; once theContextMenuItem
has been appended to theContextMenu
these properties should not be changed.Optionally, for simple cases, a
ContextMenuItem
can be added by simply calling one of theaddItem
methods 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 void
addSupportedObjectType(java.lang.String objectType)
When thisContextMenuItem
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 thisContextMenuItem
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 thisContextMenuItem
.java.lang.String
getJSCode()
Returns the javascript code associated with thisContextMenuItem
.java.lang.String
getKey()
Deprecated.This method should only be used internally.java.lang.String
getName()
Returns the name of thisContextMenuItem
.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 correspondingContextMenu
, otherwise it returns null.java.lang.String
getSubMenuName()
int
getSubType()
Return the subtype of thisContextMenuItem
.java.lang.String
getTarget()
This method returns the name of the browser's window that will be open when thisContextMenuItem
is selected.java.lang.String
getURL()
Returns the URL associated with thisContextMenuItem
.boolean
isEvalURL()
Deprecated.This method should only be used internally.boolean
isIFrameEnabled()
Returnstrue
if thisContextMenuItem
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 thisContextMenuItem
.void
setIsChecked(boolean checked)
Marks this item as selected.void
setIsDisabled(boolean disabled)
Sets this item as disabled.void
setIsIFrameEnabled(boolean newValue)
Determines whether thisContextMenuItem
action will trigger an iFrame manipulation.void
setJSCode(java.lang.String jsCode)
Associates some javascript to be executed when thisContextMenuItem
is selected.protected void
setKey(java.lang.String key)
void
setName(java.lang.String name)
Deprecated.The name of theContextMenuItem
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 thisContextMenuItem
.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.void
setURL(java.lang.String url)
Associates a URL (web-address) with thisContextMenuItem
.void
showItem(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 newContextMenuItem
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 newContextMenuItem
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 theEnumContextMenuItems
enumeration.
-
ContextMenuItem
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 theContextMenu
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 thisContextMenuItem
.
-
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 thisContextMenuItem
is 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 theEnumMenuImages
enumeration.
-
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 theEnumContextMenuItems
enumeration
-
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 thisContextMenuItem
through 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
public void setName(java.lang.String name)
Deprecated.The name of theContextMenuItem
should 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 thisContextMenuItem
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. Whenfalse
, the URL will be enclosed in quotes (i.e. treat it as a string) and whentrue
it's not (i.e. treat it as javascript code).
-
isIFrameEnabled
public boolean isIFrameEnabled()
Returnstrue
if thisContextMenuItem
action triggers an iFrame manipulation.
-
setIsIFrameEnabled
public void setIsIFrameEnabled(boolean newValue)
Determines whether thisContextMenuItem
action will trigger an iFrame manipulation.
-
addSupportedObjectType
public void addSupportedObjectType(java.lang.String objectType)
When thisContextMenuItem
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 thisContextMenuItem
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 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
-
-