Examples of DOMProtocol


Examples of com.volantis.mcs.protocols.DOMProtocol

     * in table and div elements, they should all still be removed unless the
     * div element has 'important' Styles as is the case here.
     */
    public void testMultipleDissectingPanes() throws Exception {
        ProtocolBuilder builder = new ProtocolBuilder();
        DOMProtocol protocol = (DOMProtocol) builder.build(
                new TestProtocolRegistry.TestXHTMLBasicFactory(),
                internalDevice);

        // The transformer is only interested in table and div elements so the
        // dissectable pane element can be called whatever we like, the test is
View Full Code Here

Examples of com.volantis.mcs.protocols.DOMProtocol

     *
     * @throws Exception
     */
    public void testInverseRemapTableRetention() throws Exception {
        ProtocolBuilder builder = new ProtocolBuilder();
        DOMProtocol protocol = (DOMProtocol) builder.build(
                new TestProtocolRegistry.TestXHTMLBasicFactory(),
                internalDevice);
        String original =
            "<html xmlns=\"http://www.w3.org/1999/xhtml\">" +
              "<head>" +
View Full Code Here

Examples of com.volantis.mcs.protocols.DOMProtocol

        final MarinerPageContextMock pageContextMock =
            new MarinerPageContextMock("pageContextMock", expectations);
        final MarinerRequestContextMock requestContextMock =
            new MarinerRequestContextMock("requestContextMock", expectations);

        final DOMProtocol protocol = createProtocol();
        protocol.setMarinerPageContext(pageContextMock);

        requestContextMock.expects.
            getMarinerPageContext().returns(pageContextMock).any();

        final StylingEngine stylingEngine = getStylingEngine();
View Full Code Here

Examples of com.volantis.mcs.protocols.DOMProtocol

        StyledDOMTester tester = new StyledDOMTester(entityResolver);
        Document inputDoc =
                tester.parse(getClass().getResourceAsStream(inputFile));
        Document expectedDoc =
                tester.parse(getClass().getResourceAsStream(expectedFile));
        DOMProtocol protocol = createProtocol(protocolConfig, psf);
        protocol.setMarinerPageContext(pageContext);

        // run the test
        XFormEmulationTransformer transformer = new XFormEmulationTransformer();
        Document outputDoc = transformer.transform(protocol, inputDoc);
View Full Code Here

Examples of com.volantis.mcs.protocols.DOMProtocol

     * Simple method test
     */
    public void testGetVisitor() throws Exception {
        TransFactory factory = new XHTMLBasicTransFactory(configuration);
        ProtocolBuilder builder = new ProtocolBuilder();
        DOMProtocol protocol = (DOMProtocol) builder.build(
                new TestProtocolRegistry.TestDOMProtocolFactory(),
                internalDevice);

        TransVisitor visitor = factory.getVisitor(protocol);

View Full Code Here

Examples of com.volantis.mcs.protocols.DOMProtocol

    private DOMOutputBuffer stringOutputBuffer;

    // Javadoc inherited.
    public void doRenderOpen(VolantisProtocol protocol,
            MCSAttributes attributes) throws ProtocolException {
        DOMProtocol domProtocol = (DOMProtocol) protocol;

        require(WidgetScriptModules.BASE_COMMON,protocol, attributes);       

        // Open a placeholder span element for the widget
        // content, which will converted to the JavaScript string.
        // Generate a HTML ID for it, so that it can be referenced
        // from JavaScript code.
        placeholderSpanAttributes = new SpanAttributes();
       
        placeholderSpanAttributes.copy(attributes);
       
        if (placeholderSpanAttributes.getId() == null) {
            placeholderSpanAttributes.setId(protocol.getMarinerPageContext().generateUniqueFCID());
        }
        // Now, this is a hack to better the user experience.
        // In almost most cases, the 'display' stylistic attribute for this
        // element is 'none', because we don't want the user to see rendered
        // string on the page. But in the most common configuration, MCS renders
        // that property into the stylesheet. Some browsers before
        // downloading stylesheets, displays the RAW content of the page,
        // including this string. This looks very messy. That's why we
        // put display:none into the inline styles right here.
        if (attributes.getStyles()
                .getPropertyValues()
                .getComputedValue(StylePropertyDetails.DISPLAY) == DisplayKeywords.NONE) {
            Element element = openSpanElement(protocol, attributes);
       
            element.setAttribute("style", "display:none");
        }
       
        // Create and output buffer for the widget content.
        // This will be an instance of DOMOutputBuffer, because the protocol
        // used is an instance of DOMProtocol.
        stringOutputBuffer = (DOMOutputBuffer) domProtocol.getOutputBufferFactory().createOutputBuffer();

        // Push the buffer on the stack, so that the widget content will be
        // rendered to that buffer.
        protocol.getMarinerPageContext().pushOutputBuffer(stringOutputBuffer);
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.DOMProtocol

    }

    // Javadoc inherited.
    public void doRenderClose(VolantisProtocol protocol,
            MCSAttributes attributes) throws ProtocolException {
        DOMProtocol domProtocol = (DOMProtocol) protocol;

        // Pop the output buffer from the stack. At this moment it contains the
        // content of the widget, which will be rendered to JavaScript string.
        domProtocol.getMarinerPageContext().popOutputBuffer(stringOutputBuffer);

        // Mark all elements in the output buffer as requiring to be transformed to text nodes.
        Node child = stringOutputBuffer.getRoot().getHead();
       
        while (child != null) {
            if (child instanceof Element) {
                domProtocol.setTransformToTextMarker((Element) child, true);
            }
           
            child = child.getNext();
        }
       
View Full Code Here

Examples of com.volantis.mcs.protocols.DOMProtocol

    public void testHrefMakeChild() throws IOException {

        ProtocolFactory factory = new ProtocolRegistry.HTMLVersion4_0Factory();
        ProtocolBuilder builder = new ProtocolBuilder();

        DOMProtocol protocol = (DOMProtocol)builder.build(factory, null);

        Document document = domFactory.createDocument();

        Element element1 = domFactory.createElement();
        element1.setName("h1");
        element1.setAttribute("href", "http://www.volantis.com/target.html");
        element1.setStyles(StylesBuilder.getInitialValueStyles());

        document.addNode(element1);

        HrefTransformer transfromer = new HrefTransformer();

        document = transfromer.transform(protocol, document);

        String actual = DOMUtilities.toString(
                document, protocol.getCharacterEncoder());

        String expected = "<h1><a href=\"http://www.volantis.com/target.html\"/></h1>";

        assertEquals("The href has not been moved down as expected.", expected, actual);
View Full Code Here

Examples of com.volantis.mcs.protocols.DOMProtocol

    public void testHrefMakeParent() throws IOException {

        ProtocolFactory factory = new ProtocolRegistry.HTMLVersion4_0Factory();
        ProtocolBuilder builder = new ProtocolBuilder();

        DOMProtocol protocol = (DOMProtocol)builder.build(factory, null);

        Document document = domFactory.createDocument();

        Element element1 = domFactory.createElement();
        element1.setName("span");
        element1.setStyles(StylesBuilder.getInitialValueStyles());

        document.addNode(element1);

        Element element2 = domFactory.createElement();
        element2.setName("code");
        element2.setStyles(StylesBuilder.getInitialValueStyles());
        element2.setAttribute("href", "http://www.volantis.com/target.html");

        element1.addHead(element2);

        HrefTransformer transfromer = new HrefTransformer();

        document = transfromer.transform(protocol, document);

        String actual = DOMUtilities.toString(
                document, protocol.getCharacterEncoder());

        String expected = "<span><a href=\"http://www.volantis.com/target.html\"><code/></a></span>";

        assertEquals("The href has not been moved up as expected.", expected, actual);
View Full Code Here

Examples of com.volantis.mcs.protocols.DOMProtocol

    public void testHrefPushDown() throws IOException {

        ProtocolFactory factory = new ProtocolRegistry.HTMLVersion4_0Factory();
        ProtocolBuilder builder = new ProtocolBuilder();

        DOMProtocol protocol = (DOMProtocol)builder.build(factory, null);

        Document document = domFactory.createDocument();

        Element element1 = domFactory.createElement();
        element1.setName("tr");
        element1.setStyles(StylesBuilder.getInitialValueStyles());
        element1.setAttribute("href", "http://www.volantis.com/target.html");

        document.addNode(element1);

        Element element2 = domFactory.createElement();
        element2.setName("ul");
        element2.setStyles(StylesBuilder.getInitialValueStyles());

        element1.addHead(element2);

        HrefTransformer transfromer = new HrefTransformer();

        document = transfromer.transform(protocol, document);

        String actual = DOMUtilities.toString(
                document, protocol.getCharacterEncoder());

        String expected = "<tr><ul href=\"http://www.volantis.com/target.html\"/></tr>";

        assertEquals("The href has not been moved down as expected.", expected, actual);
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.