Package com.volantis.mcs.protocols

Examples of com.volantis.mcs.protocols.DOMOutputBuffer


     */
    public void notestOpenPane() throws RepositoryException, IOException,
            ParserConfigurationException, SAXException {
        privateSetUp();

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();

        Element el = null;

        Pane pane = new Pane(null);
        pane.setName(PANE_NAME);
        pane.setBackgroundColour("#ff0000");
        pane.setBorderWidth("15");
        pane.setCellPadding("16");
        pane.setCellSpacing("17");

        final String cssValues = "background-color: #ff00ff; " +
                "border-width: 5px; " +
                "border-spacing: 7px";

        PaneAttributes attributes = new PaneAttributes();
        attributes.setStyles(StylesBuilder.getStyles(cssValues));
//        attributes.setBackgroundColour("#ff00ff");
//        attributes.setBorderWidth("5");
//        attributes.setCellPadding("6");
//        attributes.setCellSpacing("7");
        attributes.setPane(pane);

        protocol.openPane(buffer, attributes);
        try {
            el = buffer.closeElement("td");
        } catch (IllegalStateException ise) {
            fail("td element not found.");
        }

        //@todo add actual tests.
View Full Code Here


    public void testOpenPaneWithContainerCell() throws Exception {
        privateSetUp();
        context.setDevice(INTERNAL_DEVICE_FACTORY.createInternalDevice(
            new DefaultDevice(DEVICE_NAME, new HashMap(), null)));
       
        DOMOutputBuffer dom = new DOMOutputBuffer();
        Element containerCell;

        dom.initialise();

        containerCell = dom.openElement("td");
        containerCell.setAttribute("valign", "top");

        Pane pane1 = new Pane(null);
        pane1.setName(PANE_NAME);

        PaneAttributes attributes = new PaneAttributes();
        attributes.setStyles(StylesBuilder.getStyles(
                "background-color: #ff0000"));
        attributes.setPane(pane1);

//        context.setStyleClassName(CLASS_NAME);
        protocol.setMarinerPageContext(context);
        protocol.openPane(dom, attributes);

        Element cell = null;
        try {
            cell = dom.closeElement("td");
            dom.closeElement("tr");
            dom.closeElement("table");
        } catch (IllegalStateException e) {
            fail("Expected table/tr/td elements not found");
        }

        if (containerCell != null) {
View Full Code Here

        context = new TestMarinerPageContext();
        protocol.setMarinerPageContext(context);
        TestDeviceLayoutContext deviceContext = new TestDeviceLayoutContext();
        context.pushDeviceLayoutContext(deviceContext);

        DOMOutputBuffer dom = new DOMOutputBuffer();
        dom.initialise();
        PaneAttributes attributes = new PaneAttributes();
        Pane pane = new Pane(null);
        attributes.setPane(pane);

        Element body;
        // @todo 2005060816 annotate child with style information if it's not inherited from the parent
        body = dom.openStyledElement("body", attributes);
        dom.openElement("table");
        dom.openElement("tr");
        dom.openElement("td");

        dom.appendEncoded("Example");

        protocol.closePane(dom, attributes);

        assertSame("The DOM's current element isn't the body element",
                   dom.getCurrentElement(),
                   body);
    }
View Full Code Here

     * test for the openDissectingPane method
     */
    public void testOpenDissectingPane() throws RepositoryException {
        privateSetUp();

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();

        String inclusionPath = "TestInclusionPath";
        String paneName = "TestPaneName";
        String nextShortcut = "TestNextShardShortcut";
        String nextLink = "TestNextShardLink";
        String nextClass = "TestNextShardLinkClass";
        String prevShortcut = "TestPreviousShardShortcut";
        String prevLink = "TestPreviousShardLink";
        String prevClass = "TestPreviousShardLinkClass";
        String maxContentSize = "100";
        boolean nextLinkFirst = true;

        DissectingPane pane = new DissectingPane(canvasLayout);
        pane.setName(paneName);
        pane.setAttribute(FormatConstants.NEXT_SHARD_SHORTCUT_ATTRIBUTE,
                          nextShortcut);
        pane.setAttribute(FormatConstants.NEXT_SHARD_LINK_TEXT_ATTRIBUTE,
                          nextLink);
        pane.setAttribute(FormatConstants.NEXT_SHARD_LINK_CLASS_ATTRIBUTE,
                          nextClass);
        pane.setAttribute(FormatConstants.PREVIOUS_SHARD_SHORTCUT_ATTRIBUTE,
                          prevShortcut);
        pane.setAttribute(FormatConstants.PREVIOUS_SHARD_LINK_TEXT_ATTRIBUTE,
                          prevLink);
        pane.setAttribute(FormatConstants.PREVIOUS_SHARD_LINK_CLASS_ATTRIBUTE,
                          prevClass);
        pane.setAttribute(FormatConstants.MAXIMUM_CONTENT_SIZE_ATTRIBUTE,
                          maxContentSize);

        DissectingPaneAttributes atts = new DissectingPaneAttributes();
        atts.setDissectingPane(pane);
        atts.setInclusionPath(inclusionPath);
        atts.setIsNextLinkFirst(nextLinkFirst);

        protocol.setDissecting(true);
        protocol.openDissectingPane(buffer, atts);

        if (protocol.isDissectionSupported()) {
            Element el = null;
            try {
                el = buffer.closeElement("div");
                el = buffer.closeElement
                        (DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT);
            } catch (IllegalStateException ise) {
                fail(DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT +
                     " element not found.");
            }

            // check that all the attributes have been written out
            assertEquals("Invalid inclusion path attribute",
                         el.getAttributeValue
                         (DissectionConstants.INCLUSION_PATH_ATTRIBUTE),
                         atts.getInclusionPath());

            assertEquals("Invalid pane name attribute",
                         el.getAttributeValue
                         (DissectionConstants.DISSECTING_PANE_NAME_ATTRIBUTE),
                         atts.getDissectingPane().getName());

            assertEquals("Invalid next shard shortcut attribute",
                         el.getAttributeValue
                         (DissectionConstants.NEXT_SHARD_SHORTCUT_ATTRIBUTE),
                         nextShortcut);

            assertEquals("Invalid next shard link attribute",
                         el.getAttributeValue
                         (DissectionConstants.NEXT_SHARD_LINK_TEXT_ATTRIBUTE),
                         nextLink);

            assertEquals("Invalid previous shortcut attribute",
                         el.getAttributeValue
                         (DissectionConstants.PREVIOUS_SHARD_SHORTCUT_ATTRIBUTE),
                         prevShortcut);

            assertEquals("Invalid previous link attribute",
                         el.getAttributeValue
                         (DissectionConstants.PREVIOUS_SHARD_LINK_TEXT_ATTRIBUTE),
                         prevLink);

            assertEquals("Invalid next link first attribute",
                         el.getAttributeValue
                         (DissectionConstants.GENERATE_NEXT_LINK_FIRST_ATTRIBUTE),
                         String.valueOf(nextLinkFirst));

            assertEquals("Invalid max contents attribute",
                         el.getAttributeValue
                         (DissectionConstants.MAXIMUM_CONTENT_SIZE_ATTRIBUTE),
                         maxContentSize);
        } else {
            assertTrue("Protocol does not support dissection so no markup " +
                       "should have been generated", buffer.isEmpty());
        }
    }
View Full Code Here

    }

    public void testShardLinkStyleClass() throws Exception {
        privateSetUp();

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        ShardLinkAttributes attributes = new ShardLinkAttributes();
        attributes.setStyles(StylesBuilder.getDeprecatedStyles());
        Element anchor;
        Node node;

        buffer.initialise();
        attributes.setHref("http://www.volantis.com/page");
        attributes.setLinkText("Next");
        attributes.setShortcut("N");

        protocol.doShardLink(buffer, attributes);

        node = buffer.getCurrentElement().getHead();

        assertNotNull("Should have found a node",
                      node);

        assertTrue("Node should be an element",
View Full Code Here

     * test the getFormatStyleClass method.
     */
    public void notestGetFormatStyleClass() throws Exception {
        privateSetUp();

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();

        // Demonstrate that this device layout isn't used
        context.setDeviceLayout(null);

//        context.setStyleClassName(CLASS_NAME);
View Full Code Here

    /**
     * Test that we are rendering the type of action inputs properly.
     */
    protected void checkActionInputType() throws ProtocolException {

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
        XFActionAttributes attributes = new XFActionAttributes();
        attributes.setStyles(StylesBuilder.getInitialValueStyles());

        // Setup test for normal behaviour for input tag generation (submit)
        String name = "My Name";
        String actionType = "submit";
        String caption = "This is my caption";
        String value = "This is my value";

        attributes.setName(name);
        attributes.setType(actionType);
        attributes.setCaption(new LiteralTextAssetReference(caption));
        attributes.setValue(value);

        protocol.doActionInput(buffer, attributes);
        String actualResult = bufferToString(buffer);
        assertEquals("DOM buffer should match",
                     "<input name=\"" + name + "\" " +
                     "type=\"" + actionType + "\" value=\"" + caption  + "\"/>",
                     actualResult);

        // Setup test for normal behaviour for input tag generation (perform)
        buffer = new DOMOutputBuffer();
        buffer.initialise();
        actionType = "perform";
        attributes.setType(actionType);

        protocol.doActionInput(buffer, attributes);
        actualResult = bufferToString(buffer);

        assertEquals("DOM buffer should match",
                     "<input name=\"" + name + "\" " +
                     "type=\"" + "submit" + "\" value=\"" + caption  + "\"/>",
                     actualResult);

        // Setup test for normal behaviour for input tag generation (perform)
        buffer = new DOMOutputBuffer();
        buffer.initialise();
        actionType = "reset";
        attributes.setType(actionType);
        protocol.doActionInput(buffer, attributes);
        actualResult = bufferToString(buffer);
        assertEquals("DOM buffer should match",
                     "<input name=\"" + name + "\" " +
                     "type=\"" + actionType + "\" value=\"" + caption  + "\"/>",
                     actualResult);

        // Setup test for abnormal behaviour - garbage actionType
        buffer = new DOMOutputBuffer();
        buffer.initialise();
        actionType = "GARBAGE";
        attributes.setType(actionType);
        try {
            protocol.doActionInput(buffer, attributes);
            fail("Should have thrown an IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        }

        // Setup test for abnormal behaviour - garbage actionType
        buffer = new DOMOutputBuffer();
        buffer.initialise();
        actionType = "submit";
        attributes.setType(actionType);
        attributes.setTabindex("1");
        protocol.doActionInput(buffer, attributes);
        assertTrue(protocol.supportsTabindex);
View Full Code Here

        String name = "My Name";
        String actionType = "submit";
        String caption = "The caption";
        String value = "This is my value";

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();

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

        attributes.setName(name);
View Full Code Here

    }

    protected void checkActionInputShortcut(boolean generated,
            boolean styled) throws ProtocolException {

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
        XFActionAttributes attributes = new XFActionAttributes();
        attributes.setStyles(StylesBuilder.getInitialValueStyles());

        // Setup test for normal behaviour for input tag generation (submit)
        String shortcut = "1";
View Full Code Here

        //           entryBuffer == captionBuffer != null
        selector = protocol.createBufferSelector(
            entry, caption, null, null, null);
        doTestBufferSelector(selector, caption, entry, true, true, false);

        DOMOutputBuffer dom = new DOMOutputBuffer();
        selector = protocol.createBufferSelector(
            null, null, null, null, dom);
        doTestBufferSelector(selector, null, null, true, true, true);

        DOMOutputBuffer entryBuffer = new DOMOutputBuffer();
        DOMOutputBuffer captionBuffer = new DOMOutputBuffer();
        selector = protocol.createBufferSelector(
            null, null, null, captionBuffer, null);
        doTestBufferSelector(selector, null, null, true, true, true);

        selector = protocol.createBufferSelector(
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.DOMOutputBuffer

Copyright © 2018 www.massapicom. 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.