Examples of JsScript


Examples of org.apache.click.element.JsScript

            Map<String, Object> model = ClickUtils.createTemplateModel(this, getContext());
            model.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/ajax-live-scroller.js", model));
        }
        return headElements;
    }
View Full Code Here

Examples of org.apache.click.element.JsScript

            // 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/ajax-select.js", model));
        }

        return headElements;
    }
View Full Code Here

Examples of org.apache.click.element.JsScript

        }

        // Note, the addLoadEvent script is recreated and checked if it
        // is contained in the headElement.
        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

Examples of org.apache.click.element.JsScript

            // 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 ajax-select.js template
            headElements.add(new JsScript("/ajax/ajax-select.js", model));
        }

        return headElements;
    }
View Full Code Here

Examples of org.apache.click.element.JsScript

        if (headElements == null) {
            headElements = super.getHeadElements();
            headElements.add(new JsImport("/assets/js/jquery-1.3.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

Examples of org.apache.click.element.JsScript

            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

Examples of org.apache.click.element.JsScript

            jsImport = new JsImport("/click/menu-fix-ie6.js", versionIndicator);
            jsImport.setConditionalComment(JsImport.IF_LESS_THAN_IE7);
            headElements.add(jsImport);

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

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

            HtmlStringBuffer buffer = new HtmlStringBuffer();
            buffer.append(" if(typeof Click != 'undefined' && typeof Click.menu != 'undefined') {\n");
            buffer.append("   if(typeof Click.menu.fixHiddenMenu != 'undefined') {\n");
            buffer.append("     Click.menu.fixHiddenMenu(\"").append(id).append("\");\n");
            buffer.append("     Click.menu.fixHover(\"").append(id).append("\");\n");
            buffer.append("   }\n");
            buffer.append(" }\n");
            script.setContent(buffer.toString());
            headElements.add(script);
        }

        return headElements;
    }
View Full Code Here

Examples of org.apache.click.element.JsScript

                    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

Examples of org.apache.click.element.JsScript

     * @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

Examples of org.apache.click.element.JsScript

    /**
     * Return the names of months and weekdays as a script.
     */
    protected void addCalenderTranslations(List<Element> headElements) {
        JsScript script = new JsScript();
        script.setId("datefield-js-setup-global");
        if (!headElements.contains(script)) {
            DateFormatSymbols dfs = new DateFormatSymbols(getLocale());

            HtmlStringBuffer buffer = new HtmlStringBuffer(150);
            buffer.append("Date.months=new Array(");
            generateJavaScriptArray(buffer, dfs.getMonths(), 0, 12);
            buffer.append(");\n");

            buffer.append("Date.monthAbbreviations=new Array(");
            generateJavaScriptArray(buffer, dfs.getShortMonths(), 0, 12);
            buffer.append(");\n");

            buffer.append("Date.dayNames=new Array(");
            generateJavaScriptArray(buffer, dfs.getWeekdays(),
                    Calendar.SUNDAY, Calendar.SATURDAY + 1);
            buffer.append(");\n");

            buffer.append("Date.dayAbbreviations=new Array(");
            generateJavaScriptArray(buffer, dfs.getShortWeekdays(),
                    Calendar.SUNDAY, Calendar.SATURDAY + 1);
            buffer.append(");\n");

            String[] weekdays = null;
            if (getMessages().containsKey("calendar-weekdays-heading")) {
                String headings = getMessage("calendar-weekdays-heading");
                weekdays = StringUtils.splitPreserveAllTokens("," + headings, ',');
            } else {
                weekdays = dfs.getShortWeekdays();
            }
            String[] days = new String[7];
            int firstDayOfWeek = getFirstDayOfWeek() - 1;
            for (int i = 0; i < 7; i++) {
                days[i] = weekdays[(i + firstDayOfWeek) % 7 + 1];
            }
            buffer.append("Date.weekdays=new Array(");
            generateJavaScriptArray(buffer, days, 0, 7);
            buffer.append(");\n");

            buffer.append("Date.first_day_of_week=").append(firstDayOfWeek).append(";\n");
            if (getMessages().containsKey("calendar-ok")) {
                buffer.append("_translations[\"OK\"] = \"");
                buffer.append(getMessage("calendar-ok"));
                buffer.append("\";\n");
            }
            if (getMessages().containsKey("calendar-now")) {
                buffer.append("_translations[\"Now\"] = \"");
                buffer.append(getMessage("calendar-now"));
                buffer.append("\";\n");
            }
            if (getMessages().containsKey("calendar-today")) {
                buffer.append("_translations[\"Today\"] = \"");
                buffer.append(getMessage("calendar-today"));
                buffer.append("\";\n");
            }
            if (getMessages().containsKey("calendar-clear")) {
                buffer.append("_translations[\"Clear\"] = \"");
                buffer.append(getMessage("calendar-clear"));
                buffer.append("\";\n");
            }

            script.setContent(buffer.toString());
            headElements.add(script);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.