From d0769eef27da10d320508cd6af44a0a715fd87f2 Mon Sep 17 00:00:00 2001 From: GregWoolsey Date: Wed, 1 Mar 2017 17:15:38 -0800 Subject: [PATCH] https://github.com/parttio/easyuploads/issues/25 fix bounds check for maxFileCount to allow for uploading 1 file --- .../vaadin/easyuploads/client/ui/VMultiUpload.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/vaadin/easyuploads/client/ui/VMultiUpload.java b/src/main/java/org/vaadin/easyuploads/client/ui/VMultiUpload.java index 35599b9..e5a94ae 100644 --- a/src/main/java/org/vaadin/easyuploads/client/ui/VMultiUpload.java +++ b/src/main/java/org/vaadin/easyuploads/client/ui/VMultiUpload.java @@ -119,13 +119,15 @@ public static final native VHtml5File[] getFiles(Element el) private String receiverUri; private ReadyStateChangeHandler readyStateChangeHandler = new ReadyStateChangeHandler() { - public void onReadyStateChange(XMLHttpRequest xhr) { + @Override + public void onReadyStateChange(XMLHttpRequest xhr) { if (xhr.getReadyState() == XMLHttpRequest.DONE) { xhr.clearOnReadyStateChange(); VConsole.log("Ready state + " + xhr.getReadyState()); Scheduler.get().scheduleDeferred(new ScheduledCommand() { - public void execute() { + @Override + public void execute() { if (isAttached() && !fileQueue.isEmpty()) { client.updateVariable(paintableId, "ready", true, true); @@ -144,7 +146,8 @@ public VMultiUpload() { panel.add(fu); submitButton = new VButton(); submitButton.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent event) { + @Override + public void onClick(ClickEvent event) { // fire click on upload (eg. focused button and hit space) fireNativeClick(fu.getElement()); } @@ -157,7 +160,8 @@ public void onClick(ClickEvent event) { addStyleName(CLASSNAME + "-immediate"); } - public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { + @Override + public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { if (client.updateComponent(this, uidl, true)) { return; } @@ -292,7 +296,7 @@ private void submit() { } else if (!AcceptUtil.accepted(file.getName(), file.getType(), accepted)) { noMatches.add(file); - } else if (maxFileCount != null && filedetails.size() >= maxFileCount) { + } else if (maxFileCount != null && filedetails.size() > maxFileCount) { tooMany.add(file); } else { queueFilePost(file);