Examples of IMarkupWriter


Examples of org.apache.tapestry.IMarkupWriter

        verifyControls();
    }

    public void testCollectionNullAndEmpty()
    {
        IMarkupWriter writer = newWriter();
        DescribableStrategy strategy = newStrategy();

        replayControls();

        HTMLDescriptionReceiver dr = new HTMLDescriptionReceiver(writer, strategy);
View Full Code Here

Examples of org.apache.tapestry.IMarkupWriter

        verifyControls();
    }

    public void testScalarProperties()
    {
        IMarkupWriter writer = newWriter();
        DescribableStrategy strategy = newStrategy();

        trainForTitle(writer, "Scalars");
        trainForKeyValue(writer, "boolean", "true", true);
        trainForKeyValue(writer, "byte", "22", false);
View Full Code Here

Examples of org.apache.tapestry.IMarkupWriter

        verifyControls();
    }

    public void testNullRoot()
    {
        IMarkupWriter writer = newWriter();
        DescribableStrategy strategy = newStrategy();

        writer.print(HTMLDescriptionReceiver.NULL_VALUE);

        replayControls();

        RootDescriptionReciever dr = new HTMLDescriptionReceiver(writer, strategy);
View Full Code Here

Examples of org.apache.tapestry.IMarkupWriter

        cycle.setAttribute(ATTRIBUTE_NAME, this);

        _outerWriter = writer;

        IMarkupWriter nested = writer.getNestedWriter();

        renderBody(nested, cycle);

        // Start the body tag.
        writer.println();
        writer.begin(getElement());
        renderInformalParameters(writer, cycle);

        writer.println();

        // Write the page's scripting.  This is included scripts
        // and dynamic JavaScript, including initialization.

        writeScript(_outerWriter);

        // Close the nested writer, which dumps its buffered content
        // into its parent.

        nested.close();

        writer.end(); // <body>

    }
View Full Code Here

Examples of org.apache.tapestry.IMarkupWriter

        // Commit all changes and ignore further changes.

        IPage page = cycle.getPage();

        IMarkupWriter writer = page.getResponseWriter(output);

        output.setContentType(writer.getContentType());

        boolean discard = true;

        try
        {
            cycle.renderPage(writer);

            discard = false;
        }
        finally
        {
            // Closing the writer closes its PrintWriter and a whole stack of java.io objects,
            // which tend to stream a lot of output that eventually hits the
            // ResponseOutputStream.  If we are discarding output anyway (due to an exception
            // getting thrown during the render), we can save ourselves some trouble
            // by ignoring it.

            if (discard)
                output.setDiscard(true);

            writer.close();

            if (discard)
                output.setDiscard(false);
        }
View Full Code Here

Examples of org.apache.tapestry.IMarkupWriter

        // And another for the name of the component that
        // triggered the submit.

        addHiddenValue(FormConstants.SUBMIT_NAME_PARAMETER, null);

        IMarkupWriter nested = _writer.getNestedWriter();

        _form.renderBody(nested, _cycle);

        runDeferredRunnables();
       
        int portI = (port == null) ? 0 : port.intValue();
        writeTag(_writer, method, link.getURL(scheme, null, portI, null, false));
       
        // For XHTML compatibility
        _writer.attribute("id", formId);

        if (_encodingType != null)
            _writer.attribute("enctype", _encodingType);

        // Write out event handlers collected during the rendering.

        emitEventHandlers(formId);

        informalParametersRenderer.render(_writer, _cycle);

        // Finish the <form> tag

        _writer.println();

        writeHiddenFields();

        // Close the nested writer, inserting its contents.
       
        nested.close();

        // Close the <form> tag.

        _writer.end();
View Full Code Here

Examples of org.apache.tapestry.IMarkupWriter

     * {@link org.apache.tapestry.wml.GoFormSupportImpl}.
     */
   
    protected void writeHiddenFields()
    {
        IMarkupWriter writer = getHiddenFieldWriter();
       
        writer.begin("div");
        writer.attribute("style", "display:none;");
        writer.attribute("id", _form.getName() + "hidden");
       
        writeHiddenFieldList(writer);
       
        writer.end();
    }
View Full Code Here

Examples of org.apache.tapestry.IMarkupWriter

    public static final ILinkRenderer RENDERER = new FormLinkRenderer();

    public void renderLink(IMarkupWriter writer, IRequestCycle cycle,
            ILinkComponent linkComponent)
    {
        IMarkupWriter wrappedWriter = null;

        if (cycle.getAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME) != null)
            throw new ApplicationRuntimeException(Tapestry
                    .getMessage("AbstractLinkComponent.no-nesting"),
                    linkComponent, null, null);

        cycle.setAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME,
                linkComponent);
       
        String formName = cycle.getUniqueId("LinkForm");
       
        boolean hasBody = getHasBody();

        boolean disabled = linkComponent.isDisabled();

        if (!disabled && !cycle.isRewinding())
        {
            ILink l = linkComponent.getLink(cycle);
            String anchor = linkComponent.getAnchor();

            Body body = (Body) TapestryUtils.getPageRenderSupport(cycle, linkComponent);

            String function = generateFormFunction(formName, l, anchor);
            body.addBodyScript(linkComponent, function);

            if (hasBody)
                writer.begin(getElement());
            else writer.beginEmpty(getElement());

            writer.attribute(getUrlAttribute(), "javascript: document."
                    + formName + ".submit();");

            beforeBodyRender(writer, cycle, linkComponent);

            // Allow the wrapped components a chance to render.
            // Along the way, they may interact with this component
            // and cause the name variable to get set.

            wrappedWriter = writer.getNestedWriter();
        }
        else wrappedWriter = writer;

        if (hasBody) linkComponent.renderBody(wrappedWriter, cycle);

        if (!disabled && !cycle.isRewinding())
        {
            afterBodyRender(writer, cycle, linkComponent);

            linkComponent.renderAdditionalAttributes(writer, cycle);

            if (hasBody)
            {
                wrappedWriter.close();

                // Close the <element> tag

                writer.end();
            }
View Full Code Here

Examples of org.apache.tapestry.IMarkupWriter

            writer.attribute("onclick", onclick);
        }
       
        component.renderAdditionalAttributes(writer, cycle);

        IMarkupWriter wrappedWriter = writer.getNestedWriter();

        component.renderBody(wrappedWriter, cycle);

        wrappedWriter.close();

        writer.end();

        cycle.removeAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME);
    }
View Full Code Here

Examples of org.apache.tapestry.IMarkupWriter

    public static final ILinkRenderer SHARED_INSTANCE = new DefaultLinkRenderer();

    public void renderLink(IMarkupWriter writer, IRequestCycle cycle,
            ILinkComponent linkComponent)
    {
        IMarkupWriter wrappedWriter = null;

        if (cycle.getAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME) != null)
            throw new ApplicationRuntimeException(LinkMessages.noNesting(),
                    linkComponent, null, null);

        cycle.setAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME,
                linkComponent);
       
        boolean hasBody = getHasBody();

        boolean disabled = linkComponent.isDisabled() || cycle.isRewinding();

        if (!disabled)
        {
            if (hasBody)
                writer.begin(getElement());
            else
                writer.beginEmpty(getElement());
           
            writer.attribute(getUrlAttribute(), constructURL(linkComponent,
                    cycle));
           
            String target = linkComponent.getTarget();
           
            if (HiveMind.isNonBlank(target))
                writer.attribute(getTargetAttribute(), target);
           
            beforeBodyRender(writer, cycle, linkComponent);
           
            // Allow the wrapped components a chance to render.
            // Along the way, they may interact with this component
            // and cause the name variable to get set.
           
            wrappedWriter = writer.getNestedWriter();
        } else
            wrappedWriter = writer;
       
        if (hasBody)
            linkComponent.renderBody(wrappedWriter, cycle);
       
        if (!disabled) {
           
            afterBodyRender(writer, cycle, linkComponent);
           
            linkComponent.renderAdditionalAttributes(writer, cycle);
           
            if (hasBody) {
                wrappedWriter.close();
               
                // Close the <element> tag
               
                writer.end();
            } else
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.