public class

PreferencesGenericTransform

extends AbstractPreferencesTransform
java.lang.Object
   ↳ com.microstrategy.web.transform.AbstractTransform
     ↳ com.microstrategy.web.transform.AbstractLayoutTransform
       ↳ com.microstrategy.web.app.transforms.AbstractAppTransform
         ↳ com.microstrategy.web.app.transforms.AbstractPreferencesTransform
           ↳ com.microstrategy.web.app.transforms.PreferencesGenericTransform
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

The PreferencesGenericTransform is the base class for rendering preferences in Microstrategy Web.

It has several layout-aware helper methods which will render a preference in a particular type of HTML input element.

This class is not tied to rendering a specific preference but it is rather a generic class which can render any preference in the specified HTML input type format.

Some of the HTML input types in which it can render a preference are checkbox, radio button, select option and text field.

Summary

Constants
String ORIENTATION_HORIZONTAL A constant to specify if you want to render each of the value of a preference in a horizontal fashion next to each other.
String ORIENTATION_VERTICAL A constant to specify if you want to render each of the value of a preference in a vertical fashion below each other.
[Expand]
Inherited Constants
From class com.microstrategy.web.app.transforms.AbstractPreferencesTransform
From class com.microstrategy.web.app.transforms.AbstractAppTransform
[Expand]
Inherited Fields
From class com.microstrategy.web.app.transforms.AbstractPreferencesTransform
From class com.microstrategy.web.app.transforms.AbstractAppTransform
Public Constructors
PreferencesGenericTransform()
Public Methods
boolean checkPreferenceValue(String preferenceEnumName, String prefValue, String prefLevel)
This method checks if the value of a particular preference at a particular level is equal to a value which the user wants to check against.
void renderAllowSaveFlash(MarkupOutput out, String preferenceEnumName, String descriptorID)
render a select box for allow save over flash dashboard in HTML5.
void renderAsCheckBox(MarkupOutput out, String preferenceEnumName, String descriptorID)
Renders the particular preference as a check box along with the descriptor text next to the preference.
void renderAsChecklist(MarkupOutput out, String preferenceName, String onclick)
Render the list of allowable values as CheckBox list
void renderAsComboBox(MarkupOutput out, String preferenceEnumName, String descriptorID, Map<String, String> attributes)
void renderAsComboBox(MarkupOutput out, String preferenceEnumName, String descriptorID, String desc)
void renderAsComboBox(MarkupOutput out, String preferenceEnumName, String descriptorID)
Renders the particular preference as a set of options within a select box.
void renderAsRadio(MarkupOutput out, String preferenceEnumName)
Renders the particular preference as a set of radio buttons.
void renderAsRadio(MarkupOutput out, String preferenceEnumName, String prefValue, String descriptorID)
Renders the particular preference as a radio button along with the descriptor text next to the preference.
void renderAsRadio(MarkupOutput out, String preferenceEnumName, String orientation)
Renders the particular preference as a set of radio buttons.
void renderAsTextBox(MarkupOutput out, String preferenceEnumName, String size, String maxLength, String descriptorID)
Renders the particular preference as a text box along with the descriptor text next to the preference.
void renderCheckBox(MarkupOutput out, String preferenceEnumName)
Renders the particular preference as a check box.
void renderCheckBox(MarkupOutput out, String preferenceEnumName, String onclick)
Renders the particular preference as a check box.
void renderComboBox(MarkupOutput out, String preferenceEnumName)
Renders the particular preference as a set of options within a select box.
void renderDefaultDashboard(MarkupOutput out, String preferenceEnumName, String descriptorID)
render a select box for default dashboard execution mode.
void renderLabel(MarkupOutput out, String preferenceEnumName, String descriptorID)
Renders the descriptor text for a particular preference.
void renderLabel2(MarkupOutput out, String preferenceEnumName, String text)
void renderPreference(String preferenceName, MarkupOutput out)
This method is deprecated. No replacement.
void renderPreference(MarkupOutput out, String preferenceName)
void renderRadio(MarkupOutput out, String preferenceEnumName, String prefValue)
Renders the particular preference as a radio button.
void renderShortcutListAsComboBox(MarkupOutput out, String preferenceEnumName, String listName)
Renders the particular preference as a set of options within a select box.
void renderTextBox(MarkupOutput out, String preferenceEnumName, String size, String maxLength)
Renders the particular preference as a text box.
Protected Methods
List getAllowableValues(String preferenceEnumName)
void transformBody(MarkupOutput out)
Abstract method that must be override by the concrete class.
[Expand]
Inherited Methods
From class com.microstrategy.web.app.transforms.AbstractPreferencesTransform
From class com.microstrategy.web.app.transforms.AbstractAppTransform
From class com.microstrategy.web.transform.AbstractLayoutTransform
From class com.microstrategy.web.transform.AbstractTransform
From class java.lang.Object
From interface com.microstrategy.web.app.transforms.AppTransform
From interface com.microstrategy.web.transform.LayoutTransform
From interface com.microstrategy.web.transform.Transform

Constants

public static final String ORIENTATION_HORIZONTAL

A constant to specify if you want to render each of the value of a preference in a horizontal fashion next to each other.

Constant Value: "horizontal"

public static final String ORIENTATION_VERTICAL

A constant to specify if you want to render each of the value of a preference in a vertical fashion below each other.

Constant Value: "vertical"

Public Constructors

public PreferencesGenericTransform ()

Public Methods

public boolean checkPreferenceValue (String preferenceEnumName, String prefValue, String prefLevel)

This method checks if the value of a particular preference at a particular level is equal to a value which the user wants to check against. The value of the argument preferenceEnumName could be the name of a preference or could be from the enumeration EnumWebPreferences.

The value of the level can be "default", "system", "server", "project", "user" or "user_project" and the preference will be evaluated at that level. If the user does not specify a level argument and leaves it blank we will evaluate the preference value at the lowest level at which the preference has a value.

Parameters
preferenceEnumName The name of the preference whose value we are checking.
prefValue The value which we are comparing against the preference value.
prefLevel The level at which we want to evaluate the prefernece value.
Returns
  • true if the preference value at the indicated level is equal to the value which we are comparing against.

public void renderAllowSaveFlash (MarkupOutput out, String preferenceEnumName, String descriptorID)

render a select box for allow save over flash dashboard in HTML5. Disable it when the dashboard execution mode is Flash.

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.
descriptorID The DescriptorID for the descriptor text to be rendered.

public void renderAsCheckBox (MarkupOutput out, String preferenceEnumName, String descriptorID)

Renders the particular preference as a check box along with the descriptor text next to the preference. This method internally calls renderCheckBox(MarkupOutput, String) and then renderLabel(MarkupOutput, String, String) in that order

Example code for this method:

   renderCheckBox(out, preferenceEnumName);
   out.append("&nbsp;");
   renderLabel(out, preferenceEnumName, descriptorID);
 

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.
descriptorID The DescriptorID for the descriptor text to be rendered.

public void renderAsChecklist (MarkupOutput out, String preferenceName, String onclick)

Render the list of allowable values as CheckBox list

public void renderAsComboBox (MarkupOutput out, String preferenceEnumName, String descriptorID, Map<String, String> attributes)

public void renderAsComboBox (MarkupOutput out, String preferenceEnumName, String descriptorID, String desc)

public void renderAsComboBox (MarkupOutput out, String preferenceEnumName, String descriptorID)

Renders the particular preference as a set of options within a select box. This method internally calls renderLabel(MarkupOutput, String, String) and then renderComboBox(MarkupOutput, String) in that order

Example code for this method:

   renderLabel(out, preferenceEnumName, descriptorID);
   out.append("&nbsp;");
   renderComboBox(out, preferenceEnumName);
 

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.
descriptorID The DescriptorID for the descriptor text to be rendered.

public void renderAsRadio (MarkupOutput out, String preferenceEnumName)

Renders the particular preference as a set of radio buttons.

This method internally calls the method renderAsRadio(MarkupOutput, String, String) with ORIENTATION_HORIZONTAL orientation.

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.

public void renderAsRadio (MarkupOutput out, String preferenceEnumName, String prefValue, String descriptorID)

Renders the particular preference as a radio button along with the descriptor text next to the preference. This method internally calls renderRadio(MarkupOutput, String, String) and then renderLabel(MarkupOutput, String, String) in that order

Example code for this method:

   renderRadio(out, preferenceEnumName, prefValue);
   out.append("&nbsp;");
   renderLabel(out, preferenceEnumName, descriptorID);
 

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.
prefValue The value of the radio button which if equal to that of the preference will render the radio button as selected.
descriptorID The DescriptorID for the descriptor text to be rendered.

public void renderAsRadio (MarkupOutput out, String preferenceEnumName, String orientation)

Renders the particular preference as a set of radio buttons. The value of the argument preferenceEnumName could be the name of a preference or could be from the enumeration EnumWebPreferences.

This method will render the particular preference as a set of radio buttons. It will read the list of allowable values for this preference from the preference definition itself. The preference definition is specified in the file sys_definitions.xml. the list of allowable values will specified along with the preference definition in the nodes "allowableValues" and "allowableValue"

Internally for each allowable value this method will call the method renderRadio(MarkupOutput, String, String) and the method renderPreferenceBodyText(MarkupOutput, String, String) in that order

If no allowable values are specified for the preference in the preference definition file, this method will not render anything. The list of radio buttons will be either rendered vertically one below the other or horizontally one next to the other. This depends on the value of the argument orientation which could be either ORIENTATION_HORIZONTAL or ORIENTATION_VERTICAL.

This is how the output of this method will look like for rendering a text box for the preference named drillRetainThresholds assuming that the value of the preference is 1.

<input value="1" type="radio" checked="1" name="drillRetainThresholds" id="drillRetainThresholds"/>&nbsp;<span class="prefs-content-text" id="maxRow_label"><nobr>Yes:</nobr></span>

&nbsp;

<input value="2" type="radio" name="drillRetainThresholds" id="drillRetainThresholds"/>&nbsp;<span class="prefs-content-text" id="maxRow_label"><nobr>No:</nobr></span>

This is how the list of allowable values will be specified in the file sys_definitions.xml.

<pr des="Drill retain threshold" n="drillRetainThresholds" scp="user_project" v="3">
<allowableValues>
<allowableValue des="Yes" des-id="mstrWeb.219" v="com.microstrategy.web.app.transforms.DRILL_OPTION_RETAIN_THRESHOLD_YES" />
<allowableValue des="No" des-id="mstrWeb.218" v="com.microstrategy.web.app.transforms.DRILL_OPTION_RETAIN_THRESHOLD_NO" />
</allowableValues>
</pr>

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.
orientation Specifies if the radio buttons get rendered vertically one below the other or horizontally one next to the other.

public void renderAsTextBox (MarkupOutput out, String preferenceEnumName, String size, String maxLength, String descriptorID)

Renders the particular preference as a text box along with the descriptor text next to the preference. This method internally calls renderLabel(MarkupOutput, String, String) and then renderTextBox(MarkupOutput, String, String, String) in that order

Example code for this method:

   renderLabel(out, preferenceEnumName, descriptorID);
   out.append("&nbsp;");
   renderTextBox(out, preferenceEnumName, size, maxLength);
 

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.
size The size of the text box to be rendered.
maxLength The max length of the text box to be rendered.
descriptorID The DescriptorID for the descriptor text to be rendered.

public void renderCheckBox (MarkupOutput out, String preferenceEnumName)

Renders the particular preference as a check box. The value of the argument preferenceEnumName could be the name of a preference or could be from the enumeration EnumWebPreferences.

This method will render the check box as cheked if the value of the preference which it is trying to render is PREFERENCE_ON.

This is how the output of this method will look like for rendering a check box for the preference named sSrt assuming that the current value of the preference is PREFERENCE_ON.

<input value="1" type="checkbox" checked="1" name="sSrt" id="sSrt"/><input value="0" type="hidden" name="sSrt" id="sSrt"/>

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.

public void renderCheckBox (MarkupOutput out, String preferenceEnumName, String onclick)

Renders the particular preference as a check box. The value of the argument preferenceEnumName could be the name of a preference or could be from the enumeration EnumWebPreferences.

This method will render the check box as cheked if the value of the preference which it is trying to render is PREFERENCE_ON.

This is how the output of this method will look like for rendering a check box for the preference named sSrt assuming that the current value of the preference is PREFERENCE_ON.

<input value="1" type="checkbox" checked="1" name="sSrt" id="sSrt"/><input value="0" type="hidden" name="sSrt" id="sSrt"/>

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.
onclick Javascript code as onclick handler

public void renderComboBox (MarkupOutput out, String preferenceEnumName)

Renders the particular preference as a set of options within a select box. The value of the argument preferenceEnumName could be the name of a preference or could be from the enumeration EnumWebPreferences.

This method will render the particular preference as a select box. It will read the list of allowable values for this preference from the preference definition itself. The preference definition is specified in the file sys_definitions.xml. the list of allowable values will specified along with the preference definition in the nodes "allowableValues" and "allowableValue"

Internally for each allowable value this method will create an option tag and add it as a child of the seclect box.

If no allowable values are specified for the preference in the preference definition file, this method will not render anything.

This is how the output of this method will look like for rendering a text box for the preference named drillRetainThresholds assuming that the value of the preference is 3.

<SELECT ID="drillRetainThresholds" NAME="drillRetainThresholds" SIZE="1" > <OPTION VALUE="1" >Yes</OPTION> <OPTION VALUE="2" >No</OPTION> <OPTION VALUE="3" SELECTED="1" >Use the settings stored in the report definition</OPTION> </SELECT>

This is how the list of allowable values will be specified in the file sys_definitions.xml.

<pr des="Drill retain threshold" n="drillRetainThresholds" scp="user_project" v="3">
<allowableValues>
<allowableValue des="Yes" des-id="mstrWeb.219" v="com.microstrategy.web.app.transforms.DRILL_OPTION_RETAIN_THRESHOLD_YES" />
<allowableValue des="No" des-id="mstrWeb.218" v="com.microstrategy.web.app.transforms.DRILL_OPTION_RETAIN_THRESHOLD_NO" />
<allowableValue des="Use the settings stored in the report definition" des-id="mstrWeb.270" v="com.microstrategy.web.app.transforms.DRILL_OPTION_RETAIN_THRESHOLD_REPORT_DEFINITION" />
</allowableValues>
</pr>

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.

public void renderDefaultDashboard (MarkupOutput out, String preferenceEnumName, String descriptorID)

render a select box for default dashboard execution mode. Add a toggleDependentSelectsStatus function to make it disable other dependent elements when selecting some options.

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.
descriptorID The DescriptorID for the descriptor text to be rendered.

public void renderLabel (MarkupOutput out, String preferenceEnumName, String descriptorID)

Renders the descriptor text for a particular preference. The value of the argument preferenceEnumName could be the name of a preference or could be from the enumeration EnumWebPreferences. This method internally calls the method renderPreferenceBodyText(MarkupOutput, String, String) after resolving the text for the descriptorID.

It is advisable to use this method as it renders the text next to the preference in a pre defined well formatted CSS style. It also renders the text in a special marked CSS style if there is an error in saving the particular preference.

This is how the output of this method will look like for rendering the descriptor text for the preference named maxRow and the descriptorID mstrWeb.243 which is the descriptor ID for the text Maximum rows in grid:

<span class="mstrStandardHighlighted" id="maxRow_label"><nobr>Maximum rows in grid:</nobr></span>

If users do not have a descriptor for the text that they want to render they can directly call the method renderPreferenceBodyText(MarkupOutput, String, String) with the right string instead of the descriptorID.

The same string would be rendered in the following way if there was any error which saving the preference.

<span class="prefs-content-text" id="maxRow_label"><nobr>Maximum rows in grid:

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference for which we are rendering the descriptor text.
descriptorID The DescriptorID for the descriptor text to be rendered.

public void renderLabel2 (MarkupOutput out, String preferenceEnumName, String text)

public void renderPreference (String preferenceName, MarkupOutput out)

This method is deprecated.
No replacement.

Render individual preferences based on the name provided

Parameters
preferenceName name id of the preference

public void renderPreference (MarkupOutput out, String preferenceName)

public void renderRadio (MarkupOutput out, String preferenceEnumName, String prefValue)

Renders the particular preference as a radio button. The value of the argument preferenceEnumName could be the name of a preference or could be from the enumeration EnumWebPreferences.

This method will render the radio button as cheked if the value of the preference which it is trying to render is equal to the value of the argument prefValue.

This is how the output of this method will look like for rendering a radio button for the preference named graphSize assuming that the value of the argument prefValue is equal to that of the preference.

<input value="1" type="radio" checked="1" name="graphSize" id="graphSize"/>

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.
prefValue The value of the radio button which if equal to that of the preference will render the radio button as selected.

public void renderShortcutListAsComboBox (MarkupOutput out, String preferenceEnumName, String listName)

Renders the particular preference as a set of options within a select box. The value of the argument preferenceEnumName could be the name of a preference or could be from the enumeration EnumWebPreferences.

This method will render the particular preference as a select box. It will read the list of allowable values as specified by the ShortcutList specified by the argument listName. These lists are specified in the pageConfig file under the node named <system-pickers>

Internally for each allowable value this method will create an option tag and add it as a child of the seclect box.

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.
listName The name of the shortcut list which we want to render as a select option.

public void renderTextBox (MarkupOutput out, String preferenceEnumName, String size, String maxLength)

Renders the particular preference as a text box. The value of the argument preferenceEnumName could be the name of a preference or could be from the enumeration EnumWebPreferences.

The value of the text box will be that of the preference that it is trying to render.

This is how the output of this method will look like for rendering a text box for the preference named graphWidth assuming that the value of the preference is 150.

<input value="150" maxlength="4" type="text" class="standard-text" size="4" name="graphWidth" id="graphWidth"/>

Parameters
out Where the output gets rendered.
preferenceEnumName The name of the preference which we are rendering as a check box.
size The size of the text box to be rendered.
maxLength The max length of the text box to be rendered.

Protected Methods

protected List getAllowableValues (String preferenceEnumName)

protected void transformBody (MarkupOutput out)

Abstract method that must be override by the concrete class. This is called to generate the main body of the Preference dialog

Parameters
out where to create the output