Package org.apache.click.element

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


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

        Map jsModel = ClickUtils.createTemplateModel(this, context);
        jsModel.put("linkId", '#' + link.getId());

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

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

        // 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.
        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("'");

            String id  = getId();

            // Include the field id as a parameter
            buffer.append(",{parameters: '").append(id).append("=1'");

            if (hasParameters()) {

                for (Entry<String, Object> entry : getParameters().entrySet()) {
                    // Add additional parameters
                    buffer.append("&amp;");
                    buffer.append(entry.getKey());
                    buffer.append("=");
                    buffer.append(entry.getValue());
                }
            }

            if (StringUtils.isNotEmpty(getAutoCompleteOptions())) {
                buffer.append(",").append(getAutoCompleteOptions());
            }

            buffer.append("});");

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

            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

            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

            headElements.add(new JsImport("/yui/element/element-beta-min.js"));
            headElements.add(new JsImport("/yui/container/container_core-min.js"));
            headElements.add(new JsImport("/yui/editor/simpleeditor-min.js"));
        }

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

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

            HtmlStringBuffer buffer = new HtmlStringBuffer();
            buffer.append("var myConfig = {").append(getConfig()).append("};\n");
            buffer.append("var myEditor = new YAHOO.widget.SimpleEditor('");
            buffer.append(getId()).append("', myConfig);\n");
            buffer.append("if(myConfig.titlebar) {");
            buffer.append(" myEditor._defaultToolbar.titlebar=myConfig.titlebar; }\n");
            buffer.append("myEditor.render();\n");
            script.setContent(buffer.toString());
            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'
            jsModel.put("target", "customerDetails");

            // Include the ajax-select.js template
            headElements.add(new JsScript("/ajax/select/ajax-select.js", jsModel));
        }

        return headElements;
    }
View Full Code Here

        // Setup showBorders checkbox Javascript using a JsScript HEAD element

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

        // Then add a JsScript element to the Page HEAD elements
        getHeadElements().add(jsScript);
    }
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/table/table-ajax.js", new HashMap()));
        }
        return headElements;
    }
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.