Package org.apache.tapestry.html

Examples of org.apache.tapestry.html.Body


        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


        // If some other field has taken the honors, then let it.

        __CLOVER_459_0.S[10350]++;if ((((cycle.getAttribute(SELECTED_ATTRIBUTE_NAME) != null) && (++__CLOVER_459_0.CT[1773] != 0)) || (++__CLOVER_459_0.CF[1773] == 0))){
            __CLOVER_459_0.S[10351]++;return;}

        __CLOVER_459_0.S[10352]++;Body body = Body.get(cycle);

        // If not wrapped by a Body, then do nothing.

        __CLOVER_459_0.S[10353]++;if ((((body == null) && (++__CLOVER_459_0.CT[1774] != 0)) || (++__CLOVER_459_0.CF[1774] == 0))){
            __CLOVER_459_0.S[10354]++;return;}

        __CLOVER_459_0.S[10355]++;IForm form = Form.get(cycle);

        __CLOVER_459_0.S[10356]++;String formName = form.getName();
        __CLOVER_459_0.S[10357]++;String textFieldName = getName();

        __CLOVER_459_0.S[10358]++;String fullName = "document." + formName + "." + textFieldName;

        __CLOVER_459_0.S[10359]++;body.addInitializationScript(fullName + ".focus();");
        __CLOVER_459_0.S[10360]++;body.addInitializationScript(fullName + ".select();");

        // Put a marker in, indicating that the selected field is known.

        __CLOVER_459_0.S[10361]++;cycle.setAttribute(SELECTED_ATTRIBUTE_NAME, Boolean.TRUE);
    } finally { }}
View Full Code Here

        __CLOVER_445_0.S[9858]++;Resource location =
            new ClasspathResource(engine.getClassResolver(), scriptPath);

        __CLOVER_445_0.S[9859]++;IScript script = source.getScript(location);

        __CLOVER_445_0.S[9860]++;Body body = Body.get(cycle);

        __CLOVER_445_0.S[9861]++;if ((((body == null) && (++__CLOVER_445_0.CT[1688] != 0)) || (++__CLOVER_445_0.CF[1688] == 0))){
            __CLOVER_445_0.S[9862]++;throw new ApplicationRuntimeException(
                Tapestry.getMessage("ValidField.must-be-contained-by-body"),
                field,
View Full Code Here

        __CLOVER_137_0.S[3319]++;boolean disabled = isDisabled();
        __CLOVER_137_0.S[3320]++;if ((((!disabled) && (++__CLOVER_137_0.CT[610] != 0)) || (++__CLOVER_137_0.CF[610] == 0))){
        {
            __CLOVER_137_0.S[3321]++;if ((((!rewinding) && (++__CLOVER_137_0.CT[611] != 0)) || (++__CLOVER_137_0.CF[611] == 0))){
            {
                __CLOVER_137_0.S[3322]++;Body body = Body.get(cycle);

        __CLOVER_137_0.S[3323]++;if ((((body == null) && (++__CLOVER_137_0.CT[612] != 0)) || (++__CLOVER_137_0.CF[612] == 0))){
            __CLOVER_137_0.S[3324]++;throw new ApplicationRuntimeException(
                Tapestry.format("must-be-contained-by-body", "LinkSubmit"),
                this,
                null,
                null);}
                       
                // make sure the submit function is on the page (once)
                __CLOVER_137_0.S[3325]++;if ((((cycle.getAttribute(ATTRIBUTE_FUNCTION_NAME) == null) && (++__CLOVER_137_0.CT[613] != 0)) || (++__CLOVER_137_0.CF[613] == 0))){
                {
                    __CLOVER_137_0.S[3326]++;body.addBodyScript(
                        "function submitLink(form, elementId) { form._linkSubmit.value = elementId; if (form.onsubmit == null || form.onsubmit()) form.submit(); }");
                    __CLOVER_137_0.S[3327]++;cycle.setAttribute(ATTRIBUTE_FUNCTION_NAME, this);
                }}

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

    {try { __CLOVER_130_0.M[700]++;

        __CLOVER_130_0.S[3130]++;if ((((_events == null || _events.isEmpty()) && (++__CLOVER_130_0.CT[570] != 0)) || (++__CLOVER_130_0.CF[570] == 0))){
            __CLOVER_130_0.S[3131]++;return;}

        __CLOVER_130_0.S[3132]++;Body body = Body.get(cycle);

        __CLOVER_130_0.S[3133]++;if ((((body == null) && (++__CLOVER_130_0.CT[571] != 0)) || (++__CLOVER_130_0.CF[571] == 0))){
            __CLOVER_130_0.S[3134]++;throw new ApplicationRuntimeException(
                Tapestry.getMessage("Form.needs-body-for-event-handlers"),
                this,
                null,
                null);}

        __CLOVER_130_0.S[3135]++;StringBuffer buffer = new StringBuffer();

        __CLOVER_130_0.S[3136]++;Iterator i = _events.entrySet().iterator();
        __CLOVER_130_0.S[3137]++;while ((((i.hasNext()) && (++__CLOVER_130_0.CT[572] != 0)) || (++__CLOVER_130_0.CF[572] == 0))){
        {

            __CLOVER_130_0.S[3138]++;Map.Entry entry = (Map.Entry) i.next();
            __CLOVER_130_0.S[3139]++;FormEventType type = (FormEventType) entry.getKey();
            __CLOVER_130_0.S[3140]++;Object value = entry.getValue();

            __CLOVER_130_0.S[3141]++;buffer.append("document.");
            __CLOVER_130_0.S[3142]++;buffer.append(_name);
            __CLOVER_130_0.S[3143]++;buffer.append(".");
            __CLOVER_130_0.S[3144]++;buffer.append(type.getPropertyName());
            __CLOVER_130_0.S[3145]++;buffer.append(" = ");

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

            __CLOVER_130_0.S[3146]++;if ((((value instanceof String) && (++__CLOVER_130_0.CT[573] != 0)) || (++__CLOVER_130_0.CF[573] == 0))){
            {
                __CLOVER_130_0.S[3147]++;buffer.append(value.toString());
                __CLOVER_130_0.S[3148]++;buffer.append(";");
            }}
            else{
            {
                // Build a composite function in-place

                __CLOVER_130_0.S[3149]++;buffer.append("function ()\n{\n");

                __CLOVER_130_0.S[3150]++;boolean combineWithAnd = type.getCombineUsingAnd();

                __CLOVER_130_0.S[3151]++;List l = (List) value;
                __CLOVER_130_0.S[3152]++;int count = l.size();

                __CLOVER_130_0.S[3153]++;for (int j = 0; (((j < count) && (++__CLOVER_130_0.CT[574] != 0)) || (++__CLOVER_130_0.CF[574] == 0)); j++){
                {
                    __CLOVER_130_0.S[3154]++;String functionName = (String) l.get(j);

                    __CLOVER_130_0.S[3155]++;if ((((j > 0) && (++__CLOVER_130_0.CT[575] != 0)) || (++__CLOVER_130_0.CF[575] == 0))){
                    {

                        __CLOVER_130_0.S[3156]++;if ((((combineWithAnd) && (++__CLOVER_130_0.CT[576] != 0)) || (++__CLOVER_130_0.CF[576] == 0))){
                            __CLOVER_130_0.S[3157]++;buffer.append(" &&");}
                        else{
                            __CLOVER_130_0.S[3158]++;buffer.append(";");}
                    }}

                    __CLOVER_130_0.S[3159]++;buffer.append("\n  ");

                    __CLOVER_130_0.S[3160]++;if ((((combineWithAnd) && (++__CLOVER_130_0.CT[577] != 0)) || (++__CLOVER_130_0.CF[577] == 0))){
                    {
                        __CLOVER_130_0.S[3161]++;if ((((j == 0) && (++__CLOVER_130_0.CT[578] != 0)) || (++__CLOVER_130_0.CF[578] == 0))){
                            __CLOVER_130_0.S[3162]++;buffer.append("return ");}
                        else{
                            __CLOVER_130_0.S[3163]++;buffer.append("  ");}
                    }}

                    __CLOVER_130_0.S[3164]++;buffer.append(functionName);
                    __CLOVER_130_0.S[3165]++;buffer.append("()");
                }}

                __CLOVER_130_0.S[3166]++;buffer.append(";\n}");
            }}

            __CLOVER_130_0.S[3167]++;buffer.append("\n\n");
        }}

        __CLOVER_130_0.S[3168]++;body.addInitializationScript(buffer.toString());
    } finally { }}
View Full Code Here

        __CLOVER_173_0.S[4178]++;String name = null;

        __CLOVER_173_0.S[4179]++;if ((((_eventHandlers == null) && (++__CLOVER_173_0.CT[771] != 0)) || (++__CLOVER_173_0.CF[771] == 0))){
            __CLOVER_173_0.S[4180]++;return;}

        __CLOVER_173_0.S[4181]++;Body body = Body.get(cycle);

        __CLOVER_173_0.S[4182]++;if ((((body == null) && (++__CLOVER_173_0.CT[772] != 0)) || (++__CLOVER_173_0.CF[772] == 0))){
            __CLOVER_173_0.S[4183]++;throw new ApplicationRuntimeException(
                Tapestry.getMessage("AbstractLinkComponent.events-need-body"),
                this,
View Full Code Here

        __CLOVER_128_0.S[2948]++;boolean disabled = isDisabled();

        __CLOVER_128_0.S[2949]++;if ((((!cycle.isRewinding()) && (++__CLOVER_128_0.CT[534] != 0)) || (++__CLOVER_128_0.CF[534] == 0))){
        {
            __CLOVER_128_0.S[2950]++;Body body = Body.get(cycle);

            __CLOVER_128_0.S[2951]++;if ((((body == null) && (++__CLOVER_128_0.CT[535] != 0)) || (++__CLOVER_128_0.CF[535] == 0))){
                __CLOVER_128_0.S[2952]++;throw new ApplicationRuntimeException(
                    Tapestry.format("must-be-contained-by-body", "DatePicker"),
                    this,
View Full Code Here

        StringBuffer buffer = null;

        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);

        Iterator i = _events.entrySet().iterator();
        while (i.hasNext())
        {
            Map.Entry entry = (Map.Entry) i.next();
            FormEventType type = (FormEventType) entry.getKey();
            Object value = entry.getValue();

            String formPath = "document." + _name;
            String propertyName = type.getPropertyName();
            String finalFunctionName;

            boolean combineWithAnd = type.getCombineUsingAnd();

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

            if (value instanceof String)
            {
                finalFunctionName = (String) value;
            }
            else
            {

                String compositeName = propertyName + "_" + _name;

                if (buffer == null)
                    buffer = new StringBuffer(200);

                buffer.append("\nfunction ");
                buffer.append(compositeName);
                buffer.append("()\n{");

                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}\n\n");

                finalFunctionName = compositeName;
            }

            body.addInitializationScript(
                formPath + "." + propertyName + " = " + finalFunctionName + ";");

        }

        if (buffer != null)
            body.addBodyScript(buffer.toString());

    }
View Full Code Here

        // If some other field has taken the honors, then let it.

        if (cycle.getAttribute(SELECTED_ATTRIBUTE_NAME) != null)
            return;

        Body body = Body.get(cycle);

        // If not wrapped by a Body, then do nothing.

        if (body == null)
            return;

        IForm form = Form.get(cycle);

        String formName = form.getName();
        String textFieldName = getName();

        String fullName = "document." + formName + "." + textFieldName;

        body.addInitializationScript(fullName + ".focus();");
        body.addInitializationScript(fullName + ".select();");

        // Put a marker in, indicating that the selected field is known.

        cycle.setAttribute(SELECTED_ATTRIBUTE_NAME, Boolean.TRUE);
    }
View Full Code Here

        IResourceLocation location =
            new ClasspathResourceLocation(engine.getResourceResolver(), scriptPath);

        IScript script = source.getScript(location);

    Body body = Body.get(cycle);

    if (body == null)
      throw new ApplicationRuntimeException(
        Tapestry.getMessage("ValidField.must-be-contained-by-body"),
        field);
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.