Package org.apache.tapestry.dom

Examples of org.apache.tapestry.dom.Element


    @BeginRender
    void begin(MarkupWriter writer)
    {
        final Field field = _field;

        final Element element = writer.element("label");

        _resources.renderInformalParameters(writer);

        // Uh oh! Referencing a private field (that happens to get instrumented up the wazoo) from
        // a inner class causes a java.lang.Verify error (Unable to pop operand off an empty stack).
        // Perhaps this is a Javassist error? Shouldn't the inner class be going through a synthetic
        // accessor method of some kind? Resolved by assigning to a local variable and referencing
        // that. Layers on layers, oh my!

        final ValidationDecorator decorator = _decorator;

        // Since we don't know if the field has rendered yet, we need to defer writing the for
        // attribute until we know the field has rendered (and set its clientId property). That's
        // exactly what Heartbeat is for.

        Runnable command = new Runnable()
        {
            public void run()
            {
                String fieldId = field.getClientId();

                element.forceAttributes("for", fieldId);

                decorator.insideLabel(field, element);
            }
        };
View Full Code Here


                if (line == current) writer.getElement().addClassName("t-location-current");

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

                Element td = writer.element("td", "class", "t-location-content");

                if (line == current) td.addClassName("t-location-current");

                if (start == current) td.addClassName("t-location-content-first");

                writer.write(input);
                writer.end();

                writer.end(); // tr
View Full Code Here

    {
        notNull(submitButton, "submitButton");

        assertIsSubmit(submitButton);

        Element form = getFormAncestor(submitButton);
        String value = submitButton.getAttribute("value");

        if (value == null) value = DEFAULT_SUBMIT_VALUE_ATTRIBUTE;

        fieldValues.put(submitButton.getAttribute("name"), value);
View Full Code Here

        _scriptBlock.append("\n");
    }

    public void updateDocument(Document document)
    {
        Element body = document.find("html/body");

        if (body == null)
            return;

        for (int i = 0; i < _scripts.size(); i++)
        {
            String scriptURL = _scripts.get(i);

            body.elementAt(i, "script", "src", scriptURL, "type", "text/javascript");
        }

        if (_scriptBlock.length() > 0)
        {
            Element e = body.element("script", "type", "text/javascript", "language", "javascript");
            e.raw("\n<!--\n");

            // This assumes that Prototype is available.
           
            e.text("Event.observe(window, \"load\", function() {\n");
           
            e.text(_scriptBlock.toString());

            e.text("});\n");
           
            e.raw("// -->\n");
        }

    }
View Full Code Here

    {
        notNull(submitButton, "submitButton");

        assertIsSubmit(submitButton);

        Element form = getFormAncestor(submitButton);
        String value = submitButton.getAttribute("value");

        if (value == null) value = DEFAULT_SUBMIT_VALUE_ATTRIBUTE;

        fieldValues.put(submitButton.getAttribute("name"), value);
View Full Code Here

    {
        final Field field = _field;

        _decorator.beforeLabel(field);

        final Element element = writer.element("label");

        _resources.renderInformalParameters(writer);

        // Since we don't know if the field has rendered yet, we need to defer writing the for
        // attribute until we know the field has rendered (and set its clientId property). That's
        // exactly what Heartbeat is for.

        Runnable command = new Runnable()
        {
            public void run()
            {
                String fieldId = field.getClientId();

                element.forceAttributes("for", fieldId, "id", fieldId + ":label");

                _decorator.insideLabel(field, element);
            }
        };
View Full Code Here

     * @param link           the link that will form the href
     * @param namesAndValues additional attributes to write
     */
    protected final void writeLink(MarkupWriter writer, String clientId, Link link, Object... namesAndValues)
    {
        Element e = writer.element("a", "href", buildHref(link), "id", clientId);

        writer.attributes(namesAndValues);

        _resources.renderInformalParameters(writer);

View Full Code Here

TOP

Related Classes of org.apache.tapestry.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.