Package org.apache.tapestry.html

Examples of org.apache.tapestry.html.Body


        boolean disabled = isDisabled();

        if (!cycle.isRewinding())
        {
            Body body = Body.get(cycle);

            if (body == null)
                throw new ApplicationRuntimeException(
                    Tapestry.format("must-be-contained-by-body", "DatePicker"),
                    this);
View Full Code Here


        boolean disabled = isDisabled();
        if (!disabled)
        {
            if (!rewinding) {
                Body body = Body.get(cycle);

                // make sure the submit function is on the page (once)
                if (cycle.getAttribute(ATTRIBUTE_FUNCTION_NAME) == null) {
                    body.addBodyScript("function submitLink(form, elementId) { form._linkSubmit.value = elementId; if (form.onsubmit == null || form.onsubmit()) form.submit(); }");
                    cycle.setAttribute(ATTRIBUTE_FUNCTION_NAME, this);
                }
               
                // one hidden field per form:
                String formHiddenFieldAttributeName = ATTRIBUTE_FUNCTION_NAME + formName;
View Full Code Here

        IEngineService service = engine.getService(Tapestry.DIRECT_SERVICE);
        ILink link = service.getLink(cycle, this, null);

        symbols.put("URL", link.getURL());

    Body body = Body.get(cycle);

     if (body == null)
       throw new ApplicationRuntimeException(
         Tapestry.getMessage("InspectorButton.must-be-contained-by-body"),
         this);
View Full Code Here

        String name = null;

        if (_eventHandlers == null)
            return;

        Body body = Body.get(cycle);

        if (body == null)
            throw new ApplicationRuntimeException(
                Tapestry.getMessage("AbstractLinkComponent.events-need-body"),
                this);
View Full Code Here

                getSpecification().getSpecificationLocation().getRelativeLocation("Palette.script");

            _script = source.getScript(scriptLocation);
        }

        Body body = Body.get(cycle);
        if (body == null)
            throw new ApplicationRuntimeException(
                "Palette component must be wrapped by a Body.",
                this);
View Full Code Here

    {

        if (_events == null || _events.isEmpty())
            return;

        Body body = Body.get(cycle);

        if (body == null)
            throw new ApplicationRuntimeException(
                Tapestry.getMessage("Form.needs-body-for-event-handlers"),
                this,
                null,
                null);

        StringBuffer buffer = new StringBuffer();

        Iterator i = _events.entrySet().iterator();
        while (i.hasNext())
        {

            Map.Entry entry = (Map.Entry) i.next();
            FormEventType type = (FormEventType) entry.getKey();
            Object value = entry.getValue();

            buffer.append("document.");
            buffer.append(_name);
            buffer.append(".");
            buffer.append(type.getPropertyName());
            buffer.append(" = ");

            // The typical case; one event one event handler.  Easy enough.

            if (value instanceof String)
            {
                buffer.append(value.toString());
                buffer.append(";");
            }
            else
            {
                // Build a composite function in-place

                buffer.append("function ()\n{\n");

                boolean combineWithAnd = type.getCombineUsingAnd();

                List l = (List) value;
                int count = l.size();

                for (int j = 0; j < count; j++)
                {
                    String functionName = (String) l.get(j);

                    if (j > 0)
                    {

                        if (combineWithAnd)
                            buffer.append(" &&");
                        else
                            buffer.append(";");
                    }

                    buffer.append("\n  ");

                    if (combineWithAnd)
                    {
                        if (j == 0)
                            buffer.append("return ");
                        else
                            buffer.append("  ");
                    }

                    buffer.append(functionName);
                    buffer.append("()");
                }

                buffer.append(";\n}");
            }

            buffer.append("\n\n");
        }

        body.addInitializationScript(buffer.toString());
    }
View Full Code Here

        boolean disabled = isDisabled();

        if (!cycle.isRewinding())
        {
            Body body = Body.get(cycle);

            if (body == null)
                throw new ApplicationRuntimeException(
                    Tapestry.format("must-be-contained-by-body", "DatePicker"),
                    this,
View Full Code Here

        boolean disabled = isDisabled();
        if (!disabled)
        {
            if (!rewinding)
            {
                Body body = Body.get(cycle);

                // make sure the submit function is on the page (once)
                if (cycle.getAttribute(ATTRIBUTE_FUNCTION_NAME) == null)
                {
                    body.addBodyScript(
                        "function submitLink(form, elementId) { form._linkSubmit.value = elementId; if (form.onsubmit == null || form.onsubmit()) form.submit(); }");
                    cycle.setAttribute(ATTRIBUTE_FUNCTION_NAME, this);
                }

                // one hidden field per form:
View Full Code Here

        String name = null;

        if (_eventHandlers == null)
            return;

        Body body = Body.get(cycle);

        if (body == null)
            throw new ApplicationRuntimeException(
                Tapestry.getMessage("AbstractLinkComponent.events-need-body"),
                this,
View Full Code Here

        worker.setElementScript(elementScript);
       
        IDirectEvent component = newMock(IDirectEvent.class);
        IWidget widget = newMock(IWidget.class);
        MockControl bodyControl = MockClassControl.createControl(Body.class);
        Body body = (Body) bodyControl.getMock();
       
        assertNotNull(worker.getScript(component));
        assertEquals(compScript, worker.getScript(component).getPath());
       
        assertNotNull(worker.getScript(widget));
View Full Code Here

TOP

Related Classes of org.apache.tapestry.html.Body

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.