Class ReportGridCellMetricValueImpl

  • All Implemented Interfaces:
    ReportGridCellMetricValue, ReportGridDisplayCell, java.lang.Cloneable
    Direct Known Subclasses:
    IPhoneReportGridCellMetricValueImpl, ReportGridExcelCellMetricValueImpl

    public class ReportGridCellMetricValueImpl
    extends AbstractReportGridDisplayCell
    implements ReportGridCellMetricValue

    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(com.microstrategy.web.beans.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);
             }
     
    Since:
    MicroStrategy Web 7.5.1
    See Also:
    ReportGridDisplayCell, ReportGridTransformImpl
    • Constructor Detail

      • ReportGridCellMetricValueImpl

        public ReportGridCellMetricValueImpl()
        Constructor used for creating a generic display cell.
    • Method Detail

      • reset

        public void reset()
        Description copied from interface: ReportGridDisplayCell
        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.
        Specified by:
        reset in interface ReportGridDisplayCell
        Overrides:
        reset in class AbstractReportGridDisplayCell
      • getWebRowValue

        public WebRowValue getWebRowValue()
        Description copied from interface: ReportGridCellMetricValue
        Returns the underlying SDK object associated with this cell. It should always return null if the instance represents an empty cell.
        Specified by:
        getWebRowValue in interface ReportGridCellMetricValue
        Returns:
        The underlying SDK object.
        Since:
        MicroStrategy Web 8.0.0
      • encodeMetricValue

        protected boolean encodeMetricValue()
        Whether to HTML-encode metric values (based on the preference value)
        Returns:
        Whether to HTML-encode metric values.
        Since:
        MicroStrategy Web 9.0.0
      • initRowValueInformation

        protected void initRowValueInformation​(WebRowValue rowValue)
        Since:
        MicroStrategy Web 8.0.1
      • getParentElementIndex

        protected java.lang.String getParentElementIndex()
        Returns:
        the parent element index based on the WebHeader, null if canHyperLink() returns false
      • getParentFormValueIndex

        protected java.lang.String getParentFormValueIndex()
        Returns:
        the parent element index based on the WebHeader, null if canHyperLink() returns false
      • init

        @Deprecated
        public void init​(WebComponent wc,
                         WebRowValue rowValue,
                         java.util.HashMap cachedObjects)
        Deprecated.
        please use the interface that receives TransformContext instance instead.
        Description copied from interface: ReportGridCellMetricValue
        This method is called to initialize the cell with the corresponding WebRowValue as the underlying SDK object.
        Specified by:
        init in interface ReportGridCellMetricValue
        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.
        Since:
        MicroStrategy Web 7.5.2
      • generateContent

        protected void generateContent​(MarkupOutput mo)
        Extends generateContent by adding a URL link to the cell's text.

        Developers can either use the AbstractReportGridDisplayCell.setContent(java.lang.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>");
         }
         

        Overrides:
        generateContent in class AbstractReportGridDisplayCell
        Parameters:
        mo - the output object
      • generateHyperLinkAnchor

        protected AnchorTag generateHyperLinkAnchor()
        Since:
        MicroStrategy Web 8.1.2
      • generateDrillAnchor

        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
        Since:
        MicroStrategy Web 8.0.1
      • getStyle

        public java.lang.String getStyle()
        Description copied from class: AbstractReportGridDisplayCell
        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.
        Specified by:
        getStyle in interface ReportGridDisplayCell
        Overrides:
        getStyle in class AbstractReportGridDisplayCell
        Returns:
        The css class name as registered by the Transform.
        Since:
        MicroStrategy Web 8.1.1
      • getRowValueForURL

        protected java.lang.String getRowValueForURL()
        Returns the value of the current row.
        Returns:
        String
      • generateText

        public void generateText​(MarkupOutput mo)
        Description copied from class: AbstractReportGridDisplayCell

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

        Developers can either use the AbstractReportGridDisplayCell.setText(java.lang.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) || "&nbsp;".equals(text)) {
                 mo.append("-");
             } else {
                 super.generateText(mo);
             }
        
         }
         
        Overrides:
        generateText in class AbstractReportGridDisplayCell
        Parameters:
        mo - the output object
      • generateTooltipContent

        protected java.lang.String generateTooltipContent()
        Generates the string with the tooltip information to be assigned to the TITLE attribute of the cell tag for this instance
        Overrides:
        generateTooltipContent in class AbstractReportGridDisplayCell
        Returns:
        String with the information about the tooltip to render for the current cell.
        Since:
        MicroStrategy Web 8.0.1
      • generateThresholdSymbol

        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.
      • canDrillAdvanced

        public boolean canDrillAdvanced()
        Utility methood for determining if the cell object is enabled for displaying the user the option for advanced drilling on it
        Specified by:
        canDrillAdvanced in interface ReportGridDisplayCell
        Overrides:
        canDrillAdvanced in class AbstractReportGridDisplayCell
        Returns:
        boolean value indicating if the manipulation should be enabled
        Since:
        MicroStrategy Web 8.0.1
      • addContextMenuAttributes

        protected void addContextMenuAttributes​(java.util.Map atts)
        Obtain the tag attributes that should be added to the cell's definition for processing context menus
        Overrides:
        addContextMenuAttributes in class AbstractReportGridDisplayCell
        Parameters:
        atts - Map where attributes will be appended.
        Since:
        MicroStrategy Web 8.1.0
      • getCellLevelAttributes

        protected void getCellLevelAttributes​(java.util.Map cell)
        CTY indicates the cell type UTP indicates the template unit that it belongs to, in the format of "axis,position"
        Overrides:
        getCellLevelAttributes in class AbstractReportGridDisplayCell
        Since:
        MicroStrategy Web 9.0.0
      • isDrillPathAvailable

        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.
      • cellNeedsLink

        protected boolean cellNeedsLink()
        Description copied from class: AbstractReportGridDisplayCell
        Utility method for determining if the current cell being displayed needs to be a link or not, for example, in case of drilling available.
        Overrides:
        cellNeedsLink in class AbstractReportGridDisplayCell
        Returns:
        boolean value indicating if the current cell should be displayed as a link.
        Since:
        MicroStrategy Web 8.0.1
      • hasWebObject

        protected boolean hasWebObject()
        Description copied from class: AbstractReportGridDisplayCell
        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.
        Specified by:
        hasWebObject in class AbstractReportGridDisplayCell
        Returns:
        true if the cell has underlying WebObject.
        Since:
        MicroStrategy Web 8.0.0
      • canRemoveFromGrid

        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.
        Specified by:
        canRemoveFromGrid in interface ReportGridDisplayCell
        Overrides:
        canRemoveFromGrid in class AbstractReportGridDisplayCell
        Returns:
        boolean value indicating if the manipulation should be enabled
        Since:
        MicroStrategy Web 8.0.1
      • canRename

        public boolean canRename()
        Utility methood for determining if the cell object is enabled for displaying the user the option to rename it
        Specified by:
        canRename in interface ReportGridDisplayCell
        Overrides:
        canRename in class AbstractReportGridDisplayCell
        Returns:
        boolean value indicating if the manipulation should be enabled
        Since:
        MicroStrategy Web 8.0.1
      • canFilterOn

        public boolean canFilterOn()
        Utility methood for determining if the cell object is enabled for displaying the user the option to filter on it
        Specified by:
        canFilterOn in interface ReportGridDisplayCell
        Overrides:
        canFilterOn in class AbstractReportGridDisplayCell
        Returns:
        boolean value indicating if the manipulation should be enabled
        Since:
        MicroStrategy Web 8.0.1
      • canFormat

        public boolean canFormat()
        Utility methood for determining if the cell object is enabled for displaying the user the option to format it
        Specified by:
        canFormat in interface ReportGridDisplayCell
        Overrides:
        canFormat in class AbstractReportGridDisplayCell
        Returns:
        boolean value indicating if the manipulation should be enabled
        Since:
        MicroStrategy Web 8.0.1
      • canSort

        public boolean canSort()
        Utility methood for determining if the cell object is enabled for displaying the user the option to sort it
        Specified by:
        canSort in interface ReportGridDisplayCell
        Overrides:
        canSort in class AbstractReportGridDisplayCell
        Returns:
        boolean value indicating if the manipulation should be enabled
        Since:
        MicroStrategy Web 8.0.1
      • canDrill

        public boolean canDrill()
        Utility methood for determining if the cell object is enabled for displaying the user the option to drill on it
        Specified by:
        canDrill in interface ReportGridDisplayCell
        Overrides:
        canDrill in class AbstractReportGridDisplayCell
        Returns:
        boolean value indicating if the manipulation should be enabled
        Since:
        MicroStrategy Web 8.0.1
      • canPivot

        public boolean canPivot()
        Utility methood for determining if the cell object is enabled for displaying the user the option to pivot it
        Specified by:
        canPivot in interface ReportGridDisplayCell
        Overrides:
        canPivot in class AbstractReportGridDisplayCell
        Returns:
        boolean value indicating if the manipulation should be enabled
        Since:
        MicroStrategy Web 8.0.1
      • getKey

        public int getKey()
        Specified by:
        getKey in interface ReportGridDisplayCell
        Returns:
        int value with the key information about the cell being analyzed.
        Since:
        MicroStrategy Web 9.0.0