for (int i = 0; i < fileCount; i++) {
final int fileId = filecounter++;
final VHtml5File file = event.getFile(i);
+ VConsole.log("Preparing to upload file " + file.getName()
+ + " with id " + fileId);
transferable.setData("fi" + i, "" + fileId);
transferable.setData("fn" + i, file.getName());
transferable.setData("ft" + i, file.getType());
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.Paintable;
import com.vaadin.client.UIDL;
+import com.vaadin.client.VConsole;
import com.vaadin.client.ui.VDragAndDropWrapper;
import com.vaadin.client.ui.customcomponent.CustomComponentConnector;
import com.vaadin.shared.ui.Connect;
getWidget().fileIds.remove(indexOf);
}
} else {
+ if (getWidget().fileIdToReceiver.containsKey(fileId)
+ && receiverUrl != null
+ && !receiverUrl
+ .equals(getWidget().fileIdToReceiver
+ .get(fileId))) {
+ VConsole.error("Overwriting file receiver mapping for fileId "
+ + fileId
+ + " . Old receiver URL: "
+ + getWidget().fileIdToReceiver.get(fileId)
+ + " New receiver URL: " + receiverUrl);
+ }
getWidget().fileIdToReceiver.put(fileId, receiverUrl);
}
}
(String) rawVariables.get("ft" + i)); // mime
String id = (String) rawVariables.get("fi" + i);
files[i] = file;
- receivers.put(id, file);
+ receivers.put(id, new ProxyReceiver(id, file));
markAsDirty(); // paint Receivers
}
}
}
- private Map<String, Html5File> receivers = new HashMap<String, Html5File>();
+ private Map<String, ProxyReceiver> receivers = new HashMap<String, ProxyReceiver>();
public class WrapperTargetDetails extends TargetDetailsImpl {
getDropHandler().getAcceptCriterion().paint(target);
}
if (receivers != null && receivers.size() > 0) {
- for (Iterator<Entry<String, Html5File>> it = receivers.entrySet()
- .iterator(); it.hasNext();) {
- Entry<String, com.vaadin.ui.Html5File> entry = it.next();
+ for (Iterator<Entry<String, ProxyReceiver>> it = receivers
+ .entrySet().iterator(); it.hasNext();) {
+ Entry<String, ProxyReceiver> entry = it.next();
String id = entry.getKey();
- Html5File html5File = entry.getValue();
+ ProxyReceiver proxyReceiver = entry.getValue();
+ Html5File html5File = proxyReceiver.file;
if (html5File.getStreamVariable() != null) {
target.addVariable(this, "rec-" + id, new ProxyReceiver(id,
html5File));