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.ObjectThis 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 intLOCAL_TARGET_ALL_METRICSConstant for representing All Metrics on the report as target for the formattingstatic intLOCAL_TARGET_ALL_REPORTConstant for representing All Report as target for the formattingstatic intLOCAL_TARGET_GRID_BORDERConstant for representing Grid border on the report as target for the formattingstatic intLOCAL_TARGET_GRID_CONTAINERConstant 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.StringconstructNumberFormat(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.StringconvertColorDecimalToHTMLHex(int colorCode)Converts a color ID retrieved as cell property from the metadata to its HTML hexadecimal representationstatic WebFormatContainergetAxis(WebTemplate wt, int targetAxis)Do the required validation for returning the requested axis' format containerstatic java.lang.StringgetComparedPropertyValue(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.StringgetComparedPropertyValue(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.ArrayListgetGridFormatObjectsArray(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.ArrayListgetGridFormatObjectsArray(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.ArrayListgetGridFormatObjectsArray(boolean getAsRequested, WebTemplate template, int targetAxis, int targetPosition, int targetLevel)static java.util.ArrayListgetGridFormatObjectsArray(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.ArrayListgetGridFormatObjectsArray(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 WebTemplategetGridTemplate(WebComponent wc)Get the template object out of the report beanstatic WebFormatContainergetMetric(WebTemplate wt, int indexPosition)Do required validation for returning requested metric's format containerstatic booleangetPropertyUseDefault(WebFormat wf, java.lang.String group, java.lang.String property)Retrieve the property requested from theWebFormatobject and determine if default value is to be used on itstatic java.lang.StringgetPropertyValue(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.StringgetPropertyValue(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 WebFormatContainergetTemplateUnit(WebTemplate wt, int targetAxis, int targetPosition)Do required validation for returning requested template unit's format containerstatic intgetUnitType(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 theEnumDSSXMLAxisNameenumeration 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
EnumGridFormatUnitenumeration 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- aWebFormatobject 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- aWebFormatobject 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
nullif 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 theWebFormatobject and determine if default value is to be used on it- Parameters:
wf-WebFormatinstance 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- aWebComponentinstance initialized - the method processesReportBeanandViewBeaninstances.- Returns:
- a
WebTemplateinstance corresponding to the report bean sent as parameter. Returnsnullif 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- aWebTemplateinstance initializedtargetAxis- an element from theEnumDSSXMLAxisNameenumeration representing the axis to return- Returns:
- a
WebFormatContainerinstance for the axis requested. Returnsnullif 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- aWebTemplateinstance initializedindexPosition- the index location of the metric in the Metrics array- Returns:
- a
WebFormatContainerinstance for the metric requested. Returnsnullif 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- aWebTemplateinstance initializedtargetAxis- an element from theEnumDSSXMLAxisNameenumeration 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
WebFormatContainerinstance for the template unit requested. Returnsnullif 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 typeReportBeanorViewBeanpropertyGroup- 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 theEnumDSSXMLAxisNameenumeration 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 theEnumWebFormatTypeenumeration 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 theEnumDSSXMLAxisNameenumeration 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 theEnumWebFormatTypeenumeration representing the level being formatted for the unittargetBean- target grid bean that is being targeted for formatting (usually of typeReportBeanorViewBean- 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 theEnumDSSXMLAxisNameenumeration 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 theEnumWebFormatTypeenumeration representing the level being formatted for the unittargetBean- target grid bean that is being targeted for formatting (usually of typeReportBeanorViewBean- 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 typeReportBeanorViewBeantargetAxis- an element from theEnumDSSXMLAxisNameenumeration 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 theEnumWebFormatTypeenumeration 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 typeReportBeanorViewBeantargetAxis- an element from theEnumDSSXMLAxisNameenumeration 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 theEnumWebFormatTypeenumeration 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 theEnumGridFormatNumberCategoryenumerationthousandSeparator- 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 theEnumGridNumberCurrencyPositionenumerationnegativeNumbers- category selected for negative numbers, a String element of theEnumGridNegativeNumbersFormatenumerationoriginalFormat- aStringrepresenting the original nubmer format selected- Returns:
- the String representation of all these settings selected
-
-