public JadePanel(String id, Map<String, Object> values) { this(id, Model.ofMap(values)); }
/** * Constructor * * @param scope the scope * @param function the function, i.e.: the name of the '.js' file without the extension * @param variables the variable {@code Map} to supply to the file */ public JavaScriptPackageHeaderItem(Class<?> scope, String function, Map<String, Object> variables) { super(new TextTemplateResourceReference(scope, function + ".js", Model.ofMap(variables)), null, function, false, null, null); } }
/** * Constructor * * @param scope the scope * @param function the function, i.e.: the name of the '.js' file without the extension * @param variables the variable {@code Map} to supply to the file */ public JavaScriptPackageHeaderItem(Class<?> scope, String function, Map<String, Object> variables) { super(new TextTemplateResourceReference(scope, function + ".js", Model.ofMap(variables)), null, function, false, null, null); } }
/** * Gets the resource reference. * * @return the resource reference */ private ResourceReference getResourceReference() { final Map<String, Object> map = new HashMap<>(); map.put("url", WicketUrlExtensions.getUrlAsString(pageClass)); final ResourceReference resourceReference = new TextTemplateResourceReference(pageClass, this.filename, "text/javascript", Model.ofMap(map)); return resourceReference; }
/** {@inheritDoc} */ @Override public void onComponentTag(Component component, ComponentTag tag) { String pageIndex = String.valueOf(page + 1).intern(); Map<String, String> vars = new MicroMap<String, String>("page", pageIndex); tag.put("title", PagingNavigation.this.getString(RES, Model.ofMap(vars))); } }
/** {@inheritDoc} */ @Override public void onComponentTag(Component component, ComponentTag tag) { String pageIndex = String.valueOf(page + 1).intern(); Map<String, String> vars = new MicroMap<String, String>("page", pageIndex); tag.put("title", PagingNavigation.this.getString(RES, Model.ofMap(vars))); } }
/** {@inheritDoc} */ @Override public void onComponentTag(Component component, ComponentTag tag) { Map<String, String> vars = new MicroMap<String, String>("page", String.valueOf(page + 1)); tag.put("title", PagingNavigation.this.getString(RES, Model.ofMap(vars))); } }
/** * The default message may look like ".. may not exceed 10240 Bytes..". Which is ok, but * sometimes you may want something like "10KB". By subclassing this method you may replace * maxSize in the model or add you own property and use that in your error message. * <p> * Don't forget to call super.onFileUploadException(e, model) at the end of your method. * * @param e * @param model */ protected void onFileUploadException(final FileUploadException e, final Map<String, Object> model) { if (e instanceof FileUploadBase.SizeLimitExceededException) { String msg = getString(UPLOAD_TOO_LARGE_RESOURCE_KEY, Model.ofMap(model)); error(msg); } else if (e instanceof FileUploadBase.FileSizeLimitExceededException) { String msg = getString(UPLOAD_SINGLE_FILE_TOO_LARGE_RESOURCE_KEY, Model.ofMap(model)); error(msg); } else { String msg = getString(UPLOAD_FAILED_RESOURCE_KEY, Model.ofMap(model)); error(msg); log.warn(msg, e); } }
/** * The default message may look like ".. may not exceed 10240 Bytes..". Which is ok, but * sometimes you may want something like "10KB". By subclassing this method you may replace * maxSize in the model or add you own property and use that in your error message. * <p> * Don't forget to call super.onFileUploadException(e, model) at the end of your method. * * @param e * @param model */ protected void onFileUploadException(final FileUploadException e, final Map<String, Object> model) { if (e instanceof FileUploadBase.SizeLimitExceededException) { String msg = getString(UPLOAD_TOO_LARGE_RESOURCE_KEY, Model.ofMap(model)); error(msg); } else if (e instanceof FileUploadBase.FileSizeLimitExceededException) { String msg = getString(UPLOAD_SINGLE_FILE_TOO_LARGE_RESOURCE_KEY, Model.ofMap(model)); error(msg); } else { String msg = getString(UPLOAD_FAILED_RESOURCE_KEY, Model.ofMap(model)); error(msg); log.warn(msg, e); } }
/** * Adds an error message about the exceeded file size limit. By default it mimics the upload * error handling of Form. In o.a.w.markup.html.form.Form look for #handleMultiPart() and * #onFileUploadException(). * * @param target * wicket object representing the ajax response, not-null * @param fileList * list of files chosen in the upload field, not-null */ protected void addErrorMsg(AjaxRequestTarget target, FileList fileList) { FormComponent<?> component = getFormComponent(); Bytes maxSize = getMaxSize(); final Map<String, Object> model = new HashMap<String, Object>(); model.put("maxSize", maxSize); final String defaultValue = "Upload must be less than " + maxSize; String msg = component.getString(component.getId() + "." + UPLOAD_TOO_LARGE_RESOURCE_KEY, Model.ofMap(model), defaultValue); component.error(msg); }
.getResourceSettings() .getLocalizer() .getString("ServerAndClientTimeFilter.statustext", null, Model.ofMap(map), defaultValue.toString()); AppendingStringBuffer endScript = new AppendingStringBuffer(150);
"ServerAndClientTimeFilter.statustext", null, Model.ofMap(map), defaultValue.toString()); AppendingStringBuffer endScript = new AppendingStringBuffer(150);
.getResourceSettings() .getLocalizer() .getString("ServerAndClientTimeFilter.statustext", null, Model.ofMap(map), defaultValue.toString()); AppendingStringBuffer endScript = new AppendingStringBuffer(150);
@Override public void onSubmit() { if (getContainer().hasNode(fileName)) { error(getString("fileExists", Model.ofMap(new MicroMap<String, String>( "fileName", fileName)))); return; } // create initial node skeleton BrixNode node = (BrixNode) getContainer().addNode(fileName, "nt:file"); BrixFileNode file = BrixFileNode.initialize(node, "text"); // temp-mime // save the node so brix assigns the correct jcr type to it getContainer().save(); // populate node ResourceNode resource = (ResourceNode) getContainer().getSession().getItem( node.getPath()); model.setObject(new BrixNodeModel(resource)); model.apply(); getContainer().save(); // done getSession().info(getString("saved")); SitePlugin.get().selectNode(this, resource, true); } });