Package org.apache.click.element

Examples of org.apache.click.element.JsScript


            headElements.add(new JsImport("/assets/js/jquery.tools.min.js"));
            headElements.add(new CssImport("/assets/css/tabs-accordion.css"));

            // Note the actual JavaScript necessary to setup the accordion is
            // specified in the Page JavaScript template -> accordion.js.
            headElements.add(new JsScript("/ajax/accordion/accordion.js", new HashMap()));

            // Alternatively, the JsScript below could be used to add
            // the necessary JavaScript to setup the accordion, for example:
            /*
            String content =
View Full Code Here


            Map<String, Object> jsModel = ClickUtils.createTemplateModel(this, getContext());
            jsModel.put("pageSize", pageSize);

            // Note the actual JavaScript necessary to setup the dynamic scrolling
            // is specified in the Page JavaScript template: ajax-live-scroller.js.
            headElements.add(new JsScript("/ajax/scroller/ajax-live-scroller.js", jsModel));
        }
        return headElements;
    }
View Full Code Here

        if (headElements == null) {
            headElements = super.getHeadElements();
            headElements.add(new JsImport("/assets/js/jquery-1.4.2.js"));

            Map<String, Object> jsModel = new HashMap<String, Object>();
            headElements.add(new JsScript("/control/disabled-demo.js", jsModel));
        }
        return headElements;
    }
View Full Code Here

            templateModel.put("cityId", city.getId());
            templateModel.put("suburbId", suburb.getId());

            // populate-on-select.js is a Velocity template which is rendered directly
            // from this Page
            JsScript script = new JsScript("/form/dynamic/populate-on-select.js", templateModel);
            headElements.add(script);
        }
        return headElements;
    }
View Full Code Here

            // Add the ID of a target element in the Page template to replace
            // with new data, in this example the target is 'customerDetails'
            model.put("target", "customerDetails");

            // Include the Page associated JavaScript template
            headElements.add(new JsScript("/ajax/select/ajax-select.js", model));
        }

        return headElements;
    }
View Full Code Here

    @Override
    public List<Element> getHeadElements() {
        if (headElements == null) {
            headElements = super.getHeadElements();
            headElements.add(new JsImport("/assets/js/jquery-1.4.2.js"));
            headElements.add(new JsScript("/ajax/form/advanced-form-ajax.js", new HashMap()));
        }
        return headElements;
    }
View Full Code Here

            jsModel.put("linkId", '#' + link.getId());

            String content =
                context.renderTemplate("/general/page-head-demo.js", jsModel);

            headElements.add(new JsScript(content));
        }
        return headElements;
    }
View Full Code Here

    @Override
    public List<Element> getHeadElements() {
        if (headElements == null) {
            headElements = super.getHeadElements();
            headElements.add(new JsImport("/assets/js/jquery-1.4.2.js"));
            headElements.add(new JsScript("/ajax/form/simple-form-ajax.js", new HashMap()));
        }
        return headElements;
    }
View Full Code Here

                    versionIndicator));
            }
        }

        String checkListId = getId();
        JsScript script = new JsScript();
        script.setId(checkListId + "-js-setup");

        if (!headElements.contains(script)) {
            script.setExecuteOnDomReady(true);

            HtmlStringBuffer buffer = new HtmlStringBuffer(50);

            if (isSortable()) {
                if (getHeight() != null) {
                    buffer.append("Position.includeScrollOffset = true;\n");
                }
                // Script to execute
                buffer.append("Sortable.create('");
                buffer.append(StringEscapeUtils.escapeJavaScript(checkListId));
                buffer.append("-ul'");

                if (getHeight() != null) {
                    buffer.append(", { scroll : '");
                    buffer.append(StringEscapeUtils.escapeJavaScript(checkListId));
                    buffer.append("'}");
                }
                buffer.append(");");

            } else {
                buffer.append("initChecklist('");
                buffer.append(StringEscapeUtils.escapeJavaScript(checkListId));
                buffer.append("-ul');\n");
            }
            script.setContent(buffer.toString());
            headElements.add(script);
        }

        return headElements;
    }
View Full Code Here

     * @param headElements the list of head elements to include for this control
     */
    protected void addCalendarOptions(List<Element> headElements) {
        String fieldId = getId();

        JsScript script = new JsScript();
        script.setId(fieldId + "-js-setup");

        // Note: the setup script is recreated and checked if it is contained in
        // the headElement. This check cater for when the field is used by another
        // Control using the fly-weight pattern eg. FormTable.
        if (!headElements.contains(script)) {

            // Script must be executed as soon as browser dom is ready
            script.setExecuteOnDomReady(true);

            HtmlStringBuffer buffer = new HtmlStringBuffer(150);

            buffer.append("Event.observe('").append(fieldId).append("-button").append("', 'click', function(){");
            buffer.append(" calendar = new CalendarDateSelect($('").append(fieldId).append("'), {");
            buffer.append("  minute_interval: 1, popup_by: '").append(fieldId).append("-button").append("',");
            buffer.append("  embedded: false,");
            buffer.append("  footer: false,");
            buffer.append("  buttons: ").append(isShowTime()).append(",");
            buffer.append("  time: ").append(isShowTime() ? "'mixed'," : "false,");
            buffer.append("  formatValue: '").append(getCalendarPattern()).append("',");
            buffer.append("  year_range: [").append(getMinimumYear()).append(",").append(getMaximumYear()).append("]");
            buffer.append(" });");
            buffer.append("});");

            script.setContent(buffer.toString());
            headElements.add(script);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.click.element.JsScript

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.