Class PromptExpressionCartXHTMLTransform

    • Field Detail

      • logicalOperatorSelectionMethod

        public FormalParameter logicalOperatorSelectionMethod
        Specifies whether the 'And/Or' match case checkbox is displayed or not next the selected list in cart style ouput.
      • logicalOperatorDefault

        public FormalParameter logicalOperatorDefault
        Specifies 'And/Or' match case default value. The value for this formal parameter comes from the EnumDSSXMLFunction enumeration.
      • logicalOperatorAvailableUserDefined

        public FormalParameter logicalOperatorAvailableUserDefined
        Specifies a custome boolean value indicating whether or not to displaye logical operators.
      • loadFileSeparator

        public FormalParameter loadFileSeparator
        Specifies separator to be used when parsing uploaded file values.
      • truncateUploadedAnswersDisplay

        public FormalParameter truncateUploadedAnswersDisplay
        Specifies whether or not to truncate selected list output to certain number of characters.
        This formal parameter will be ignored if uploading answers isn't enabled. Default value indicates not to truncate.
      • truncateUploadedAnswersDisplaySize

        public FormalParameter truncateUploadedAnswersDisplaySize
        Specifies maximum number of characters displayed when truncate expression is requested.
        This formal parameter will be ignored if uploading answers isn't enabled. Default value is 100 characters.
    • Constructor Detail

      • PromptExpressionCartXHTMLTransform

        public PromptExpressionCartXHTMLTransform()
        Default no-args constructor, initialize all the formal parameters as Parent class has defined.
    • Method Detail

      • isExpressionAMetric

        public boolean isExpressionAMetric()
        Indicates whether or not prompt's expression is Metric Qualification.
        It gets prompts expression and compares its type against EnumDSSXMLExpressionType.DssXmlFilterSingleMetricQual.
        Returns:
        boolean true if expression is a Metric Qualification.
      • getAttributeForms

        protected WebAttributeForms getAttributeForms​(WebAttribute attribute)
        Returns collection of forms associated to given Attribute.
        It returns all forms if current Prompted report isn't an XDA MDX type. If that's the case, then it checks (WebExpressionPrompt.getDisplayedForms()) which kind of forms are to be returned.
        Parameters:
        attribute - WebAttribute
        Returns:
        WebAttributeForms
      • isAnswerComplex

        public boolean isAnswerComplex()
        Determines whether or not current answer is complex.
        Overrides:
        isAnswerComplex in class PromptCartXHTMLTransform
        Returns:
        boolean True if answer is complex.
      • isInputFromTextFile

        public boolean isInputFromTextFile()
        Determines if the input for this prompt comes from text file or not.
        This is accomplished by checking the inputFromTextFile formal parameter value.
        Returns:
        boolean True if input of this prompt can come from text file.
      • isCalendarAvailable

        public boolean isCalendarAvailable()
        Indicates whether or not Calendar object is enabled.
        Returns:
        boolean value indicating if a calendar is available for this prompt output, by asking the Cart initialized instance isCalendarAvailable.
      • getAnswer

        protected WebExpression getAnswer()
        Indicates the answer instance of the prompt being transformed.
        Returns:
        WebExpression instance corresponding to the answer of the PromptObject being transformed.
      • getCartExpression

        protected CartExpression getCartExpression()
        Returns an instance of CartExpression object.
        An active CartExpression instance is returned, making sure this instance isn't null.
        Returns:
        CartExpression instance related to this transform.
      • createCartExpression

        protected CartExpression createCartExpression()
        Create a new CartExpression using the GUIElement Factory
        Returns:
        a new instance of the CartExpression
        Since:
        MicroStrategy Web 8.0.1
      • checkLogicalOperatorMethod

        protected boolean checkLogicalOperatorMethod​(int iConst)
        Validates whether or not, given operator mode (iConst) is enabled.
        Test if the logicalOperatorSelectionMethod formal parameter value contains this flag
        Parameters:
        iConst - logical operator mode flag to use for testing the formal parameter value
        Returns:
        True if the level logical operator mode flag is included in the logicalOperatorSelectionMethod parameter value. Otherwise returns False.
      • renderCart

        public void renderCart​(MarkupOutput out)
        Renders a shopping cart output by calling different methods that will render the individual sections of the prompt layout. The output is organized with a series of DIV HTML tags created.
        The methods used for the cart output are listed below, where out is a MarkupOutput instance where the HTML generated by these calls is saved.
           renderLabel(out,
                       (String) _cart.getProperty(EnumCartProperties.AVAILABLE_LABEL),
                       (String) _cart.getProperty(EnumCartProperties.AVAILABLE_ARGUMENT));
           renderIncrementalFetch(out);
           renderAvailable(out);
           renderLabel(out, (String) _cart.getProperty(EnumCartProperties.OPERATOR_LABEL), (String) _cart.getProperty(EnumCartProperties.OPERATOR_ARGUMENT));
           renderOperators(out);
           renderLabel(out, (String) _cart.getProperty(EnumCartProperties.INPUT_LABEL), (String) _cart.getProperty(EnumCartProperties.INPUT_ARGUMENT));
           renderQualificationInputBox(out);
           if (((Boolean) _cart.getProperty(EnumCartProperties.BUTTON_NEXT_INPUT_AVAILABLE)).booleanValue()) {
             renderLabel(out, " ", null);
             renderNextInputButton(out);
           }
           renderAdd(out);
           renderRemove(out);
           renderLabel(out,
                       (String) _cart.getProperty(EnumCartProperties.SELECTED_LABEL),
                       (String) _cart.getProperty(EnumCartProperties.SELECTED_ARGUMENT));
           renderSelected(out);
           if (((Boolean) _cart.getProperty(EnumCartProperties.UP_AND_DOWN_AVAILABLE)).booleanValue()) {
             renderUp(out);
             renderDown(out);
           }
           renderMatch(out);
           if (isCalendarAvailable()) {
             renderCalendarButton(out);
           }
           if (isInputFromTextFile()) {
             renderInputTextFile(out);
           }
         
        Overrides:
        renderCart in class PromptCartXHTMLTransform
        Parameters:
        out - where to write the output of the method.
      • renderAvailableLabel

        public void renderAvailableLabel​(MarkupOutput out)
        Renders label associated to Available section.
        Parameters:
        out - MarkupOutput where to write label.
      • renderOperatorLabel

        public void renderOperatorLabel​(MarkupOutput out)
        Renders label associated to Operators section.
        Parameters:
        out - MarkupOutput where to write label.
      • isNextInputButtonAvailable

        public boolean isNextInputButtonAvailable()
        Indicates whether or not 'Next Input' button is enabled.
        Returns:
        boolean true if enabled.
      • isExpressionAFilter

        public boolean isExpressionAFilter()
        Determines whether or not, prompt's expression type corresponds to a Filter.
        Returns:
        boolean true if expression is a Filter type.
      • areUPandDownButtonsAvailable

        public boolean areUPandDownButtonsAvailable()
        Indicates whether or not UP and Down buttons are enabled.
        Returns:
        boolean true if enabled.
      • renderOperators

        public void renderOperators​(MarkupOutput out)
        Renders the applicable operators for this prompt expression. Sample code for this method would be defined as follows:
           _cart.renderOperators(out);
         
        Parameters:
        out - MarkupOutput instance where the HTML content generated by this method will be saved
      • renderQualificationInputBox

        public void renderQualificationInputBox​(MarkupOutput out)
        Renders the text box input where the expression value may be written.
        Sample code for this method would be defined as follows:
           _cart.renderInput(out);
         
        Parameters:
        out - MarkupOutput instance where the HTML content generated by this method will be saved
      • renderNextInputButton

        public void renderNextInputButton​(MarkupOutput out)
        Renders the Output Level box option. Sample code for this method would be defined as follows:
           _cart.renderButtonNextInput(out);
         
        Parameters:
        out - MarkupOutput instance where the HTML content generated by this method will be saved
      • renderMatch

        public void renderMatch​(MarkupOutput out)
        Renders the AND or OR information for this cart expression. Sample code for this method would be defined as follows:
           _cart.renderMatch(out);
         
        Parameters:
        out - MarkupOutput instance where the HTML content generated by this method will be saved
      • renderCalendarButton

        public void renderCalendarButton​(MarkupOutput out)
        Renders the calendar button information. Sample code for this method would be defined as follows:
           _cart.getCalendar().showOrHideCalendarButton(out, (String) _cart.getProperty(EnumCartProperties.AVAILABLE_ARGUMENT));
         
        Parameters:
        out - MarkupOutput instance where the HTML content generated by this method will be saved
      • renderInputTextFile

        public void renderInputTextFile​(MarkupOutput out)
        Renders the text box input where the user will be enabled to enter or view the text file from where the prompt information comes up. Sample source code for this method would be defined as follows:
                 WebEvent event = getPromptsBean().getWebEvent(EnumPromptsBeanEvents.PROMPTS_EVENT_PROCESS_ALL_PROMPTS);
                if (event != null) {
                    out.append(getDescriptor(1381)); //Descriptor: Import filter from a file:
                    String argumentName = event.getArgumentName(EnumPageEvents.WebEventArgumentTextFileAnswer, getPrompt().getPromptPosition());
        
                    //the browse button.
                    out.append("<INPUT TYPE=\"file\" NAME=\"");
                    out.append(argumentName);
                    out.append("\" LABEL=\"");
                    out.append(getDescriptor(1825));    //Descriptor: Browse
                    if (isDhtmlMode) {
                        out.append("\" ONFOCUS=\"javascript: selectInOperator('" + getArgumentName(PROMPTS_EVENT_ARGUMENT_FUNCTION) + "');");
                    }
                    out.append("\" SIZE=30 /> ");
        
                    //Generating the dotted arrow image.
                    String dottedArrowImgName = _imagesFolder + _dottedArrowImg.getValue();
                    HTMLHelper.generateIMG(out, 0, dottedArrowImgName, 39, 22, "", 0);
                    out.append(" ");
        
                    if (isDhtmlMode) {
                        //Check the preferences the admin set for the file extensions.
                        String sValidExtensions = "";
        
                        AppContext promptsAppContext = getPromptsAppContext();
        
                        if (promptsAppContext != null) {
                            Preferences pref = promptsAppContext.getPreferences();
        
                            sValidExtensions = pref.getValue(EnumWebPreferences.WebPreferencePromptsUploadFileExtensions);
                        }
                        //We will append a script that sets the variables.
                        out.append("<SCRIPT>");
                        out.append(" var sValidExtensions = '," + sValidExtensions + ",';");
                        out.append("var sInvalidFileMessage= '" + StringUtils.replaceString(getDescriptor(1261), "##", sValidExtensions) + "';");
                        out.append("var sEventID='" + String.valueOf(event.getID()) + "';");
                        out.append("</SCRIPT>");
                    }
                    //the LoadFile button.
                    String buttonName = event.getArgumentName(EnumPageEvents.WebEventArgumentLoadFile, getPrompt().getPromptPosition());
        
                    out.append("<INPUT TYPE=\"submit\" NAME=\"");
                    out.append(buttonName);
                    out.append("\" VALUE=\"");
                    out.append(getDescriptor(1348));    //Descriptor: Load File
                    out.append("\" ID=\"" + buttonName);
                    if (isDhtmlMode) {
                        out.append("\" ONCLICK=\"javascript: selectInOperator('" + getArgumentName(PROMPTS_EVENT_ARGUMENT_FUNCTION) + "'); return(checkFileExtension('" + argumentName + "'));");
                    }
                    out.append("\" />");
                }
         
        Parameters:
        out - MarkupOutput instance where the HTML content generated by this method will be saved