All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jwebmp.plugins.blueimp.fileupload.parts.BlueImpUploadForm Maven / Gradle / Ivy

Go to download

File Upload widget with multiple file selection, drag and drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.

There is a newer version: 1.2.2.1-jre17
Show newest version
package com.jwebmp.plugins.blueimp.fileupload.parts;

import com.jwebmp.core.SessionHelper;
import com.jwebmp.core.base.angular.AngularAttributes;
import com.jwebmp.core.base.html.Form;
import com.jwebmp.plugins.blueimp.fileupload.BlueImpFileUploadBinderGuiceSiteBinder;
import com.jwebmp.plugins.blueimp.fileupload.options.BlueImpFileUploadOptions;

/**
 * The file upload form used as target for the file upload widget
 *
 * @param 
 */
public class BlueImpUploadForm>
		extends Form
{


	private BlueImpFileUploadOptions options;

	public BlueImpUploadForm()
	{
		addAttribute("action", SessionHelper.getServletUrl() + BlueImpFileUploadBinderGuiceSiteBinder.BLUEIMP_FILEUPLOAD_SERVLETURL);
		addAttribute("method", "POST");
		addAttribute("enc-type", "multipart/form-data");
		addAttribute("data-file-upload", "options");
		addAttribute("data-ng-class", "{'fileupload-processing': processing() || loadingFiles}");
	}

	public BlueImpUploadButtonBar addButtonBar()
	{
		BlueImpUploadButtonBar bar = new BlueImpUploadButtonBar();
		add(bar);
		return bar;
	}

	public BlueImpFileUploadTable addDisplayTable()
	{
		BlueImpFileUploadTable bar = new BlueImpFileUploadTable();
		add(bar);
		return bar;
	}

	@Override
	public void preConfigure()
	{
		if (!isConfigured())
		{
			String optionsString = getOptions().toString()
			                                   .replaceAll("\\s", "");
			if (!optionsString.trim()
			                  .isEmpty())
			{
				addAttribute(AngularAttributes.ngInit.getAttributeName(), "options=" + getOptions().toString()
				                                                                                   .replaceAll("\\s", ""));
			}
		}
		super.preConfigure();
	}

	@Override
	public BlueImpFileUploadOptions getOptions()
	{
		if (options == null)
		{
			options = new BlueImpFileUploadOptions();
		}
		return options;
	}

	@Override
	public int hashCode()
	{
		return super.hashCode();
	}

	@Override
	public boolean equals(Object o)
	{
		return super.equals(o);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy