Package org.apache.tapestry5.dom

Examples of org.apache.tapestry5.dom.Element


        if (!rootElementName.equals("html"))
            throw new RuntimeException(ServicesMessages.documentMissingHTMLRoot(rootElementName));

        String childElement = scriptsAtTop ? "head" : "body";

        Element container = findOrCreateElement(root, childElement, scriptsAtTop);

        // TAPESTRY-2364

        addScriptLinksForIncludedScripts(container, scripts);
View Full Code Here


        addDynamicScriptBlock(findOrCreateElement(root, "body", false));
    }

    private Element findOrCreateElement(Element root, String childElement, boolean atTop)
    {
        Element container = root.find(childElement);

        // Create the element is it is missing.

        if (container == null)
            container = atTop ? root.elementAt(0, childElement) : root.element(childElement);
View Full Code Here

    {
        boolean blockNeeded = (developmentMode && !scripts.isEmpty()) || scriptBlock.length() > 0;

        if (blockNeeded)
        {
            Element e = body.element("script");
            if (developmentMode)
                e.raw("Tapestry.DEBUG_ENABLED = true;\n");

            e.raw("Tapestry.onDOMLoaded(function() {\n");

            e.raw(scriptBlock.toString());

            e.raw("});\n");
        }
    }
View Full Code Here

        String rootElementName = root.getName();

        // Not an html document, don't add anything.
        if (!rootElementName.equals("html")) return;

        Element head = findOrCreateElement(root, "head", true);

        for (int i = 0; i < count; i++)
            stylesheets.get(i).add(head, i);
    }
View Full Code Here

            public void render(MarkupWriter writer, RenderQueue queue)
            {
                // Create an element to contain the content for the zone. We give it a mnemonic
                // element name and attribute just to help with debugging (the element itself is discarded).

                final Element zoneContainer = writer.element("zone-update", "zoneId", zoneId);

                ajaxFormUpdateController.setupBeforePartialZoneRender(writer);

                queue.push(new RenderCommand()
                {
                    public void render(MarkupWriter writer, RenderQueue queue)
                    {
                        writer.end(); // the zoneContainer element

                        // Need to do this Ajax Form-related cleanup here, before we extract the zone content.

                        ajaxFormUpdateController.cleanupAfterPartialZoneRender();

                        String zoneUpdateContent = zoneContainer.getChildMarkup();

                        zoneContainer.remove();

                        if (!reply.has("zones"))
                        {
                            reply.put("zones", new JSONObject());
                        }
View Full Code Here

    Block beginRender(MarkupWriter writer)
    {
        String clientId = jsSupport.allocateClientId(resources);
        String elementName = resources.getElementName("div");

        Element e = writer.element(elementName, "id", clientId);

        resources.renderInformalParameters(writer);

        e.addClassName("t-zone");

        Link link = resources.createEventLink(EventConstants.ACTION, context);

        JSONObject spec = new JSONObject();
View Full Code Here

        clientId = resources.isBound("id") ? idParameter : javascriptSupport.allocateClientId(resources);

        hiddenFieldPositioner = new HiddenFieldPositioner(writer, rules);

        Element element = writer.element(this.element, "id", clientId);

        resources.renderInformalParameters(writer);

        if (!visible)
            element.addClassName(CSSClassConstants.INVISIBLE);

        clientBehaviorSupport.addFormFragment(clientId, alwaysSubmit, show, hide, visibleBound);

        componentActions = new ComponentActionSink(logger, clientDataEncoder);
View Full Code Here

    {
        assert submitButton != null;

        assertIsSubmit(submitButton);

        Element form = getFormAncestor(submitButton);

        request.clear().setPath(stripContextFromPath(extractNonBlank(form, "action")));

        pushFieldValuesIntoRequest(form);
View Full Code Here

        return findAncestor(element, "form");
    }

    private Element findAncestor(Element element, String ancestorName)
    {
        Element e = element;

        while (e != null)
        {
            if (e.getName().equalsIgnoreCase(ancestorName))
                return e;

            e = e.getContainer();
        }

        throw new RuntimeException(String.format("Could not locate an ancestor element of type '%s'.", ancestorName));

    }
View Full Code Here

    void beginRender(final MarkupWriter writer)
    {
        if (tracker == null)
            throw new RuntimeException(InternalMessages.encloseErrorsInForm());

        Element element = writer.element("div");

        updateElement(element);

        writer.end();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.dom.Element

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.