public class

GridWebFormatHelper

extends Object
java.lang.Object
   ↳ com.microstrategy.web.beans.GridWebFormatHelper
Known Direct Subclasses

Class Overview

This class provides a series of methods that aid on the manipulation of grid formatting properties.

Summary

Constants
int LOCAL_TARGET_ALL_METRICS Constant for representing All Metrics on the report as target for the formatting
int LOCAL_TARGET_ALL_REPORT Constant for representing All Report as target for the formatting
int LOCAL_TARGET_GRID_BORDER Constant for representing Grid border on the report as target for the formatting
int LOCAL_TARGET_GRID_CONTAINER Constant for representing Grid Container on the RWD as target for the formatting
Public Constructors
GridWebFormatHelper()
Public Methods
static String constructNumberFormat(String numberCategory, String thousandSeparator, String decimalPlaces, String currencySymbol, String currencyPosition, String negativeNumbers, String originalFormat)
Given the formatting specifications, constructs the string that represents the formatting indicated.
static 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 String getComparedPropertyValue(WebTemplate template, ArrayList webFormatArray, String propertyGroup, String propertyName, String defaultValue, int originalTargetAxis, int originalTargetPosition, int originalTargetLevel)
static String getComparedPropertyValue(WebComponent taskBean, ArrayList webFormatArray, String propertyGroup, String propertyName, 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 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 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 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 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 ArrayList getGridFormatObjectsArray(boolean getAsRequested, WebTemplate template, int targetAxis, int targetPosition, int targetLevel)
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, String group, String property)
Retrieve the property requested from the WebFormat object and determine if default value is to be used on it
static String getPropertyValue(WebFormat wf, String group, String property)
Given the group and property specified as parameters, find and return its value according to the WebFormat object passed as parameter.
static String getPropertyValue(WebFormat wf, String group, String property, 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
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int LOCAL_TARGET_ALL_METRICS

Constant for representing All Metrics on the report as target for the formatting

Constant Value: -999 (0xfffffc19)

public static final int LOCAL_TARGET_ALL_REPORT

Constant for representing All Report as target for the formatting

Constant Value: -9999 (0xffffd8f1)

public static final int LOCAL_TARGET_GRID_BORDER

Constant for representing Grid border on the report as target for the formatting

Constant Value: -99 (0xffffff9d)

public static final int LOCAL_TARGET_GRID_CONTAINER

Constant for representing Grid Container on the RWD as target for the formatting

Constant Value: -9 (0xfffffff7)

Public Constructors

public GridWebFormatHelper ()

Public Methods

public static String constructNumberFormat (String numberCategory, String thousandSeparator, String decimalPlaces, String currencySymbol, String currencyPosition, String negativeNumbers, 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

public static 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

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.

public static String getComparedPropertyValue (WebTemplate template, ArrayList webFormatArray, String propertyGroup, String propertyName, String defaultValue, int originalTargetAxis, int originalTargetPosition, int originalTargetLevel)

public static String getComparedPropertyValue (WebComponent taskBean, ArrayList webFormatArray, String propertyGroup, String propertyName, 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
taskBean target grid bean that is being targeted for formatting (usually of type ReportBean or ViewBean
webFormatArray array of web format objects to analyze
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

public static 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
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 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
Returns
  • an array with the format objects to check for

public static 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
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)
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
Returns
  • an array with the format objects to check for

public static 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
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)
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
Returns
  • an array with the format objects to check for

public static 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
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
Returns
  • an array with the format objects to check for

public static ArrayList getGridFormatObjectsArray (boolean getAsRequested, WebTemplate template, int targetAxis, int targetPosition, int targetLevel)

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.

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.

public static boolean getPropertyUseDefault (WebFormat wf, String group, 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

public static String getPropertyValue (WebFormat wf, String group, 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

public static String getPropertyValue (WebFormat wf, String group, String property, 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

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.

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