Examples of JsScript


Examples of org.apache.click.element.JsScript

        // Setup showBorders checkbox Javascript using a JsScript HEAD element

        // First create a JsScript instance for the JavaScript template
        // '/form-head.htm'
        JsScript jsScript = new JsScript("/form-head.htm", new HashMap());

        // Then add a JsScript element to the Page HEAD elements
        getHeadElements().add(jsScript);
    }
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 fieldId = getId();
        JsScript script = new JsScript();
        script.setId(fieldId + "_autocomplete");
        if (!headElements.contains(script)) {
            // Script must be executed as soon as browser dom is ready
            script.setExecuteOnDomReady(true);

            String contextPath = context.getRequest().getContextPath();
            HtmlStringBuffer buffer = new HtmlStringBuffer(150);
            buffer.append("new Ajax.Autocompleter(");
            buffer.append("'").append(fieldId).append("'");
            buffer.append(",'").append(fieldId).append("_auto_complete_div'");
            buffer.append(",'").append(contextPath).append(page.getPath()).append(
                "'");
            buffer.append(",").append(getAutoCompleteOptions()).append(");");
            script.setContent(buffer.toString());
            headElements.add(script);
        }
        return headElements;
    }
View Full Code Here

Examples of org.apache.click.element.JsScript

            headElements.add(jsImport);
            headElements.add(new CssImport("/click/keyboard.css", versionIndicator));
        }

        String fieldId = getId();
        JsScript script = new JsScript();
        script.setId(fieldId + "_js_setup");

        if (!headElements.contains(script)) {
            HtmlStringBuffer buffer = new HtmlStringBuffer(150);
            buffer.append("var keyboard_png_path=\"");
            buffer.append(context.getRequest().getContextPath());
            buffer.append("/click/keyboard");
            buffer.append(versionIndicator);
            buffer.append(".png\"");
            script.setContent(buffer.toString());
            headElements.add(script);
        }
        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 menuId = getId();
        JsScript script = new JsScript();
        script.setId(menuId + "_js_setup");
        if (!headElements.contains(script)) {
            // Script must be executed as soon as browser dom is ready
            script.setExecuteOnDomReady(true);

            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

        }

        // 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

                if (line.indexOf(" src=") != -1) {
                    JsImport jsImport = asJsImport(lines[i]);
                    add(jsImport);

                } else {
                    JsScript jsScript = asJsScript(lines[i]);
                    setUnique(jsScript, jsScript.getContent().toString());
                    add(jsScript);

                }
            } else {
                throw new IllegalArgumentException("Unknown include type: " + lines[i]);
View Full Code Here

Examples of org.apache.click.element.JsScript

            buffer.append('\n');
        }

        // Then include all the scripts e.g. <script>...</script>
        for (Iterator it = jsScripts.iterator(); it.hasNext();) {
            JsScript jsScript = (JsScript) it.next();
            jsScript.render(buffer);
            buffer.append('\n');
        }
    }
View Full Code Here

Examples of org.apache.click.element.JsScript

     *
     * @param line the HTML import line to convert to a JavaScript instance
     * @return a Javascript instance
     */
    private JsScript asJsScript(String line) {
        JsScript jsScript = new JsScript();
        copyAttributes(jsScript, line);
        jsScript.setContent(extractJsContent(line, jsScript));
        return jsScript;
    }
View Full Code Here

Examples of org.apache.click.element.JsScript

     */
    protected void addCalendarOptions(List headElements) {
        String fieldId = getId();
        String imgId = fieldId + "-button";

        JsScript script = new JsScript();
        script.setId(fieldId + "_calendar_date_select");

        // Note the Calendar options script is recreated and checked if it
        // is contained in the headElement. This caters for when the field is
        // used in a fly-weight pattern such as 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(imgId).append("', 'click', function(){");
            buffer.append(" Date.first_day_of_week=").append(getFirstDayOfWeek() - 1).append(";");
            buffer.append(" calendar = new CalendarDateSelect($('").append(fieldId).append("'), {");
            buffer.append("  minute_interval: 1, popup_by: '").append(imgId).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

        }

        // Note the addLoadEvent script is recreated and checked if it
        // is contained in the headElement.
        String fieldId = getId();
        JsScript script = new JsScript();
        script.setId(fieldId + "_autocomplete");
        if (!headElements.contains(script)) {
            // Script must be executed as soon as browser dom is ready
            script.setExecuteOnDomReady(true);

            String contextPath = context.getRequest().getContextPath();
            HtmlStringBuffer buffer = new HtmlStringBuffer(150);
            buffer.append("new Ajax.Autocompleter(");
            buffer.append("'").append(fieldId).append("'");
            buffer.append(",'").append(fieldId).append("_auto_complete_div'");
            buffer.append(",'").append(contextPath).append(page.getPath()).append(
                "'");
            buffer.append(",").append(getAutoCompleteOptions()).append(");");
            script.setContent(buffer.toString());
            headElements.add(script);
        }
        return headElements;
    }
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.