4055: Workspace Uploder enhancement: work with multiple-instances of DnD Workspace Uploader in the DOM

Task-Url: https://support.d4science.org/issues/4055

Added new constructor
Added new random ID

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@128668 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-05-18 16:10:49 +00:00
parent 37aa0559ba
commit c6bf3b0660
1 changed files with 15 additions and 14 deletions

View File

@ -25,16 +25,10 @@ import com.google.gwt.user.client.ui.Widget;
* The Class MultipleDNDUpload. * The Class MultipleDNDUpload.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Oct 28, 2015 * May 18, 2016
*/ */
public class MultipleDNDUpload extends LayoutPanel implements public class MultipleDNDUpload extends LayoutPanel implements HasWorskpaceUploadNotificationListener {
HasWorskpaceUploadNotificationListener {
/**
*
*/
// private WorkspaceFieldsUploadManager fields;
private String idFolder; private String idFolder;
private UPLOAD_TYPE type; private UPLOAD_TYPE type;
@ -64,11 +58,11 @@ public class MultipleDNDUpload extends LayoutPanel implements
public static final String DROP_TARGET_UNIQUE_CHILD_ID = "drop_target_unique_child"; public static final String DROP_TARGET_UNIQUE_CHILD_ID = "drop_target_unique_child";
/** The drop target ids. */ /** The drop target ids. */
private int randomInt = Random.nextInt() + Random.nextInt(); private String randomID = Random.nextInt() + "_" +Random.nextInt();
private String dropTargetID = DROP_TARGET_CLASS +"-" + randomInt; private String dropTargetID = DROP_TARGET_CLASS +"-" + randomID;
private String dropTargetOuterID = DROP_TARGET_OUTER_CLASS +"-"+ randomInt; private String dropTargetOuterID = DROP_TARGET_OUTER_CLASS +"-"+ randomID;
private String dropTargetInnerID = DROP_TARGET_INNER_CLASS +"-"+ randomInt; private String dropTargetInnerID = DROP_TARGET_INNER_CLASS +"-"+ randomID;
private String dropTargetUniqueChildID = DROP_TARGET_UNIQUE_CHILD_ID +"-"+ randomInt; private String dropTargetUniqueChildID = DROP_TARGET_UNIQUE_CHILD_ID +"-"+ randomID;
/** /**
* Instantiates a new DND file reader. * Instantiates a new DND file reader.
@ -304,6 +298,8 @@ public class MultipleDNDUpload extends LayoutPanel implements
} }
/** /**
* Gets the drop target id.
*
* @return the dropTargetID * @return the dropTargetID
*/ */
public String getDropTargetID() { public String getDropTargetID() {
@ -312,6 +308,8 @@ public class MultipleDNDUpload extends LayoutPanel implements
} }
/** /**
* Gets the drop target outer id.
*
* @return the dropTargetOuterID * @return the dropTargetOuterID
*/ */
public String getDropTargetOuterID() { public String getDropTargetOuterID() {
@ -321,6 +319,8 @@ public class MultipleDNDUpload extends LayoutPanel implements
/** /**
* Gets the drop target inner id.
*
* @return the dropTargetInnerID * @return the dropTargetInnerID
*/ */
public String getDropTargetInnerID() { public String getDropTargetInnerID() {
@ -337,7 +337,8 @@ public class MultipleDNDUpload extends LayoutPanel implements
private static native void resetPanel(MultipleDNDUpload instance) /*-{ private static native void resetPanel(MultipleDNDUpload instance) /*-{
var drop_target_inner = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::dropTargetInnerID; var drop_target_inner = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::dropTargetInnerID;
var drop_target_outer = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::dropTargetOuterID; var drop_target_outer = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::dropTargetOuterID;
var drop = $wnd.$('#drop_target')[0]; var drop_target = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::dropTargetID;
var drop = $wnd.$('#'+drop_target)[0];
if (drop === null || drop === undefined) { if (drop === null || drop === undefined) {
return; return;
} }