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 aShortcut
class as the definition and populates theContextMenuItem
based 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 ContextMenuItem
createItem(TransformContext context)
Creates and populates a ContextMenuItem based on the information in theShortcut
used as defintion.ContextMenuItem
createItem(TransformContext context, java.lang.String name)
Creates and populates a ContextMenuItem based on the information in theShortcut
used as defintion.protected Shortcut
getDefinition()
Get the definition of the <@link Shortcut> shortcut objectjava.lang.String
getItemKey(TransformContext context)
Retrieve the key will be set on the context menu item corresponding to the context input.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".boolean
isItemAvailable(TransformContext context)
Returnstrue
if the underlyingShortcut
used 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 theShortcut
object
-
-
Method Detail
-
isItemAvailable
public boolean isItemAvailable(TransformContext context)
Returns
true
if the underlyingShortcut
used as definition is available (based on the features defined on the <shortcut> xml.If this method returns
false
the context-menu-item should not be included as part of the available options in the menu.- Specified by:
isItemAvailable
in interfaceContextMenuItemBuilder
- Parameters:
context
- TransformContext with context information.- Returns:
true
if 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:
getItemKey
in 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
null
will 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 theShortcut
used as defintion.- Specified by:
createItem
in 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 theShortcut
used 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
-
-