public class

OptionsHelper

extends Object
java.lang.Object
   ↳ com.microstrategy.web.app.utils.OptionsHelper

Class Overview

This is the helper class used to save the print and PDF options on the report

Summary

Constants
String AdminFooterCenter
String AdminFooterLeft
String AdminFooterRight
String AdminHeaderCenter
String AdminHeaderLeft
String AdminHeaderRight
String AdvancedSettings
String BlackAndWhite
String CenterHorizontal
String CenterVertical
String Columns
String CoverPageDetailsContents
String CoverPageLocation
String EmbedFonts
String EncodeHTML
String ExcelEmbedImages
String ExcelReportFooter
String ExcelReportHeader
String ExcelReportHeaderLocation
String ExpandAllPages
String ExpandPageFields
String ExpandToFit
String ExportAdminFooter
String ExportAdminHeader
String ExportAdvancedPropertiesPropertySetName
String ExportPageByInfo
String ExportPropertiesPropertySetName
String ExportReportTitle
String ExportSection
String FilterDetails
String FooterCenter
String FooterLeft
String FooterRight
String GraphFormat
String GridandGraph
String HeaderCenter
String HeaderLeft
String HeaderRight
String HeadersAsText
String HtmlColumns
String HtmlRows
String MarginBottom
String MarginLeft
String MarginRight
String MarginTop
String MaxFooterSize
String MaxHeaderSize
String MetricValuesAsText
String NumberingStartPage
String Orientation
String OverlapGridTitles
String PDFPropertySetName
String PageOrdering
String PaperHeight
String PaperType
String PaperWidth
String PlaintextDelimiter
String PrintCoverDetails
String PrintPropertySetName
String PrintQuality
String RepeatColumnHeaders
String RepeatRowHeaders
String ReportHeader
int ReportObjectType
String ReportOfficeRefresh
String ReportPDFSettingsPresent
String Rows
String ScalePagesTall
String ScalePagesWide
String ScalePercentage
String Scaling
String SettingsPresent
String ShowAttributeFormNames
String ShowPageFieldTitles
String TemplateFormattingPropertySetName
String UseLiveChartGraphs
String UseSeparateSheets
Public Constructors
OptionsHelper()
Public Methods
static String booleanPreferencePropertyMapping(String preferenceValue)
Maps the value of a preference to a report property
static String booleanPreferencePropertyMappingGraphFormat(String preferenceValue)
Maps the value of the useBMPGraphs preference to the GraphFormat report property
static String booleanPreferencePropertyMappingPrintQuality(String preferenceValue)
Maps the value of the draftQualityGraphs preference to the PrintQuality report property
static String booleanPreferencePropertyRowsColsMapping(String preferenceValue)
static String booleanPropertyPreferenceMapping(String propertyValue)
Maps the value of a report property to the preference's respective value
static String booleanPropertyPreferenceMappingGraphFormat(String propertyValue)
Maps the value of the Graph Format report property to the useBMPGraphs preference respective value
static String booleanPropertyPreferenceMappingPrintQuality(String propertyValue)
Maps the value of the PrintQuality report property to the draftQualityGraphs preference respective value
static String booleanPropertyPreferenceRowsColsMapping(String propertyValue)
static boolean checkPropertiesPresent(ReportBean rb, String propertySetName)
Tells whether the print/pdf properties are present or not.
static String convertUnits(String unitFrom, String unitTo, String value, int dpi)
static String convertUnits(String value, Locale locale, String unitsPreference, int dpi)
Converts a given double String from inches to cm if the user preference indicates so.
static String convertUnitsToUS(String value, Locale locale, String unitsPreference, int dpi)
Converts a given double String from cm to inches if the user preference indicates so.
static String getCheckboxOptionValue(RequestKeys rk, Preferences pref, HashList propertyValues, boolean propertiesPresent, String preferenceName, String propertyName)
static boolean getCheckboxOptionValueFromRK(RequestKeys rk, String argumentName)
static String[] getDesktopPaperSize(PaperSizesList paperSizesList, String paperSize)
This method is deprecated. Use getDesktopPaperSize(ShortcutList, String)
static String[] getDesktopPaperSize(ShortcutList paperSizesList, String paperSize)
Gets the Desktop's paper size
static String getOptionValue(RequestKeys rk, Preferences pref, HashList propertyValues, boolean propertiesPresent, String preferenceName, String propertyName)
static String getWebPaperSize(PaperSizesList paperSizesList, String paperType, String paperHeight, String paperWidth)
This method is deprecated. Use getWebPaperSize(ShortcutList, String, String, String)
static String getWebPaperSize(ShortcutList paperSizesList, String paperType, String paperHeight, String paperWidth)
Retunrs the paper size key for the specified arguments or a Custom size with the specified paperHeight and paperWidth
static HashList loadGlobalPropertyValues(ReportBean rb, String propertySetName)
Returns a list of the global properties needed for PDF
static HashList loadProjectPropertyValues(AppContext ac, String propertySetName)
Returns a list of the project properties needed for printing/PDF (depending on the propertySetName)
static HashList loadPropertyValues(ReportBean rb, String propertySetName)
Returns a list of the properties needed for printing/PDF (depending on the propertySetName)
static String localizeDouble(String doubleValue, String localeID)
Converts a double to the specified locale
static String localizeDoubleToEnglish(String doubleValue)
Converts a double to English locale
static void saveProjectPropertyValues(AppContext ac, HashList argumentValues, String propertySetName)
Saves the project properties contained in the argumentValues.
static void savePropertyValues(AppContext ac, HashList argumentValues, String propertySetName, boolean allProjects)
Saves properties contained in the argumentValues.
static void setPrefValue(Preferences preferences, String name, PreferenceLevel level, String value)
Saves the value of a preference
static void setPrefValueIfInRequest(Preferences preferences, RequestKeys rk, String name, PreferenceLevel level, String value)
Saves the value of a preference if the preference is present on the request
static void submitSetPropertyEvent(ReportBean rb, HashList argumentValues)
Submits an event that saves all the properties on the list
static String truncateDecimalVaule(String value, int maxLength, String localeID)
Truncate a decimal vaule so the length of its string representation does not exceed 'maxLength'.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String AdminFooterCenter

Constant Value: "AdminFooterCenter"

public static final String AdminFooterLeft

Constant Value: "AdminFooterLeft"

public static final String AdminFooterRight

Constant Value: "AdminFooterRight"

public static final String AdminHeaderCenter

Constant Value: "AdminHeaderCenter"

public static final String AdminHeaderLeft

Constant Value: "AdminHeaderLeft"

public static final String AdminHeaderRight

Constant Value: "AdminHeaderRight"

public static final String AdvancedSettings

Constant Value: "AdvancedSettings"

public static final String BlackAndWhite

Constant Value: "BlackAndWhite"

public static final String CenterHorizontal

Constant Value: "CenterHorizontal"

public static final String CenterVertical

Constant Value: "CenterVertical"

public static final String Columns

Constant Value: "Columns"

public static final String CoverPageDetailsContents

Constant Value: "CoverPageDetailsContents"

public static final String CoverPageLocation

Constant Value: "CoverPageLocation"

public static final String EmbedFonts

Constant Value: "EmbedFonts"

public static final String EncodeHTML

Constant Value: "EncodeHTML"

public static final String ExcelEmbedImages

Constant Value: "ExcelEmbedImages"

public static final String ExcelReportFooter

Constant Value: "ExcelReportFooter"

public static final String ExcelReportHeader

Constant Value: "ExcelReportHeader"

public static final String ExcelReportHeaderLocation

Constant Value: "ExcelReportHeaderLocation"

public static final String ExpandAllPages

Constant Value: "ExpandAllPages"

public static final String ExpandPageFields

Constant Value: "ExpandPageFields"

public static final String ExpandToFit

Constant Value: "ExpandToFit"

public static final String ExportAdminFooter

Constant Value: "AdminFooter"

public static final String ExportAdminHeader

Constant Value: "AdminHeader"

public static final String ExportAdvancedPropertiesPropertySetName

Constant Value: "ExportAdvancedProperties"

public static final String ExportPageByInfo

Constant Value: "ExportPageByInfo"

public static final String ExportPropertiesPropertySetName

Constant Value: "ExportProperties"

public static final String ExportReportTitle

Constant Value: "ExportReportTitle"

public static final String ExportSection

Constant Value: "ExportSection"

public static final String FilterDetails

Constant Value: "FilterDetails"

public static final String FooterCenter

Constant Value: "FooterCenter"

public static final String FooterLeft

Constant Value: "FooterLeft"

public static final String FooterRight

Constant Value: "FooterRight"

public static final String GraphFormat

Constant Value: "GraphFormat"

public static final String GridandGraph

Constant Value: "GridandGraph"

public static final String HeaderCenter

Constant Value: "HeaderCenter"

public static final String HeaderLeft

Constant Value: "HeaderLeft"

public static final String HeaderRight

Constant Value: "HeaderRight"

public static final String HeadersAsText

Constant Value: "HeadersAsText"

public static final String HtmlColumns

Constant Value: "HtmlColumns"

public static final String HtmlRows

Constant Value: "HtmlRows"

public static final String MarginBottom

Constant Value: "MarginBottom"

public static final String MarginLeft

Constant Value: "MarginLeft"

public static final String MarginRight

Constant Value: "MarginRight"

public static final String MarginTop

Constant Value: "MarginTop"

public static final String MaxFooterSize

Constant Value: "MaxFooterSize"

public static final String MaxHeaderSize

Constant Value: "MaxHeaderSize"

public static final String MetricValuesAsText

Constant Value: "MetricValuesAsText"

public static final String NumberingStartPage

Constant Value: "NumberingStartPage"

public static final String Orientation

Constant Value: "Orientation"

public static final String OverlapGridTitles

Constant Value: "OverlapGridTitles"

public static final String PDFPropertySetName

Constant Value: "ExportPDFSettings"

public static final String PageOrdering

Constant Value: "PageOrdering"

public static final String PaperHeight

Constant Value: "PaperHeight"

public static final String PaperType

Constant Value: "PaperType"

public static final String PaperWidth

Constant Value: "PaperWidth"

public static final String PlaintextDelimiter

Constant Value: "PlaintextDelimiter"

public static final String PrintCoverDetails

Constant Value: "PrintCoverDetails"

public static final String PrintPropertySetName

Constant Value: "WebPrintSettings"

public static final String PrintQuality

Constant Value: "PrintQuality"

public static final String RepeatColumnHeaders

Constant Value: "RepeatColumnHeaders"

public static final String RepeatRowHeaders

Constant Value: "RepeatRowHeaders"

public static final String ReportHeader

Constant Value: "ReportHeader"

public static final int ReportObjectType

Constant Value: 4 (0x00000004)

public static final String ReportOfficeRefresh

Constant Value: "ReportOfficeRefresh"

public static final String ReportPDFSettingsPresent

Constant Value: "ReportPDFSettingsPresent"

public static final String Rows

Constant Value: "Rows"

public static final String ScalePagesTall

Constant Value: "ScalePagesTall"

public static final String ScalePagesWide

Constant Value: "ScalePagesWide"

public static final String ScalePercentage

Constant Value: "ScalePercentage"

public static final String Scaling

Constant Value: "Scaling"

public static final String SettingsPresent

Constant Value: "SettingsPresent"

public static final String ShowAttributeFormNames

Constant Value: "LongNames"

public static final String ShowPageFieldTitles

Constant Value: "ShowPageFieldTitles"

public static final String TemplateFormattingPropertySetName

Constant Value: "Template Formatting"

public static final String UseLiveChartGraphs

Constant Value: "UseLiveChartGraphs"

public static final String UseSeparateSheets

Constant Value: "UseSeparateSheets"

Public Constructors

public OptionsHelper ()

Public Methods

public static String booleanPreferencePropertyMapping (String preferenceValue)

Maps the value of a preference to a report property

Parameters
preferenceValue The preference value
Returns
  • the report property value

public static String booleanPreferencePropertyMappingGraphFormat (String preferenceValue)

Maps the value of the useBMPGraphs preference to the GraphFormat report property

Parameters
preferenceValue The preference value
Returns
  • the report property value

public static String booleanPreferencePropertyMappingPrintQuality (String preferenceValue)

Maps the value of the draftQualityGraphs preference to the PrintQuality report property

Parameters
preferenceValue The preference value
Returns
  • the report property value

public static String booleanPreferencePropertyRowsColsMapping (String preferenceValue)

public static String booleanPropertyPreferenceMapping (String propertyValue)

Maps the value of a report property to the preference's respective value

Parameters
propertyValue property value
Returns
  • the preference value

public static String booleanPropertyPreferenceMappingGraphFormat (String propertyValue)

Maps the value of the Graph Format report property to the useBMPGraphs preference respective value

Parameters
propertyValue property value
Returns
  • the preference value

public static String booleanPropertyPreferenceMappingPrintQuality (String propertyValue)

Maps the value of the PrintQuality report property to the draftQualityGraphs preference respective value

Parameters
propertyValue property value
Returns
  • the preference value

public static String booleanPropertyPreferenceRowsColsMapping (String propertyValue)

public static boolean checkPropertiesPresent (ReportBean rb, String propertySetName)

Tells whether the print/pdf properties are present or not. it looks for property OptionsHelper.ReportPDFSettingsPresent on the property set specified

Parameters
rb report bean
propertySetName property set name (OptionsHelper.PrintPropertySetName or OptionsHelper.ExportPDFSettings)
Returns
  • true if print/pdf properties are present

public static String convertUnits (String unitFrom, String unitTo, String value, int dpi)

public static String convertUnits (String value, Locale locale, String unitsPreference, int dpi)

Converts a given double String from inches to cm if the user preference indicates so. If the user preference is set to inches, the function does not do anything.

Parameters
value Double value in string format to convert.
locale User's locale
unitsPreference Preference that specifies the units to be used
Returns
  • the converted value

public static String convertUnitsToUS (String value, Locale locale, String unitsPreference, int dpi)

Converts a given double String from cm to inches if the user preference indicates so. If the user preference is set to inches, the function does not do anything.

Parameters
value Double value in string format to convert.
locale User's locale
unitsPreference Preference that specifies the units to be used
Returns
  • the converted value

public static String getCheckboxOptionValue (RequestKeys rk, Preferences pref, HashList propertyValues, boolean propertiesPresent, String preferenceName, String propertyName)

public static boolean getCheckboxOptionValueFromRK (RequestKeys rk, String argumentName)

public static String[] getDesktopPaperSize (PaperSizesList paperSizesList, String paperSize)

This method is deprecated.
Use getDesktopPaperSize(ShortcutList, String)

Gets the Desktop's paper size

Parameters
paperSizesList paper sizes list
paperSize paper size
Returns
  • Desktop's paper size

public static String[] getDesktopPaperSize (ShortcutList paperSizesList, String paperSize)

Gets the Desktop's paper size

Parameters
paperSizesList paper sizes list
paperSize paper size
Returns
  • Desktop's paper size

public static String getOptionValue (RequestKeys rk, Preferences pref, HashList propertyValues, boolean propertiesPresent, String preferenceName, String propertyName)

public static String getWebPaperSize (PaperSizesList paperSizesList, String paperType, String paperHeight, String paperWidth)

This method is deprecated.
Use getWebPaperSize(ShortcutList, String, String, String)

Retunrs the paper size key for the specified arguments or a Custom size with the specified paperHeight and paperWidth

Parameters
paperSizesList a PaperSizesList collection with the available paper sizes
paperType a String that specifies the paper type
paperHeight a String that specifies the paper height
paperWidth a String that specifies the paper width
Returns
  • a String with the key for the specified arguments

public static String getWebPaperSize (ShortcutList paperSizesList, String paperType, String paperHeight, String paperWidth)

Retunrs the paper size key for the specified arguments or a Custom size with the specified paperHeight and paperWidth

Parameters
paperSizesList a ShortcutList collection with the available paper sizes
paperType a String that specifies the paper type
paperHeight a String that specifies the paper height
paperWidth a String that specifies the paper width
Returns
  • a String with the key for the specified arguments

public static HashList loadGlobalPropertyValues (ReportBean rb, String propertySetName)

Returns a list of the global properties needed for PDF

Parameters
rb report bean
propertySetName property set name (OptionsHelper.ExportPropertiesPropertySetName)
Returns
  • a Hashlist with all the global properties needed for PDF

public static HashList loadProjectPropertyValues (AppContext ac, String propertySetName)

Returns a list of the project properties needed for printing/PDF (depending on the propertySetName)

Parameters
ac The Application Context
propertySetName property set name (OptionsHelper.PrintPropertySetName or OptionsHelper.ExportPDFSettings)
Returns
  • a Hashlist with all the project properties needed for printing/PDF (depending on the propertySetName)

public static HashList loadPropertyValues (ReportBean rb, String propertySetName)

Returns a list of the properties needed for printing/PDF (depending on the propertySetName)

Parameters
rb report bean
propertySetName property set name (OptionsHelper.PrintPropertySetName or OptionsHelper.ExportPDFSettings)
Returns
  • a Hashlist with all the properties needed for printing/PDF (depending on the propertySetName)

public static String localizeDouble (String doubleValue, String localeID)

Converts a double to the specified locale

Parameters
doubleValue value to localize
localeID locale to localize to
Returns
  • localized value

public static String localizeDoubleToEnglish (String doubleValue)

Converts a double to English locale

Parameters
doubleValue value to localize
Returns
  • value localized

public static void saveProjectPropertyValues (AppContext ac, HashList argumentValues, String propertySetName)

Saves the project properties contained in the argumentValues. Equivalent to savePropertyValues(AppContext, HashList, String, boolean) where allProjects is false.

Parameters
ac AppContext the application context
argumentValues HashList with all the project properties to be saved
propertySetName String property set name (OptionsHelper.PrintPropertySetName or OptionsHelper.ExportPDFSettings)

public static void savePropertyValues (AppContext ac, HashList argumentValues, String propertySetName, boolean allProjects)

Saves properties contained in the argumentValues.

Parameters
ac AppContext the application context
argumentValues HashList with all the project properties to be saved
propertySetName String property set name (OptionsHelper.PrintPropertySetName or OptionsHelper.ExportPDFSettings)
allProjects whether to apply settings to all projects or only the current project

public static void setPrefValue (Preferences preferences, String name, PreferenceLevel level, String value)

Saves the value of a preference

Parameters
preferences Preferences object
name name of the preference
level preference level (a value from EnumPreferenceLevels)
value preference value

public static void setPrefValueIfInRequest (Preferences preferences, RequestKeys rk, String name, PreferenceLevel level, String value)

Saves the value of a preference if the preference is present on the request

Parameters
preferences Preferences object
name name of the preference
level preference level (a value from EnumPreferenceLevels)
value preference value

public static void submitSetPropertyEvent (ReportBean rb, HashList argumentValues)

Submits an event that saves all the properties on the list

Parameters
rb report bean
argumentValues hashlist with the properties to save

public static String truncateDecimalVaule (String value, int maxLength, String localeID)

Truncate a decimal vaule so the length of its string representation does not exceed 'maxLength'. In any case we can only decrease the precision but not change the vaule itself.

Parameters
value The string representation of the value, formatted with specified locale
maxLength The maximum length of objective string after truncation
localeID The ID of the locale with which the original value is localized
Returns
  • The representation of the value after truncation