org.apache.wicket.util.template.PackageTextTemplate Java Examples
The following examples show how to use
org.apache.wicket.util.template.PackageTextTemplate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ColorPickerPanel.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
/** * @see org.apache.wicket.Component#onInitialize() */ @Override protected void onInitialize() { super.onInitialize(); final Form<Void> colorForm = new Form<Void>("colorForm"); add(colorForm); final TextField<String> colorField = new TextField<String>("color", new PropertyModel<String>(this, "selectedColor")); colorField.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; /** * @see org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior#onUpdate(org.apache.wicket.ajax.AjaxRequestTarget) */ @Override protected void onUpdate(final AjaxRequestTarget target) { onColorUpdate(selectedColor); } }); colorForm.add(colorField); // colorpicker js final JavaScriptTemplate jsTemplate = new JavaScriptTemplate(new PackageTextTemplate(ColorPickerPanel.class, "ColorPicker.js.template")); final String javaScript = jsTemplate.asString(new MicroMap<String, String>("markupId", colorField.getMarkupId())); add(new Label("template", javaScript).setEscapeModelStrings(false)); }
Example #2
Source File: SlidebarBehavior.java From nextreports-server with Apache License 2.0 | 6 votes |
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(CssHeaderItem.forReference(new PackageResourceReference(SlidebarBehavior.class, "slidebars.css"))); response.render(CssHeaderItem.forUrl("css/slidebar.css")); response.render(JavaScriptHeaderItem.forReference(new PackageResourceReference(SlidebarBehavior.class, "slidebars.js"))); Map<String, String> vars = new HashMap<String, String>(); // vars.put("siteClose", "true"); PackageTextTemplate template = new PackageTextTemplate(SlidebarBehavior.class, "slidebar-behavior.template.js"); // template.interpolate(vars); response.render(OnDomReadyHeaderItem.forScript(template.getString())); }
Example #3
Source File: PivotPanel.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssHeaderItem.forReference(PIVOT_CSS)); response.render(CssHeaderItem.forReference(PIVOT_CSS_FIX)); response.render(CssHeaderItem.forReference(C3_CSS)); response.render(JavaScriptHeaderItem.forReference(JQueryDashboardSupport.JQUERY_UI_JS)); response.render(JavaScriptHeaderItem.forReference(PIVOT_JS)); response.render(JavaScriptHeaderItem.forReference(D3_JS)); response.render(JavaScriptHeaderItem.forReference(C3_JS)); response.render(JavaScriptHeaderItem.forReference(D3_RENDERERS_JS)); response.render(JavaScriptHeaderItem.forReference(C3_RENDERERS_JS)); String lang = getLocale().getLanguage(); if(SUPPORTED_LANGS.indexOf(lang)<0) lang = "en"; JavaScriptResourceReference langRes = getLocalizationJSResource(lang); if(langRes!=null) response.render(JavaScriptHeaderItem.forReference(langRes)); TextTemplate template = new PackageTextTemplate(PivotPanel.class, "pivottable.tmpl.js"); Map<String, Object> params = new HashMap<String, Object>(); params.put("componentId", getMarkupId()); params.put("dataUrl", getModelObject().replace("'", "\\'")); params.put("config", Strings.defaultIfEmpty(configModel.getObject(), "{}")); params.put("editMode", DisplayMode.EDIT.equals(modeModel.getObject())); params.put("callBackScript", updatePivotTableBehavior.getCallbackScript()); params.put("language", lang); template.interpolate(params); response.render(OnDomReadyHeaderItem.forScript(template.asString())); }
Example #4
Source File: AjaxIndicator.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); TextTemplate template = new PackageTextTemplate(AjaxIndicator.class, "ajax-indicator.js"); template.interpolate(CommonUtils.<String, Object>toMap("componentId", getMarkupId())); response.render(OnDomReadyHeaderItem.forScript(template.getString())); }
Example #5
Source File: GridsterAjaxBehavior.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); DashboardPanel<?> dashboard = (DashboardPanel<?>)component; response.render(JavaScriptHeaderItem.forReference(GridsterDashboardSupport.GRIDSTER_JS)); response.render(CssHeaderItem.forReference(GridsterDashboardSupport.GRIDSTER_CSS)); response.render(CssHeaderItem.forReference(GridsterDashboardSupport.WIDGET_CSS)); Map<String, Object> variables = new HashMap<String, Object>(); variables.put("componentId", dashboard.getMarkupId()); variables.put("callBackScript", getCallbackScript()); variables.put("disabled", !DisplayMode.EDIT.equals(dashboard.getModeObject())); TextTemplate template = new PackageTextTemplate(GridsterDashboardSupport.class, "widget.tmpl.js"); String script = template.asString(variables); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #6
Source File: JQueryDashboardAjaxBehavior.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); DashboardPanel<?> dashboard = (DashboardPanel<?>)component; response.render(CssHeaderItem.forReference(JQueryDashboardSupport.WIDGET_CSS)); response.render(JavaScriptHeaderItem.forReference(JQueryDashboardSupport.JQUERY_UI_JS)); Map<String, Object> variables = new HashMap<String, Object>(); variables.put("componentId", dashboard.getMarkupId()); variables.put("callBackScript", getCallbackScript()); variables.put("disabled", !DisplayMode.EDIT.equals(dashboard.getModeObject())); TextTemplate template = new PackageTextTemplate(JQueryDashboardAjaxBehavior.class, "widget.tmpl.js"); String script = template.asString(variables); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #7
Source File: OArchitectEditorWidget.java From Orienteer with Apache License 2.0 | 4 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssReferenceHeaderItem.forReference(OARCHITECT_CSS)); response.render(CssReferenceHeaderItem.forReference(MXGRAPH_CSS)); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/OArchitectApplication.js"))); response.render(JavaScriptHeaderItem.forScript( String.format("initMxGraph('%s');", "en"), null)); response.render(JavaScriptHeaderItem.forReference(MXGRAPH_JS)); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OArchitectEditor.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OArchitectBar.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/util/OArchitectOType.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OArchitectMessage.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OArchitectPopupMenu.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OArchitectModalWindow.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OArchitectValueContainer.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OClassEditModalWindow.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OPropertyEditModalWindow.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/behavior/OArchitectAction.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/config/GraphConfig.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/config/GraphConnectionConfig.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/config/GraphStyleConfig.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/util/OArchitectCommand.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/util/OArchitectUtil.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/util/OArchitectOClass.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/util/OArchitectOProperty.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/util/OArchitectConstants.js"))); String locale = getOArchitectEditorLocale(); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, String.format("js/util/locale/architect_%s.js", locale)))); PackageResourceReference configXml = new PackageResourceReference(OArchitectEditorWidget.class, "js/OArchitectApplication.js"); String configUrl = urlFor(configXml, null).toString(); String baseUrl = configUrl.substring(0, configUrl.indexOf("js/OArchitectApplication")); TextTemplate configTemplate = new PackageTextTemplate(OArchitectEditorWidget.class, "config.tmpl.xml"); Map<String, Object> params = CommonUtils.toMap("basePath", baseUrl); String config = configTemplate.asString(params); boolean canUpdate = canUserUpdateEditor(); response.render(OnLoadHeaderItem.forScript(String.format("initOrienteerArchitect('%s', %s, %s, '%s', '%s', '%s', '%s', '%s', '%s', %s);", baseUrl, CommonUtils.escapeAndWrapAsJavaScriptString(config), locale, this.getMarkupId(), container.getMarkupId(), editor.getMarkupId(), sidebar.getMarkupId(), toolbar.getMarkupId(), outline.getMarkupId(), Boolean.toString(canUpdate)))); }