starting file upload integration
This commit is contained in:
parent
579c97067a
commit
26230f7e9f
10
.classpath
10
.classpath
|
@ -1,14 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/metadata-profile-form-builder-widget-0.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
|
@ -18,10 +19,9 @@
|
|||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<classpathentry excluding="**" kind="src" output="target/metadata-profile-form-builder-widget-0.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
|
@ -35,5 +35,5 @@
|
|||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
<classpathentry kind="output" path="target/metadata-profile-form-builder-widget-0.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
10
.project
10
.project
|
@ -15,11 +15,6 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.gwtplugins.gdt.eclipse.core.webAppProjectValidator</name>
|
||||
<arguments>
|
||||
|
@ -35,6 +30,11 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
eclipse.preferences.version=1
|
||||
lastWarOutDir=/home/francesco-mangiacrapa/git/metadata-profile-form-builder-widget/target/metadata-profile-form-builder-widget-0.1.0-SNAPSHOT
|
||||
lastWarOutDir=/home/francesco/git/metadata-profile-form-builder-widget/target/metadata-profile-form-builder-widget-0.1.0-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
<wb-module deploy-name="metadata-profile-form-builder-widget-0.1.0-SNAPSHOT">
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<dependent-module archiveName="metadata-profile-discovery-0.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/metadata-profile-discovery/metadata-profile-discovery">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/resources"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
|
||||
|
||||
|
||||
<property name="context-root" value="metadata-profile-form-builder-widget"/>
|
||||
|
||||
|
||||
<property name="java-output-path" value="/metadata-profile-form-builder-widget/target/classes"/>
|
||||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
</project-modules>
|
||||
|
|
|
@ -1,30 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='MetadataProfileFormBuilder'>
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<!-- Other module inherits -->
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
<!-- Responsive design -->
|
||||
<set-property name="bootstrap.responsiveDesign" value="true" />
|
||||
<inherits name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
|
||||
<set-property name="bootstrap.responsiveDesign"
|
||||
value="true" />
|
||||
<inherits
|
||||
name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
|
||||
<inherits name='com.github.gwtbootstrap.datepicker.Datepicker' />
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<inherits name='com.google.gwt.json.JSON'/>
|
||||
<inherits
|
||||
name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portal.clientcontext.GCubeClientContext' />
|
||||
|
||||
<inherits name='com.google.gwt.json.JSON' />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
|
||||
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<!-- Other module inherits -->
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
|
||||
<entry-point class='org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilder' />
|
||||
<!-- Specify the app entry point class. -->
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
<entry-point
|
||||
class='org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilder' />
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
|
||||
</module>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.client;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
public class ConstantsMPFormBuilder {
|
||||
|
||||
public static final String WORKSPACE_UPLOADER_SERVLET_STREAM__MODIFIED = GWT.getModuleBaseURL() + "workspaceUploadServletStream";
|
||||
|
||||
public static final String CURR_GROUP_ID = "currGroupId";
|
||||
//public static final String CURR_USER_ID = "currUserId";
|
||||
public static final String IS_OVERWRITE = "isOverwrite";
|
||||
public static final String UPLOAD_TYPE = "uploadType";
|
||||
public static final String ID_FOLDER = "idFolder";
|
||||
public static final String UPLOAD_FORM_ELEMENT = "uploadFormElement";
|
||||
|
||||
public static final String CLIENT_UPLOAD_KEYS = "client_upload_keys";
|
||||
public static final String CANCEL_UPLOAD = "cancel_upload";
|
||||
public static final String JSON_CLIENT_KEYS = "ClientKeys";
|
||||
|
||||
public static final int LIMIT_UPLOADS = 50;
|
||||
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.widgets.mpformbuilder.client;
|
|||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.FileUpload;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
|
|
|
@ -2,10 +2,8 @@ package org.gcube.portlets.widgets.mpformbuilder.client.form.generic;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderService;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync;
|
||||
|
@ -18,9 +16,9 @@ import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CategoryPanel
|
|||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEntry;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.resources.AddResourceToDataset;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.tags.TagsPanel;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection.TwinColumnSelectionMainPanel;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.InfoIconsLabels;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.LoaderIcon;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.OrganizationBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.license.LicenseBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.CategoryWrapper;
|
||||
|
@ -79,7 +77,7 @@ public class CreateMetadataForm extends Composite{
|
|||
@UiField ControlGroup customFields;
|
||||
@UiField Button addCustomFieldButton;
|
||||
@UiField Button createButton;
|
||||
@UiField Button resetButton;
|
||||
// @UiField Button resetButton;
|
||||
@UiField AlertBlock infoBlock;
|
||||
@UiField AlertBlock onContinueAlertBlock;
|
||||
@UiField AlertBlock onCreateAlertBlock;
|
||||
|
@ -87,9 +85,11 @@ public class CreateMetadataForm extends Composite{
|
|||
@UiField ListBox metadataTypeListbox;
|
||||
@UiField Form formFirstStep;
|
||||
@UiField Form formThirdStep;
|
||||
@UiField Button continueButton;
|
||||
// @UiField Button continueButton;
|
||||
@UiField Paragraph selectedProfile;
|
||||
@UiField TagsPanel tagsPanel;
|
||||
@UiField LoaderIcon loaderProfiles;
|
||||
@UiField LoaderIcon loaderProfileInformation;
|
||||
//@UiField TagsPanel tagsPanel;
|
||||
|
||||
// info panels
|
||||
@UiField Icon infoIconTypes;
|
||||
|
@ -99,11 +99,6 @@ public class CreateMetadataForm extends Composite{
|
|||
@UiField FocusPanel focusPanelCustomFields;
|
||||
@UiField Popover popoverCustomFields;
|
||||
@UiField ControlGroup metadataTypesControlGroup;
|
||||
// @UiField ControlGroup productTitleGroup;
|
||||
// @UiField ControlGroup maintainerControlGroup;
|
||||
// @UiField ControlGroup versionControlGroup;
|
||||
// @UiField ControlGroup organizationsGroup;
|
||||
// @UiField ControlGroup groupsControlGroup;
|
||||
|
||||
private final MetadataProfileFormBuilderServiceAsync formBuilderService = GWT.create(MetadataProfileFormBuilderService.class);
|
||||
|
||||
|
@ -164,6 +159,7 @@ public class CreateMetadataForm extends Composite{
|
|||
this(eventBus);
|
||||
this.scope = scope;
|
||||
this.genericResourceSecondaryType = genericResourceSecondaryType;
|
||||
showLoadingProfiles(true);
|
||||
MetadataProfileFormBuilderServiceAsync.Util.getInstance().getProfilesInTheScope(scope, genericResourceSecondaryType, new AsyncCallback<List<MetaDataProfileBean>>() {
|
||||
|
||||
@Override
|
||||
|
@ -173,6 +169,7 @@ public class CreateMetadataForm extends Composite{
|
|||
@Override
|
||||
public void onSuccess(List<MetaDataProfileBean> profiles) {
|
||||
createDatasetFormBody(profiles);
|
||||
showLoadingProfiles(false);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -186,7 +183,9 @@ public class CreateMetadataForm extends Composite{
|
|||
*/
|
||||
public CreateMetadataForm(List<MetaDataProfileBean> profiles, HandlerManager eventBus) {
|
||||
this(eventBus);
|
||||
showLoadingProfiles(true);
|
||||
createDatasetFormBody(profiles);
|
||||
showLoadingProfiles(false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -201,6 +200,16 @@ public class CreateMetadataForm extends Composite{
|
|||
bind();
|
||||
prepareInfoIcons();
|
||||
}
|
||||
|
||||
private void showLoadingProfiles(boolean bool) {
|
||||
loaderProfiles.setText("Loading Profiles...");
|
||||
loaderProfiles.setVisible(bool);
|
||||
}
|
||||
|
||||
private void showLoadingProfileInformation(boolean bool) {
|
||||
loaderProfileInformation.setText("Loading Profile Information...");
|
||||
loaderProfileInformation.setVisible(bool);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -252,27 +261,29 @@ public class CreateMetadataForm extends Composite{
|
|||
|
||||
if(profiles != null && !profiles.isEmpty()){
|
||||
for(MetaDataProfileBean metadataBean: profiles){
|
||||
|
||||
metadataTypeListbox.addItem(metadataBean.getType());
|
||||
|
||||
// add handler on select
|
||||
metadataTypeListbox.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
|
||||
String selectedItemText = metadataTypeListbox.getSelectedItemText();
|
||||
metadataFieldsPanel.clear();
|
||||
if(selectedItemText.equals(NONE_PROFILE)){
|
||||
metadataFieldsPanel.setVisible(false);
|
||||
//receivedBean.setChosenType(null);
|
||||
}else{
|
||||
//receivedBean.setChosenType(selectedItemText);
|
||||
addFields(selectedItemText, profiles);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// add handler on select
|
||||
metadataTypeListbox.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
|
||||
String selectedItemText = metadataTypeListbox.getSelectedItemText();
|
||||
metadataFieldsPanel.clear();
|
||||
if(selectedItemText.equals(NONE_PROFILE)){
|
||||
metadataFieldsPanel.setVisible(false);
|
||||
//receivedBean.setChosenType(null);
|
||||
}else{
|
||||
//receivedBean.setChosenType(selectedItemText);
|
||||
showLoadingProfileInformation(true);
|
||||
formThirdStep.setVisible(true);
|
||||
selectedProfile.setText("Selected Profile is " + metadataTypeListbox.getSelectedItemText());
|
||||
addFields(selectedItemText, profiles);
|
||||
showLoadingProfileInformation(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// // hide elements or show them if needed (groups in profiles cannot be present again in groups listbox)
|
||||
// if(groupsControlGroup.isVisible()){
|
||||
|
@ -422,7 +433,7 @@ public class CreateMetadataForm extends Composite{
|
|||
*
|
||||
* @param e the e
|
||||
*/
|
||||
@UiHandler("continueButton")
|
||||
/*@UiHandler("continueButton")
|
||||
void onContinueButton(ClickEvent e){
|
||||
|
||||
// validate data
|
||||
|
@ -442,7 +453,7 @@ public class CreateMetadataForm extends Composite{
|
|||
else
|
||||
selectedProfile.setText("Selected Type is " + metadataTypeListbox.getSelectedItemText());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* After onContinue ...
|
||||
|
@ -482,22 +493,22 @@ public class CreateMetadataForm extends Composite{
|
|||
*
|
||||
* @param e the e
|
||||
*/
|
||||
@UiHandler("goBackButtonSecondStep")
|
||||
void onGoBackButton(ClickEvent e){
|
||||
|
||||
Window.alert("Called onGoBackButton");
|
||||
|
||||
// // swap forms
|
||||
// if(isWorkspaceRequest){
|
||||
// formFirstStep.setVisible(hideManageResources());
|
||||
// formSecondStep.setVisible(!hideManageResources());
|
||||
// }else{
|
||||
// formFirstStep.setVisible(true);
|
||||
// formSecondStep.setVisible(false);
|
||||
// }
|
||||
// formThirdStep.setVisible(false);
|
||||
|
||||
}
|
||||
// @UiHandler("goBackButtonSecondStep")
|
||||
// void onGoBackButton(ClickEvent e){
|
||||
//
|
||||
// Window.alert("Called onGoBackButton");
|
||||
//
|
||||
//// // swap forms
|
||||
//// if(isWorkspaceRequest){
|
||||
//// formFirstStep.setVisible(hideManageResources());
|
||||
//// formSecondStep.setVisible(!hideManageResources());
|
||||
//// }else{
|
||||
//// formFirstStep.setVisible(true);
|
||||
//// formSecondStep.setVisible(false);
|
||||
//// }
|
||||
//// formThirdStep.setVisible(false);
|
||||
//
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * On continue third step.
|
||||
|
@ -531,7 +542,7 @@ public class CreateMetadataForm extends Composite{
|
|||
}
|
||||
else{
|
||||
|
||||
Set<String> tags = new HashSet<String>(tagsPanel.getTags());
|
||||
//Set<String> tags = new HashSet<String>(tagsPanel.getTags());
|
||||
List<OrganizationBean> groups = new ArrayList<OrganizationBean>();
|
||||
List<OrganizationBean> groupsToForceCreation = new ArrayList<OrganizationBean>();
|
||||
Map<String, List<String>> customFieldsMap = new HashMap<String, List<String>>();
|
||||
|
@ -554,9 +565,9 @@ public class CreateMetadataForm extends Composite{
|
|||
customFieldsMap.put(key, valuesForThisField);
|
||||
|
||||
// get also tag/group if it is the case for this field
|
||||
List<String> tagsField = field.getTagFromThisField();
|
||||
if(tagsField != null)
|
||||
tags.addAll(tagsField);
|
||||
// List<String> tagsField = field.getTagFromThisField();
|
||||
// if(tagsField != null)
|
||||
// tags.addAll(tagsField);
|
||||
|
||||
List<String> groupsTitle = field.getGroupTitleFromThisGroup();
|
||||
if(groupsTitle != null){
|
||||
|
@ -601,7 +612,7 @@ public class CreateMetadataForm extends Composite{
|
|||
private void prepareInfoIcons() {
|
||||
|
||||
// tags
|
||||
tagsPanel.prepareIcon(popupOpenedIds);
|
||||
//tagsPanel.prepareIcon(popupOpenedIds);
|
||||
|
||||
|
||||
// profiles (or types)
|
||||
|
@ -662,8 +673,8 @@ public class CreateMetadataForm extends Composite{
|
|||
onContinueAlertBlock.setText(text);
|
||||
onContinueAlertBlock.setType(type);
|
||||
onContinueAlertBlock.setVisible(true);
|
||||
continueButton.setEnabled(true);
|
||||
resetButton.setEnabled(true);
|
||||
// continueButton.setEnabled(true);
|
||||
// resetButton.setEnabled(true);
|
||||
|
||||
// hide after some seconds
|
||||
Timer t = new Timer() {
|
||||
|
@ -718,65 +729,6 @@ public class CreateMetadataForm extends Composite{
|
|||
*/
|
||||
private String validateDataOnContinue() {
|
||||
|
||||
// // remove errors
|
||||
// productTitleGroup.setType(ControlGroupType.NONE);
|
||||
// maintainerControlGroup.setType(ControlGroupType.NONE);
|
||||
// versionControlGroup.setType(ControlGroupType.NONE);
|
||||
// metadataTypesControlGroup.setType(ControlGroupType.NONE);
|
||||
// organizationsGroup.setType(ControlGroupType.NONE);
|
||||
// tagsPanel.setGroupPanelType(ControlGroupType.NONE);
|
||||
//
|
||||
// String title = titleTextBox.getText().trim();
|
||||
// if(title.isEmpty()){
|
||||
// productTitleGroup.setType(ControlGroupType.ERROR);
|
||||
// return "Missing title";
|
||||
// }
|
||||
//
|
||||
// // better check for the title
|
||||
// String[] splittedTitle = title.split(" ");
|
||||
//
|
||||
// for (String word : splittedTitle) {
|
||||
// String replaced = word.replaceAll(REGEX_TITLE_PRODUCT_SUBWORD, "");
|
||||
// if(!replaced.equals(word)){
|
||||
// productTitleGroup.setType(ControlGroupType.ERROR);
|
||||
// return "Please note not all characters are allowed for the title";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // email reg expression
|
||||
// String maintainerMail = maintainerEmailTextbox.getText();
|
||||
// if(!maintainerMail.isEmpty() && !maintainerMail.matches(REGEX_MAIL)){
|
||||
// maintainerControlGroup.setType(ControlGroupType.ERROR);
|
||||
// return "Not valid maintainer email";
|
||||
// }
|
||||
//
|
||||
// // check if version is a number
|
||||
// try{
|
||||
// int number = Integer.valueOf(versionTextbox.getText().trim());
|
||||
// if(number <= 0)
|
||||
// throw new Exception();
|
||||
// }catch(Exception e){
|
||||
// versionControlGroup.setType(ControlGroupType.ERROR);
|
||||
// return "Version must be a natural number greater than zero";
|
||||
// }
|
||||
//
|
||||
// // check if metadata profile is different from none and its mandatory fields have been fulfilled
|
||||
// if(checkSelectedMetaDataProfile()){
|
||||
// metadataTypesControlGroup.setType(ControlGroupType.ERROR);
|
||||
// return "You must select a Type different frome none";
|
||||
// }
|
||||
//
|
||||
// if(organizationsListbox.getSelectedItemText() == null){
|
||||
// organizationsGroup.setType(ControlGroupType.ERROR);
|
||||
// return "You must select an organization in which you want to publish";
|
||||
// }
|
||||
//
|
||||
// // at least one tag..
|
||||
// if(tagsPanel.getTags().isEmpty()){
|
||||
// tagsPanel.setGroupPanelType(ControlGroupType.ERROR);
|
||||
// return "Please add at least one meaningful tag for the item";
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -794,7 +746,7 @@ public class CreateMetadataForm extends Composite{
|
|||
*
|
||||
* @param e the e
|
||||
*/
|
||||
@UiHandler("resetButton")
|
||||
/*@UiHandler("resetButton")
|
||||
void resetFormEvent(ClickEvent e){
|
||||
|
||||
// delete custom fields
|
||||
|
@ -802,14 +754,14 @@ public class CreateMetadataForm extends Composite{
|
|||
customField.removeFromParent();
|
||||
}
|
||||
customFieldEntriesList.clear();
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Disable dataset editable fields once the dataset has been successfully created.
|
||||
*/
|
||||
protected void disableDatasetFields() {
|
||||
|
||||
tagsPanel.freeze();
|
||||
//tagsPanel.freeze();
|
||||
addCustomFieldButton.setEnabled(false);
|
||||
metadataTypeListbox.setEnabled(false);
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||
xmlns:m="urn:import:org.gcube.portlets.widgets.mpformbuilder.client.ui.tags">
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||
xmlns:m="urn:import:org.gcube.portlets.widgets.mpformbuilder.client.ui.tags"
|
||||
xmlns:f="urn:import:org.gcube.portlets.widgets.mpformbuilder.client.ui.upload"
|
||||
xmlns:u="urn:import:org.gcube.portlets.widgets.mpformbuilder.client.ui.utils">
|
||||
<ui:style>
|
||||
.form-main-style {
|
||||
margin-left: 10px;
|
||||
|
@ -45,215 +48,33 @@
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.the-margin-left{
|
||||
.the-margin-left {
|
||||
margin-left: 5px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="createDatasetMainPanel">
|
||||
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
|
||||
ui:field="formFirstStep" visible="true">
|
||||
<b:Fieldset styleName="{style.fieldset-border-style}">
|
||||
|
||||
<u:LoaderIcon ui:field="loaderProfiles" visible="false"></u:LoaderIcon>
|
||||
|
||||
<b:Fieldset styleName="{style.fieldset-border-style}">
|
||||
<b:Legend styleName="{style.legend-style}">
|
||||
Insert Item Information
|
||||
<small>
|
||||
<span style="color:red;">*</span>
|
||||
is required
|
||||
</small>
|
||||
Choose a Profile
|
||||
<!-- <small> -->
|
||||
<!-- <span style="color:red;">*</span> -->
|
||||
<!-- is required -->
|
||||
<!-- </small> -->
|
||||
</b:Legend>
|
||||
|
||||
<!-- Alert blocks for info/errors -->
|
||||
<b:AlertBlock type="INFO" close="false" animation="true"
|
||||
visible="false" ui:field="infoBlock" styleName="{style.block-alert-style}"></b:AlertBlock>
|
||||
|
||||
<!-- <b:ControlGroup ui:field="productTitleGroup"> -->
|
||||
<!-- <b:ControlLabel for="title" title="Item title"> -->
|
||||
<!-- <font color="red">*</font> -->
|
||||
<!-- Title : -->
|
||||
<!-- </b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:TextBox alternateSize="LARGE" placeholder="Item title" -->
|
||||
<!-- width="90%" b:id="title" title="Item title" ui:field="titleTextBox" /> -->
|
||||
<!-- <span style="float:right; width:5%; color: #aaaaaa;"> -->
|
||||
<!-- <b:Popover ui:field="popoverTitle" html="true" -->
|
||||
<!-- animation="true" placement="LEFT"> -->
|
||||
<!-- <g:FocusPanel ui:field="focusPanelTitle"> -->
|
||||
<!-- <b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconTitle" /> -->
|
||||
<!-- </g:FocusPanel> -->
|
||||
<!-- </b:Popover> -->
|
||||
<!-- </span> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
|
||||
<!-- <b:ControlGroup> -->
|
||||
<!-- <b:ControlLabel for="description" title="Item description"> -->
|
||||
<!-- Description: -->
|
||||
<!-- </b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:TextArea placeholder="eg. Some useful notes about the item" -->
|
||||
<!-- width="90%" alternateSize="LARGE" b:id="description" title="Item description" -->
|
||||
<!-- ui:field="descriptionTextarea"></b:TextArea> -->
|
||||
<!-- <span style="float:right; width:5%; color: #aaaaaa;"> -->
|
||||
<!-- <b:Popover ui:field="popoverDescription" html="true" -->
|
||||
<!-- animation="true" placement="LEFT"> -->
|
||||
<!-- <g:FocusPanel ui:field="focusPanelDescription"> -->
|
||||
<!-- <b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconDescription" /> -->
|
||||
<!-- </g:FocusPanel> -->
|
||||
<!-- </b:Popover> -->
|
||||
<!-- </span> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
|
||||
<!-- <b:ControlGroup> -->
|
||||
<!-- <b:ControlLabel for="licenses" title="License">License:</b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:ListBox b:id="licenses" title="Item license" -->
|
||||
<!-- width="91%" ui:field="licenseListbox"> -->
|
||||
<!-- </b:ListBox> -->
|
||||
<!-- <span style="float:right; width:5%; color: #aaaaaa;"> -->
|
||||
<!-- <b:Popover ui:field="popoverLicenses" html="true" -->
|
||||
<!-- animation="true" placement="LEFT"> -->
|
||||
<!-- <g:FocusPanel ui:field="focusPanelLicenses"> -->
|
||||
<!-- <b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconLicenses" /> -->
|
||||
<!-- </g:FocusPanel> -->
|
||||
<!-- </b:Popover> -->
|
||||
<!-- </span> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
|
||||
<!-- <b:ControlGroup> -->
|
||||
<!-- <b:ControlLabel for="licenseUrl" title="Selected License'url">Selected -->
|
||||
<!-- License Url:</b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:Paragraph ui:field="unavailableUrl" visible="true"> -->
|
||||
<!-- <b>Unavailable</b> -->
|
||||
<!-- </b:Paragraph> -->
|
||||
<!-- <g:Anchor ui:field="licenseUrlAnchor" target="_blank" -->
|
||||
<!-- visible="false"></g:Anchor> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
|
||||
<!-- <b:ControlGroup> -->
|
||||
<!-- <b:ControlLabel for="visibility" title="Visibility of the item">Visibility:</b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:ListBox b:id="visibility" title="Item visibility" -->
|
||||
<!-- width="91%" ui:field="visibilityListbox"> -->
|
||||
<!-- <g:item title="restricted">Restricted</g:item> -->
|
||||
<!-- <g:item enabled="true" title="public">Public</g:item> -->
|
||||
<!-- </b:ListBox> -->
|
||||
<!-- <span style="float:right; width:5%; color: #aaaaaa;"> -->
|
||||
<!-- <b:Popover ui:field="popoverVisibility" html="true" -->
|
||||
<!-- animation="true" placement="LEFT"> -->
|
||||
<!-- <g:FocusPanel ui:field="focusPanelVisibility"> -->
|
||||
<!-- <b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconVisibility" /> -->
|
||||
<!-- </g:FocusPanel> -->
|
||||
<!-- </b:Popover> -->
|
||||
<!-- </span> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
|
||||
<!-- <b:ControlGroup ui:field="organizationsGroup"> -->
|
||||
<!-- <b:ControlLabel for="organization" -->
|
||||
<!-- title="Select the organizations in which you want -->
|
||||
<!-- to publish the item">Publish in:</b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:ListBox b:id="organization" alternateSize="LARGE" -->
|
||||
<!-- width="91%" title="Publish in this organization" ui:field="organizationsListbox"> -->
|
||||
<!-- </b:ListBox> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
|
||||
<!-- <b:ControlGroup ui:field="versionControlGroup"> -->
|
||||
<!-- <b:ControlLabel for="version" -->
|
||||
<!-- title="Item version expressed as positive integer number"> -->
|
||||
<!-- Version: -->
|
||||
<!-- </b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:TextBox alternateSize="LARGE" placeholder="1.0" b:id="version" -->
|
||||
<!-- width="90%" title="Item version" ui:field="versionTextbox" /> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
|
||||
<!-- <b:ControlGroup> -->
|
||||
<!-- <b:ControlLabel for="author" title="Item author"> -->
|
||||
<!-- <font color="red">*</font> -->
|
||||
<!-- Author: -->
|
||||
<!-- </b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:TextBox alternateSize="LARGE" width="90%" -->
|
||||
<!-- placeholder="Joe Bloggs" enabled="false" b:id="author" title="Item author" -->
|
||||
<!-- ui:field="authorTextbox" /> -->
|
||||
<!-- <span style="float:right; width:5%; color: #aaaaaa;"> -->
|
||||
<!-- <b:Popover ui:field="popoverAuthor" html="true" -->
|
||||
<!-- animation="true" placement="LEFT"> -->
|
||||
<!-- <g:FocusPanel ui:field="focusPanelAuthor"> -->
|
||||
<!-- <b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconAuthor" /> -->
|
||||
<!-- </g:FocusPanel> -->
|
||||
<!-- </b:Popover> -->
|
||||
<!-- </span> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
|
||||
<!-- <b:ControlGroup ui:field="authorEmailControlGroup"> -->
|
||||
<!-- <b:ControlLabel for="email" title="Item author's email"> -->
|
||||
<!-- <font color="red">*</font> -->
|
||||
<!-- Author Email: -->
|
||||
<!-- </b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:TextBox alternateSize="LARGE" width="90%" -->
|
||||
<!-- placeholder="joe.bloggs@example.com" enabled="false" b:id="email" -->
|
||||
<!-- title="Item author" ui:field="authorEmailTextbox" /> -->
|
||||
<!-- <span style="float:right; width:5%; color: #aaaaaa;"> -->
|
||||
<!-- <b:Popover ui:field="popoverAuthorEmail" html="true" -->
|
||||
<!-- animation="true" placement="LEFT"> -->
|
||||
<!-- <g:FocusPanel ui:field="focusPanelAuthorEmail"> -->
|
||||
<!-- <b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconAuthorEmail" /> -->
|
||||
<!-- </g:FocusPanel> -->
|
||||
<!-- </b:Popover> -->
|
||||
<!-- </span> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
|
||||
<!-- <b:ControlGroup> -->
|
||||
<!-- <b:ControlLabel for="maintainer" title="Item maintainer"> -->
|
||||
<!-- Maintainer: -->
|
||||
<!-- </b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:TextBox alternateSize="LARGE" placeholder="Joe Bloggs" -->
|
||||
<!-- width="90%" b:id="maintainer" title="Item maintainer" -->
|
||||
<!-- ui:field="maintainerTextbox" /> -->
|
||||
<!-- <span style="float:right; width:5%; color: #aaaaaa;"> -->
|
||||
<!-- <b:Popover ui:field="popoverMaintainer" html="true" -->
|
||||
<!-- animation="true" placement="LEFT"> -->
|
||||
<!-- <g:FocusPanel ui:field="focusPanelMaintainer"> -->
|
||||
<!-- <b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconMaintainer" /> -->
|
||||
<!-- </g:FocusPanel> -->
|
||||
<!-- </b:Popover> -->
|
||||
<!-- </span> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
|
||||
<!-- <b:ControlGroup ui:field="maintainerControlGroup"> -->
|
||||
<!-- <b:ControlLabel for="emailMaintaner" title="Item author's email"> -->
|
||||
<!-- Maintainer Email: -->
|
||||
<!-- </b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:TextBox alternateSize="LARGE" placeholder="maintainer@example.com" -->
|
||||
<!-- width="90%" b:id="emailMaintaner" title="Item author" -->
|
||||
<!-- ui:field="maintainerEmailTextbox" /> -->
|
||||
<!-- <span style="float:right; width:5%; color: #aaaaaa;"> -->
|
||||
<!-- <b:Popover ui:field="popoverMaintainerEmail" html="true" -->
|
||||
<!-- animation="true" placement="LEFT"> -->
|
||||
<!-- <g:FocusPanel ui:field="focusPanelMaintainerEmail"> -->
|
||||
<!-- <b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconMaintainerEmail" /> -->
|
||||
<!-- </g:FocusPanel> -->
|
||||
<!-- </b:Popover> -->
|
||||
<!-- </span> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
<b:AlertBlock type="INFO" close="false"
|
||||
animation="true" visible="false" ui:field="infoBlock"
|
||||
styleName="{style.block-alert-style}"></b:AlertBlock>
|
||||
|
||||
<b:ControlGroup ui:field="metadataTypesControlGroup">
|
||||
<b:ControlLabel for="metadataTypes" title="Item profile types">Types:</b:ControlLabel>
|
||||
<b:ControlLabel for="metadataTypes"
|
||||
title="Item profile types">Profiles:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:ListBox b:id="metadataTypes" alternateSize="LARGE"
|
||||
width="91%" title="The item type to be used"
|
||||
|
@ -264,87 +85,33 @@
|
|||
<b:Popover ui:field="popoverTypes" html="true"
|
||||
animation="true" placement="LEFT">
|
||||
<g:FocusPanel ui:field="focusPanelTypes">
|
||||
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconTypes" />
|
||||
<b:Icon type="INFO_SIGN" size="TWO_TIMES"
|
||||
ui:field="infoIconTypes" />
|
||||
</g:FocusPanel>
|
||||
</b:Popover>
|
||||
</span>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
|
||||
<!-- TAGS Panel -->
|
||||
<m:TagsPanel ui:field="tagsPanel"></m:TagsPanel>
|
||||
<!-- <m:TagsPanel ui:field="tagsPanel"></m:TagsPanel> -->
|
||||
|
||||
<!-- <b:ControlGroup ui:field="groupsControlGroup" -->
|
||||
<!-- visible="false"> -->
|
||||
<!-- <b:ControlLabel for="groups" title="The groups for this item">Item Groups:</b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:ListBox b:id="groups" alternateSize="LARGE" width="91%" -->
|
||||
<!-- multipleSelect="true" -->
|
||||
<!-- title="The groups for this item (Hold CTRL or Command button for multiple selection)" -->
|
||||
<!-- ui:field="groupsListbox"> -->
|
||||
<!-- </b:ListBox> -->
|
||||
<!-- <span style="float:right; width:5%; color: #aaaaaa;"> -->
|
||||
<!-- <b:Popover ui:field="popoverGroups" html="true" -->
|
||||
<!-- animation="true" placement="LEFT"> -->
|
||||
<!-- <g:FocusPanel ui:field="focusPanelGroups"> -->
|
||||
<!-- <b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconGroups" /> -->
|
||||
<!-- </g:FocusPanel> -->
|
||||
<!-- </b:Popover> -->
|
||||
<!-- </span> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
<f:FileUpload ui:field="dialogUpload"></f:FileUpload>
|
||||
|
||||
<!-- Alert block on continue -->
|
||||
<!-- <b:AlertBlock animation="true" visible="false" -->
|
||||
<!-- ui:field="alertNoResources" -->
|
||||
<!-- text="Please note that the item you are going to publish will not have resources."> -->
|
||||
<!-- </b:AlertBlock> -->
|
||||
|
||||
<!-- Alert block on continue -->
|
||||
<b:AlertBlock type="INFO" close="false" animation="true"
|
||||
visible="false" ui:field="onContinueAlertBlock">
|
||||
<b:AlertBlock type="INFO" close="false"
|
||||
animation="true" visible="false" ui:field="onContinueAlertBlock">
|
||||
</b:AlertBlock>
|
||||
|
||||
<b:Button title="Continue" ui:field="continueButton" type="PRIMARY"
|
||||
block="true">Continue</b:Button>
|
||||
<b:Button title="Reset" ui:field="resetButton" block="true">Reset</b:Button>
|
||||
<!-- <b:Button title="Continue" ui:field="continueButton" type="PRIMARY" -->
|
||||
<!-- block="true">Continue</b:Button> -->
|
||||
<!-- <b:Button title="Reset" ui:field="resetButton" block="true">Reset</b:Button> -->
|
||||
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
|
||||
|
||||
<!-- <b:Form type="HORIZONTAL" styleName="{style.form-main-style}" -->
|
||||
<!-- ui:field="formSecondStep" visible="false"> -->
|
||||
<!-- <b:Fieldset styleName="{style.fieldset-border-style}"> -->
|
||||
<!-- <b:Legend styleName="{style.legend-style}"> -->
|
||||
<!-- Manage Resources -->
|
||||
<!-- </b:Legend> -->
|
||||
<!-- <b:ControlGroup> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <span style="float:right; width:5%; color: #aaaaaa;"> -->
|
||||
<!-- <b:Popover ui:field="popoverResources" html="true" -->
|
||||
<!-- animation="true" placement="LEFT"> -->
|
||||
<!-- <g:FocusPanel ui:field="focusPanelResources"> -->
|
||||
<!-- <b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconResources" /> -->
|
||||
<!-- </g:FocusPanel> -->
|
||||
<!-- </b:Popover> -->
|
||||
<!-- </span> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
|
||||
<!-- <g:SimplePanel ui:field="workspaceResourcesContainer" -->
|
||||
<!-- width="100%" visible="true"> -->
|
||||
<!-- </g:SimplePanel> -->
|
||||
|
||||
<!-- <b:Button title="Continue" ui:field="continueThirdStep" -->
|
||||
<!-- type="PRIMARY" block="true">Continue</b:Button> -->
|
||||
|
||||
<!-- <b:Button title="Go Back" ui:field="goBackButtonFirstStep" -->
|
||||
<!-- block="true">Go -->
|
||||
<!-- Back</b:Button> -->
|
||||
<!-- </b:Fieldset> -->
|
||||
<!-- </b:Form> -->
|
||||
|
||||
<u:LoaderIcon ui:field="loaderProfileInformation"
|
||||
visible="false"></u:LoaderIcon>
|
||||
|
||||
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
|
||||
ui:field="formThirdStep" visible="false">
|
||||
|
@ -357,7 +124,8 @@
|
|||
</small>
|
||||
</b:Legend>
|
||||
|
||||
<b:Paragraph ui:field="selectedProfile" styleName="{style.selected-profile}"></b:Paragraph>
|
||||
<b:Paragraph ui:field="selectedProfile"
|
||||
styleName="{style.selected-profile}"></b:Paragraph>
|
||||
|
||||
<!-- Here will be placed the metadata fields formats -->
|
||||
<g:VerticalPanel ui:field="metadataFieldsPanel"
|
||||
|
@ -374,7 +142,8 @@
|
|||
<b:Popover ui:field="popoverCustomFields" html="true"
|
||||
animation="true" placement="LEFT">
|
||||
<g:FocusPanel ui:field="focusPanelCustomFields">
|
||||
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconCustomFields" />
|
||||
<b:Icon type="INFO_SIGN" size="TWO_TIMES"
|
||||
ui:field="infoIconCustomFields" />
|
||||
</g:FocusPanel>
|
||||
</b:Popover>
|
||||
</span>
|
||||
|
@ -384,25 +153,27 @@
|
|||
</b:ControlGroup>
|
||||
|
||||
<!-- Alert block on create -->
|
||||
<b:AlertBlock type="INFO" close="false" animation="true"
|
||||
visible="false" ui:field="onCreateAlertBlock" styleName="{style.block-alert-style}">
|
||||
<b:AlertBlock type="INFO" close="false"
|
||||
animation="true" visible="false" ui:field="onCreateAlertBlock"
|
||||
styleName="{style.block-alert-style}">
|
||||
</b:AlertBlock>
|
||||
|
||||
<g:HorizontalPanel ui:field="goToDatasetButtonPanel" visible="false">
|
||||
<g:Label>Go to the Item</g:Label>
|
||||
<b:Button title="Go to the Item" ui:field="goToDatasetButton"
|
||||
type="LINK" visible="false" styleName="{style.the-margin-left}"></b:Button>
|
||||
</g:HorizontalPanel>
|
||||
<!-- <g:HorizontalPanel ui:field="goToDatasetButtonPanel" visible="false"> -->
|
||||
<!-- <g:Label>Go to the Item</g:Label> -->
|
||||
<!-- <b:Button title="Go to the Item" ui:field="goToDatasetButton" -->
|
||||
<!-- type="LINK" visible="false" styleName="{style.the-margin-left}"></b:Button> -->
|
||||
<!-- </g:HorizontalPanel> -->
|
||||
|
||||
<b:Button title="Add resources to the just created item"
|
||||
block="true" type="PRIMARY" visible="false" ui:field="addResourcesButton">Add Resources</b:Button>
|
||||
<!-- <b:Button title="Add resources to the just created item" -->
|
||||
<!-- block="true" type="PRIMARY" visible="false" ui:field="addResourcesButton">Add
|
||||
Resources</b:Button> -->
|
||||
|
||||
<b:Button title="Create Item" ui:field="createButton"
|
||||
type="PRIMARY" block="true">Create</b:Button>
|
||||
|
||||
<b:Button title="Go Back" ui:field="goBackButtonSecondStep"
|
||||
block="true">Go
|
||||
Back</b:Button>
|
||||
<!-- <b:Button title="Go Back" ui:field="goBackButtonSecondStep" -->
|
||||
<!-- block="true">Go -->
|
||||
<!-- Back</b:Button> -->
|
||||
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
|
|
|
@ -1,13 +1,21 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.client.ui.icons;
|
||||
|
||||
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
||||
public interface Images extends ClientBundle {
|
||||
|
||||
public static final Images ICONS = GWT.create(Images.class);
|
||||
|
||||
@Source("file.png")
|
||||
ImageResource fileIcon();
|
||||
|
||||
@Source("folder.png")
|
||||
ImageResource folderIcon();
|
||||
|
||||
@Source("loading.gif")
|
||||
ImageResource loading();
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
|
@ -0,0 +1,334 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.client.ui.upload;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portal.clientcontext.client.GCubeClientContext;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.WorkspaceUploadNotification.HasWorskpaceUploadNotificationListener;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.WorkspaceUploadNotification.WorskpaceUploadNotificationListener;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.HandlerResultMessage;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
import com.google.gwt.user.client.ui.FileUpload;
|
||||
import com.google.gwt.user.client.ui.FormPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
||||
import com.google.gwt.user.client.ui.Hidden;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
|
||||
|
||||
/**
|
||||
* The Class DialogUploadStream.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Sep 24, 2015
|
||||
*/
|
||||
public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotificationListener{
|
||||
|
||||
//protected final FormPanel formPanel = new FormPanel();
|
||||
protected FileUpload fileUpload;
|
||||
protected Hidden jsonClientKeys;
|
||||
protected List<WorkspaceUploaderItem> fakeUploaders = new ArrayList<WorkspaceUploaderItem>();
|
||||
protected WorkspaceUploaderListenerController controller = new WorkspaceUploaderListenerController();
|
||||
|
||||
/**
|
||||
* The Enum UPLOAD_TYPE.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Sep 11, 2015
|
||||
*/
|
||||
private HTML LOADING = new HTML("Upload starting...");
|
||||
|
||||
protected String parentIdentifier = "";
|
||||
protected VerticalPanel panel;
|
||||
private HorizontalPanel hpBottom;
|
||||
// private MonitorPanel monitorPanel;
|
||||
protected String clientUploadKey;
|
||||
private Anchor anchorMyUploads;
|
||||
|
||||
/**
|
||||
* Instantiates a new dialog upload stream.
|
||||
*
|
||||
* @param headerTitle the header title
|
||||
* @param parentId the parent id
|
||||
* @param uploadType the upload type
|
||||
*/
|
||||
public DialogUpload(){
|
||||
//setWidth("400px");
|
||||
fileUpload = new FileUpload();
|
||||
//fileUpload.getElement().setAttribute("multiple", "multiple");
|
||||
this.addStyleName("fileInputUploader");
|
||||
setAction(ConstantsMPFormBuilder.WORKSPACE_UPLOADER_SERVLET_STREAM__MODIFIED);
|
||||
setEncoding(FormPanel.ENCODING_MULTIPART);
|
||||
setMethod(FormPanel.METHOD_POST);
|
||||
setWidth("auto");
|
||||
|
||||
// Create a panel to hold all of the form widgets.
|
||||
panel = new VerticalPanel();
|
||||
setWidget(panel);
|
||||
|
||||
fileUpload.setName(ConstantsMPFormBuilder.UPLOAD_FORM_ELEMENT);
|
||||
|
||||
// Add hidden parameters
|
||||
panel.add(new Hidden(ConstantsMPFormBuilder.CURR_GROUP_ID, GCubeClientContext.getCurrentContextId()));
|
||||
|
||||
initJsonClientKeys();
|
||||
panel.add(jsonClientKeys);
|
||||
panel.add(fileUpload);
|
||||
|
||||
HorizontalPanel hp = new HorizontalPanel();
|
||||
// hp.getElement().setId("hpID");
|
||||
hp.getElement().getStyle().setWidth(100, Unit.PCT);
|
||||
hp.getElement().getStyle().setMarginTop(5, Unit.PX);
|
||||
hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
|
||||
hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
|
||||
|
||||
panel.add(hp);
|
||||
|
||||
// hpBottom = new HorizontalPanel();
|
||||
// hpBottom.setWidth("100%");
|
||||
//// hpBottom.getElement().getStyle().setMarginTop(5, Unit.PX);
|
||||
// hpBottom.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
|
||||
//
|
||||
// //if(uploadType.equals(UPLOAD_TYPE.File)){
|
||||
//// HTML msg = new HTML("<p>To select multiple files, press and hold down the Ctrl key, and then</p><p style='margin:-3px 0;'>click each item that you want to select</p>");
|
||||
//// msg.getElement().getStyle().setFontSize(10, Unit.PX);
|
||||
//// hpBottom.add(msg);
|
||||
// //}
|
||||
//
|
||||
// HorizontalPanel hp2 = new HorizontalPanel();
|
||||
// hp2.getElement().getStyle().setMarginTop(5, Unit.PX);
|
||||
//// hp2.getElement().getStyle().setWidth(100, Unit.PCT);
|
||||
// hp2.addStyleName("align-right-close");
|
||||
//
|
||||
// hpBottom.add(hp2);
|
||||
// panel.add(hpBottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the panel
|
||||
*/
|
||||
public VerticalPanel getPanel() {
|
||||
return panel;
|
||||
}
|
||||
|
||||
protected void initJsonClientKeys(){
|
||||
jsonClientKeys = new Hidden(ConstantsMPFormBuilder.CLIENT_UPLOAD_KEYS,"");
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind events.
|
||||
*/
|
||||
public void bindEvents(){
|
||||
this.addHandlers();
|
||||
// this.addListeners();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the handlers.
|
||||
*/
|
||||
protected void addHandlers() {
|
||||
|
||||
// handle the post
|
||||
addSubmitCompleteHandler(new SubmitCompleteHandler() {
|
||||
|
||||
@Override
|
||||
public void onSubmitComplete(SubmitCompleteEvent event) {
|
||||
GWT.log("onSubmitComplete");
|
||||
// isStatusCompleted = true;
|
||||
String result = event.getResults();
|
||||
|
||||
if (result == null) {
|
||||
removeLoading();
|
||||
Window.alert("An error occurred during file upload");
|
||||
//new DialogResult(null, "Error during upload", "An error occurred during file upload.").center();
|
||||
return;
|
||||
}
|
||||
String strippedResult = new HTML(result).getText();
|
||||
final HandlerResultMessage resultMessage = HandlerResultMessage.parseResult(strippedResult);
|
||||
|
||||
switch (resultMessage.getStatus()) {
|
||||
case ERROR:
|
||||
removeLoading();
|
||||
GWT.log("Error during upload "+resultMessage.getMessage());
|
||||
break;
|
||||
case UNKNOWN:
|
||||
removeLoading();
|
||||
GWT.log("Error during upload "+resultMessage.getMessage());
|
||||
break;
|
||||
case WARN: {
|
||||
GWT.log("Upload completed with warnings "+resultMessage.getMessage());
|
||||
removeLoading();
|
||||
break;
|
||||
}
|
||||
case SESSION_EXPIRED:{
|
||||
GWT.log("Upload aborted due to session expired: "+ resultMessage.getMessage());
|
||||
Window.alert("Session expired, please reload the page");
|
||||
removeLoading();
|
||||
break;
|
||||
}
|
||||
case OK: {
|
||||
//// removeLoading();
|
||||
//// UploaderMonitor.getInstance().pollWorkspaceUploaderId(resultMessage.getMessage());
|
||||
//
|
||||
// Timer t = new Timer() {
|
||||
// public void run() {
|
||||
// GWT.log("Upload started with id: "+resultMessage.getMessage());
|
||||
// UploaderMonitor.getInstance().pollWorkspaceUploaderId(resultMessage.getMessage());
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// t.schedule(250);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//TODO NEVER USED, WE ARE USING MULTIPLE DIALOG UPLOAD
|
||||
addSubmitHandler(new SubmitHandler() {
|
||||
|
||||
@Override
|
||||
public void onSubmit(SubmitEvent event) {
|
||||
GWT.log("SubmitEvent");
|
||||
/*addLoading();
|
||||
enableButtons(false);
|
||||
WorkspaceUploaderItem fakeUploader = new WorkspaceUploaderItem();
|
||||
fakeUploader.setClientUploadKey(clientUploadKey);
|
||||
int queueIndex = UploaderMonitor.getInstance().newQueue();
|
||||
UploaderMonitor.getInstance().addNewUploaderToMonitorPanel(fakeUploader, fileUpload.getFilename());
|
||||
setVisible(false);
|
||||
removeLoading();
|
||||
UploaderMonitor.getInstance().addNewUploaderToQueue(queueIndex, fakeUploader);
|
||||
UploaderMonitor.getInstance().doStartPollingQueue(queueIndex);
|
||||
*/
|
||||
}
|
||||
});
|
||||
|
||||
fileUpload.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
|
||||
GWT.log("btnSubmit click");
|
||||
if (fileUpload.getFilename()==null || !(fileUpload.getFilename().length()>2)) {
|
||||
GWT.log("No file specified ");
|
||||
return;
|
||||
}
|
||||
|
||||
GWT.log("fileUpload.getFilename() "+fileUpload.getFilename());
|
||||
/*
|
||||
* TODO: recall: Some browser would write in fileUploadField.getValue() C:\fakepath\$fileName
|
||||
*/
|
||||
String normalizedFileName = fileUpload.getFilename();
|
||||
if (normalizedFileName.contains("\\")) {
|
||||
normalizedFileName = normalizedFileName.substring(normalizedFileName.lastIndexOf("\\")+1); //remove C:\fakepath\ if exists
|
||||
}
|
||||
|
||||
final String label = normalizedFileName;
|
||||
submitForm();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the loading.
|
||||
*/
|
||||
protected void addLoading(){
|
||||
panel.add(LOADING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the loading.
|
||||
*/
|
||||
protected void removeLoading(){
|
||||
try{
|
||||
panel.remove(LOADING);
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable buttons.
|
||||
*
|
||||
* @param bool the bool
|
||||
*/
|
||||
protected void enableButtons(boolean bool){
|
||||
// btnUpload.setEnabled(bool);
|
||||
// btnCancel.setEnabled(bool);
|
||||
// upload.setEnabled(bool);
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit form.
|
||||
*/
|
||||
public void submitForm(){
|
||||
submit();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the item and submit form.
|
||||
*
|
||||
* @param itemId the item id
|
||||
*/
|
||||
protected void removeItemAndSubmitForm(String itemId){
|
||||
/*
|
||||
AppControllerExplorer.rpcWorkspaceService.removeItem(itemId, new AsyncCallback<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Info.display("Error", caught.getMessage());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
if(result){
|
||||
hiddenOverwrite.setValue("true");
|
||||
submitForm();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Update item submit form.
|
||||
*
|
||||
* @param itemId the item id
|
||||
*/
|
||||
protected void updateItemSubmitForm(String itemId){
|
||||
//hiddenOverwrite.setValue("true");
|
||||
submitForm();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.HasWorskpaceUploadNotificationListener#addWorkspaceUploadNotificationListener(org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.WorskpaceUploadNotificationListener)
|
||||
*/
|
||||
@Override
|
||||
public void addWorkspaceUploadNotificationListener(WorskpaceUploadNotificationListener handler) {
|
||||
controller.addWorkspaceUploadListener(handler);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.HasWorskpaceUploadNotificationListener#removeWorkspaceUploadNotificationListener(org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.WorskpaceUploadNotificationListener)
|
||||
*/
|
||||
@Override
|
||||
public void removeWorkspaceUploadNotificationListener(WorskpaceUploadNotificationListener handler) {
|
||||
controller.removeWorkspaceUploadListener(handler);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.client.ui.upload;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class FileUpload extends Composite {
|
||||
|
||||
private static FileUploadUiBinder uiBinder = GWT.create(FileUploadUiBinder.class);
|
||||
|
||||
interface FileUploadUiBinder extends UiBinder<Widget, FileUpload> {
|
||||
}
|
||||
|
||||
@UiField HTMLPanel fileUploadPanel;
|
||||
|
||||
public FileUpload() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
fileUploadPanel.add(new DialogUpload());
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||
<ui:style>
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="fileUploadPanel">
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.mpformbuilder.client.ui.upload;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Aug 6, 2015
|
||||
*/
|
||||
public class GenerateUUID {
|
||||
private static final char[] CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".toCharArray();
|
||||
|
||||
/**
|
||||
* Generate a random uuid of the specified length. Example: uuid(15) returns
|
||||
* "VcydxgltxrVZSTV"
|
||||
*
|
||||
* @param len
|
||||
* the desired number of characters
|
||||
*/
|
||||
public static String get(int len) {
|
||||
return get(len, CHARS.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a random uuid of the specified length, and radix. Examples:
|
||||
* <ul>
|
||||
* <li>uuid(8, 2) returns "01001010" (8 character ID, base=2)
|
||||
* <li>uuid(8, 10) returns "47473046" (8 character ID, base=10)
|
||||
* <li>uuid(8, 16) returns "098F4D35" (8 character ID, base=16)
|
||||
* </ul>
|
||||
*
|
||||
* @param len
|
||||
* the desired number of characters
|
||||
* @param radix
|
||||
* the number of allowable values for each character (must be <=
|
||||
* 62)
|
||||
*/
|
||||
public static String get(int len, int radix) {
|
||||
if (radix > CHARS.length) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
char[] uuid = new char[len];
|
||||
// Compact form
|
||||
for (int i = 0; i < len; i++) {
|
||||
uuid[i] = CHARS[(int) (Math.random() * radix)];
|
||||
}
|
||||
return new String(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a RFC4122, version 4 ID. Example:
|
||||
* "92329D39-6F5C-4520-ABFC-AAB64544E172"
|
||||
*/
|
||||
public static String get() {
|
||||
char[] uuid = new char[36];
|
||||
int r;
|
||||
|
||||
// rfc4122 requires these characters
|
||||
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
|
||||
uuid[14] = '4';
|
||||
|
||||
// Fill in random data. At i==19 set the high bits of clock sequence as
|
||||
// per rfc4122, sec. 4.1.5
|
||||
for (int i = 0; i < 36; i++) {
|
||||
if (uuid[i] == 0) {
|
||||
r = (int) (Math.random() * 16);
|
||||
uuid[i] = CHARS[(i == 19) ? (r & 0x3) | 0x8 : r & 0xf];
|
||||
}
|
||||
}
|
||||
return new String(uuid);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,370 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.mpformbuilder.client.ui.upload;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.HandlerResultMessage;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploadFile;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem.UPLOAD_STATUS;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.json.client.JSONArray;
|
||||
import com.google.gwt.json.client.JSONObject;
|
||||
import com.google.gwt.json.client.JSONString;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
|
||||
/**
|
||||
* The Class MultipleDilaogUploadStream.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Oct 2, 2015
|
||||
*/
|
||||
public class MultipleDilaogUpload extends DialogUpload {
|
||||
|
||||
public static final String FILE_DELEMITER = ";";
|
||||
private String fileUploadID;
|
||||
//private MultipleDNDUpload dnd;
|
||||
public MultipleDilaogUpload instance = this;
|
||||
private String jsonKeys;
|
||||
|
||||
private String idFolder;
|
||||
|
||||
/**
|
||||
* Instantiates a new multiple dilaog upload stream.
|
||||
*
|
||||
* @param headerTitle
|
||||
* the header title
|
||||
* @param parentId
|
||||
* the parent id
|
||||
* @param uploadType
|
||||
* the upload type
|
||||
*/
|
||||
public MultipleDilaogUpload() {
|
||||
fileUploadID = GenerateUUID.get(10, 16); // is tagID
|
||||
fileUpload.getElement().setId(fileUploadID);
|
||||
this.addHandlers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate new upload client keys.
|
||||
*
|
||||
* @param files the files
|
||||
* @param parentId the parent id
|
||||
* @return the list
|
||||
*/
|
||||
public void generateFakeUploaders(String filesSelected, String parentId) {
|
||||
|
||||
if(filesSelected==null || filesSelected.isEmpty())
|
||||
return;
|
||||
|
||||
String[] files = filesSelected.split(FILE_DELEMITER);
|
||||
|
||||
// NORMALIZE FILE NAMES
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
String normalizedFileName = files[i];
|
||||
if (normalizedFileName.contains("\\")) {
|
||||
files[i] = normalizedFileName.substring(normalizedFileName.lastIndexOf("\\") + 1); // remove C:\fakepath if exists
|
||||
}
|
||||
}
|
||||
|
||||
GWT.log("generating fake uploaders on: "+Arrays.asList(files.toString()));
|
||||
fakeUploaders = new ArrayList<WorkspaceUploaderItem>(files.length);
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
WorkspaceUploaderItem fakeItem = new WorkspaceUploaderItem();
|
||||
fakeItem.setClientUploadKey(GenerateUUID.get());
|
||||
fakeItem.setUploadStatus(UPLOAD_STATUS.WAIT);
|
||||
WorkspaceUploadFile fakeFile = new WorkspaceUploadFile();
|
||||
fakeFile.setFileName(files[i]);
|
||||
fakeFile.setParentId(parentId);
|
||||
fakeItem.setFile(fakeFile);
|
||||
fakeUploaders.add(fakeItem);
|
||||
}
|
||||
|
||||
GWT.log("fakeUploaders generated: "+fakeUploaders.toString());
|
||||
// return fakeUploaders;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.gcube.portlets.widgets.workspaceuploader.client.uploader.
|
||||
* DialogUploadStream#addHandlers()
|
||||
*/
|
||||
@Override
|
||||
protected void addHandlers() {
|
||||
|
||||
// handle the post
|
||||
addSubmitCompleteHandler(new SubmitCompleteHandler() {
|
||||
|
||||
@Override
|
||||
public void onSubmitComplete(SubmitCompleteEvent event) {
|
||||
GWT.log("onSubmitComplete");
|
||||
|
||||
// isStatusCompleted = true;
|
||||
String result = event.getResults();
|
||||
|
||||
if (result == null) {
|
||||
removeLoading();
|
||||
Window.alert("An error occurred during file upload.");
|
||||
// new DialogResult(null, "Error during upload",
|
||||
// "An error occurred during file upload.").center();
|
||||
return;
|
||||
}
|
||||
String strippedResult = new HTML(result).getText();
|
||||
final HandlerResultMessage resultMessage = HandlerResultMessage
|
||||
.parseResult(strippedResult);
|
||||
|
||||
switch (resultMessage.getStatus()) {
|
||||
case ERROR:
|
||||
removeLoading();
|
||||
GWT.log("Error during upload " + resultMessage.getMessage());
|
||||
break;
|
||||
case UNKNOWN:
|
||||
removeLoading();
|
||||
GWT.log("Error during upload " + resultMessage.getMessage());
|
||||
break;
|
||||
case WARN: {
|
||||
GWT.log("Upload completed with warnings "+ resultMessage.getMessage());
|
||||
removeLoading();
|
||||
break;
|
||||
}
|
||||
case SESSION_EXPIRED:{
|
||||
GWT.log("Upload aborted due to session expired: "+ resultMessage.getMessage());
|
||||
Window.alert("Session expired, please reload the page");
|
||||
removeLoading();
|
||||
break;
|
||||
}
|
||||
case OK: {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
addSubmitHandler(new SubmitHandler() {
|
||||
|
||||
@Override
|
||||
public void onSubmit(SubmitEvent event) {
|
||||
GWT.log("SubmitEvent");
|
||||
addLoading();
|
||||
enableButtons(false);
|
||||
addNewSubmitToMonitor();
|
||||
}
|
||||
});
|
||||
|
||||
fileUpload.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
GWT.log("browse return...");
|
||||
if (fileUpload.getFilename() == null
|
||||
|| fileUpload.getFilename().isEmpty()) {
|
||||
GWT.log("No file specified ");
|
||||
//MultipleDilaogUpload.this.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
String[] files = null;
|
||||
GWT.log("Current Uploader has id: "+fileUploadID);
|
||||
String filesSelected = getFilesSelected(fileUploadID, FILE_DELEMITER);
|
||||
GWT.log("getFilesSelected: " + filesSelected);
|
||||
files = filesSelected.split(FILE_DELEMITER);
|
||||
|
||||
if(isLimitExceeded(files.length))
|
||||
return;
|
||||
|
||||
// GENERATE NEW UPLOADERS
|
||||
generateFakeUploaders(filesSelected, parentIdentifier);
|
||||
GWT.log(fakeUploaders.toString());
|
||||
createJsonKeyForFiles();
|
||||
GWT.log(jsonKeys);
|
||||
|
||||
if (jsonKeys == null) {
|
||||
Window.alert("Sorry an error occurred during file/s submit. Try again");
|
||||
return;
|
||||
}
|
||||
|
||||
// ADD TO FORM PANEL
|
||||
// initJsonClientKeys();
|
||||
jsonClientKeys.setValue(jsonKeys);
|
||||
|
||||
// // CASE 1 FILE
|
||||
// if (files.length == 1) {
|
||||
//
|
||||
// // recall: Some browser would write in
|
||||
// // fileUploadField.getValue() C:\fakepath\$fileName
|
||||
// final String label = files[0];
|
||||
// WorkspaceUploaderServiceAsync.Util.getInstance()
|
||||
// .itemExistsInWorkpaceFolder(parentIdentifier,
|
||||
// label, new AsyncCallback<String>() {
|
||||
//
|
||||
// @Override
|
||||
// public void onSuccess(
|
||||
// final String itemId) {
|
||||
// GWT.log("itemExistsInWorkpaceFolder: "
|
||||
// + itemId);
|
||||
// if (itemId != null) {
|
||||
// removeItemAndSubmitForm(itemId);
|
||||
// updateItemSubmitForm(itemId);
|
||||
//// if (Window.confirm(label+ " exists in folder. If you continue, a new version will be created")) {
|
||||
//// removeItemAndSubmitForm(itemId);
|
||||
//// updateItemSubmitForm(itemId);
|
||||
//// }
|
||||
// } else
|
||||
// submitForm(); // ITEM does NOT
|
||||
// // EXIST SO
|
||||
// // SUBMIT FORM;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFailure(Throwable caught) {
|
||||
// GWT.log("Sorry an error occurred on the server "
|
||||
// + caught.getLocalizedMessage()
|
||||
// + ". Please try again later");
|
||||
// Window.alert(caught.getMessage());
|
||||
// }
|
||||
//
|
||||
// });
|
||||
// } else
|
||||
submitForm();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is limit exceeded.
|
||||
*
|
||||
* @param numbOfFiles the numb of files
|
||||
* @return true, if is limit exceeded
|
||||
*/
|
||||
public boolean isLimitExceeded(int numbOfFiles){
|
||||
|
||||
if (numbOfFiles > ConstantsMPFormBuilder.LIMIT_UPLOADS) {
|
||||
Window.alert("Multiple upload limit is "
|
||||
+ ConstantsMPFormBuilder.LIMIT_UPLOADS
|
||||
+ " files");
|
||||
//MultipleDilaogUpload.this.hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the new submit to monitor.
|
||||
*/
|
||||
public void addNewSubmitToMonitor(){
|
||||
GWT.log("addNewSubmitToMonitor...");
|
||||
/*int queueIndex = UploaderMonitor.getInstance().newQueue();
|
||||
for (final WorkspaceUploaderItem workspaceUploaderItem : fakeUploaders) {
|
||||
UploaderMonitor.getInstance().addNewUploaderToMonitorPanel(workspaceUploaderItem, workspaceUploaderItem.getFile().getFileName());
|
||||
setVisible(false);
|
||||
removeLoading();
|
||||
UploaderMonitor.getInstance().addNewUploaderToQueue(queueIndex, workspaceUploaderItem);
|
||||
// UploaderMonitor.getInstance().pollWorkspaceUploader(workspaceUploaderItem);
|
||||
}
|
||||
|
||||
UploaderMonitor.getInstance().doStartPollingQueue(queueIndex);*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the json key for files.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
protected void createJsonKeyForFiles() {
|
||||
|
||||
try {
|
||||
JSONObject productObj = new JSONObject();
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
productObj.put(ConstantsMPFormBuilder.JSON_CLIENT_KEYS, jsonArray);
|
||||
// GWT.log("Creating json keys on fakeUploaders: "+fakeUploaders.toString());
|
||||
|
||||
for (int i = 0; i < fakeUploaders.size(); i++) {
|
||||
WorkspaceUploaderItem file = fakeUploaders.get(i);
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(file.getClientUploadKey(), new JSONString(file.getFile().getFileName()));
|
||||
jsonArray.set(i, obj);
|
||||
}
|
||||
|
||||
jsonKeys = productObj.toString();
|
||||
GWT.log("updated jsonKeys: "+jsonKeys);
|
||||
} catch (Exception e) {
|
||||
GWT.log("error " + e.getMessage());
|
||||
jsonKeys = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit form.
|
||||
*/
|
||||
@Override
|
||||
public void submitForm() {
|
||||
submit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the files selected.
|
||||
*
|
||||
* @param iFrameName the i frame name
|
||||
* @return the files selected
|
||||
*/
|
||||
private static native String stopIFrame(final String iFrameName) /*-{
|
||||
console.log("iFrameName: " + iFrameName);
|
||||
// var iframe= window.frames[iFrameName];
|
||||
var iframe = $wnd.$('iframe[name=' + iFrameName + ']', parent.document)[0];
|
||||
var iframewindow = iframe.contentWindow ? iframe.contentWindow
|
||||
: iframe.contentDocument.defaultView;
|
||||
if (iframe == null)
|
||||
console.log("iframe is null");
|
||||
else
|
||||
console.log("iframe is not null");
|
||||
|
||||
if (navigator.appName == 'Microsoft Internet Explorer'
|
||||
&& iframewindow.document.execCommand) { // IE browsers
|
||||
console.log("IE browsers");
|
||||
iframewindow.document.execCommand("Stop");
|
||||
} else { // other browsers
|
||||
console.log("other browsers");
|
||||
iframewindow.stop();
|
||||
}
|
||||
|
||||
}-*/;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the files selected.
|
||||
*
|
||||
* @param tagId
|
||||
* the tag id
|
||||
* @param fileDelimiter
|
||||
* the file delimiter
|
||||
* @return the files selected
|
||||
*/
|
||||
public static native String getFilesSelected(final String tagId, final String fileDelimiter) /*-{
|
||||
var count = $wnd.$("#" + tagId)[0].files.length;
|
||||
console.log(count);
|
||||
var out = "";
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
var file = $wnd.$("#" + tagId)[0].files[i];
|
||||
// out += file.name + fileDelimiter + file.size + fileDelimiter;
|
||||
out += file.name + fileDelimiter;
|
||||
}
|
||||
return out;
|
||||
}-*/;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.client.ui.upload;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class ProgressBar extends Composite {
|
||||
|
||||
private static final double COMPLETE_PERECENTAGE = 100d;
|
||||
private static final double START_PERECENTAGE = 0d;
|
||||
|
||||
private static ProgressBarUiBinder uiBinder = GWT
|
||||
.create(ProgressBarUiBinder.class);
|
||||
|
||||
interface ProgressBarUiBinder extends UiBinder<Widget, ProgressBar> { }
|
||||
|
||||
@UiField HTML progressBarContainer;
|
||||
|
||||
public ProgressBar() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public void update(int percentage) {
|
||||
if (percentage > 100)
|
||||
percentage = 100;
|
||||
if (percentage < START_PERECENTAGE || percentage > COMPLETE_PERECENTAGE) {
|
||||
throw new IllegalArgumentException("invalid value for percentage " + percentage);
|
||||
} else { //cannot use DOM getElemById cus the second time you open the popup it fails
|
||||
progressBarContainer.getElement().setAttribute("style", "width: "+percentage+"%");
|
||||
progressBarContainer.getElement().getFirstChildElement().getFirstChildElement().setInnerText(percentage+"%");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||
<g:HTMLPanel>
|
||||
<div class="bar-container">
|
||||
<g:HTML styleName="progress myBackground" ui:field='progressBarContainer' >
|
||||
<span class="blue" style="width: 100%;">
|
||||
<span id="upload-percent-number">0%</span>
|
||||
</span>
|
||||
</g:HTML>
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,101 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.mpformbuilder.client.ui.upload;
|
||||
|
||||
/**
|
||||
* The Class WorkspaceUploadNotification.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Oct 2, 2015
|
||||
*/
|
||||
public class WorkspaceUploadNotification {
|
||||
|
||||
/**
|
||||
* The listener interface for receiving worskpaceUploadNotification events.
|
||||
* The class that is interested in processing a worskpaceUploadNotification
|
||||
* event implements this interface, and the object created with that class
|
||||
* is registered with a component using the component's
|
||||
* <code>addWorskpaceUploadNotificationListener<code> method. When
|
||||
* the worskpaceUploadNotification event occurs, that object's appropriate
|
||||
* method is invoked.
|
||||
*
|
||||
* @see WorskpaceUploadNotificationEvent
|
||||
*/
|
||||
public interface WorskpaceUploadNotificationListener {
|
||||
|
||||
/**
|
||||
* On upload completed.
|
||||
*
|
||||
* @param parentId
|
||||
* the parent id
|
||||
* @param itemId
|
||||
* the item id
|
||||
*/
|
||||
void onUploadCompleted(String parentId, String itemId);
|
||||
|
||||
/**
|
||||
* On upload aborted.
|
||||
*
|
||||
* @param parentId
|
||||
* the parent id
|
||||
* @param itemId
|
||||
* the item id
|
||||
*/
|
||||
void onUploadAborted(String parentId, String itemId);
|
||||
|
||||
/**
|
||||
* On error.
|
||||
*
|
||||
* @param parentId
|
||||
* the parent id
|
||||
* @param itemId
|
||||
* the item id
|
||||
* @param throwable
|
||||
* the throwable
|
||||
*/
|
||||
void onError(String parentId, String itemId, Throwable throwable);
|
||||
|
||||
/**
|
||||
* On overwrite completed.
|
||||
*
|
||||
* @param parentId the parent id
|
||||
* @param itemId the item id
|
||||
*/
|
||||
void onOverwriteCompleted(String parentId, String itemId);
|
||||
}
|
||||
|
||||
/**
|
||||
* The listener interface for receiving hasWorskpaceUploadNotification
|
||||
* events. The class that is interested in processing a
|
||||
* hasWorskpaceUploadNotification event implements this interface, and the
|
||||
* object created with that class is registered with a component using the
|
||||
* component's
|
||||
* <code>addHasWorskpaceUploadNotificationListener<code> method. When
|
||||
* the hasWorskpaceUploadNotification event occurs, that object's appropriate
|
||||
* method is invoked.
|
||||
*
|
||||
* @see HasWorskpaceUploadNotificationEvent
|
||||
*/
|
||||
public interface HasWorskpaceUploadNotificationListener {
|
||||
|
||||
/**
|
||||
* Adds the workspace upload notification listener.
|
||||
*
|
||||
* @param handler
|
||||
* the handler
|
||||
*/
|
||||
public void addWorkspaceUploadNotificationListener(
|
||||
WorskpaceUploadNotificationListener handler);
|
||||
|
||||
/**
|
||||
* Removes the workspace upload notification listener.
|
||||
*
|
||||
* @param handler
|
||||
* the handler
|
||||
*/
|
||||
public void removeWorkspaceUploadNotificationListener(
|
||||
WorskpaceUploadNotificationListener handler);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.mpformbuilder.client.ui.upload;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.WorkspaceUploadNotification.WorskpaceUploadNotificationListener;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.events.NotifyUploadEvent;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.events.NotifyUploadEventHandler;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
|
||||
|
||||
/**
|
||||
* The Class WorkspaceExplorerListenerController.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Oct 5, 2015
|
||||
*/
|
||||
public class WorkspaceUploaderListenerController {
|
||||
|
||||
private static HandlerManager controllerEventBus = null;
|
||||
|
||||
private List<WorskpaceUploadNotificationListener> listenersUpload = new ArrayList<WorskpaceUploadNotificationListener>();
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace explorer listener controller.
|
||||
*/
|
||||
public WorkspaceUploaderListenerController(){
|
||||
controllerEventBus = new HandlerManager(null);
|
||||
bindEvents();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind events.
|
||||
*/
|
||||
private void bindEvents() {
|
||||
controllerEventBus.addHandler(NotifyUploadEvent.TYPE, new NotifyUploadEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onNotifyUpload(final NotifyUploadEvent notifyUploadEvent) {
|
||||
|
||||
if(notifyUploadEvent.getEvent()==null)
|
||||
return;
|
||||
|
||||
switch(notifyUploadEvent.getEvent()){
|
||||
|
||||
case UPLOAD_COMPLETED:
|
||||
GWT.log("NotifyUploadEvent Completed");
|
||||
notifyUploadCompleted(notifyUploadEvent.getParentId(), notifyUploadEvent.getItemId());
|
||||
break;
|
||||
case ABORTED:
|
||||
GWT.log("NotifyUploadEvent Aborted");
|
||||
notifyUploadAborted(notifyUploadEvent.getParentId(), notifyUploadEvent.getItemId());
|
||||
break;
|
||||
case FAILED:
|
||||
GWT.log("NotifyUploadEvent FAILED");
|
||||
notifyUploadError(notifyUploadEvent.getParentId(), notifyUploadEvent.getItemId(), new Exception(notifyUploadEvent.getUploadResultMsg()));
|
||||
break;
|
||||
case OVERWRITE_COMPLETED:
|
||||
GWT.log("NotifyUploadEvent OVERWRITE_COMPLETED");
|
||||
notifyOverwriteCompleted(notifyUploadEvent.getParentId(), notifyUploadEvent.getItemId());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the event bus.
|
||||
*
|
||||
* @return the event bus
|
||||
*/
|
||||
public static HandlerManager getEventBus(){
|
||||
return controllerEventBus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the workspace upload listener.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
public void addWorkspaceUploadListener(WorskpaceUploadNotificationListener handler) {
|
||||
this.listenersUpload.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the workspace upload listener.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
public void removeWorkspaceUploadListener(WorskpaceUploadNotificationListener handler) {
|
||||
try {
|
||||
this.listenersUpload.remove(handler);
|
||||
} catch (Exception e) {
|
||||
// SILENT
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset listeners.
|
||||
*/
|
||||
public void resetListeners(){
|
||||
this.listenersUpload.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify upload completed.
|
||||
*
|
||||
* @param parentId the parent id
|
||||
* @param itemId the item id
|
||||
*/
|
||||
private void notifyUploadCompleted(String parentId, String itemId){
|
||||
// listenersSize();
|
||||
for (WorskpaceUploadNotificationListener listener : listenersUpload) {
|
||||
listener.onUploadCompleted(parentId, itemId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify overwrite completed.
|
||||
*
|
||||
* @param parentId the parent id
|
||||
* @param itemId the item id
|
||||
*/
|
||||
private void notifyOverwriteCompleted(String parentId, String itemId) {
|
||||
// listenersSize();
|
||||
for (WorskpaceUploadNotificationListener listener : listenersUpload) {
|
||||
listener.onOverwriteCompleted(parentId, itemId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify upload aborted.
|
||||
*
|
||||
* @param parentId the parent id
|
||||
* @param itemId the item id
|
||||
*/
|
||||
private void notifyUploadAborted(String parentId, String itemId){
|
||||
for (WorskpaceUploadNotificationListener listener : listenersUpload) {
|
||||
listener.onUploadAborted(parentId, itemId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify upload error.
|
||||
*
|
||||
* @param parentId the parent id
|
||||
* @param itemId the item id
|
||||
* @param t the t
|
||||
*/
|
||||
private void notifyUploadError(String parentId, String itemId, Throwable t){
|
||||
for (WorskpaceUploadNotificationListener listener : listenersUpload) {
|
||||
listener.onError(parentId, itemId, t);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Listeners size.
|
||||
*
|
||||
* @return the int
|
||||
*/
|
||||
private int listenersSize(){
|
||||
GWT.log("listenersUpload.size() "+listenersUpload.size());
|
||||
return listenersUpload.size();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,181 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.events;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
/**
|
||||
* The Class NotifyUploadEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Oct 5, 2015
|
||||
*/
|
||||
public class NotifyUploadEvent extends GwtEvent<NotifyUploadEventHandler> {
|
||||
public static Type<NotifyUploadEventHandler> TYPE = new Type<NotifyUploadEventHandler>();
|
||||
|
||||
/**
|
||||
* The Enum UPLOAD_EVENT_TYPE.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Oct 5, 2015
|
||||
*/
|
||||
public static enum UPLOAD_EVENT_TYPE {
|
||||
UPLOAD_COMPLETED, FAILED, ABORTED, OVERWRITE_COMPLETED
|
||||
}
|
||||
|
||||
private UPLOAD_EVENT_TYPE event;
|
||||
private String parentId;
|
||||
private String itemId;
|
||||
private String uploadResultMsg;
|
||||
private Throwable exception;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the exception.
|
||||
*
|
||||
* @return the exception
|
||||
*/
|
||||
public Throwable getException() {
|
||||
return exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the exception.
|
||||
*
|
||||
* @param exception the exception to set
|
||||
*/
|
||||
public void setException(Throwable exception) {
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the event.
|
||||
*
|
||||
* @return the event
|
||||
*/
|
||||
public UPLOAD_EVENT_TYPE getEvent() {
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the event.
|
||||
*
|
||||
* @param event the event to set
|
||||
*/
|
||||
public void setEvent(UPLOAD_EVENT_TYPE event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new notify upload event.
|
||||
*
|
||||
* @param event the event
|
||||
* @param parentId the parent id
|
||||
* @param itemId the item id
|
||||
*/
|
||||
public NotifyUploadEvent(UPLOAD_EVENT_TYPE event, String parentId, String itemId) {
|
||||
this.parentId = parentId;
|
||||
this.itemId = itemId;
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new notify upload event.
|
||||
*
|
||||
* @param event the event
|
||||
* @param parentId the parent id
|
||||
* @param itemId the item id
|
||||
* @param e the e
|
||||
*/
|
||||
public NotifyUploadEvent(UPLOAD_EVENT_TYPE event, String parentId, String itemId, Throwable e) {
|
||||
this.parentId = parentId;
|
||||
this.itemId = itemId;
|
||||
this.event = event;
|
||||
this.exception = e;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new notify upload event.
|
||||
*
|
||||
* @param event the event
|
||||
* @param parentId the parent id
|
||||
* @param itemId the item id
|
||||
* @param uploadResultMsg the upload result msg
|
||||
* @param e the e
|
||||
*/
|
||||
public NotifyUploadEvent(UPLOAD_EVENT_TYPE event, String parentId, String itemId, String uploadResultMsg, Throwable e) {
|
||||
this.parentId = parentId;
|
||||
this.itemId = itemId;
|
||||
this.event = event;
|
||||
this.uploadResultMsg = uploadResultMsg;
|
||||
this.exception = e;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the parent id.
|
||||
*
|
||||
* @return the parentId
|
||||
*/
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item id.
|
||||
*
|
||||
* @return the itemId
|
||||
*/
|
||||
public String getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the parent id.
|
||||
*
|
||||
* @param parentId the parentId to set
|
||||
*/
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the item id.
|
||||
*
|
||||
* @param itemId the itemId to set
|
||||
*/
|
||||
public void setItemId(String itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the uploadResultMsg
|
||||
*/
|
||||
public String getUploadResultMsg() {
|
||||
|
||||
return uploadResultMsg;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
public Type<NotifyUploadEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared
|
||||
* .EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(NotifyUploadEventHandler handler) {
|
||||
handler.onNotifyUpload(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.events;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
/**
|
||||
* The Interface NotifyUploadEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Oct 5, 2015
|
||||
*/
|
||||
public interface NotifyUploadEventHandler extends EventHandler {
|
||||
|
||||
|
||||
/**
|
||||
* On notify upload.
|
||||
*
|
||||
* @param notifyUploadEvent the notify upload event
|
||||
*/
|
||||
void onNotifyUpload(NotifyUploadEvent notifyUploadEvent);
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.mpformbuilder.client.ui.utils;
|
||||
|
||||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.icons.Images;
|
||||
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
|
||||
/**
|
||||
* The Class LoaderIcon.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 19, 2015
|
||||
*/
|
||||
public class LoaderIcon extends HorizontalPanel{
|
||||
|
||||
|
||||
private Image imgLoading = new Image(Images.ICONS.loading());
|
||||
private HTML txtLoading = new HTML("");
|
||||
|
||||
/**
|
||||
* Instantiates a new loader icon.
|
||||
*
|
||||
* @param txtHTML the txt html
|
||||
*/
|
||||
public LoaderIcon(String txtHTML) {
|
||||
this();
|
||||
setText(txtHTML);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new loader icon.
|
||||
*/
|
||||
public LoaderIcon() {
|
||||
setStyleName("marginTop20");
|
||||
add(imgLoading);
|
||||
add(txtLoading);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text.
|
||||
*
|
||||
* @param txtHTML the new text
|
||||
*/
|
||||
public void setText(String txtHTML){
|
||||
txtLoading.setHTML("<span style=\"margin-left:5px; vertical-align:middle;\">"+txtHTML+"</span>");
|
||||
}
|
||||
|
||||
/**
|
||||
* Show.
|
||||
*
|
||||
* @param bool the bool
|
||||
*/
|
||||
public void show(boolean bool){
|
||||
this.setVisible(bool);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,180 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.mpformbuilder.shared.upload;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* The Class HandlerResultMessage.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* May 10, 2016
|
||||
*/
|
||||
public class HandlerResultMessage implements Serializable{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final String SEPARATOR = ":";
|
||||
protected Status status;
|
||||
protected String message;
|
||||
|
||||
/**
|
||||
* The Enum Status.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Aug 3, 2015
|
||||
*/
|
||||
public enum Status {
|
||||
/**
|
||||
* If an error occurs.
|
||||
*/
|
||||
ERROR,
|
||||
/**
|
||||
* If no error occurs.
|
||||
*/
|
||||
OK,
|
||||
/**
|
||||
* If there was some problems.
|
||||
*/
|
||||
WARN,
|
||||
|
||||
/**
|
||||
* If the result is unknown.
|
||||
*/
|
||||
UNKNOWN,
|
||||
|
||||
/**
|
||||
* If the session is expired.
|
||||
*/
|
||||
SESSION_EXPIRED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TO SERIALIZATION.
|
||||
*/
|
||||
public HandlerResultMessage() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new result message.
|
||||
* @param status the status.
|
||||
* @param message the message.
|
||||
*/
|
||||
public HandlerResultMessage(Status status, String message) {
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Error result.
|
||||
*
|
||||
* @param message the message
|
||||
* @return the handler result message
|
||||
*/
|
||||
public static HandlerResultMessage errorResult(String message){
|
||||
return new HandlerResultMessage(Status.ERROR, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ok result.
|
||||
*
|
||||
* @param message the message
|
||||
* @return the handler result message
|
||||
*/
|
||||
public static HandlerResultMessage okResult(String message){
|
||||
return new HandlerResultMessage(Status.OK, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Warn result.
|
||||
*
|
||||
* @param message the message
|
||||
* @return the handler result message
|
||||
*/
|
||||
public static HandlerResultMessage warnResult(String message){
|
||||
return new HandlerResultMessage(Status.WARN, message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Session expired result.
|
||||
*
|
||||
* @param message the message
|
||||
* @return the handler result message
|
||||
*/
|
||||
public static HandlerResultMessage sessionExpiredResult(String message){
|
||||
return new HandlerResultMessage(Status.SESSION_EXPIRED, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the result.
|
||||
* expected status:message (e.g. OK:Upload aborted)
|
||||
* @param result the result
|
||||
* @return the handler result message
|
||||
*/
|
||||
public static HandlerResultMessage parseResult(String result){
|
||||
//expected status:message
|
||||
String statusToken = null;
|
||||
String messageToken = null;
|
||||
|
||||
if(result==null || result.isEmpty())
|
||||
return errorResult("result is null or empty");
|
||||
|
||||
int index = result.indexOf(':');
|
||||
if (index>=0){
|
||||
statusToken = result.substring(0,index);
|
||||
if (index<result.length()){
|
||||
messageToken = result.substring(index+1);
|
||||
}
|
||||
}
|
||||
|
||||
Status status = Status.UNKNOWN;
|
||||
if (statusToken!=null){
|
||||
try{
|
||||
status = Status.valueOf(statusToken);
|
||||
}catch (Exception e) {
|
||||
status = Status.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
String message = messageToken!=null?messageToken:"";
|
||||
|
||||
return new HandlerResultMessage(status, message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the status.
|
||||
*
|
||||
* @return the status
|
||||
*/
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message.
|
||||
*
|
||||
* @return the message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(status);
|
||||
builder.append(SEPARATOR);
|
||||
builder.append(message);
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
|
||||
package org.gcube.portlets.widgets.mpformbuilder.shared.upload;
|
||||
|
||||
/**
|
||||
* The Interface UploadEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Sep 1, 2015
|
||||
*/
|
||||
public interface UploadEvent {
|
||||
|
||||
/**
|
||||
* Gets the read percentage.
|
||||
*
|
||||
* @return the read percentage
|
||||
*/
|
||||
int getReadPercentage();
|
||||
|
||||
/**
|
||||
* Sets the read percentage.
|
||||
*
|
||||
* @param percentage
|
||||
* the new read percentage
|
||||
*/
|
||||
void setReadPercentage(int percentage);
|
||||
|
||||
/**
|
||||
* Sets the read time. (in millisecond) the difference, measured in
|
||||
* milliseconds, between the current time and midnight, January 1, 1970 UTC.
|
||||
*
|
||||
* @param time
|
||||
* the new read time
|
||||
*/
|
||||
void setReadTime(long time);
|
||||
|
||||
/**
|
||||
* Gets the read time (in millisecond).
|
||||
*
|
||||
* @return the read time
|
||||
*/
|
||||
long getReadTime();
|
||||
|
||||
/**
|
||||
* Gets the read bytes.
|
||||
*
|
||||
* @return the read bytes
|
||||
*/
|
||||
public long getReadBytes();
|
||||
|
||||
/**
|
||||
* Gets the total bytes.
|
||||
*
|
||||
* @return the total bytes
|
||||
*/
|
||||
public long getTotalBytes();
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.shared.upload;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The Class UploadProgress.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Sep 1, 2015
|
||||
*/
|
||||
public final class UploadProgress implements Serializable{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 419707497192632320L;
|
||||
private List<UploadEvent> events = new ArrayList<UploadEvent>();
|
||||
|
||||
/**
|
||||
* Instantiates a new upload progress.
|
||||
*/
|
||||
public UploadProgress() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the events.
|
||||
*
|
||||
* @return the events
|
||||
*/
|
||||
public List<UploadEvent> getEvents() {
|
||||
return events;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
*
|
||||
* @param event the event
|
||||
*/
|
||||
public void add(final UploadEvent event) {
|
||||
events.add(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last event.
|
||||
*
|
||||
* @return the last event
|
||||
*/
|
||||
public UploadEvent getLastEvent(){
|
||||
if(isEmpty())
|
||||
return null;
|
||||
return events.get(events.size()-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear.
|
||||
*/
|
||||
public void clear() {
|
||||
events = new ArrayList<UploadEvent>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is empty.
|
||||
*
|
||||
* @return true, if is empty
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return events.isEmpty();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("UploadProgress [events=");
|
||||
builder.append(events);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.shared.upload;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* The Class UploadProgressChangeEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Sep 1, 2015
|
||||
*/
|
||||
public final class UploadProgressChangeEvent implements UploadEvent, Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -714607581338378280L;
|
||||
private int readPercentage = -1;
|
||||
private long readTime = 0L;
|
||||
private long readBytes = 0L;
|
||||
private long totalBytes = 0L;
|
||||
|
||||
/**
|
||||
* Instantiates a new upload progress change event.
|
||||
*/
|
||||
public UploadProgressChangeEvent() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.workspaceuploader.shared.event.UploadEvent#getReadPercentage()
|
||||
*/
|
||||
public int getReadPercentage() {
|
||||
return readPercentage;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.workspaceuploader.shared.event.UploadEvent#setReadPercentage(java.lang.Integer)
|
||||
*/
|
||||
public void setReadPercentage(int percentage) {
|
||||
this.readPercentage = percentage;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.workspaceuploader.shared.event.UploadEvent#setReadTime(long)
|
||||
*/
|
||||
@Override
|
||||
public void setReadTime(long time) {
|
||||
this.readTime = time;
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.workspaceuploader.shared.event.UploadEvent#getReadTime()
|
||||
*/
|
||||
@Override
|
||||
public long getReadTime() {
|
||||
return readTime;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the read bytes.
|
||||
*
|
||||
* @param readBytes the readBytes to set
|
||||
*/
|
||||
public void setReadBytes(long readBytes) {
|
||||
|
||||
this.readBytes = readBytes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the total bytes.
|
||||
*
|
||||
* @param totalBytes the totalBytes to set
|
||||
*/
|
||||
public void setTotalBytes(long totalBytes) {
|
||||
|
||||
this.totalBytes = totalBytes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the read bytes.
|
||||
*
|
||||
* @return the readBytes
|
||||
*/
|
||||
public long getReadBytes() {
|
||||
|
||||
return readBytes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the total bytes.
|
||||
*
|
||||
* @return the totalBytes
|
||||
*/
|
||||
public long getTotalBytes() {
|
||||
|
||||
return totalBytes;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("UploadProgressChangeEvent [readPercentage=");
|
||||
builder.append(readPercentage);
|
||||
builder.append(", readTime=");
|
||||
builder.append(readTime);
|
||||
builder.append(", readBytes=");
|
||||
builder.append(readBytes);
|
||||
builder.append(", totalBytes=");
|
||||
builder.append(totalBytes);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.mpformbuilder.shared.upload;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* The Class WorkspaceUploadFile.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Aug 3, 2015
|
||||
*/
|
||||
public class WorkspaceUploadFile implements Serializable{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4693939404459889859L;
|
||||
private String parentId;
|
||||
private String fileName;
|
||||
private String itemId;
|
||||
private String versionName;
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace upload file.
|
||||
*/
|
||||
public WorkspaceUploadFile() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace upload file.
|
||||
*
|
||||
* @param parentId the parent id
|
||||
* @param itemId the item id
|
||||
* @param fileName the file name
|
||||
* @param versionName the version
|
||||
*/
|
||||
public WorkspaceUploadFile(String parentId, String itemId, String fileName, String versionName) {
|
||||
super();
|
||||
this.parentId = parentId;
|
||||
this.itemId = itemId;
|
||||
this.fileName = fileName;
|
||||
this.versionName = versionName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the version name.
|
||||
*
|
||||
* @return the version name
|
||||
*/
|
||||
public String getVersionName() {
|
||||
|
||||
return versionName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the version name.
|
||||
*
|
||||
* @param versionName the new version name
|
||||
*/
|
||||
public void setVersionName(String versionName) {
|
||||
|
||||
this.versionName = versionName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the item id.
|
||||
*
|
||||
* @param itemId the itemId to set
|
||||
*/
|
||||
public void setItemId(String itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the parent id.
|
||||
*
|
||||
* @return the parentId
|
||||
*/
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the file name.
|
||||
*
|
||||
* @return the fileName
|
||||
*/
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the parent id.
|
||||
*
|
||||
* @param parentId the parentId to set
|
||||
*/
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the item id.
|
||||
*
|
||||
* @return the itemId
|
||||
*/
|
||||
public String getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the file name.
|
||||
*
|
||||
* @param fileName the fileName to set
|
||||
*/
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 31;
|
||||
hash = hash * 13 + (parentId == null ? 0 : parentId.hashCode());
|
||||
hash = hash * 17 + (fileName == null ? 0 : fileName.hashCode());
|
||||
hash = hash * 19 + (itemId == null ? 0 : itemId.hashCode());
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("WorkspaceUploadFile [parentId=");
|
||||
builder.append(parentId);
|
||||
builder.append(", fileName=");
|
||||
builder.append(fileName);
|
||||
builder.append(", itemId=");
|
||||
builder.append(itemId);
|
||||
builder.append(", versionName=");
|
||||
builder.append(versionName);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,267 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.mpformbuilder.shared.upload;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* The Class WorkspaceUploaderItem.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Aug 3, 2015
|
||||
*/
|
||||
public class WorkspaceUploaderItem implements Serializable{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3635794780284917733L;
|
||||
|
||||
/**
|
||||
* The Enum UPLOAD_STATUS.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Aug 6, 2015
|
||||
*/
|
||||
public static enum UPLOAD_STATUS{
|
||||
|
||||
WAIT("WAIT", "wait"),
|
||||
IN_PROGRESS("IN_PROGRESS", "in progress"),
|
||||
FAILED("FAILED", "failed"),
|
||||
ABORTED("ABORTED", "aborted"),
|
||||
COMPLETED("COMPLETED", "completed");
|
||||
|
||||
protected String id;
|
||||
protected String label;
|
||||
|
||||
/**
|
||||
* Instantiates a new upload status.
|
||||
*
|
||||
* @param id the id
|
||||
* @param label the label
|
||||
*/
|
||||
private UPLOAD_STATUS(String id, String label) {
|
||||
this.id = id;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
private String identifier;
|
||||
private WorkspaceUploadFile file;
|
||||
private UPLOAD_STATUS uploadStatus;
|
||||
private String statusDescription;
|
||||
private String clientUploadKey;
|
||||
private UploadProgress uploadProgress;
|
||||
private Boolean isOverwrite;
|
||||
// private Long threadId;
|
||||
private Boolean erasable;
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace uploader item.
|
||||
*/
|
||||
public WorkspaceUploaderItem() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace uploader item.
|
||||
*
|
||||
* @param identifier the identifier
|
||||
*/
|
||||
public WorkspaceUploaderItem(String identifier) {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace uploader item.
|
||||
*
|
||||
* @param identifier the identifier
|
||||
* @param file the file
|
||||
* @param status the status
|
||||
* @param statusDescription the status description
|
||||
* @param uploadProgress the upload progress
|
||||
*/
|
||||
public WorkspaceUploaderItem(String identifier, WorkspaceUploadFile file, UPLOAD_STATUS status, String statusDescription, UploadProgress uploadProgress) {
|
||||
super();
|
||||
this.identifier = identifier;
|
||||
this.file = file;
|
||||
this.uploadStatus = status;
|
||||
this.statusDescription = statusDescription;
|
||||
this.uploadProgress = uploadProgress;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the identifier.
|
||||
*
|
||||
* @return the identifier
|
||||
*/
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the status description.
|
||||
*
|
||||
* @return the statusDescription
|
||||
*/
|
||||
public String getStatusDescription() {
|
||||
return statusDescription;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the status description.
|
||||
*
|
||||
* @param statusDescription the statusDescription to set
|
||||
*/
|
||||
public void setStatusDescription(String statusDescription) {
|
||||
this.statusDescription = statusDescription;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the file.
|
||||
*
|
||||
* @return the file
|
||||
*/
|
||||
public WorkspaceUploadFile getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the upload status.
|
||||
*
|
||||
* @return the uploadStatus
|
||||
*/
|
||||
public UPLOAD_STATUS getUploadStatus() {
|
||||
return uploadStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the file.
|
||||
*
|
||||
* @param file the file to set
|
||||
*/
|
||||
public void setFile(WorkspaceUploadFile file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the upload status.
|
||||
*
|
||||
* @param uploadStatus the uploadStatus to set
|
||||
*/
|
||||
public void setUploadStatus(UPLOAD_STATUS uploadStatus) {
|
||||
this.uploadStatus = uploadStatus;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the client upload key.
|
||||
*
|
||||
* @return the clientUploadKey
|
||||
*/
|
||||
public String getClientUploadKey() {
|
||||
return clientUploadKey;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the client upload key.
|
||||
*
|
||||
* @param clientUploadKey the clientUploadKey to set
|
||||
*/
|
||||
public void setClientUploadKey(String clientUploadKey) {
|
||||
this.clientUploadKey = clientUploadKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the upload progress.
|
||||
*
|
||||
* @return the uploadProgress
|
||||
*/
|
||||
public UploadProgress getUploadProgress() {
|
||||
return uploadProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the upload progress.
|
||||
*
|
||||
* @param uploadProgress the uploadProgress to set
|
||||
*/
|
||||
public void setUploadProgress(UploadProgress uploadProgress) {
|
||||
this.uploadProgress = uploadProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isOverwrite
|
||||
*/
|
||||
public Boolean getIsOverwrite() {
|
||||
return isOverwrite;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isOverwrite the isOverwrite to set
|
||||
*/
|
||||
public void setIsOverwrite(Boolean isOverwrite) {
|
||||
this.isOverwrite = isOverwrite;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the erasable.
|
||||
*
|
||||
* @param b the new erasable
|
||||
*/
|
||||
public void setErasable(Boolean b) {
|
||||
this.erasable = b;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is erasable.
|
||||
*
|
||||
* @return the erasable
|
||||
*/
|
||||
public Boolean isErasable() {
|
||||
|
||||
if(erasable==null)
|
||||
return false;
|
||||
|
||||
return erasable;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("WorkspaceUploaderItem [identifier=");
|
||||
builder.append(identifier);
|
||||
builder.append(", file=");
|
||||
builder.append(file);
|
||||
builder.append(", uploadStatus=");
|
||||
builder.append(uploadStatus);
|
||||
builder.append(", statusDescription=");
|
||||
builder.append(statusDescription);
|
||||
builder.append(", clientUploadKey=");
|
||||
builder.append(clientUploadKey);
|
||||
// builder.append(", uploadProgress=");
|
||||
// builder.append(uploadProgress);
|
||||
builder.append(", isOverwrite=");
|
||||
builder.append(isOverwrite);
|
||||
builder.append(", erasable=");
|
||||
builder.append(erasable);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,30 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='MetadataProfileFormBuilder'>
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<!-- Other module inherits -->
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
<!-- Responsive design -->
|
||||
<set-property name="bootstrap.responsiveDesign" value="true" />
|
||||
<inherits name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
|
||||
<set-property name="bootstrap.responsiveDesign"
|
||||
value="true" />
|
||||
<inherits
|
||||
name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
|
||||
<inherits name='com.github.gwtbootstrap.datepicker.Datepicker' />
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<inherits name='com.google.gwt.json.JSON'/>
|
||||
<inherits
|
||||
name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portal.clientcontext.GCubeClientContext' />
|
||||
|
||||
<inherits name='com.google.gwt.json.JSON' />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
|
||||
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<!-- Other module inherits -->
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
|
||||
<entry-point class='org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilder' />
|
||||
<!-- Specify the app entry point class. -->
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
<entry-point
|
||||
class='org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilder' />
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
|
||||
</module>
|
||||
|
|
Loading…
Reference in New Issue