Package com.microstrategy.web.app.gui
Class ContextMenu.DefaultContextMenuItemBuilder
- java.lang.Object
-
- com.microstrategy.web.app.gui.ContextMenu.DefaultContextMenuItemBuilder
-
- All Implemented Interfaces:
ContextMenuItemBuilder
- Direct Known Subclasses:
AbstractFilterOperatorContextMenuItemBuilder,AbstractFolderContextMenuItemBuilder,AbstractInboxContextMenuItemBuilder,AbstractPagebyContextMenuItemBuilder,AbstractReportCellContextMenuItemBuilder,AbstractUserMgrContextMenuItemBuilder,AddDimensionAttributeToGridOrFilter,AddDimensionElementToFilter,FolderTreeExportLink,GraphColorPicker,NCSRemoveRecipient,ReportGraphFill,ReportGraphFont,ReportGraphFormat,ReportGraphLine,ReportWSDelete,RWDrill,TextHyperLinkNavigation
- Enclosing class:
- ContextMenu
public static class ContextMenu.DefaultContextMenuItemBuilder extends java.lang.Object implements ContextMenuItemBuilder
This class is the default implementation of aContextMenuItemBuilder. It simply uses aShortcutclass as the definition and populates theContextMenuItembased on this definition.- Since:
- MicroStrategy Web 8.0.1
-
-
Constructor Summary
Constructors Constructor Description DefaultContextMenuItemBuilder(Shortcut definition)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContextMenuItemcreateItem(TransformContext context)Creates and populates a ContextMenuItem based on the information in theShortcutused as defintion.ContextMenuItemcreateItem(TransformContext context, java.lang.String name)Creates and populates a ContextMenuItem based on the information in theShortcutused as defintion.protected ShortcutgetDefinition()Get the definition of the <@link Shortcut> shortcut objectjava.lang.StringgetItemKey(TransformContext context)Retrieve the key will be set on the context menu item corresponding to the context input.protected java.lang.StringgetScript(java.lang.String baseBone, java.lang.String script)Adds "microstrategy.bone(id)." to the script if baseBone is not empty and the script doesn't start already with "microstrategy".booleanisItemAvailable(TransformContext context)Returnstrueif the underlyingShortcutused as definition is available (based on the features defined on the <shortcut> xml.
-
-
-
Constructor Detail
-
DefaultContextMenuItemBuilder
public DefaultContextMenuItemBuilder(Shortcut definition)
Constructor- Parameters:
definition- the definition of theShortcutobject
-
-
Method Detail
-
isItemAvailable
public boolean isItemAvailable(TransformContext context)
Returns
trueif the underlyingShortcutused as definition is available (based on the features defined on the <shortcut> xml.If this method returns
falsethe context-menu-item should not be included as part of the available options in the menu.- Specified by:
isItemAvailablein interfaceContextMenuItemBuilder- Parameters:
context- TransformContext with context information.- Returns:
trueif the context-menu-item is available and should be included.
-
getItemKey
public java.lang.String getItemKey(TransformContext context)
Retrieve the key will be set on the context menu item corresponding to the context input. The context menu item generated based on the same context input will have the same key. This method can be called by context menu before callingcreateItem(TransformContext)to check whether the item already exists in the menu to avoid unnecessary creation.- Specified by:
getItemKeyin interfaceContextMenuItemBuilder- Parameters:
context- The context for context menu item creation- Returns:
- The key for the context menu item if created using the context. By default
nullwill be return, which means build has no knowledge about the item key. Then context menu item may generate the key by itself. For builder who wants avoid unnecessary item creation should take advantage of this method by overriding with a meaningful implementation. - Since:
- MicroStrategy Web 9.0.0
-
createItem
public ContextMenuItem createItem(TransformContext context)
Creates and populates a ContextMenuItem based on the information in theShortcutused as defintion.- Specified by:
createItemin interfaceContextMenuItemBuilder- Parameters:
context- TransformContext with context information.- Returns:
- a new instance of a
ContextMenuItem.
-
createItem
public ContextMenuItem createItem(TransformContext context, java.lang.String name)
Creates and populates a ContextMenuItem based on the information in theShortcutused as defintion.- Parameters:
context- TransformContext with context information.name- The name of the context menu item.- Returns:
- a new instance of a
ContextMenuItem. - Since:
- MicroStrategy Web 9.0.0
-
getDefinition
protected Shortcut getDefinition()
Get the definition of the <@link Shortcut> shortcut object- Returns:
- the shortcut object defintion
-
getScript
protected java.lang.String getScript(java.lang.String baseBone, java.lang.String script)Adds "microstrategy.bone(id)." to the script if baseBone is not empty and the script doesn't start already with "microstrategy".- Parameters:
baseBone- String the id of the basebonescript- String the name of the script- Returns:
- the "microstrategy.bone(id).script" string
-
-