public static class

ContextMenu.DefaultContextMenuItemBuilder

extends Object
implements ContextMenuItemBuilder
java.lang.Object
   ↳ com.microstrategy.web.app.gui.ContextMenu.DefaultContextMenuItemBuilder
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

This class is the default implementation of a ContextMenuItemBuilder. It simply uses a Shortcut class as the definition and populates the ContextMenuItem based on this definition.

Summary

Public Constructors
ContextMenu.DefaultContextMenuItemBuilder(Shortcut definition)
Constructor
Public Methods
ContextMenuItem createItem(TransformContext context, String name)
Creates and populates a ContextMenuItem based on the information in the Shortcut used as defintion.
ContextMenuItem createItem(TransformContext context)
Creates and populates a ContextMenuItem based on the information in the Shortcut used as defintion.
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 underlying Shortcut used as definition is available (based on the features defined on the <shortcut> xml.

Protected Methods
Shortcut getDefinition()
Get the definition of the <@link Shortcut> shortcut object
String getScript(String baseBone, String script)
Adds "microstrategy.bone(id)." to the script if baseBone is not empty and the script doesn't start already with "microstrategy".
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.microstrategy.web.app.gui.ContextMenuItemBuilder

Public Constructors

public ContextMenu.DefaultContextMenuItemBuilder (Shortcut definition)

Constructor

Parameters
definition the definition of the Shortcut object

Public Methods

public ContextMenuItem createItem (TransformContext context, String name)

Creates and populates a ContextMenuItem based on the information in the Shortcut used as defintion.

Parameters
context TransformContext with context information.
name The name of the context menu item.
Returns
  • a new instance of a ContextMenuItem.

public ContextMenuItem createItem (TransformContext context)

Creates and populates a ContextMenuItem based on the information in the Shortcut used as defintion.

Parameters
context TransformContext with context information.
Returns
  • a new instance of a ContextMenuItem.

public 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 calling createItem(TransformContext) to check whether the item already exists in the menu to avoid unnecessary creation.

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.

public boolean isItemAvailable (TransformContext context)

Returns true if the underlying Shortcut 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.

Parameters
context TransformContext with context information.
Returns
  • true if the context-menu-item is available and should be included.

Protected Methods

protected Shortcut getDefinition ()

Get the definition of the <@link Shortcut> shortcut object

Returns
  • the shortcut object defintion

protected String getScript (String baseBone, 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 basebone
script String the name of the script
Returns
  • the "microstrategy.bone(id).script" string