Class AbstractFolderContextMenuItemBuilder
- java.lang.Object
-
- com.microstrategy.web.app.gui.ContextMenu.DefaultContextMenuItemBuilder
-
- com.microstrategy.web.app.transforms.contextmenus.AbstractFolderContextMenuItemBuilder
-
- All Implemented Interfaces:
ContextMenuItemBuilder
- Direct Known Subclasses:
AbstractFolderParentMenu
,AdminFolderEdit
,FolderCopy
,FolderCreateAnalysisFromReport
,FolderCreateDocumentFromAnalysis
,FolderCreateDocumentFromReport
,FolderCreateDocumentFromTheme
,FolderCreateReportFromCube
,FolderCreateShortcut
,FolderDelete
,FolderDisplayProperties
,FolderExportLink
,FolderInlineRename
,FolderMove
,FolderNewFilter
,FolderNewPrompt
,FolderOpenInLibrary
,FolderRename
,FolderRunViewMedia
,FolderSimpleAction
public abstract class AbstractFolderContextMenuItemBuilder extends ContextMenu.DefaultContextMenuItemBuilder
This class is used by Microstrategy Web as a base class for those used to populate context-menus used in the Folder page.
New context-menus-builders can be created simply by extending this class and implementing three methods:
- getContextMenuFlag(): Used to maintain backwards compatibility, these builders
check for the
contextMenuFlags
FormalParameter to make sure they can enabled. New builders should return in this method the flag associated with the context-menu-item, for example, a "copy" context-menu would returnFolderViewTransform.CM_FLAG_COPY
. - isActionEnabled(): Besides checking the context-menu flag, this method enables the builder to check for other conditions to enable the action. For example, to check whether the user has enough privileges/access control. Subclasses can ultimately delegate this logic to the transform.
- getEvent(): This method returns the
WebEvent
to execute when this menu item is selected. Also in this case, subclasses can ultimately delegate this logic to the transform.
The following would be an example of a subclass used to populate an "Edit" context-menu-item:
public class FolderEdit extends AbstractFolderContextMenuItemBuilder { public FolderEdit(Shortcut definition) { super(definition); } protected int getContextMenuFlag() { //No flag is defined for this action: return FolderViewTransform.CM_FLAG_ALL; } protected boolean isActionEnabled(TransformContext context) { FolderViewTransform t = getTransform(context); WebObjectInfo object = getObjectInfo(context); return t.canEdit(object); } protected WebEvent getEvent(TransformContext context) { FolderViewTransform t = getTransform(context); WebObjectInfo object = getObjectInfo(context); return t.getEditEvent(object); } }
- Since:
- MicroStrategy Web 8.0.1
-
-
Constructor Summary
Constructors Constructor Description AbstractFolderContextMenuItemBuilder(Shortcut definition)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ContextMenuItem
createItem(TransformContext context)
Creates the item and sets its javascript to submit the corresponding event using the iFrame.protected abstract int
getContextMenuFlag()
Indicates the abstract class which is the context-menu flag associated with this item.protected WebEvent
getEvent(TransformContext context)
Provides the abstract class with the corresponding event to execution with this item.java.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
getJSCode(TransformContext context)
Returns the javascript code to use with this context-menu-itemprotected java.lang.String
getLinkForMenuItem(TransformContext context, FolderViewTransform transform)
protected WebObjectInfo
getObjectInfo(TransformContext context)
Helper method to retrieve the WebObjectInfo from the context.protected java.lang.String
getTarget(TransformContext context)
protected FolderViewTransform
getTransform(TransformContext context)
Helper method to retrieve the FolderViewTransform from the context.protected java.lang.String
iframeParam(FolderViewTransform transform)
protected abstract boolean
isActionEnabled(TransformContext context)
Indicates the abstract class if the corresponding action of this item is available.boolean
isItemAvailable(TransformContext context)
Returns true if the corresponding flag is on and the the corresponding action is available.-
Methods inherited from class com.microstrategy.web.app.gui.ContextMenu.DefaultContextMenuItemBuilder
createItem, getDefinition, getScript
-
-
-
-
Constructor Detail
-
AbstractFolderContextMenuItemBuilder
public AbstractFolderContextMenuItemBuilder(Shortcut definition)
-
-
Method Detail
-
isItemAvailable
public boolean isItemAvailable(TransformContext context)
Returns true if the corresponding flag is on and the the corresponding action is available.- Specified by:
isItemAvailable
in interfaceContextMenuItemBuilder
- Overrides:
isItemAvailable
in classContextMenu.DefaultContextMenuItemBuilder
- Parameters:
context
- TransformContext with context information.- Returns:
true
if the context-menu-item is available and should be included.
-
createItem
public ContextMenuItem createItem(TransformContext context)
Creates the item and sets its javascript to submit the corresponding event using the iFrame.- Specified by:
createItem
in interfaceContextMenuItemBuilder
- Overrides:
createItem
in classContextMenu.DefaultContextMenuItemBuilder
- Parameters:
context
- TransformContext with context information.- Returns:
- a new instance of a
ContextMenuItem
.
-
getJSCode
protected java.lang.String getJSCode(TransformContext context)
Returns the javascript code to use with this context-menu-item
-
getLinkForMenuItem
protected java.lang.String getLinkForMenuItem(TransformContext context, FolderViewTransform transform)
- Since:
- MicroStrategy Web 9.0.0
-
getTarget
protected java.lang.String getTarget(TransformContext context)
- Since:
- MicroStrategy Web 9.0.0
-
iframeParam
protected java.lang.String iframeParam(FolderViewTransform transform)
- Since:
- MicroStrategy Web 9.0.0
-
getTransform
protected FolderViewTransform getTransform(TransformContext context)
Helper method to retrieve the FolderViewTransform from the context.
-
getObjectInfo
protected WebObjectInfo getObjectInfo(TransformContext context)
Helper method to retrieve the WebObjectInfo from the context.
-
getContextMenuFlag
protected abstract int getContextMenuFlag()
Indicates the abstract class which is the context-menu flag associated with this item.
-
isActionEnabled
protected abstract boolean isActionEnabled(TransformContext context)
Indicates the abstract class if the corresponding action of this item is available.
-
getEvent
protected WebEvent getEvent(TransformContext context)
Provides the abstract class with the corresponding event to execution with this item.
-
getItemKey
public java.lang.String getItemKey(TransformContext context)
Description copied from class:ContextMenu.DefaultContextMenuItemBuilder
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 callingContextMenu.DefaultContextMenuItemBuilder.createItem(TransformContext)
to check whether the item already exists in the menu to avoid unnecessary creation.- Specified by:
getItemKey
in interfaceContextMenuItemBuilder
- Overrides:
getItemKey
in classContextMenu.DefaultContextMenuItemBuilder
- 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
-
-