Class PreferencesGenericTransform

    • Field Detail

      • ORIENTATION_HORIZONTAL

        public static final java.lang.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.
        See Also:
        Constant Field Values
      • ORIENTATION_VERTICAL

        public static final java.lang.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.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PreferencesGenericTransform

        public PreferencesGenericTransform()
    • Method Detail

      • renderLabel

        public void renderLabel​(MarkupOutput out,
                                java.lang.String preferenceEnumName,
                                java.lang.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 AbstractPreferencesTransform.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 AbstractPreferencesTransform.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.
      • renderLabel2

        public void renderLabel2​(MarkupOutput out,
                                 java.lang.String preferenceEnumName,
                                 java.lang.String text)
      • renderCheckBox

        public void renderCheckBox​(MarkupOutput out,
                                   java.lang.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 EnumWebPreferences.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 EnumWebPreferences.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.
      • renderCheckBox

        public void renderCheckBox​(MarkupOutput out,
                                   java.lang.String preferenceEnumName,
                                   java.lang.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 EnumWebPreferences.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 EnumWebPreferences.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
      • renderAsCheckBox

        public void renderAsCheckBox​(MarkupOutput out,
                                     java.lang.String preferenceEnumName,
                                     java.lang.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.
      • renderRadio

        public void renderRadio​(MarkupOutput out,
                                java.lang.String preferenceEnumName,
                                java.lang.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.
      • renderAsRadio

        public void renderAsRadio​(MarkupOutput out,
                                  java.lang.String preferenceEnumName,
                                  java.lang.String prefValue,
                                  java.lang.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.
      • renderAsRadio

        public void renderAsRadio​(MarkupOutput out,
                                  java.lang.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.
      • renderAsRadio

        public void renderAsRadio​(MarkupOutput out,
                                  java.lang.String preferenceEnumName,
                                  java.lang.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 AbstractPreferencesTransform.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.
      • renderAsChecklist

        public void renderAsChecklist​(MarkupOutput out,
                                      java.lang.String preferenceName,
                                      java.lang.String onclick)
        Render the list of allowable values as CheckBox list
        Parameters:
        out -
        preferenceName -
      • renderTextBox

        public void renderTextBox​(MarkupOutput out,
                                  java.lang.String preferenceEnumName,
                                  java.lang.String size,
                                  java.lang.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.
      • renderAsTextBox

        public void renderAsTextBox​(MarkupOutput out,
                                    java.lang.String preferenceEnumName,
                                    java.lang.String size,
                                    java.lang.String maxLength,
                                    java.lang.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.
      • renderComboBox

        public void renderComboBox​(MarkupOutput out,
                                   java.lang.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.
      • renderAsComboBox

        public void renderAsComboBox​(MarkupOutput out,
                                     java.lang.String preferenceEnumName,
                                     java.lang.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.
      • renderAsComboBox

        public void renderAsComboBox​(MarkupOutput out,
                                     java.lang.String preferenceEnumName,
                                     java.lang.String descriptorID,
                                     java.util.Map<java.lang.String,​java.lang.String> attributes)
      • renderAsComboBox

        public void renderAsComboBox​(MarkupOutput out,
                                     java.lang.String preferenceEnumName,
                                     java.lang.String descriptorID,
                                     java.lang.String desc)
      • renderDefaultDashboard

        public void renderDefaultDashboard​(MarkupOutput out,
                                           java.lang.String preferenceEnumName,
                                           java.lang.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.
      • renderAllowSaveFlash

        public void renderAllowSaveFlash​(MarkupOutput out,
                                         java.lang.String preferenceEnumName,
                                         java.lang.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.
      • renderShortcutListAsComboBox

        public void renderShortcutListAsComboBox​(MarkupOutput out,
                                                 java.lang.String preferenceEnumName,
                                                 java.lang.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.
      • checkPreferenceValue

        public boolean checkPreferenceValue​(java.lang.String preferenceEnumName,
                                            java.lang.String prefValue,
                                            java.lang.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.
      • getAllowableValues

        protected java.util.List getAllowableValues​(java.lang.String preferenceEnumName)
      • renderPreference

        public void renderPreference​(MarkupOutput out,
                                     java.lang.String preferenceName)