Class ContextMenu
- java.lang.Object
 - 
- com.microstrategy.web.app.gui.ContextMenu
 
 
- 
public class ContextMenu extends java.lang.ObjectA
ContextMenuis 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
ContextMenuis basically a collection ofContextMenuItemobjects. EachContextMenuItemrepresents a single option to the end user.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.Optionally, a
ContextMenucan be populated programatically using one of the severaladdItemmethods it exposes. Once populated, theContextMenushould be attached to the corresponding HTML tag by calling theattachTo(com.microstrategy.web.tags.Tag)method or by appending the necessary attributes returned by thegetTriggerString()- Since:
 - MicroStrategy Web 7.3.1 or earlier
 - See Also:
 ContextMenuManager
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classContextMenu.DefaultContextMenuItemBuilderThis class is the default implementation of aContextMenuItemBuilder. 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringATT_FOR_CONTEXT_MENU_INDICESstatic java.lang.StringATT_FOR_CONTEXT_MENU_MANAGER_IDstatic intTRIGGER_ITEMFrom the attributes necessary to trigger the display of theContextMenu, this represents the id of this context-menu.static intTRIGGER_MENUFrom the attributes necessary to trigger the display of theContextMenu, this represents the name of theContextMenuManager. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ContextMenuItemaddItem(ContextMenuItem item)Adds an existingContextMenuIteminstance to the list of options available in thisContextMenu.ContextMenuItemaddItem(java.lang.String name)Deprecated.this method may cause context menus to break due to an optimization that finds duplicated menu items, please useaddItem(ContextMenuItem item)ContextMenuItemaddItem(java.lang.String name, ContextMenu submenu)Adds a newContextMenuItemwith the given name, and sets the givenContextMenuas its subMenu; this sub-menu will automatically be displayed when the item is selected.ContextMenuItemaddItem(java.lang.String name, java.lang.String url)Adds a newContextMenuItemwith the given name and sets its action to be to open the given URL.ContextMenuItemaddItem(java.lang.String name, java.lang.String jsSubmitFunction, java.lang.String jsParameters)Adds a newContextMenuItemwith the given name and sets its action to be to execute the given javascript function using the corresponding parameters.voidaddSeparator()Adds a new separator item to theContextMenu.voidaddTagAttributes(java.util.Map<java.lang.String,java.lang.String> atts)Adds to the givenMap(name/value pairs) all attributes required in an HTML Tag to trigger the display of the context-menu.voidaddTagAttributes(java.util.Map<java.lang.String,java.lang.String> atts, int infoFlag)Appends to the given Map those attributes required in an HTML Tag to trigger the display of the context-menu.voidattachTo(Tag tag)Appends to the HTMLTagall those attributes required to trigger the display of the context-menu.voidattachTo(Tag tag, int infoFlag)Appends to the HTMLTagthose attributes required to trigger the display of the context-menu.static java.util.Map<java.lang.String,java.lang.String>getEmptyTagAttributes()protected intgetID()Deprecated.This method should only be used internally.java.lang.StringgetKey()Deprecated.This method should only be used internally.java.lang.StringgetManagerName()Returns the name of the Context Menu Manager to whom this ContextMenu is associated.java.lang.StringgetMenuIndicesAttribute()intgetMenuSize()Returns the number of current menu-items in this context-menu.java.lang.StringgetName()Returns the name of thisContextMenu.protected intgetParentID()Deprecated.This method should only be used internally.java.util.Map<java.lang.String,java.lang.String>getTagAttributes()Returns aMap(name/value pairs) of all attributes required to append into an HTML Tag to trigger the display of the context-menu.java.util.Map<java.lang.String,java.lang.String>getTagAttributes(int infoFlag)Returns aMap(name/value pairs) of those attributes required to append into an HTML Tag to trigger the display of the context-menu.MarkupOutputgetTriggerOutput()Deprecated.java.lang.StringgetTriggerString()Returns aStringobject with all the attributes that should be used inside an HTML tag to trigger the display of the context-menu.java.lang.StringgetTriggerString(int infoFlag)Returns aStringobject with those attributes that should be used inside an HTML tag to trigger the display of the context-menu.protected voidsetID(int ID)Deprecated.This method should only be used internally.voidsetManagerName(java.lang.String newValue)Deprecated.This method should only be used internally.voidsetName(java.lang.String name)Deprecated.The name of theContextMenushould be provided as part of the constructor.protected voidsetParentID(int parentID)Deprecated.This method should only be used internally.voidstartGroup()After calling this method, thisContextMenuwill append a separator when a newContextMenuItemis added. 
 - 
 
- 
- 
Field Detail
- 
ATT_FOR_CONTEXT_MENU_INDICES
public static final java.lang.String ATT_FOR_CONTEXT_MENU_INDICES
- Since:
 - MicroStrategy Web 9.0.1
 - See Also:
 - Constant Field Values
 
 
- 
ATT_FOR_CONTEXT_MENU_MANAGER_ID
public static final java.lang.String ATT_FOR_CONTEXT_MENU_MANAGER_ID
- Since:
 - MicroStrategy Web 9.0.1
 - See Also:
 - Constant Field Values
 
 
- 
TRIGGER_ITEM
public static final int TRIGGER_ITEM
From the attributes necessary to trigger the display of theContextMenu, this represents the id of this context-menu.- Since:
 - MicroStrategy Web 8.0.0
 - See Also:
 - Constant Field Values
 
 
- 
TRIGGER_MENU
public static final int TRIGGER_MENU
From the attributes necessary to trigger the display of theContextMenu, this represents the name of theContextMenuManager.- Since:
 - MicroStrategy Web 8.0.0
 - See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
addItem
public ContextMenuItem addItem(ContextMenuItem item)
Adds an existingContextMenuIteminstance to the list of options available in thisContextMenu.- Parameters:
 item- TheContextMenuItemto be added.- Returns:
 - The same 
ContextMenuItem 
 
- 
addItem
public ContextMenuItem addItem(java.lang.String name)
Deprecated.this method may cause context menus to break due to an optimization that finds duplicated menu items, please useaddItem(ContextMenuItem item)Adds a newContextMenuItemwith the specified name to the ContextMenu.- Parameters:
 name- Name of the newContextMenuItemto be added.- Returns:
 - The new 
ContextMenuIteminstance added. 
 
- 
addItem
public ContextMenuItem addItem(java.lang.String name, java.lang.String url)
Adds a newContextMenuItemwith the given name and sets its action to be to open the given URL. It is equivalent to:ContextMenuItem item = new ContextMenuItem(name); item.setURL(url); addItem(item);
- Parameters:
 name- name of the new item to be added.url- URL to be associatied with the item. If the Item is clicked by the user, she will be redirected to such location.- Returns:
 - The new 
ContextMenuIteminstance added. 
 
- 
addItem
public ContextMenuItem addItem(java.lang.String name, java.lang.String jsSubmitFunction, java.lang.String jsParameters)
Adds a newContextMenuItemwith the given name and sets its action to be to execute the given javascript function using the corresponding parameters. It is equivalent to:ContextMenuItem item = new ContextMenuItem(name); item.setJSCode(jsSubmitFunction + "(" + jsParameters + ");"); addItem(item);- Parameters:
 name- name of the new item to be addedjsSubmitFunction- Name of the javascript function to executejsParameters- String with the list of the paramters required by the javascript function.- Returns:
 - the ContextMenuItem instance added.
 
 
- 
addSeparator
public void addSeparator()
Adds a new separator item to theContextMenu. A separator is identified in the collection ofContextMenuItemchildren as those whose name is "-". 
- 
addItem
public ContextMenuItem addItem(java.lang.String name, ContextMenu submenu)
Adds a newContextMenuItemwith the given name, and sets the givenContextMenuas its subMenu; this sub-menu will automatically be displayed when the item is selected. This method is equivalent to calling:ContextMenuItem item = new ContextMenuItem(name); item.setSubMenu(submenu); addItem(item);
- Parameters:
 name- name of the new item to be added.submenu-ContextMenucontaining the submenu items of the current ContextMenu.- Returns:
 - The ContextMenuItem
 
 
- 
setID
protected void setID(int ID)
Deprecated.This method should only be used internally. It will be marked as private in future versions.Sets the id of this menu. 
- 
getID
protected int getID()
Deprecated.This method should only be used internally. It will be marked as private in future versions.Returns the ID of thisContextMenu 
- 
setParentID
protected void setParentID(int parentID)
Deprecated.This method should only be used internally. It will be marked as private in future versions.Used by thoseContextMenuobjects which are actually submenus, to know the ID of their parent menu. 
- 
getParentID
protected int getParentID()
Deprecated.This method should only be used internally. It will be marked as private in future versions.For thoseContextMenuobjects that are actually submenus, return the ID of their parentContextMenu. 
- 
getTriggerOutput
public MarkupOutput getTriggerOutput()
Deprecated.Returns a newMarkupOutputobject with the attributes that should be used inside an HTML tag to trigger the display of the context-menu. 
- 
getTriggerString
public java.lang.String getTriggerString()
Returns aStringobject with all the attributes that should be used inside an HTML tag to trigger the display of the context-menu. 
- 
getTriggerString
public java.lang.String getTriggerString(int infoFlag)
Returns aStringobject with those attributes that should be used inside an HTML tag to trigger the display of the context-menu. TheinfoFlagparameter receives a flagged enumeration specifying what information should be included. Possible values:- Since:
 - MicroStrategy Web 8.0.0
 
 
- 
attachTo
public void attachTo(Tag tag)
Appends to the HTMLTagall those attributes required to trigger the display of the context-menu.- Since:
 - MicroStrategy Web 8.0.0
 
 
- 
attachTo
public void attachTo(Tag tag, int infoFlag)
Appends to the HTMLTagthose attributes required to trigger the display of the context-menu.
TheinfoFlagparameter receives a flagged enumeration specifying what information should be included. Possible values:- Since:
 - MicroStrategy Web 8.0.0
 
 
- 
getTagAttributes
public java.util.Map<java.lang.String,java.lang.String> getTagAttributes()
Returns aMap(name/value pairs) of all attributes required to append into an HTML Tag to trigger the display of the context-menu.- Since:
 - MicroStrategy Web 8.0.0
 
 
- 
getTagAttributes
public java.util.Map<java.lang.String,java.lang.String> getTagAttributes(int infoFlag)
Returns aMap(name/value pairs) of those attributes required to append into an HTML Tag to trigger the display of the context-menu. TheinfoFlagparameter receives a flagged enumeration specifying what information should be included. Possible values:- Since:
 - MicroStrategy Web 8.0.0
 
 
- 
getEmptyTagAttributes
public static java.util.Map<java.lang.String,java.lang.String> getEmptyTagAttributes()
- Since:
 - MicroStrategy Web 9.0.1
 
 
- 
addTagAttributes
public void addTagAttributes(java.util.Map<java.lang.String,java.lang.String> atts)
Adds to the givenMap(name/value pairs) all attributes required in an HTML Tag to trigger the display of the context-menu.- Since:
 - MicroStrategy Web 8.1.0
 
 
- 
addTagAttributes
public void addTagAttributes(java.util.Map<java.lang.String,java.lang.String> atts, int infoFlag)Appends to the given Map those attributes required in an HTML Tag to trigger the display of the context-menu. TheinfoFlagparameter receives a flagged enumeration specifying what information should be included. Possible values:- Since:
 - MicroStrategy Web 8.1.0
 
 
- 
getMenuIndicesAttribute
public java.lang.String getMenuIndicesAttribute()
- Since:
 - MicroStrategy Web 9.0.1
 
 
- 
startGroup
public void startGroup()
After calling this method, thisContextMenuwill append a separator when a newContextMenuItemis added.- Since:
 - MicroStrategy Web 8.0.0
 
 
- 
getKey
public java.lang.String getKey()
Deprecated.This method should only be used internally. It will be marked as private in future versions.Returns aStringwith the key identifier of this ContextMenu.- Returns:
 - String object.
 
 
- 
setName
public void setName(java.lang.String name)
Deprecated.The name of theContextMenushould be provided as part of the constructor.Sets the name of thisContextMenu.- Since:
 - MicroStrategy Web 8.0.0
 
 
- 
getName
public java.lang.String getName()
Returns the name of thisContextMenu.- Since:
 - MicroStrategy Web 8.0.0
 
 
- 
setManagerName
public void setManagerName(java.lang.String newValue)
Deprecated.This method should only be used internally. It will be marked as private in future versions.Sets the name of the Context Menu Manager. 
- 
getManagerName
public java.lang.String getManagerName()
Returns the name of the Context Menu Manager to whom this ContextMenu is associated.- Since:
 - MicroStrategy Web 8.0.0
 
 
- 
getMenuSize
public int getMenuSize()
Returns the number of current menu-items in this context-menu.- Since:
 - MicroStrategy Web 7.5.1
 
 
 - 
 
 -