Examples of XFSelectAttributes


Examples of com.volantis.mcs.papi.XFSelectAttributes

    String getInitialValue(
            MarinerPageContext pageContext,
            PAPIAttributes papiAttributes)
            throws PAPIException {

        XFSelectAttributes attributes = (XFSelectAttributes) papiAttributes;

        return attributes.getInitial();
    }
View Full Code Here

Examples of com.volantis.mcs.papi.XFSelectAttributes

            throws PAPIException {

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        XFSelectAttributes attributes = (XFSelectAttributes) papiAttributes;

        // Create a new protocol attributes object every time, as this element
        // could be reused before the attributes have actually been finished with
        // by the protocol.
        pattributes = new com.volantis.mcs.protocols.XFSelectAttributes();

        // Initialise the attributes specific to this field.
        TextAssetReference object;

        PolicyReferenceResolver resolver =
                pageContext.getPolicyReferenceResolver();

        // Process the errmsg as a mariner expression.
        object = resolver.resolveQuotedTextExpression(attributes.getErrmsg());
        pattributes.setErrmsg(object);

        // Set the initial value attribute.
        pattributes.setInitial(attributes.getInitial());

        // Set the multiple attribute.
        pattributes.setMultiple(multiple);

        // Set the tag name
View Full Code Here

Examples of com.volantis.mcs.protocols.XFSelectAttributes

        DoSelectInputTestHelper helper = new DoSelectInputTestHelper();

        final String rowCount = "3";
        final String tabIndex ="1";

        XFSelectAttributes atts = helper.buildSelectAttributes();
        atts.setStyles(StylesBuilder.getStyles("mcs-rows: " + rowCount));
        atts.setMultiple(multiSelect);

        if(!multiSelect) {
            for(int i=0; i<selectedOptions.length; i++) {
                if(selectedOptions[i]) {
                    atts.setInitial("Value" + (i+1));
                    break;
                }
            }
        }
        atts.setTabindex(tabIndex);
        // add some options

        for(int i=0; i<selectedOptions.length; i++) {
            helper.addOption(atts,
                    "Caption" + (i+1),
                    "Prompt" + (i+1),
                    "Value" + (i+1),
                    selectedOptions[i]);
        }


        //protocol.addStyleMapping(atts, style);
        TestDOMOutputBuffer buffer = new TestDOMOutputBuffer();

        TestMarinerPageContext testPageContext =
            (TestMarinerPageContext)protocol.getMarinerPageContext();
        testPageContext.setFormFragmentResetState(true);

        testable.setCurrentBuffer(atts.getEntryContainerInstance(), buffer);

        StringBuffer sb = new StringBuffer();

        sb.append("<select");
        if(multiSelect) {
            sb.append(" multiple=\"multiple\"");
        }
        sb.append(" name=\"").append(atts.getName()).append("\"");
        if(multiSelect) {
            sb.append(" size=\"").append(rowCount).append("\"");
        }
        sb.append(" tabindex=\"1\"");
        sb.append(">");
View Full Code Here

Examples of com.volantis.mcs.protocols.XFSelectAttributes

        DoSelectInputTestHelper helper = new DoSelectInputTestHelper();

        final String rowCount = "3";
        final String tabIndex ="1";

        XFSelectAttributes atts = helper.buildSelectAttributes();
        atts.setStyles(StylesBuilder.getStyles("mcs-rows: " + rowCount));
        atts.setMultiple(multiSelect);

        if(!multiSelect) {
            for(int i=0; i<selectedOptions.length; i++) {
                if(selectedOptions[i]) {
                    atts.setInitial("Value" + (i+1));
                    break;
                }
            }
        }
        atts.setTabindex(tabIndex);
        // add some options

        for(int i=0; i<selectedOptions.length; i++) {
            helper.addOption(atts,
                              "Caption" + (i+1),
                              "Prompt" + (i+1),
                              "Value" + (i+1),
                              selectedOptions[i]);
        }


        //protocol.addStyleMapping(atts, style);
        TestDOMOutputBuffer buffer = new TestDOMOutputBuffer();


        TestMarinerPageContext testPageContext =
                (TestMarinerPageContext)protocol.getMarinerPageContext();
        testPageContext.setFormFragmentResetState(true);

        testable.setCurrentBuffer(atts.getEntryContainerInstance(), buffer);

        StringBuffer sb = new StringBuffer();

        sb.append("<select ");
        sb.append("id=\"").append(atts.getId()).append("\" ");
        if(multiSelect) {
            sb.append("multiple=\"multiple\" ");
        }
        sb.append("name=\"").append(atts.getName()).append("\" ");
        if(multiSelect) {
            sb.append("size=\"").append(rowCount).append("\" ");
        }
        sb.append("tabindex=\"").append(tabIndex).append("\" ");
        sb.append("title=\"")
                .append(atts.getPrompt().getText(TextEncoding.PLAIN))
                .append("\">");

        for(int i=0; i<selectedOptions.length; i++) {
            sb.append("<option id=\"OptionId\" ");
            if(selectedOptions[i]) {
View Full Code Here

Examples of com.volantis.mcs.protocols.XFSelectAttributes

        privateSetUp();

        DoSelectInputTestHelper helper = new DoSelectInputTestHelper();


        XFSelectAttributes atts = helper.buildSelectAttributes();

        // build the following nested option optgroup structure
        // <group 1>
        //   <group 2>
        //      <group 3>
        //         <option 1>
        //      </group>
        //   <group>
        // </group>
        // <group 4>
        //   <option 2>
        // </group>
        SelectOptionGroup group = helper.addOptionGroup(atts, "Group1",
                                                         "Prompt1");
        group = helper.addOptionGroup(group, "Group2", "Prompt2");
        group = helper.addOptionGroup(group, "Group3", "Prompt3");
        helper.addOption(group, "Caption1", "Prompt1""Value1", false);

        group = helper.addOptionGroup(atts, "Group4""Prompt4");
        helper.addOption(group, "Caption2", "Prompt2""Value2", false);


        TestDOMOutputBuffer buffer = new TestDOMOutputBuffer();
        testable.setCurrentBuffer(atts.getEntryContainerInstance(), buffer);

        StringBuffer sb = new StringBuffer();

        sb.append("<select ");
        sb.append("id=\"").append(atts.getId()).append("\" ");
        sb.append("name=\"").append(atts.getName()).append("\" ");
        sb.append("title=\"").append(atts.getPrompt()
                .getText(TextEncoding.PLAIN))
                .append("\">");

        for(int i=0; (i<testable.getMaxOptGroupNestingDepth() && i<3); i++) {
            sb.append("<optgroup id=\"GroupId\" ");
View Full Code Here

Examples of com.volantis.mcs.protocols.XFSelectAttributes

            throws Exception {


        DoSelectInputTestHelper helper = new DoSelectInputTestHelper();

        XFSelectAttributes atts = helper.buildSelectAttributes();
        Styles styles = atts.getStyles();
        MutablePropertyValues propertyValues = styles.getPropertyValues();

        if(!multiSelect) {
            for(int i=0; i<selectedOtions.length; i++) {
                if(selectedOtions[i]) {
                    atts.setInitial("Value" + (i+1));
                    break;
                }
            }
        }

        atts.setMultiple(multiSelect);
        //atts.setTabindex(tabIndex);
        // add some options
        helper.addOption(atts, "Caption1", "Prompt1", "Value1",
                          selectedOtions[0]);
        helper.addOption(atts, "Caption2", "Prompt2", "Value2",
                          selectedOtions[1]);


        SelectOptionGroup group = null;
        String caption, prompt;
        int count = 0;
        do {
            caption = "Group" + (count + 1);
            prompt = "Prompt" + (count + 1);
            if(0 == count) {
                group = helper.addOptionGroup(atts, caption, prompt);;
            } else {
                group = helper.addOptionGroup(group, caption, prompt);
            }
        } while(++count < optGroupCount);


        helper.addOption(group, "Caption3", "Prompt3", "Value3",
                          selectedOtions[2]);

        //protocol.addStyleMapping(atts, style);
        TestDOMOutputBuffer buffer = new TestDOMOutputBuffer();

        propertyValues.setComputedValue(
                StylePropertyDetails.MCS_SELECTION_LIST_STYLE,
                MCSSelectionListStyleKeywords.CONTROLS);
        propertyValues.setComputedValue(
                StylePropertyDetails.MCS_SELECTION_LIST_OPTION_LAYOUT,
                rightAlignCaption ? MCSSelectionListOptionLayoutKeywords.CONTROL_FIRST
                : MCSSelectionListOptionLayoutKeywords.CAPTION_FIRST);
        propertyValues.setComputedValue(
                StylePropertyDetails.MCS_MENU_ORIENTATION,
                vertical ? MCSMenuOrientationKeywords.VERTICAL
                : MCSMenuOrientationKeywords.HORIZONTAL);

        TestMarinerPageContext testPageContext =
                (TestMarinerPageContext)protocol.getMarinerPageContext();
        testPageContext.setFormFragmentResetState(true);

       testable.setCurrentBuffer(atts.getEntryContainerInstance(), buffer);

       String type = (multiSelect) ? "checkbox" : "radio";
       String seperator = (vertical) ? "<br/>" : "\u00a0";
       StringBuffer sb = new StringBuffer();

       sb.append("<div ");
       sb.append("id=\"" + atts.getId() + "\">");

         for (int i=0; i<3; i++) {
            if(i > 0) {
                sb.append(seperator);
            }
            if (!rightAlignCaption) {
                sb.append("Caption").append(i+1);
            }
            sb.append("<input ");
            if(selectedOtions[i]) {
                sb.append("checked=\"checked\" ");
            }
            sb.append("id=\"OptionId\" ");
            sb.append("name=\"").append(atts.getName()).append("\" ");
            sb.append("title=\"").append("Prompt").append(i+1).append("\" ");
            sb.append("type=\"").append(type).append("\" ");
            sb.append("value=\"").append("Value").append(i+1).append("\"/>");
            if(rightAlignCaption) {
                sb.append("Caption").append(i+1);
View Full Code Here

Examples of com.volantis.mcs.protocols.XFSelectAttributes

    public void testXFOptionStyles() throws Exception {
        privateSetUp();
        final DoSelectInputTestHelper helper = new DoSelectInputTestHelper();

        final XFSelectAttributes attributes = helper.buildSelectAttributes();
        Styles styles = attributes.getStyles();
        MutablePropertyValues propertyValues = styles.getPropertyValues();
        attributes.setMultiple(false);

        // add some optionsDOMP
        helper.addOption(attributes, "Caption1", "Prompt1", "Value1", true);
        helper.addOption(attributes, "Caption2", "Prompt2", "Value2", false);
        final Styles captionStyles =
                StylesBuilder.getCompleteStyles("font-weight: bold");
        ((SelectOption) attributes.getOptions().get(0)).setCaptionStyles(captionStyles);

        // create style
        propertyValues.setComputedValue(
                StylePropertyDetails.MCS_SELECTION_LIST_STYLE,
                MCSSelectionListStyleKeywords.CONTROLS);
        propertyValues.setComputedValue(
                StylePropertyDetails.MCS_SELECTION_LIST_OPTION_LAYOUT,
                MCSSelectionListOptionLayoutKeywords.CONTROL_FIRST);
        propertyValues.setComputedValue(
                StylePropertyDetails.MCS_MENU_ORIENTATION,
                MCSMenuOrientationKeywords.VERTICAL);

        // initialise the buffer
        final TestDOMOutputBuffer buffer = new TestDOMOutputBuffer();
        testable.setCurrentBuffer(attributes.getEntryContainerInstance(), buffer);
        buffer.initialise();

        // select
        protocol.doSelectInput(attributes);
View Full Code Here

Examples of com.volantis.mcs.protocols.XFSelectAttributes

     */
    public void testWriteOptGroupsCaptionReference() throws ProtocolException {
        privateSetUp();

        DoSelectInputTestHelper helper = new DoSelectInputTestHelper();
        XFSelectAttributes atts = helper.buildSelectAttributes();
        helper.addOptionGroup(atts, "literal", null);
        doOptionGroupTitleTest(atts,"literal");
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.XFSelectAttributes

     */
    public void testWriteOptGroupsPromptReference() throws ProtocolException {
        privateSetUp();

        DoSelectInputTestHelper helper = new DoSelectInputTestHelper();
        XFSelectAttributes atts = helper.buildSelectAttributes();

        helper.addOptionGroup(atts, null, "literal");
        doOptionGroupTitleTest(atts, "literal");
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.XFSelectAttributes

     * Test that doSelectInput does not set an accessKey attribute.
     */
    public void testDoSelectInputAccessKey() throws ProtocolException {
        privateSetUp();

        XFSelectAttributes attributes = new XFSelectAttributes();
        attributes.setStyles(StylesBuilder.getInitialValueStyles());

        attributes.setEntryContainerInstance(new PaneInstance(null));
        attributes.setShortcut(new LiteralTextAssetReference("shortcut"));
        attributes.setName("name");
        FormInstance formInstance = new FormInstance(NDimensionalIndex.ZERO_DIMENSIONS);
        formInstance.setFormat(new Form(null));
        attributes.setFormData(formInstance);

        DoSelectInputTestHelper helper = new DoSelectInputTestHelper();
        helper.addOption(attributes,"Caption","Prompt","Value",false);
       
        testable.setSupportsAccessKeyAttribute(true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.