/** * @return estimate of the remaining number of milliseconds */ public long getRemainingMilliseconds() { int percentageComplete = getPercentageComplete(); long totalTime = ((getElapsedSeconds() * 100) / Math.max(percentageComplete, 1)); long remainingTime = (totalTime - getElapsedSeconds()); return remainingTime * 1000; // convert seconds to milliseconds and return }
/** * @return estimate of the remaining number of milliseconds */ public long getRemainingMilliseconds() { int percentageComplete = getPercentageComplete(); long totalTime = ((getElapsedSeconds() * 100) / Math.max(percentageComplete, 1)); long remainingTime = (totalTime - getElapsedSeconds()); return remainingTime * 1000; // convert seconds to milliseconds and return }
/** * @param attributes * @return status string with progress data that will feed the progressbar.js variables on * browser to update the progress bar */ private String getStatus(final Attributes attributes) { final String upload = attributes.getParameters().get(UPLOAD_PARAMETER).toString(); final HttpServletRequest req = (HttpServletRequest)attributes.getRequest() .getContainerRequest(); UploadInfo info = MultipartServletWebRequestImpl.getUploadInfo(req, upload); String status; if ((info == null) || (info.getTotalBytes() < 1)) { status = "100|"; } else { status = info.getPercentageComplete() + "|" + new StringResourceModel(RESOURCE_STATUS, (Component)null, Model.of(info)).getString(); } return status; }
/** * @param attributes * @return status string with progress data that will feed the progressbar.js variables on * browser to update the progress bar */ private String getStatus(final Attributes attributes) { final String upload = attributes.getParameters().get(UPLOAD_PARAMETER).toString(); final HttpServletRequest req = (HttpServletRequest)attributes.getRequest() .getContainerRequest(); UploadInfo info = MultipartServletWebRequestImpl.getUploadInfo(req, upload); String status; if ((info == null) || (info.getTotalBytes() < 1)) { status = "100|"; } else { status = info.getPercentageComplete() + "|" + new StringResourceModel(RESOURCE_STATUS, (Component)null, Model.of(info)).getString(); } return status; }
/** * @param attributes * @return status string with progress data that will feed the progressbar.js variables on * browser to update the progress bar */ private String getStatus(final Attributes attributes) { final String upload = attributes.getParameters().get(UPLOAD_PARAMETER).toString(); final HttpServletRequest req = (HttpServletRequest)attributes.getRequest() .getContainerRequest(); UploadInfo info = MultipartServletWebRequestImpl.getUploadInfo(req, upload); String status; if ((info == null) || (info.getTotalBytes() < 1)) { status = "100|"; } else { status = info.getPercentageComplete() + "|" + new StringResourceModel(RESOURCE_STATUS, (Component)null, Model.of(info)).getString(); } return status; }