java.lang.Object | ||
↳ | com.microstrategy.web.app.gui.ContextMenu.DefaultContextMenuItemBuilder | |
↳ | com.microstrategy.web.app.transforms.contextmenus.AbstractFolderContextMenuItemBuilder |
![]() |
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:
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 return
CM_FLAG_COPY
.
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); } }
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AbstractFolderContextMenuItemBuilder(Shortcut definition) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ContextMenuItem |
createItem(TransformContext context)
Creates the item and sets its javascript to submit the corresponding event using the iFrame.
| ||||||||||
String |
getItemKey(TransformContext context)
Retrieve the key will be set on the context menu item corresponding to the context input.
| ||||||||||
boolean |
isItemAvailable(TransformContext context)
Returns true if the corresponding flag is on and the the corresponding action is available.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract int |
getContextMenuFlag()
Indicates the abstract class which is the context-menu flag associated with this item.
| ||||||||||
WebEvent |
getEvent(TransformContext context)
Provides the abstract class with the corresponding event to execution with this item.
| ||||||||||
String |
getJSCode(TransformContext context)
Returns the javascript code to use with this context-menu-item
| ||||||||||
String | getLinkForMenuItem(TransformContext context, FolderViewTransform transform) | ||||||||||
WebObjectInfo |
getObjectInfo(TransformContext context)
Helper method to retrieve the WebObjectInfo from the context.
| ||||||||||
String | getTarget(TransformContext context) | ||||||||||
FolderViewTransform |
getTransform(TransformContext context)
Helper method to retrieve the FolderViewTransform from the context.
| ||||||||||
String | iframeParam(FolderViewTransform transform) | ||||||||||
abstract boolean |
isActionEnabled(TransformContext context)
Indicates the abstract class if the corresponding action of this item is available.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Creates the item and sets its javascript to submit the corresponding event using the iFrame.
context | TransformContext with context information. |
---|
ContextMenuItem
.
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 calling createItem(TransformContext)
to check
whether the item already exists in the menu to avoid unnecessary creation.
context | The context for context menu item creation |
---|
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. Returns true if the corresponding flag is on and the the corresponding action is available.
context | TransformContext with context information. |
---|
true
if the context-menu-item is available and should be included.
Indicates the abstract class which is the context-menu flag associated with this item.
Provides the abstract class with the corresponding event to execution with this item.
Returns the javascript code to use with this context-menu-item
Helper method to retrieve the WebObjectInfo from the context.
Helper method to retrieve the FolderViewTransform from the context.
Indicates the abstract class if the corresponding action of this item is available.