ref #11879: TDM - Update to StorageHUB
https://support.d4science.org/issues/#11879 Updated to StorageHub git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-import-widget@169494 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d9e30ea968
commit
0f4ec53573
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/tabular-data-csv-import-widget-2.9.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/tabular-data-csv-import-widget-2.10.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/tabular-data-csv-import-widget-2.9.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/tabular-data-csv-import-widget-2.10.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -33,5 +33,5 @@
|
||||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/tabular-data-csv-import-widget-2.9.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/tabular-data-csv-import-widget-2.10.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
|
<Changeset
|
||||||
|
component="org.gcube.portlets-user.tabular-data-csv-import-widget.2-10-0"
|
||||||
|
date="2018-07-01">
|
||||||
|
<Change>Updated to StorageHub [task #11879]</Change>
|
||||||
|
</Changeset>
|
||||||
<Changeset
|
<Changeset
|
||||||
component="org.gcube.portlets-user.tabular-data-csv-import-widget.2-9-0"
|
component="org.gcube.portlets-user.tabular-data-csv-import-widget.2-9-0"
|
||||||
date="2017-02-15">
|
date="2017-02-15">
|
||||||
|
|
12
pom.xml
12
pom.xml
|
@ -13,7 +13,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>tabular-data-csv-import-widget</artifactId>
|
<artifactId>tabular-data-csv-import-widget</artifactId>
|
||||||
<version>2.9.0-SNAPSHOT</version>
|
<version>2.10.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>tabular-data-csv-import-widget</name>
|
<name>tabular-data-csv-import-widget</name>
|
||||||
<description>tabular-data-csv-import-widget allows csv import from file and workspace</description>
|
<description>tabular-data-csv-import-widget allows csv import from file and workspace</description>
|
||||||
|
@ -129,20 +129,14 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- WSLT dependencies -->
|
<!-- workspace-explorer -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>workspace-explorer</artifactId>
|
<artifactId>workspace-explorer</artifactId>
|
||||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.common</groupId>
|
|
||||||
<artifactId>home-library</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- LOGGING -->
|
<!-- LOGGING -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.allen-sauer.gwt.log</groupId>
|
<groupId>com.allen-sauer.gwt.log</groupId>
|
||||||
|
|
|
@ -50,8 +50,8 @@ import com.sencha.gxt.widget.core.client.tips.ToolTipConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi" <a
|
*
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CSVConfigCard extends WizardCard {
|
public class CSVConfigCard extends WizardCard {
|
||||||
|
|
|
@ -20,8 +20,8 @@ import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi" <a
|
*
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CSVErrorWindow extends Window {
|
public class CSVErrorWindow extends Window {
|
||||||
|
|
|
@ -7,6 +7,8 @@ import com.google.web.bindery.event.shared.EventBus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
* @author Giancarlo Panichi
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public class CSVImportWizardTD extends WizardWindow {
|
public class CSVImportWizardTD extends WizardWindow {
|
||||||
|
|
||||||
|
@ -15,10 +17,7 @@ public class CSVImportWizardTD extends WizardWindow {
|
||||||
protected String WIZARDHEIGHT = "520px";
|
protected String WIZARDHEIGHT = "520px";
|
||||||
//private CSVImportWizardTD wizard;
|
//private CSVImportWizardTD wizard;
|
||||||
|
|
||||||
/**
|
|
||||||
* The id of the {@link CSVTarget} to use.
|
|
||||||
* @param targetId
|
|
||||||
*/
|
|
||||||
|
|
||||||
public CSVImportWizardTD(String title, EventBus eventBus) {
|
public CSVImportWizardTD(String title, EventBus eventBus) {
|
||||||
super(title,eventBus);
|
super(title,eventBus);
|
||||||
|
|
|
@ -4,6 +4,11 @@ import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
import com.google.web.bindery.event.shared.SimpleEventBus;
|
import com.google.web.bindery.event.shared.SimpleEventBus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Giancarlo Panichi
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class CSVImportWizardTDEntry implements EntryPoint {
|
public class CSVImportWizardTDEntry implements EntryPoint {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ import com.google.gwt.i18n.client.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author giancarlo email: <a
|
* @author Giancarlo Panichi
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface CSVImportWizardTDMessages extends Messages {
|
public interface CSVImportWizardTDMessages extends Messages {
|
||||||
|
|
|
@ -32,8 +32,8 @@ import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayou
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi" <a
|
*
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CSVOperationInProgressCard extends WizardCard implements
|
public class CSVOperationInProgressCard extends WizardCard implements
|
||||||
|
|
|
@ -50,8 +50,8 @@ import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi" <a
|
*
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CSVTableDetailCard extends WizardCard {
|
public class CSVTableDetailCard extends WizardCard {
|
||||||
|
|
|
@ -13,8 +13,8 @@ import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi" <a
|
*
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CSVUploadFileCard extends WizardCard {
|
public class CSVUploadFileCard extends WizardCard {
|
||||||
|
|
|
@ -32,8 +32,8 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.Verti
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi" <a
|
*
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CSVWorkSpaceSelectionCard extends WizardCard {
|
public class CSVWorkSpaceSelectionCard extends WizardCard {
|
||||||
|
|
|
@ -21,8 +21,7 @@ import com.sencha.gxt.widget.core.client.tips.ToolTipConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi" <a
|
* @author Giancarlo Panichi
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CsvCheckPanel extends VerticalPanel {
|
public class CsvCheckPanel extends VerticalPanel {
|
||||||
|
@ -84,16 +83,11 @@ public class CsvCheckPanel extends VerticalPanel {
|
||||||
msgs = GWT.create(CSVImportWizardTDMessages.class);
|
msgs = GWT.create(CSVImportWizardTDMessages.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public TextButton getCheckConfiguration() {
|
public TextButton getCheckConfiguration() {
|
||||||
return btnCheckConfiguration;
|
return btnCheckConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the skipInvalidCheckBox
|
|
||||||
*/
|
|
||||||
public CheckBox getSkipInvalidCheckBox() {
|
public CheckBox getSkipInvalidCheckBox() {
|
||||||
return chBoxSkipInvalid;
|
return chBoxSkipInvalid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,8 @@ import com.sencha.gxt.widget.core.client.form.FormPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi" <a
|
*
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FileUploadPanel extends FormPanel {
|
public class FileUploadPanel extends FormPanel {
|
||||||
|
|
|
@ -22,8 +22,8 @@ import com.sencha.gxt.widget.core.client.form.Radio;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi" <a
|
*
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SourceSelectionCard extends WizardCard {
|
public class SourceSelectionCard extends WizardCard {
|
||||||
|
|
|
@ -31,8 +31,8 @@ import com.sencha.gxt.widget.core.client.grid.RowNumberer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi" <a
|
*
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CSVGrid extends Grid<CSVRow> {
|
public class CSVGrid extends Grid<CSVRow> {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.google.gwt.i18n.client.Messages;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author giancarlo
|
* @author giancarlo
|
||||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* email:
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface CSVGridMessages extends Messages {
|
public interface CSVGridMessages extends Messages {
|
||||||
|
|
|
@ -21,7 +21,7 @@ import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CSVGridView extends GridView<CSVRow> {
|
public class CSVGridView extends GridView<CSVRow> {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CSVJsonReader implements DataReader<ListLoadResult<CSVRow>, String> {
|
public class CSVJsonReader implements DataReader<ListLoadResult<CSVRow>, String> {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.google.gwt.core.client.JsArray;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class CSVData extends JavaScriptObject {
|
public final class CSVData extends JavaScriptObject {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.google.gwt.core.client.JavaScriptObject;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class CSVRow extends JavaScriptObject {
|
public final class CSVRow extends JavaScriptObject {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.google.gwt.resources.client.CssResource;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface CSVImportCSS extends CssResource {
|
public interface CSVImportCSS extends CssResource {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface LicenceDataPropertiesCombo extends
|
public interface LicenceDataPropertiesCombo extends
|
||||||
|
|
|
@ -8,11 +8,8 @@ import com.google.gwt.core.client.GWT;
|
||||||
import com.sencha.gxt.widget.core.client.ProgressBar;
|
import com.sencha.gxt.widget.core.client.ProgressBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a {@link ProgressBar} progress and text based on
|
|
||||||
* {@link CSVImportProgressListener} events.
|
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi" <a
|
* @author Giancarlo Panichi
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FileUploadProgressBarUpdater implements FileUploadProgressListener {
|
public class FileUploadProgressBarUpdater implements FileUploadProgressListener {
|
||||||
|
@ -20,12 +17,6 @@ public class FileUploadProgressBarUpdater implements FileUploadProgressListener
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
private FileUploadProgressMessages msgs;
|
private FileUploadProgressMessages msgs;
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new {@link ProgressBar} updater.
|
|
||||||
*
|
|
||||||
* @param progressBar
|
|
||||||
* the {@link ProgressBar} to update.
|
|
||||||
*/
|
|
||||||
public FileUploadProgressBarUpdater(ProgressBar progressBar) {
|
public FileUploadProgressBarUpdater(ProgressBar progressBar) {
|
||||||
initMessages();
|
initMessages();
|
||||||
this.progressBar = progressBar;
|
this.progressBar = progressBar;
|
||||||
|
@ -36,18 +27,12 @@ public class FileUploadProgressBarUpdater implements FileUploadProgressListener
|
||||||
msgs = GWT.create(FileUploadProgressMessages.class);
|
msgs = GWT.create(FileUploadProgressMessages.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void operationComplete() {
|
public void operationComplete() {
|
||||||
Log.info("File upload complete");
|
Log.info("File upload complete");
|
||||||
progressBar.updateProgress(1, msgs.fileUploadCompleted());
|
progressBar.updateProgress(1, msgs.fileUploadCompleted());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void operationFailed(Throwable caught, String reason,
|
public void operationFailed(Throwable caught, String reason,
|
||||||
String failureDetails) {
|
String failureDetails) {
|
||||||
Log.info("File upload failed");
|
Log.info("File upload failed");
|
||||||
|
|
|
@ -3,33 +3,24 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.td.csvimportwidget.client.progress;
|
package org.gcube.portlets.user.td.csvimportwidget.client.progress;
|
||||||
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FileUploadProgressCardUpdater implements FileUploadProgressListener {
|
public class FileUploadProgressCardUpdater implements FileUploadProgressListener {
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public FileUploadProgressCardUpdater() {
|
public FileUploadProgressCardUpdater() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void operationComplete() {
|
public void operationComplete() {
|
||||||
Log.info("File upload completed");
|
Log.info("File upload completed");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void operationFailed(Throwable caught, String reason, String failureDetails) {
|
public void operationFailed(Throwable caught, String reason, String failureDetails) {
|
||||||
Log.info("File upload failed");
|
Log.info("File upload failed");
|
||||||
}
|
}
|
||||||
|
@ -39,7 +30,7 @@ public class FileUploadProgressCardUpdater implements FileUploadProgressListener
|
||||||
}
|
}
|
||||||
|
|
||||||
public void operationUpdate(float elaborated) {
|
public void operationUpdate(float elaborated) {
|
||||||
Log.info("File uploading: "+elaborated);
|
Log.info("File uploading: " + elaborated);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,39 +3,20 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.td.csvimportwidget.client.progress;
|
package org.gcube.portlets.user.td.csvimportwidget.client.progress;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a listener for operation progress.
|
* Defines a listener for operation progress.
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface FileUploadProgressListener {
|
public interface FileUploadProgressListener {
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the operation is starting.
|
|
||||||
*/
|
|
||||||
public void operationInitializing();
|
public void operationInitializing();
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when there is a progress for the operation.
|
|
||||||
* @param elaborated the elaborated part.
|
|
||||||
*/
|
|
||||||
public void operationUpdate(float elaborated);
|
public void operationUpdate(float elaborated);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the operation is complete.
|
|
||||||
*/
|
|
||||||
public void operationComplete();
|
public void operationComplete();
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the operation is failed.
|
|
||||||
* @param caught the failure exception.
|
|
||||||
* @param reason the failure reason.
|
|
||||||
*/
|
|
||||||
public void operationFailed(Throwable caught, String reason, String failureDetails);
|
public void operationFailed(Throwable caught, String reason, String failureDetails);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,12 @@ import com.google.gwt.i18n.client.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author giancarlo
|
* @author Giancarlo Panichi
|
||||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface FileUploadProgressMessages extends Messages {
|
public interface FileUploadProgressMessages extends Messages {
|
||||||
|
|
||||||
//
|
|
||||||
@DefaultMessage("Please Wait...")
|
@DefaultMessage("Please Wait...")
|
||||||
String pleaseWait();
|
String pleaseWait();
|
||||||
|
|
||||||
|
|
|
@ -14,71 +14,55 @@ import com.google.gwt.user.client.Timer;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This {@link Timer} retrieves {@link OperationProgress} from the specified
|
|
||||||
* {@link OperationProgressSource} with the scheduled interval. The retrieved
|
|
||||||
* information are spread to the subscribed {@link CSVImportProgressListener}.
|
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi" <a
|
* @author Giancarlo Panichi
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FileUploadProgressUpdater extends Timer {
|
public class FileUploadProgressUpdater extends Timer {
|
||||||
|
|
||||||
private ArrayList<FileUploadProgressListener> listeners = new ArrayList<FileUploadProgressListener>();
|
private ArrayList<FileUploadProgressListener> listeners = new ArrayList<FileUploadProgressListener>();
|
||||||
private static FileUploadProgressMessages msgs = GWT
|
private static FileUploadProgressMessages msgs = GWT.create(FileUploadProgressMessages.class);
|
||||||
.create(FileUploadProgressMessages.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Log.debug("requesting operation progress");
|
Log.debug("requesting operation progress");
|
||||||
TDGWTServiceAsync.INSTANCE
|
TDGWTServiceAsync.INSTANCE.getFileUploadMonitor(new AsyncCallback<FileUploadMonitor>() {
|
||||||
.getFileUploadMonitor(new AsyncCallback<FileUploadMonitor>() {
|
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
cancel();
|
cancel();
|
||||||
Log.error("Error retrieving the operation state",
|
Log.error("Error retrieving the operation state", caught);
|
||||||
caught);
|
String message = getStack(caught);
|
||||||
String message = getStack(caught);
|
fireOperationFailed(caught, msgs.failedGettingOperarionUpdateds(), message);
|
||||||
fireOperationFailed(caught,
|
}
|
||||||
msgs.failedGettingOperarionUpdateds(), message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSuccess(FileUploadMonitor result) {
|
public void onSuccess(FileUploadMonitor result) {
|
||||||
Log.info("retrieved FileUploadMonitor: "
|
Log.info("retrieved FileUploadMonitor: " + result.getState());
|
||||||
+ result.getState());
|
switch (result.getState()) {
|
||||||
switch (result.getState()) {
|
case STARTED:
|
||||||
case STARTED:
|
Log.debug("File Upload Started");
|
||||||
Log.debug("File Upload Started");
|
break;
|
||||||
break;
|
case INPROGRESS:
|
||||||
case INPROGRESS:
|
Log.debug("Progress: " + result.getElaboratedLenght() + " of " + result.getTotalLenght());
|
||||||
Log.debug("Progress: "
|
fireOperationUpdate(result.getPercentDone());
|
||||||
+ result.getElaboratedLenght() + " of "
|
break;
|
||||||
+ result.getTotalLenght());
|
case FAILED:
|
||||||
fireOperationUpdate(result.getPercentDone());
|
Log.debug("File Upload Failed");
|
||||||
break;
|
cancel();
|
||||||
case FAILED:
|
fireOperationFailed(new Throwable(msgs.fileUploadFailedHead()), result.getFailureReason(),
|
||||||
Log.debug("File Upload Failed");
|
result.getFailureDetails());
|
||||||
cancel();
|
break;
|
||||||
fireOperationFailed(new Throwable(
|
case COMPLETED:
|
||||||
msgs.fileUploadFailedHead()), result
|
cancel();
|
||||||
.getFailureReason(), result
|
Log.debug("File Upload Completed");
|
||||||
.getFailureDetails());
|
fireOperationComplete();
|
||||||
break;
|
break;
|
||||||
case COMPLETED:
|
default:
|
||||||
cancel();
|
break;
|
||||||
Log.debug("File Upload Completed");
|
}
|
||||||
fireOperationComplete();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,30 +89,15 @@ public class FileUploadProgressUpdater extends Timer {
|
||||||
listener.operationComplete();
|
listener.operationComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fireOperationFailed(Throwable caught, String failure,
|
protected void fireOperationFailed(Throwable caught, String failure, String failureDetails) {
|
||||||
String failureDetails) {
|
|
||||||
for (FileUploadProgressListener listener : listeners)
|
for (FileUploadProgressListener listener : listeners)
|
||||||
listener.operationFailed(caught, failure, failureDetails);
|
listener.operationFailed(caught, failure, failureDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a new {@link CSVImportProgressListener} to this
|
|
||||||
* {@link FileUploadProgressUpdater}.
|
|
||||||
*
|
|
||||||
* @param listener
|
|
||||||
* the listener to add.
|
|
||||||
*/
|
|
||||||
public void addListener(FileUploadProgressListener listener) {
|
public void addListener(FileUploadProgressListener listener) {
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the specified {@link CSVImportProgressListener} from this
|
|
||||||
* {@link FileUploadProgressUpdater}.
|
|
||||||
*
|
|
||||||
* @param listener
|
|
||||||
* the listener to remove.
|
|
||||||
*/
|
|
||||||
public void removeListener(FileUploadProgressListener listener) {
|
public void removeListener(FileUploadProgressListener listener) {
|
||||||
listeners.remove(listener);
|
listeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue