List of usage examples for org.apache.wicket.util.lang Bytes toString
@Override
public String toString()
From source file:gr.interamerican.wicket.markup.html.panel.FilePanel.java
License:Open Source License
/** * Refreshes the link label./*from w w w . j a v a 2 s. c o m*/ * * @param target */ @SuppressWarnings("nls") private void updateLinkLabel(AjaxRequestTarget target) { if (target != null) { target.add(downloadFileLink); } byte[] content = model.getObject() != null ? model.getObject() : new byte[0]; Bytes bytes = Bytes.bytes(content.length); linkLabel.setDefaultModelObject("[" + bytes.toString() + "]"); }
From source file:org.hippoecm.frontend.plugins.yui.upload.validation.DefaultUploadValidationService.java
License:Apache License
private void validateMaxFileSize(final FileUpload upload) { Bytes fileSize = Bytes.bytes(upload.getSize()); final Bytes maxFileSize = Bytes.valueOf(values.getString(MAX_FILE_SIZE, getDefaultMaxFileSize())); if (maxFileSize.compareTo(fileSize) == -1) { addViolation("file.validation.size", upload.getClientFileName(), fileSize.toString(), maxFileSize.toString()); if (log.isDebugEnabled()) { log.debug("File '{}' has size {} which is too big. The maximum size allowed is {}", upload.getClientFileName(), fileSize.toString(), maxFileSize.toString()); }/*from ww w . ja v a2 s. c o m*/ } }
From source file:org.hippoecm.frontend.plugins.yui.upload.validation.DefaultUploadValidationService.java
License:Apache License
/** * Check if the defaultMaximumUploadSize stored in the IApplicationSettings is set explicitly and only * then used it, otherwise use DEFAULT_MAX_FILE_SIZE. This is because it is set to Bytes.MAX * by default which is a bit overkill (8388608T). * * @return The String value of the default maximum file size for an upload */// ww w .j a v a 2 s . com protected String getDefaultMaxFileSize() { IApplicationSettings settings = Application.get().getApplicationSettings(); Bytes defaultSize = settings.getDefaultMaximumUploadSize(); return Bytes.MAX.equals(defaultSize) ? DEFAULT_MAX_FILE_SIZE : defaultSize.toString(); }