Package org.apache.tapestry5.dom

Examples of org.apache.tapestry5.dom.Element


                writer.element("li");

                if (isLast)
                    writer.attributes("class", "t-last");

                Element e = writer.element("span", "class", "t-tree-icon");

                if (node.isLeaf())
                    e.addClassName("t-leaf-node");
                else if (!node.getHasChildren())
                    e.addClassName("t-empty-node");

                boolean hasChildren = !node.isLeaf() && node.getHasChildren();
                boolean expanded = hasChildren && expansionModel.isExpanded(node);

                String clientId = jss.allocateClientId(resources);

                JSONObject spec = new JSONObject("clientId", clientId);

                e.attribute("id", clientId);

                spec.put("leaf", node.isLeaf());

                if (hasChildren)
                {
View Full Code Here


                           ? new Object[] { pageIndex }
                           : new Object[] { pageIndex, zone };

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

        Element element = writer.element("a",
                                         "href", zone == null ? link : "#",
                                         "title", messages.format("goto-page", pageIndex));

        writer.write(Integer.toString(pageIndex));
        writer.end();

        if (zone != null)
        {
            String id = jsSupport.allocateClientId(resources);

            element.attribute("id", id);

            clientBehaviorSupport.linkZone(id, zone, link);
        }
    }
View Full Code Here

        linkFixture.writeLink(writer, link);

        verify();

        Element e = writer.getElement();

        writer.write("link text");
        writer.end();

        assertEquals(writer.toString(), "<a href=\"/foo/bar.baz\">link text</a>");
View Full Code Here

    void beginRender(MarkupWriter writer)
    {
        clientId = resources.isBound("id") ? idParameter : javascriptSupport.allocateClientId(resources);

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

        resources.renderInformalParameters(writer);

        e.addClassName("t-zone");

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

        clientBehaviorSupport.addZone(clientId, show, update);

        FormSupport existingFormSupport = environment.peek(FormSupport.class);
View Full Code Here

    public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer)
    {
        // The partial will quite often contain multiple elements (or just a block of plain text),
        // so those must be enclosed in a root element.

        Element root = writer.element("ajax-partial");

        ajaxFormUpdateController.setupBeforePartialZoneRender(writer);

        renderer.renderMarkup(writer, reply);

        ajaxFormUpdateController.cleanupAfterPartialZoneRender();

        writer.end();

        String content = root.getChildMarkup().trim();

        reply.put("content", content);
    }
View Full Code Here

        public void render(MarkupWriter writer, RenderQueue queue)
        {
            renderingValue.set(false);

            Element current = writer.getElement();

            if (current != expectedElementAtCompletion)
                throw new TapestryException(StructureMessages.unbalancedElements(completeId), getLocation(), null);

            invoke(false, POST_RENDER_CLEANUP);
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

                if (isLeaf)
                {
                    writer.getElement().attribute("class", "leaf-node");
                }

                Element e = writer.element("span", "class", "tree-icon");

                if (!isLeaf && !node.getHasChildren())
                {
                    e.addClassName("empty-node");
                }

                boolean hasChildren = !isLeaf && node.getHasChildren();
                boolean expanded = hasChildren && expansionModel.isExpanded(node);

                writer.attributes("data-node-id", node.getId());

                if (expanded)
                {
                    // Inform the client side, so it doesn't try to fetch it a second time.
                    e.addClassName("tree-expanded");
                }

                writer.end(); // span.tree-icon

                // From here on in, we're pushing things onto the queue. Remember that
View Full Code Here

        injectRowLink.addParameter(RequestConstants.FORM_CLIENTID_PARAMETER, formSupport.getClientId());
        injectRowLink.addParameter(RequestConstants.FORM_COMPONENTID_PARAMETER, formSupport.getFormComponentId());

        // Fix for TAP5-227 - AjaxFormLoop dont work well inside a table tag
        Element element = writer.getElement();
        this.wrapper = element.getAttribute("data-container-type") != null
                || element.getAttribute("data-remove-row-url") != null
                || element.getAttribute("data-inject-row-url") != null ? writer.element("div") : null;

        writer.attributes("data-container-type", "core/AjaxFormLoop",
                "data-remove-row-url", removeRowLink,
                "data-inject-row-url", injectRowLink);
    }
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.