EasyUploads add-on

Hi,

I had a long car trip on passengers seat and some time to prepare a long planned idea of helpers for the rather low level Upload component in Vaadin. The add-on is a very early stage of development, but I guess it may be useful already for many Vaadin users.

Check it out from the Directory:
http://vaadin.com/directory#addon/easyuploads

Please share any kind of suggestion, patches, bug reports and any kind of contributions at all on this forum thread.

cheers,
matti

Hi,

0.2 version is now available with enhancements especially to MultiFileUpload. With Safari, Chrome and FF users can now select multiple files from the OS file chooser or drag files straight form OS to “drop zone”. I hope you find it useful. Not that advanced browsers should degrade to selecting one file at the time.

The new version requires a widgetset + latest 6.5 nightly.

cheers,
matti

cool! multi file drag & drop upload. Thanks.

Hi,

I just published a 0.3 version. It contains practically no other changes, but supports the latest nightly where file upload parts of the terminal where refactored.

I also spent some time on OS multiple file selection dialog fallback for IE (with flash), but couldn’t get swfupload-gwt to work properly yet. I hope to find some time to fix that part soon.

cheers,
matti

Hi,

I just published 0.4 version of EasyUploads add-on. Uploading several files via MultiFileUpload component is now much sleeker on IE too. The MultiFileUpload component now supports selecting multiple files at once with ctrl or shift click. On IE and Opera (and in gecko_1_8) the add-on uses swfupload as fallback. On “real” browsers “multiple” attribute used like in previous 0.3 version (HTML5 enhancement).

I’m now waiting that somebody builds a photo management app comparable to flickr with Vaadin and EasyUploads.

cheers,
matti

Hi There,

I’ve got an issue using this add-on

I’ve defined my upload field using the following in a form field factory:

    //Binary Data Field
    if (byte[].class.isAssignableFrom(type)) {
    	final UploadField field = new UploadField();
        return field;
    }

I get the following error when i set the item datasource for the form.

Caused by: java.lang.UnsupportedOperationException at org.vaadin.easyuploads.UploadField.setReadThrough(UploadField.java:775)

I’m running Vaadin 6.4.8 with EasyUploads 0.0.1

What is calling this and how do I get this plugin to work.

Cheers,
Ben

Hi,

The setReadThrough method of UploadField throws always an UnsupportedOperationException():


public void setReadThrough(boolean readTrough) 
			throws Buffered.SourceException {
	throw new UnsupportedOperationException();
}

And the method is called several places in Form. I would say that this is a bug in UploadField, maybe an empty method would be better in this case.

As a quick workaround, you can override the method in your code:


	final UploadField field = new UploadField() {
		public void setReadThrough(boolean readTrough) throws com.vaadin.data.Buffered.SourceException {
		
		};
	};

Indeed. A new version 0.4.1 with empty method now in directory.

Ben, I suggest you to go for 6.5 nighty builds (or 6.5.0 later this week) and UploadField 0.4.1.

cheers,
matti

Hi Matti,

i got an error when i use your add-on inside a form which will discarded.

Caused by: java.lang.NullPointerException
at org.vaadin.easyuploads.UploadField.setPropertyDataSource(UploadField.java:974)
at org.vaadin.easyuploads.UploadField.discard(UploadField.java:719)
at com.vaadin.ui.Form.discard(Form.java:384)

Regards,

Andreas

Hi,

I hope I fixed it. If things don’t work with the latest version (0.4.2), please post me a simple test case so I can see the configuration in which you use the field.

cheers,
matti

Can the file size be checked before uploading it? If not then it would suck for the end user to wait for the upload to fail [using server side byte count mechanism as stream is received]
and then see an error message.

Hi,

Good idea. Too bad old browsers like IE don’t still support this in any way. On modern browsers we should nowadays be able to read the file size (with js File API) before actually submitting the file. In multifile upload it might actually be possible for IE too as it is using a flash helper to do the magic.

I’ll put that on my todo list, but wont promise any implementations in a near future.

cheers,
matti

Hi!
I’m having a problem with the fallback flash. It seems like the file uploaded differs from the original image.
I am mostly uploading images, and I am not able to open the temporary files.

Hi,

If you are using Vaadin 6.5.0, upgrade to the latest bugfix release. There was a bug that corrupted files.

If you are using the latest and greatest Vaadin, please let me know about the browser and flash version and also provide me a file that gets broken on upload. Otherwise its pretty hard to help.

cheers,
matti

Hi, I am using the MultiFileUpload class. My usage is very straightforward at this point, I have just included it in a CustomField.



	@SuppressWarnings("serial")
	public FileManagerField() {
		VerticalLayout layout = new VerticalLayout();
		setCompositionRoot(layout);
		fileUpload = new MultiFileUpload() {

			@Override
			protected void handleFile(File file, String fileName,
					String mimeType, long length) {
				String msg = fileName + " uploaded. Saved to file "
				+ file.getAbsolutePath() + " (size " + length
				+ " bytes)";
				System.out.println(msg);
				
			}
			
		};
		fileUpload.setWidth("600px");
		layout.addComponent(fileUpload);
		Button manageFiles = new Button("Manage Files");
		layout.addComponent(manageFiles);
		
		
	}

On the client I am getting the following error:

"idgetset does not contain implementation for org.vaadin.easyuploads.MultiUpload. Check its @ClientWidget mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions. Unrendered UIDL:

org.vaadin.easyuploads.MultiUpload(NO CLIENT IMPLEMENTATION FOUND)

"

Not really sure what to do with this.

Hi,

Did you refer to the
addon instructions
or do you thing this is some issue specific to easy uploads?

cheers,
matti

I am wondering. I the Vaadin integration for Eclipse installed, while the project was not originally created for vaadin, it has the vaadin tab

As we are speaking, I am noticing the builder is not inthe .project. Arrgh :slight_smile: Will give it a shot.

Thanks!

Go to Project Properties → Project Facets and add the Vaadin facet. Under the configuration button, you probably want to disable automatically generating an application class etc.

If you only need the builder and not the rest of what is provided by the facet, making modifications on the Project Properties → Vaadin tab also automatically adds the builder if I remember correctly.

I know that this is an old thread, I will create a new one regarding my issue too, just in case.

I have been looking for this (see quoted thread below). I have a project which wouldn’t compile my widget set and therefore I couldn’t use some of the addons. I’m so glad I happened across this while browsing the forum.

However, after adding the “Vaadin Eclipse Integration” facet to my project and attempting to compile the widget set, I get the following, so there is still something I am missing:


Starting GWT compiler
Mar 30, 2011 10:17:14 AM com.vaadin.tools.WidgetsetCompiler$1 run
SEVERE: Widgetset compilation failed
java.lang.ClassNotFoundException: com.google.gwt.dev.GWTCompiler
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:169)
	at com.vaadin.tools.WidgetsetCompiler$1.run(WidgetsetCompiler.java:81)
	at java.lang.Thread.run(Thread.java:680)

Do I need to include the gwt compiler explicitly, and if so, how do I go about doing so?

If it is something else, please feel free to point me in the right direction.

Thanks,

Jay

Quoted Thread:

I will reply to
this thread
.