public class

ReportGridCellMetricValueImpl

extends AbstractReportGridDisplayCell
implements ReportGridCellMetricValue
java.lang.Object
   ↳ com.microstrategy.web.app.transforms.AbstractReportGridDisplayCell
     ↳ com.microstrategy.web.app.transforms.ReportGridCellMetricValueImpl
Known Direct Subclasses

Class Overview

The ReportGridCellMetricValue is used to generate the HTML of a cell value of the report data.

It uses a WebRowValue as the underlying SDK objects to retrieve the information from.

The ReportGridCellColTitleImpl extends the AbstractReportGridDisplayCell which controls the exeuction flow.

Users who intend to programatically modify the HTML generated for a metric value should extend this class. Using this technique developers could define their own rules of the text to display based on the WebTitle content.

The following is an example of a class that extends the generateText(MarkupOutput) method of this class based on the title's template unit type:
 public class CustomMetricValueextends ReportGridCellMetricValueImpl {
     public void generateText(MarkupOutput mo) {

         WebRowValue rowValue = getWebRowValue();

         if (rowValue != null) {
             String spanPrefix = "";
             String spanPostfix = "";

             switch (rowValue.getSemantics()) {
             case EnumDSSXMLBaseFormType.DssXmlBaseFormPicture:
             case EnumDSSXMLBaseFormType.DssXmlBaseFormUrl:
                 //For threshold images
                 Tag imgTag = TagsFactory.getInstance().newTag("img");

                 imgTag.setAttribute(EnumHTMLTags.ATT_SRC, rowValue.getValue());
                 imgTag.render(mo);

                 break;

             case EnumDSSXMLBaseFormType.DssXmlBaseFormSymbol:
                 //For thresholds quick symbols
                 generateThresholdSymbol(mo, Integer.parseInt(rowValue.getValue()));
                 break;

             case EnumDSSXMLBaseFormType.DssXmlBaseFormHTMLTag:
                 mo.append(HTMLHelper.decode(rowValue.getValue()));
                 break;

             default:
                 super.generateText(mo);
             }
         } else {
             super.generateText(mo);
         }
 

Summary

[Expand]
Inherited Constants
From class com.microstrategy.web.app.transforms.AbstractReportGridDisplayCell
From interface com.microstrategy.web.app.transforms.ReportGridDisplayCell
[Expand]
Inherited Fields
From class com.microstrategy.web.app.transforms.AbstractReportGridDisplayCell
Public Constructors
ReportGridCellMetricValueImpl()
Constructor used for creating a generic display cell.
Public Methods
boolean canDrill()
Utility methood for determining if the cell object is enabled for displaying the user the option to drill on it
boolean canDrillAdvanced()
Utility methood for determining if the cell object is enabled for displaying the user the option for advanced drilling on it
boolean canFilterOn()
Utility methood for determining if the cell object is enabled for displaying the user the option to filter on it
boolean canFormat()
Utility methood for determining if the cell object is enabled for displaying the user the option to format it
boolean canHaveDerivedElements()
boolean canHyperLink()
Utility method for determining if the cell object is enabled for displaying the user the option to navigate to custom hyperlinks
boolean canInsertShortcutMetric()
Utility methood for determining if the cell object is enabled for displaying the user the option to insert shortcut metrics based on it
boolean canModifyAttributeForm()
Utility methood for determining if the cell object is enabled for displaying the user the option to modify the attribute forms on it
boolean canPivot()
Utility methood for determining if the cell object is enabled for displaying the user the option to pivot it
boolean canRemoveFromGrid()
Utility methood for determining if the cell object is enabled for displaying the user the option to remove it from the grid.
boolean canRemoveFromReport()
Utility methood for determining if the cell object is enabled for displaying the user the option to remove it from the report
boolean canRename()
Utility methood for determining if the cell object is enabled for displaying the user the option to rename it
boolean canSort()
Utility methood for determining if the cell object is enabled for displaying the user the option to sort it
void generateText(MarkupOutput mo)

Generates the text of the cell.

int getCellType()
This method is deprecated. The cell type is not significant anymore for the application.
WebEvent getDerivedElementsEvent()
WebDrillPath getDrillPathWithHighImportance()
generate drilling url parameters for row value in DHTML mode
WebEvent getFilterOnEvent()
Get the event for filter on the cell header instance
int getKey()
WebEvent getRenameEvent()
Get the event for renaming the current cell
String getStyle()
Returns the css class name associated with the cell as registered by the Transform.
WebRowValue getWebRowValue()
Returns the underlying SDK object associated with this cell.
WebTemplateMetric getWebTemplateMetric()
return the WebTemplateMetric object associated with this cell
void init(WebComponent wc, WebRowValue rowValue, HashMap cachedObjects)
This method is deprecated. please use the interface that receives TransformContext instance instead.
void init(WebComponent wc, WebTemplateMetric metric, FormalParameters formalParas)
This method is deprecated. please use the interface that receives TransformContext instance instead.
void init(WebComponent wc, FormalParameters formalParas)
This method is deprecated. This method is not used by the Transform anymore. To initialize empty cells it now uses init(TransformContext).
void init(TransformContext context, WebRowValue rowValue)
This method is called to initialize the cell with the corresponding WebRowValue as the underlying SDK object
void init(FormalParameters formalParas)
This method is deprecated. This method is not used by the Transform anymore. To initialize empty cells it now uses init(TransformContext).
void reset()
Reset all of the instance variables.
Protected Methods
void addContextMenuAttributes(Map atts)
Obtain the tag attributes that should be added to the cell's definition for processing context menus
void addToHeaderMetricValueJsonMap(String key, String value)
void appendContextMenuItems(ContextMenu rhMenu)
This method is deprecated. Please use the new approach for generating context menus, see ReportCellRemoveFromGrid, ReportCellMove, etc
boolean cellNeedsLink()
Utility method for determining if the current cell being displayed needs to be a link or not, for example, in case of drilling available.
boolean encodeMetricValue()
Whether to HTML-encode metric values (based on the preference value)
void generateContent(MarkupOutput mo)
Extends generateContent by adding a URL link to the cell's text.
AnchorTag generateDrillAnchor()
Utility method for generating the AnchorTag instance with all the drill information if available for the current cell being displayed by this instance.
AnchorTag generateHyperLinkAnchor()
Tag generatePivotButton(int type)
void generateThresholdSymbol(MarkupOutput out, int thresholdValue)
Generates the HTML when the metric value is a "quick symbol" threshold.
String generateTooltipContent()
Generates the string with the tooltip information to be assigned to the TITLE attribute of the cell tag for this instance
void getCellAttributes(Map attributes)
void getCellLevelAttributes(Map cell)
CTY indicates the cell type UTP indicates the template unit that it belongs to, in the format of "axis,position"
String getParentElementIndex()
String getParentFormValueIndex()
String getRowValueForURL()
Returns the value of the current row.
String getSortID()
This method return the ID to use for sorting this cell.
boolean hasWebObject()
This method allows the abstract class to identify whether the cell has been initialized with a valid WebObject.
void initCell()
Initialize the cell title information
void initDNDForDesignMode(DragAndDropItem item)
This method initializes properties used in javascript for drag and drop in design mode.
void initDNDForExecuteMode(DragAndDropItem item)
This method initializes properties used in javascript for drag and drop in view mode.
void initRowValueInformation(WebRowValue rowValue)
boolean isDrillPathAvailable(WebRowValue rowValue)
Utility method to determine if the current row value has drill information available
boolean isHeaderMVJsonMovable()
void renderContextMenu(MarkupOutput mo)
This method is deprecated. use getContextMenuAttributes() instead
[Expand]
Inherited Methods
From class com.microstrategy.web.app.transforms.AbstractReportGridDisplayCell
From class java.lang.Object
From interface com.microstrategy.web.app.transforms.ReportGridCellMetricValue
From interface com.microstrategy.web.app.transforms.ReportGridDisplayCell

Public Constructors

public ReportGridCellMetricValueImpl ()

Constructor used for creating a generic display cell.

Public Methods

public boolean canDrill ()

Utility methood for determining if the cell object is enabled for displaying the user the option to drill on it

Returns
  • boolean value indicating if the manipulation should be enabled

public boolean canDrillAdvanced ()

Utility methood for determining if the cell object is enabled for displaying the user the option for advanced drilling on it

Returns
  • boolean value indicating if the manipulation should be enabled

public boolean canFilterOn ()

Utility methood for determining if the cell object is enabled for displaying the user the option to filter on it

Returns
  • boolean value indicating if the manipulation should be enabled

public boolean canFormat ()

Utility methood for determining if the cell object is enabled for displaying the user the option to format it

Returns
  • boolean value indicating if the manipulation should be enabled

public boolean canHaveDerivedElements ()

public boolean canHyperLink ()

Utility method for determining if the cell object is enabled for displaying the user the option to navigate to custom hyperlinks

Returns
  • boolean value indicating if the manipulation should be enabled

public boolean canInsertShortcutMetric ()

Utility methood for determining if the cell object is enabled for displaying the user the option to insert shortcut metrics based on it

Returns
  • boolean value indicating if the manipulation should be enabled

public boolean canModifyAttributeForm ()

Utility methood for determining if the cell object is enabled for displaying the user the option to modify the attribute forms on it

Returns
  • boolean value indicating if the manipulation should be enabled

public boolean canPivot ()

Utility methood for determining if the cell object is enabled for displaying the user the option to pivot it

Returns
  • boolean value indicating if the manipulation should be enabled

public boolean canRemoveFromGrid ()

Utility methood for determining if the cell object is enabled for displaying the user the option to remove it from the grid.

Returns
  • boolean value indicating if the manipulation should be enabled

public boolean canRemoveFromReport ()

Utility methood for determining if the cell object is enabled for displaying the user the option to remove it from the report

Returns
  • boolean value indicating if the manipulation should be enabled

public boolean canRename ()

Utility methood for determining if the cell object is enabled for displaying the user the option to rename it

Returns
  • boolean value indicating if the manipulation should be enabled

public boolean canSort ()

Utility methood for determining if the cell object is enabled for displaying the user the option to sort it

Returns
  • boolean value indicating if the manipulation should be enabled

public void generateText (MarkupOutput mo)

Generates the text of the cell. This is the the text that gets displayed by the browser.

Developers can either use the setText(String) method to set any text they want to display for the cell or override this method to inherit its functionality and build on top of it.

For example, the following code could be used to extend this method to render a hyphen if the cell content is empty:
 public void generateText(MarkupOutput mo) {
     String text = getText();

     if ("".equals(text) || " ".equals(text)) {
         mo.append("-");
     } else {
         super.generateText(mo);
     }

 }
 

Parameters
mo the output object

public int getCellType ()

This method is deprecated.
The cell type is not significant anymore for the application.

Returns the cell type, a value from the EnumReportGridDisplayCellTypes enumeration.

public WebEvent getDerivedElementsEvent ()

public WebDrillPath getDrillPathWithHighImportance ()

generate drilling url parameters for row value in DHTML mode

Returns
  • The drill path with high importance

public WebEvent getFilterOnEvent ()

Get the event for filter on the cell header instance

Returns
  • WebEvent instance initialized for filtering on the information of this cell

public int getKey ()

public WebEvent getRenameEvent ()

Get the event for renaming the current cell

Returns
  • WebEvent instance initialized with the information for renaming the current cell.

public String getStyle ()

Returns the css class name associated with the cell as registered by the Transform.
If set, this is the one assigned to the CLASS attribute of the TD tag to control its formatting.

Returns
  • The css class name as registered by the Transform.

public WebRowValue getWebRowValue ()

Returns the underlying SDK object associated with this cell. It should always return null if the instance represents an empty cell.

Returns
  • The underlying SDK object.

public WebTemplateMetric getWebTemplateMetric ()

return the WebTemplateMetric object associated with this cell

Returns
  • the WebTemplateMetric object

public void init (WebComponent wc, WebRowValue rowValue, HashMap cachedObjects)

This method is deprecated.
please use the interface that receives TransformContext instance instead.

This method is called to initialize the cell with the corresponding WebRowValue as the underlying SDK object.

Parameters
wc The bean being transformed.
rowValue The WebRowValue corresponding to this cell.
cachedObjects A HashMap populated by the transform and used to store information shared across multiple cells.

public void init (WebComponent wc, WebTemplateMetric metric, FormalParameters formalParas)

This method is deprecated.
please use the interface that receives TransformContext instance instead.

public void init (WebComponent wc, FormalParameters formalParas)

This method is deprecated.
This method is not used by the Transform anymore. To initialize empty cells it now uses init(TransformContext).

Initializes an ReportGridDisplayCell. This is used to initialize empty cells that have no underlying WebObject.

Parameters
wc associated web component
formalParas all the formal parameters from the report transform. Used to control some output generation.

public void init (TransformContext context, WebRowValue rowValue)

This method is called to initialize the cell with the corresponding WebRowValue as the underlying SDK object

Parameters
context TransformContext instance initialized with the grid's transform information.
rowValue WebRowValue instance corresponding to the cell to be displayed.

public void init (FormalParameters formalParas)

This method is deprecated.
This method is not used by the Transform anymore. To initialize empty cells it now uses init(TransformContext).

Initializes an ReportGridDisplayCell. This is used to initialize empty cells that have no underlying WebObject.

Parameters
formalParas all the formal parameters from the report transform. Used to control some output generation.

public void reset ()

Reset all of the instance variables. This method is very important when improve the memory performance: we create only one instance for a particular cell type and reuse it instead of creating a new instance for each concrete grid cell. Therefore, it saves a lot of memory. For implementation of this method, please follow the workflow of how all the instance variables are initialized in the class hierarchy when a new instance is created: superclass instance variables are initialized first, subclass instance variables are initialized second. Note: for the purpose of cell reuse.

Protected Methods

protected void addContextMenuAttributes (Map atts)

Obtain the tag attributes that should be added to the cell's definition for processing context menus

Parameters
atts Map where attributes will be appended.

protected void addToHeaderMetricValueJsonMap (String key, String value)

protected void appendContextMenuItems (ContextMenu rhMenu)

This method is deprecated.
Please use the new approach for generating context menus, see ReportCellRemoveFromGrid, ReportCellMove, etc

protected boolean cellNeedsLink ()

Utility method for determining if the current cell being displayed needs to be a link or not, for example, in case of drilling available.

Returns
  • boolean value indicating if the current cell should be displayed as a link.

protected boolean encodeMetricValue ()

Whether to HTML-encode metric values (based on the preference value)

Returns
  • Whether to HTML-encode metric values.

protected void generateContent (MarkupOutput mo)

Extends generateContent by adding a URL link to the cell's text.

Developers can either use the setContent(String) method to set any text they want to display as the cell's contents or override this method to inherit its functionality and build on top of it.

As an example, the following code could be used to extend this method to add a <BR> tag after cell's content:

 public void generateContent(MarkupOutput mo) {
     super.generateContent(mo);

     mo.append("<br>");
 }
 

Parameters
mo the output object

protected AnchorTag generateDrillAnchor ()

Utility method for generating the AnchorTag instance with all the drill information if available for the current cell being displayed by this instance.

Returns
  • AnchorTag instance initialized with the drill details. If drilling is not supported given the information provided, it will return null

protected AnchorTag generateHyperLinkAnchor ()

protected Tag generatePivotButton (int type)

protected void generateThresholdSymbol (MarkupOutput out, int thresholdValue)

Generates the HTML when the metric value is a "quick symbol" threshold.

Parameters
out the output object
thresholdValue the threshold id. A value from EnumDSSXMLSymbol.

protected String generateTooltipContent ()

Generates the string with the tooltip information to be assigned to the TITLE attribute of the cell tag for this instance

Returns
  • String with the information about the tooltip to render for the current cell.

protected void getCellAttributes (Map attributes)

protected void getCellLevelAttributes (Map cell)

CTY indicates the cell type UTP indicates the template unit that it belongs to, in the format of "axis,position"

protected String getParentElementIndex ()

Returns
  • the parent element index based on the WebHeader, null if canHyperLink() returns false

protected String getParentFormValueIndex ()

Returns
  • the parent element index based on the WebHeader, null if canHyperLink() returns false

protected String getRowValueForURL ()

Returns the value of the current row.

Returns
  • String

protected String getSortID ()

This method return the ID to use for sorting this cell.

Returns
  • The ID to use for sorting this cell.

protected boolean hasWebObject ()

This method allows the abstract class to identify whether the cell has been initialized with a valid WebObject. Some cells are created empty (with no underlying web object), they usually represent empty cells (like the ones used in design mode for metric values or row headers); in these cases some functionality needs to be disabled (liek context-menus or dnd), this method allow us to identify these cells.

Returns
  • true if the cell has underlying WebObject.

protected void initCell ()

Initialize the cell title information

protected void initDNDForDesignMode (DragAndDropItem item)

This method initializes properties used in javascript for drag and drop in design mode.

Parameters
item DragAndDropItem

protected void initDNDForExecuteMode (DragAndDropItem item)

This method initializes properties used in javascript for drag and drop in view mode.

Parameters
item DragAndDropItem

protected void initRowValueInformation (WebRowValue rowValue)

protected boolean isDrillPathAvailable (WebRowValue rowValue)

Utility method to determine if the current row value has drill information available

Parameters
rowValue value WebRowValue instance to analyze
Returns
  • boolean value indicating if there is drill path information available or not, for the specified title.

protected boolean isHeaderMVJsonMovable ()

protected void renderContextMenu (MarkupOutput mo)

This method is deprecated.
use getContextMenuAttributes() instead

Render the context menu's trigger for this cell.

Parameters
mo the output object