Package com.microstrategy.web.beans
Class GridWebFormatHelper
- java.lang.Object
-
- com.microstrategy.web.beans.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 formattingstatic int
LOCAL_TARGET_ALL_REPORT
Constant for representing All Report as target for the formattingstatic int
LOCAL_TARGET_GRID_BORDER
Constant for representing Grid border on the report as target for the formattingstatic int
LOCAL_TARGET_GRID_CONTAINER
Constant for representing Grid Container on the RWD as target for the formatting
-
Constructor Summary
Constructors Constructor Description GridWebFormatHelper()
-
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 representationstatic WebFormatContainer
getAxis(WebTemplate wt, int targetAxis)
Do the required validation for returning the requested axis' format containerstatic 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 interfacestatic 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 interfacestatic 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 interfacestatic WebTemplate
getGridTemplate(WebComponent wc)
Get the template object out of the report beanstatic WebFormatContainer
getMetric(WebTemplate wt, int indexPosition)
Do required validation for returning requested metric's format containerstatic boolean
getPropertyUseDefault(WebFormat wf, java.lang.String group, java.lang.String property)
Retrieve the property requested from theWebFormat
object and determine if default value is to be used on itstatic 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 containerstatic int
getUnitType(int targetAxis, int targetPosition)
Given the axis and position, calculate the unit type of the target
-
-
-
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
-
-
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 theEnumDSSXMLAxisName
enumeration representing the axis of the object being modifiedtargetPosition
- 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
- aWebFormat
object initializedgroup
- the name of the formatting property group to analyzeproperty
- the name of the property in the property group to analyzedefaultValue
- 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
- aWebFormat
object initializedgroup
- the name of the formatting property group to analyzeproperty
- 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 theWebFormat
object and determine if default value is to be used on it- Parameters:
wf
-WebFormat
instance to testgroup
- String with the name of the property group to findproperty
- 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
- aWebComponent
instance initialized - the method processesReportBean
andViewBean
instances.- Returns:
- a
WebTemplate
instance corresponding to the report bean sent as parameter. Returnsnull
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
- aWebTemplate
instance initializedtargetAxis
- an element from theEnumDSSXMLAxisName
enumeration representing the axis to return- Returns:
- a
WebFormatContainer
instance for the axis requested. Returnsnull
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
- aWebTemplate
instance initializedindexPosition
- the index location of the metric in the Metrics array- Returns:
- a
WebFormatContainer
instance for the metric requested. Returnsnull
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
- aWebTemplate
instance initializedtargetAxis
- an element from theEnumDSSXMLAxisName
enumeration representing the axis of the object being modifiedtargetPosition
- 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. Returnsnull
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 analyzetaskBean
- target grid bean that is being targeted for formatting (usually of typeReportBean
orViewBean
propertyGroup
- name of the property group to check forpropertyName
- name of the property to checkdefaultValue
- what the default value shall be if values are differentoriginalTargetAxis
- an element from theEnumDSSXMLAxisName
enumeration representing the axis of the object being modifiedoriginalTargetPosition
- 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 theEnumWebFormatType
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 theEnumDSSXMLAxisName
enumeration representing the axis of the object being modifiedtargetPosition
- 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 theEnumWebFormatType
enumeration representing the level being formatted for the unittargetBean
- target grid bean that is being targeted for formatting (usually of typeReportBean
orViewBean
- 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 theEnumDSSXMLAxisName
enumeration representing the axis of the object being modifiedtargetPosition
- 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 theEnumWebFormatType
enumeration representing the level being formatted for the unittargetBean
- target grid bean that is being targeted for formatting (usually of typeReportBean
orViewBean
- 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 typeReportBean
orViewBean
targetAxis
- an element from theEnumDSSXMLAxisName
enumeration representing the axis of the object being modifiedtargetPosition
- 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 theEnumWebFormatType
enumeration representing the level being formatted for the unitgetAsRequested
- 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 typeReportBean
orViewBean
targetAxis
- an element from theEnumDSSXMLAxisName
enumeration representing the axis of the object being modifiedtargetPosition
- 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 theEnumWebFormatType
enumeration representing the level being formatted for the unitgetAsRequested
- 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 theEnumGridFormatNumberCategory
enumerationthousandSeparator
- character to use as thousand separatordecimalPlaces
- number of decimal places to includecurrencySymbol
- character to use as currency symbolcurrencyPosition
- location of currency symbol character, a String element of theEnumGridNumberCurrencyPosition
enumerationnegativeNumbers
- category selected for negative numbers, a String element of theEnumGridNegativeNumbersFormat
enumerationoriginalFormat
- aString
representing the original nubmer format selected- Returns:
- the String representation of all these settings selected
-
-