Class GridWebFormatHelper

  • Direct Known Subclasses:
    GridFormatHelper

    public class GridWebFormatHelper
    extends java.lang.Object
    This class provides a series of methods that aid on the manipulation of grid formatting properties.
    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int LOCAL_TARGET_ALL_METRICS
      Constant for representing All Metrics on the report as target for the formatting
      static int LOCAL_TARGET_ALL_REPORT
      Constant for representing All Report as target for the formatting
      static int LOCAL_TARGET_GRID_BORDER
      Constant for representing Grid border on the report as target for the formatting
      static int LOCAL_TARGET_GRID_CONTAINER
      Constant for representing Grid Container on the RWD as target for the formatting
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String constructNumberFormat​(java.lang.String numberCategory, java.lang.String thousandSeparator, java.lang.String decimalPlaces, java.lang.String currencySymbol, java.lang.String currencyPosition, java.lang.String negativeNumbers, java.lang.String originalFormat)
      Given the formatting specifications, constructs the string that represents the formatting indicated.
      static java.lang.String convertColorDecimalToHTMLHex​(int colorCode)
      Converts a color ID retrieved as cell property from the metadata to its HTML hexadecimal representation
      static WebFormatContainer getAxis​(WebTemplate wt, int targetAxis)
      Do the required validation for returning the requested axis' format container
      static java.lang.String getComparedPropertyValue​(WebComponent taskBean, java.util.ArrayList webFormatArray, java.lang.String propertyGroup, java.lang.String propertyName, java.lang.String defaultValue, int originalTargetAxis, int originalTargetPosition, int originalTargetLevel)
      Based on the array of web format objects, compare the requested property and determine if they are the same (and what value that shall be) or if they should be marked as default if at least one value is different.
      static java.lang.String getComparedPropertyValue​(WebTemplate template, java.util.ArrayList webFormatArray, java.lang.String propertyGroup, java.lang.String propertyName, java.lang.String defaultValue, int originalTargetAxis, int originalTargetPosition, int originalTargetLevel)  
      static java.util.ArrayList getGridFormatObjectsArray​(boolean getAsRequested, WebComponent targetBean, int targetAxis, int targetPosition, int targetLevel)
      Get an array of all the format objects that should be analyzed before showing the current values selected on the editor's interface
      static java.util.ArrayList getGridFormatObjectsArray​(boolean getAsRequested, WebComponent targetBean, int targetAxis, int targetPosition, int unitType, int targetLevel)
      Get an array of all the format objects that should be analyzed before showing the current values selected on the editor's interface
      static java.util.ArrayList getGridFormatObjectsArray​(boolean getAsRequested, WebTemplate template, int targetAxis, int targetPosition, int targetLevel)  
      static java.util.ArrayList getGridFormatObjectsArray​(WebComponent targetBean, int targetAxis, int targetPosition, int targetLevel)
      Get an array of all the format objects that should be analyzed before showing the current values selected on the editor's interface.
      static java.util.ArrayList getGridFormatObjectsArray​(WebComponent targetBean, int targetAxis, int targetPosition, int unitType, int targetLevel)
      Get an array of all the format objects that should be analyzed before showing the current values selected on the editor's interface
      static WebTemplate getGridTemplate​(WebComponent wc)
      Get the template object out of the report bean
      static WebFormatContainer getMetric​(WebTemplate wt, int indexPosition)
      Do required validation for returning requested metric's format container
      static boolean getPropertyUseDefault​(WebFormat wf, java.lang.String group, java.lang.String property)
      Retrieve the property requested from the WebFormat object and determine if default value is to be used on it
      static java.lang.String getPropertyValue​(WebFormat wf, java.lang.String group, java.lang.String property)
      Given the group and property specified as parameters, find and return its value according to the WebFormat object passed as parameter.
      static java.lang.String getPropertyValue​(WebFormat wf, java.lang.String group, java.lang.String property, java.lang.String defaultValue)
      Given the group and property specified as parameters, find and return its value according to the WebFormat object passed as parameter.
      static WebFormatContainer getTemplateUnit​(WebTemplate wt, int targetAxis, int targetPosition)
      Do required validation for returning requested template unit's format container
      static int getUnitType​(int targetAxis, int targetPosition)
      Given the axis and position, calculate the unit type of the target
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOCAL_TARGET_ALL_REPORT

        public static final int LOCAL_TARGET_ALL_REPORT
        Constant for representing All Report as target for the formatting
        See Also:
        Constant Field Values
      • LOCAL_TARGET_ALL_METRICS

        public static final int LOCAL_TARGET_ALL_METRICS
        Constant for representing All Metrics on the report as target for the formatting
        See Also:
        Constant Field Values
      • LOCAL_TARGET_GRID_BORDER

        public static final int LOCAL_TARGET_GRID_BORDER
        Constant for representing Grid border on the report as target for the formatting
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • LOCAL_TARGET_GRID_CONTAINER

        public static final int LOCAL_TARGET_GRID_CONTAINER
        Constant for representing Grid Container on the RWD as target for the formatting
        Since:
        MicroStrategy Web 8.1.0
        See Also:
        Constant Field Values
    • Constructor Detail

      • GridWebFormatHelper

        public GridWebFormatHelper()
    • Method Detail

      • convertColorDecimalToHTMLHex

        public static java.lang.String convertColorDecimalToHTMLHex​(int colorCode)
        Converts a color ID retrieved as cell property from the metadata to its HTML hexadecimal representation
        Parameters:
        colorCode - decimal representation of the color to translate
        Returns:
        the String HTML hexadecimal code of the color sent as parameter
        Since:
        MicroStrategy Web 8.0.0
      • getUnitType

        public static int getUnitType​(int targetAxis,
                                      int targetPosition)
        Given the axis and position, calculate the unit type of the target
        Parameters:
        targetAxis - an element from the EnumDSSXMLAxisName enumeration representing the axis of the object being modified
        targetPosition - an index indicating the position on the axis where the object is located. Special notation is used for identifying the different object types:
        If position = 0 -> object identified is an axis (its ID is the targetAxis parameter) If position <0 -> object identified is a metric (its index position is represented on the targetAxis parameter) If position >0 -> object identified is a template unit (its axis is on the targetAxis parameter, its position is indicated on this parameter)
        Returns:
        an element of the EnumGridFormatUnit enumeration indicating the type of target unit for this manipulation
      • getPropertyValue

        public static java.lang.String getPropertyValue​(WebFormat wf,
                                                        java.lang.String group,
                                                        java.lang.String property,
                                                        java.lang.String defaultValue)
        Given the group and property specified as parameters, find and return its value according to the WebFormat object passed as parameter. If there is any error or the property or group cannot be found or default is used, the default value passed as parameter will be returned.
        Parameters:
        wf - a WebFormat object initialized
        group - the name of the formatting property group to analyze
        property - the name of the property in the property group to analyze
        defaultValue - the value to return if anything failed during the process
        Returns:
        the property value found for the object requested, or the default value if the process could not be completed
      • getPropertyValue

        public static java.lang.String getPropertyValue​(WebFormat wf,
                                                        java.lang.String group,
                                                        java.lang.String property)
        Given the group and property specified as parameters, find and return its value according to the WebFormat object passed as parameter. If there is any error or the property or group cannot be found, null will be returned.
        Parameters:
        wf - a WebFormat object initialized
        group - the name of the formatting property group to analyze
        property - the name of the property in the property group to analyze
        Returns:
        the property value found for the object requested, or the null if the process could not be completed
      • getPropertyUseDefault

        public static boolean getPropertyUseDefault​(WebFormat wf,
                                                    java.lang.String group,
                                                    java.lang.String property)
        Retrieve the property requested from the WebFormat object and determine if default value is to be used on it
        Parameters:
        wf - WebFormat instance to test
        group - String with the name of the property group to find
        property - String with the name of the property to find
        Returns:
        boolean value indicating if the property group-property pair requested is to use default value or not
      • getGridTemplate

        public static WebTemplate getGridTemplate​(WebComponent wc)
        Get the template object out of the report bean
        Parameters:
        wc - a WebComponent instance initialized - the method processes ReportBean and ViewBean instances.
        Returns:
        a WebTemplate instance corresponding to the report bean sent as parameter. Returns null if the object could not be retrieved.
        Since:
        MicroStrategy Web 8.0.0
      • getAxis

        public static WebFormatContainer getAxis​(WebTemplate wt,
                                                 int targetAxis)
        Do the required validation for returning the requested axis' format container
        Parameters:
        wt - a WebTemplate instance initialized
        targetAxis - an element from the EnumDSSXMLAxisName enumeration representing the axis to return
        Returns:
        a WebFormatContainer instance for the axis requested. Returns null if the process could not be completed.
      • getMetric

        public static WebFormatContainer getMetric​(WebTemplate wt,
                                                   int indexPosition)
        Do required validation for returning requested metric's format container
        Parameters:
        wt - a WebTemplate instance initialized
        indexPosition - the index location of the metric in the Metrics array
        Returns:
        a WebFormatContainer instance for the metric requested. Returns null if the process could not be completed.
      • getTemplateUnit

        public static WebFormatContainer getTemplateUnit​(WebTemplate wt,
                                                         int targetAxis,
                                                         int targetPosition)
        Do required validation for returning requested template unit's format container
        Parameters:
        wt - a WebTemplate instance initialized
        targetAxis - an element from the EnumDSSXMLAxisName enumeration representing the axis of the object being modified
        targetPosition - an index indicating the position on the axis where the object is located. Special notation is used for identifying the different object types:
        If position = 0 -> object identified is an axis (its ID is the targetAxis parameter) If position <0 -> object identified is a metric (its index position is represented on the targetAxis parameter) If position >0 -> object identified is a template unit (its axis is on the targetAxis parameter, its position is indicated on this parameter)
        Returns:
        a WebFormatContainer instance for the template unit requested. Returns null if the process could not be completed.
      • getComparedPropertyValue

        public static java.lang.String getComparedPropertyValue​(WebComponent taskBean,
                                                                java.util.ArrayList webFormatArray,
                                                                java.lang.String propertyGroup,
                                                                java.lang.String propertyName,
                                                                java.lang.String defaultValue,
                                                                int originalTargetAxis,
                                                                int originalTargetPosition,
                                                                int originalTargetLevel)
        Based on the array of web format objects, compare the requested property and determine if they are the same (and what value that shall be) or if they should be marked as default if at least one value is different.
        Parameters:
        webFormatArray - array of web format objects to analyze
        taskBean - target grid bean that is being targeted for formatting (usually of type ReportBean or ViewBean
        propertyGroup - name of the property group to check for
        propertyName - name of the property to check
        defaultValue - what the default value shall be if values are different
        originalTargetAxis - an element from the EnumDSSXMLAxisName enumeration representing the axis of the object being modified
        originalTargetPosition - an index indicating the position on the axis where the object is located. Special notation is used for identifying the different object types:
        If position = 0 -> object identified is an axis (its ID is the targetAxis parameter) If position <0 -> object identified is a metric (its index position is represented on the targetAxis parameter) If position >0 -> object identified is a template unit (its axis is on the targetAxis parameter, its position is indicated on this parameter)
        originalTargetLevel - an element from the EnumWebFormatType enumeration representing the level being formatted for the unit
        Returns:
        the final value to use based on the comparison of the different objects
        Since:
        MicroStrategy Web 8.0.0
      • getComparedPropertyValue

        public static java.lang.String getComparedPropertyValue​(WebTemplate template,
                                                                java.util.ArrayList webFormatArray,
                                                                java.lang.String propertyGroup,
                                                                java.lang.String propertyName,
                                                                java.lang.String defaultValue,
                                                                int originalTargetAxis,
                                                                int originalTargetPosition,
                                                                int originalTargetLevel)
        Since:
        MicroStrategy Web 9.0.0
      • getGridFormatObjectsArray

        public static java.util.ArrayList getGridFormatObjectsArray​(WebComponent targetBean,
                                                                    int targetAxis,
                                                                    int targetPosition,
                                                                    int targetLevel)
        Get an array of all the format objects that should be analyzed before showing the current values selected on the editor's interface.
        Parameters:
        targetAxis - an element from the EnumDSSXMLAxisName enumeration representing the axis of the object being modified
        targetPosition - an index indicating the position on the axis where the object is located. Special notation is used for identifying the different object types:
        If position = 0 -> object identified is an axis (its ID is the targetAxis parameter) If position <0 -> object identified is a metric (its index position is represented on the targetAxis parameter) If position >0 -> object identified is a template unit (its axis is on the targetAxis parameter, its position is indicated on this parameter)
        targetLevel - an element from the EnumWebFormatType enumeration representing the level being formatted for the unit
        targetBean - target grid bean that is being targeted for formatting (usually of type ReportBean or ViewBean
        Returns:
        an array with the format objects to check for
        Since:
        MicroStrategy Web 8.0.0
      • getGridFormatObjectsArray

        public static java.util.ArrayList getGridFormatObjectsArray​(WebComponent targetBean,
                                                                    int targetAxis,
                                                                    int targetPosition,
                                                                    int unitType,
                                                                    int targetLevel)
        Get an array of all the format objects that should be analyzed before showing the current values selected on the editor's interface
        Parameters:
        targetAxis - an element from the EnumDSSXMLAxisName enumeration representing the axis of the object being modified
        targetPosition - an index indicating the true position where the object is located.
        unitType - an identifier indicating the type of target object. If for example it is a metric, the targetAxis value will be ignored and targetPosition is the only one that matters.
        targetLevel - an element from the EnumWebFormatType enumeration representing the level being formatted for the unit
        targetBean - target grid bean that is being targeted for formatting (usually of type ReportBean or ViewBean
        Returns:
        an array with the format objects to check for
        Since:
        MicroStrategy Web 8.0.0
      • getGridFormatObjectsArray

        public static java.util.ArrayList getGridFormatObjectsArray​(boolean getAsRequested,
                                                                    WebComponent targetBean,
                                                                    int targetAxis,
                                                                    int targetPosition,
                                                                    int targetLevel)
        Get an array of all the format objects that should be analyzed before showing the current values selected on the editor's interface
        Parameters:
        targetBean - target grid bean that is being targeted for formatting (usually of type ReportBean or ViewBean
        targetAxis - an element from the EnumDSSXMLAxisName enumeration representing the axis of the object being modified
        targetPosition - an index indicating the position on the axis where the object is located. Special notation is used for identifying the different object types:
        If position = 0 -> object identified is an axis (its ID is the targetAxis parameter) If position <0 -> object identified is a metric (its index position is represented on the targetAxis parameter) If position >0 -> object identified is a template unit (its axis is on the targetAxis parameter, its position is indicated on this parameter)
        targetLevel - an element from the EnumWebFormatType enumeration representing the level being formatted for the unit
        getAsRequested - inidicates if the current axis/position should be obtained as requested or not. Particularly used when asking for an axis (return the axis object as such, not the first object in the collection)
        Returns:
        an array with the format objects to check for
        Since:
        MicroStrategy Web 8.0.0
      • getGridFormatObjectsArray

        public static java.util.ArrayList getGridFormatObjectsArray​(boolean getAsRequested,
                                                                    WebTemplate template,
                                                                    int targetAxis,
                                                                    int targetPosition,
                                                                    int targetLevel)
        Since:
        MicroStrategy Web 9.0.0
      • getGridFormatObjectsArray

        public static java.util.ArrayList getGridFormatObjectsArray​(boolean getAsRequested,
                                                                    WebComponent targetBean,
                                                                    int targetAxis,
                                                                    int targetPosition,
                                                                    int unitType,
                                                                    int targetLevel)
        Get an array of all the format objects that should be analyzed before showing the current values selected on the editor's interface
        Parameters:
        targetBean - target grid bean that is being targeted for formatting (usually of type ReportBean or ViewBean
        targetAxis - an element from the EnumDSSXMLAxisName enumeration representing the axis of the object being modified
        targetPosition - an index indicating the true position on the axis where the object is located.
        unitType - an identifier indicating the type of target object. If for example it is a metric, the targetAxis value will be ignored and targetPosition is the only one that matters.
        targetLevel - an element from the EnumWebFormatType enumeration representing the level being formatted for the unit
        getAsRequested - inidicates if the current axis/position should be obtained as requested or not. Particularly used when asking for an axis (return the axis object as such, not the first object in the collection)
        Returns:
        an array with the format objects to check for
        Since:
        MicroStrategy Web 8.0.0
      • constructNumberFormat

        public static java.lang.String constructNumberFormat​(java.lang.String numberCategory,
                                                             java.lang.String thousandSeparator,
                                                             java.lang.String decimalPlaces,
                                                             java.lang.String currencySymbol,
                                                             java.lang.String currencyPosition,
                                                             java.lang.String negativeNumbers,
                                                             java.lang.String originalFormat)
        Given the formatting specifications, constructs the string that represents the formatting indicated. (ie #,##0.00).
        Parameters:
        numberCategory - category selected by the user, a String element of the EnumGridFormatNumberCategory enumeration
        thousandSeparator - character to use as thousand separator
        decimalPlaces - number of decimal places to include
        currencySymbol - character to use as currency symbol
        currencyPosition - location of currency symbol character, a String element of the EnumGridNumberCurrencyPosition enumeration
        negativeNumbers - category selected for negative numbers, a String element of the EnumGridNegativeNumbersFormat enumeration
        originalFormat - a String representing the original nubmer format selected
        Returns:
        the String representation of all these settings selected