Updated OperationMonitor
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@99250 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
aad85271ee
commit
68034c05c7
|
@ -22,6 +22,9 @@
|
||||||
<dependent-module archiveName="tabular-data-gwt-service-2.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-gwt-service/tabular-data-gwt-service">
|
<dependent-module archiveName="tabular-data-gwt-service-2.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-gwt-service/tabular-data-gwt-service">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
|
<dependent-module archiveName="tabular-data-monitor-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-monitor-widget/tabular-data-monitor-widget">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
<dependent-module archiveName="tabular-data-wizard-widget-1.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-wizard-widget/tabular-data-wizard-widget">
|
<dependent-module archiveName="tabular-data-wizard-widget-1.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-wizard-widget/tabular-data-wizard-widget">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
|
|
9
pom.xml
9
pom.xml
|
@ -237,7 +237,14 @@
|
||||||
<artifactId>tabular-data-gwt-service</artifactId>
|
<artifactId>tabular-data-gwt-service</artifactId>
|
||||||
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
|
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- tabular-data-monitor-widget -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
|
<artifactId>tabular-data-monitor-widget</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- tabular-data-wizard-widget -->
|
<!-- tabular-data-wizard-widget -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.td.client.progress;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
import com.sencha.gxt.widget.core.client.ProgressBar;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class TemplateApplyProgressBarUpdater implements TemplateApplyProgressListener {
|
|
||||||
|
|
||||||
protected ProgressBar progressBar;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new {@link ProgressBar} updater.
|
|
||||||
* @param progressBar the {@link ProgressBar} to update.
|
|
||||||
*/
|
|
||||||
public TemplateApplyProgressBarUpdater(ProgressBar progressBar) {
|
|
||||||
this.progressBar = progressBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void operationComplete(TRId trId) {
|
|
||||||
Log.info("Completed");
|
|
||||||
progressBar.updateProgress(1, "Completed");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void operationFailed(Throwable caught, String reason, String failureDetails) {
|
|
||||||
Log.info("Failed");
|
|
||||||
progressBar.updateText("Failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void operationInitializing() {
|
|
||||||
Log.info("Inizializing");
|
|
||||||
progressBar.updateProgress(0, "Initializing...");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void operationUpdate(float elaborated) {
|
|
||||||
Log.info("Import elaborated: "+elaborated);
|
|
||||||
if (elaborated == 0) progressBar.updateProgress(0, "Initializing...");
|
|
||||||
if (elaborated>0 && elaborated<1) {
|
|
||||||
Log.trace("progress "+elaborated);
|
|
||||||
int elab=new Float(elaborated*100).intValue();
|
|
||||||
progressBar.updateProgress(elaborated,elab+"% Progress...");
|
|
||||||
}
|
|
||||||
if (elaborated == 1) progressBar.updateProgress(1, "Completing...");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void operationStopped(TRId trId,String reason, String details) {
|
|
||||||
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]");
|
|
||||||
progressBar.updateText("Validations failed");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,134 +0,0 @@
|
||||||
package org.gcube.portlets.user.td.client.progress;
|
|
||||||
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.client.template.TemplateApplyDialog;
|
|
||||||
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
|
||||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
|
||||||
import com.sencha.gxt.widget.core.client.ProgressBar;
|
|
||||||
import com.sencha.gxt.widget.core.client.Window;
|
|
||||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
|
||||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
|
||||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LabelColumnProgressDialog is a Dialog that show progress of change the column label
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class TemplateApplyProgressDialog extends Window implements TemplateApplyProgressListener {
|
|
||||||
public static final int STATUS_POLLING_DELAY = 1000;
|
|
||||||
protected String WIDTH = "400px";
|
|
||||||
protected String HEIGHT = "120px";
|
|
||||||
protected TemplateApplyDialog dialog;
|
|
||||||
protected EventBus eventBus;
|
|
||||||
protected TemplateApplyProgressUpdater progressUpdater;
|
|
||||||
protected TextButton ok;
|
|
||||||
protected TRId trId;
|
|
||||||
private ChangeTableWhy why;
|
|
||||||
|
|
||||||
public TemplateApplyProgressDialog(TemplateApplyDialog dialog, EventBus eventBus) {
|
|
||||||
this.dialog=dialog;
|
|
||||||
this.eventBus=eventBus;
|
|
||||||
setWidth(WIDTH);
|
|
||||||
setHeight(HEIGHT);
|
|
||||||
setBodyBorder(false);
|
|
||||||
setResizable(true);
|
|
||||||
setModal(true);
|
|
||||||
setHeadingText("Template Apply Progress");
|
|
||||||
|
|
||||||
trId=null;
|
|
||||||
|
|
||||||
FramedPanel panel=new FramedPanel();
|
|
||||||
panel.setHeaderVisible(false);
|
|
||||||
panel.setBodyBorder(false);
|
|
||||||
|
|
||||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
|
||||||
|
|
||||||
|
|
||||||
ProgressBar progressBar = new ProgressBar();
|
|
||||||
|
|
||||||
ok=new TextButton("OK");
|
|
||||||
ok.addSelectHandler(new SelectHandler() {
|
|
||||||
|
|
||||||
public void onSelect(SelectEvent event) {
|
|
||||||
updateInvocation();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
v.add(progressBar, new VerticalLayoutData(1,
|
|
||||||
1, new Margins(5, 5, 5, 5)));
|
|
||||||
|
|
||||||
panel.add(v);
|
|
||||||
panel.addButton(ok);
|
|
||||||
add(panel);
|
|
||||||
|
|
||||||
|
|
||||||
progressUpdater = new TemplateApplyProgressUpdater();
|
|
||||||
progressUpdater.addListener(new TemplateApplyProgressBarUpdater(progressBar));
|
|
||||||
|
|
||||||
progressUpdater.addListener(this);
|
|
||||||
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
|
||||||
show();
|
|
||||||
ok.setVisible(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void operationInitializing() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void operationUpdate(float elaborated) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void operationComplete(TRId trId) {
|
|
||||||
Log.debug("Operation Complete return: "+trId.toString());
|
|
||||||
this.trId=trId;
|
|
||||||
why=ChangeTableWhy.TABLEUPDATED;
|
|
||||||
updateInvocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void operationFailed(Throwable caught, String reason,
|
|
||||||
String failureDetails) {
|
|
||||||
ok.setVisible(true);
|
|
||||||
this.trId=null;
|
|
||||||
UtilsGXT3.alert("Error in Template Apply", reason);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateInvocation(){
|
|
||||||
if(trId!=null){
|
|
||||||
ChangeTableRequestEvent changeTableRequestEvent=
|
|
||||||
new ChangeTableRequestEvent(ChangeTableRequestType.TEMPLATEAPPLY, trId, why);
|
|
||||||
eventBus.fireEvent(changeTableRequestEvent);
|
|
||||||
}
|
|
||||||
dialog.hide();
|
|
||||||
hide();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void operationStopped(TRId trId,String reason, String details) {
|
|
||||||
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]");
|
|
||||||
ok.setVisible(true);
|
|
||||||
this.trId=trId;
|
|
||||||
why=ChangeTableWhy.TABLECURATION;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.td.client.progress;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines a listener for operation progress.
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface TemplateApplyProgressListener {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the operation is starting.
|
|
||||||
*/
|
|
||||||
public void operationInitializing();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when there is a progress for the operation.
|
|
||||||
* @param elaborated the elaborated part.
|
|
||||||
*/
|
|
||||||
public void operationUpdate(float elaborated);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the operation is complete.
|
|
||||||
*/
|
|
||||||
public void operationComplete(TRId trId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the operation is stopped
|
|
||||||
*
|
|
||||||
* @param trId
|
|
||||||
* @param reason
|
|
||||||
* @param details
|
|
||||||
*/
|
|
||||||
public void operationStopped(TRId trId, String reason, String details);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,181 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.td.client.progress;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.TemplateApplyMonitor;
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
import com.google.gwt.user.client.Timer;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class TemplateApplyProgressUpdater extends Timer {
|
|
||||||
|
|
||||||
protected ArrayList<TemplateApplyProgressListener> listeners = new ArrayList<TemplateApplyProgressListener>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Log.debug("requesting operation progress");
|
|
||||||
TDGWTServiceAsync.INSTANCE
|
|
||||||
.getTemplateApplyMonitor(new AsyncCallback<TemplateApplyMonitor>() {
|
|
||||||
|
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
cancel();
|
|
||||||
Log.error("Error retrieving the operation state",
|
|
||||||
caught);
|
|
||||||
String message = getStack(caught);
|
|
||||||
fireOperationFailed(caught,
|
|
||||||
"Failed getting operation updates", message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSuccess(TemplateApplyMonitor result) {
|
|
||||||
Log.info("retrieved TemplateApplyMonitor: "
|
|
||||||
+ result.getStatus());
|
|
||||||
switch (result.getStatus()) {
|
|
||||||
case INITIALIZING:
|
|
||||||
Log.info("Initializing...");
|
|
||||||
fireOperationInitializing();
|
|
||||||
break;
|
|
||||||
case ABORTED:
|
|
||||||
cancel();
|
|
||||||
Log.info("Template Apply Operation Aborted");
|
|
||||||
break;
|
|
||||||
case IN_PROGRESS:
|
|
||||||
fireOperationUpdate(result.getProgress());
|
|
||||||
break;
|
|
||||||
case VALIDATING_RULES:
|
|
||||||
fireOperationUpdate(result.getProgress());
|
|
||||||
break;
|
|
||||||
case STOPPED:
|
|
||||||
cancel();
|
|
||||||
stopMessage(result);
|
|
||||||
break;
|
|
||||||
case FAILED:
|
|
||||||
cancel();
|
|
||||||
errorMessage(result);
|
|
||||||
break;
|
|
||||||
case SUCCEDED:
|
|
||||||
cancel();
|
|
||||||
Log.info("Fisnish TableId :"
|
|
||||||
+ result.getTrId());
|
|
||||||
fireOperationComplete(result.getTrId());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Log.info("Unknow State");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void errorMessage(TemplateApplyMonitor result) {
|
|
||||||
Log.info("Template Apply Failed");
|
|
||||||
Throwable th = null;
|
|
||||||
String failure = null;
|
|
||||||
String details = null;
|
|
||||||
if (result.getError() != null) {
|
|
||||||
th = result.getError();
|
|
||||||
failure = "Failed Client Library applying template";
|
|
||||||
details = result.getError().getLocalizedMessage();
|
|
||||||
} else {
|
|
||||||
th = new Throwable("Failed");
|
|
||||||
failure = "Failed Client Library applying template";
|
|
||||||
details = "Template Apply failed";
|
|
||||||
}
|
|
||||||
|
|
||||||
fireOperationFailed(th, failure, details);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void stopMessage(TemplateApplyMonitor result) {
|
|
||||||
Log.info("Template Apply Stopped");
|
|
||||||
String failure = null;
|
|
||||||
String details = null;
|
|
||||||
if (result.getError() != null) {
|
|
||||||
failure = "Stopped applying template";
|
|
||||||
details = result.getError().getLocalizedMessage();
|
|
||||||
} else {
|
|
||||||
failure = "Stopped applying template";
|
|
||||||
details = "Apply template stopped";
|
|
||||||
}
|
|
||||||
|
|
||||||
fireOperationStopped(result.getTrId(),failure, details);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected String getStack(Throwable e) {
|
|
||||||
String message = e.getLocalizedMessage() + " -> <br>";
|
|
||||||
Throwable c = e.getCause();
|
|
||||||
if (c != null)
|
|
||||||
message += getStack(c);
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void fireOperationInitializing() {
|
|
||||||
for (TemplateApplyProgressListener listener : listeners)
|
|
||||||
listener.operationInitializing();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void fireOperationUpdate(float elaborated) {
|
|
||||||
for (TemplateApplyProgressListener listener : listeners)
|
|
||||||
listener.operationUpdate(elaborated);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void fireOperationComplete(TRId trId) {
|
|
||||||
for (TemplateApplyProgressListener listener : listeners)
|
|
||||||
listener.operationComplete(trId);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void fireOperationFailed(Throwable caught, String failure,
|
|
||||||
String failureDetails) {
|
|
||||||
for (TemplateApplyProgressListener listener : listeners)
|
|
||||||
listener.operationFailed(caught, failure, failureDetails);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
|
||||||
for (TemplateApplyProgressListener listener : listeners)
|
|
||||||
listener.operationStopped(trId,reason, details);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a new {@link TemplateApplyProgressListener} to this
|
|
||||||
* {@link TemplateApplyProgressUpdater}.
|
|
||||||
*
|
|
||||||
* @param listener
|
|
||||||
* the listener to add.
|
|
||||||
*/
|
|
||||||
public void addListener(TemplateApplyProgressListener listener) {
|
|
||||||
listeners.add(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the specified {@link TemplateApplyProgressListener} from this
|
|
||||||
* {@link TemplateApplyProgressUpdater}.
|
|
||||||
*
|
|
||||||
* @param listener
|
|
||||||
* the listener to remove.
|
|
||||||
*/
|
|
||||||
public void removeListener(TemplateApplyProgressListener listener) {
|
|
||||||
listeners.remove(listener);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +1,14 @@
|
||||||
package org.gcube.portlets.user.td.client.template;
|
package org.gcube.portlets.user.td.client.template;
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.client.progress.TemplateApplyProgressDialog;
|
|
||||||
import org.gcube.portlets.user.td.client.resource.TabularDataResources;
|
import org.gcube.portlets.user.td.client.resource.TabularDataResources;
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySession;
|
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySession;
|
||||||
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||||
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||||
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
|
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
@ -21,7 +25,7 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TemplateApplyDialog extends Window {
|
public class TemplateApplyDialog extends Window implements MonitorDialogListener{
|
||||||
protected String WIDTH = "650px";
|
protected String WIDTH = "650px";
|
||||||
protected String HEIGHT = "530px";
|
protected String HEIGHT = "530px";
|
||||||
protected TemplateApplySession templateApplySession;
|
protected TemplateApplySession templateApplySession;
|
||||||
|
@ -76,7 +80,7 @@ public class TemplateApplyDialog extends Window {
|
||||||
this.templateApplySession=templateApplySession;
|
this.templateApplySession=templateApplySession;
|
||||||
|
|
||||||
TDGWTServiceAsync.INSTANCE.startTemplateApply(templateApplySession,
|
TDGWTServiceAsync.INSTANCE.startTemplateApply(templateApplySession,
|
||||||
new AsyncCallback<Void>() {
|
new AsyncCallback<String>() {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Log.debug("Apply Template Error: "
|
Log.debug("Apply Template Error: "
|
||||||
+ caught.getLocalizedMessage());
|
+ caught.getLocalizedMessage());
|
||||||
|
@ -85,8 +89,8 @@ public class TemplateApplyDialog extends Window {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSuccess(Void result) {
|
public void onSuccess(String taskId) {
|
||||||
callApplyTemplateProgressDialog();
|
openMonitorDialog(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -95,16 +99,50 @@ public class TemplateApplyDialog extends Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void openMonitorDialog(String taskId){
|
||||||
|
MonitorDialog monitorDialog=new MonitorDialog(taskId,eventBus);
|
||||||
|
monitorDialog.add(this);
|
||||||
|
monitorDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
protected void callApplyTemplateProgressDialog() {
|
@Override
|
||||||
TemplateApplyProgressDialog d = new TemplateApplyProgressDialog(
|
public void operationComplete(TRId trId) {
|
||||||
this, eventBus);
|
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||||
d.show();
|
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||||
|
ChangeTableRequestType.TEMPLATEAPPLY, trId, why);
|
||||||
|
eventBus.fireEvent(changeTableRequestEvent);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationFailed(Throwable caught, String reason, String details) {
|
||||||
|
UtilsGXT3.alert(reason, details);
|
||||||
|
close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationStopped(TRId trId, String reason, String details) {
|
||||||
|
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||||
|
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||||
|
ChangeTableRequestType.TEMPLATEAPPLY, trId, why);
|
||||||
|
eventBus.fireEvent(changeTableRequestEvent);
|
||||||
|
close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationAborted() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationPutInBackground() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class TemplateDeleteDialog extends Window {
|
||||||
protected void templatesDelete(final TemplateDeleteSession templateDeleteSession){
|
protected void templatesDelete(final TemplateDeleteSession templateDeleteSession){
|
||||||
this.templateDeleteSession=templateDeleteSession;
|
this.templateDeleteSession=templateDeleteSession;
|
||||||
|
|
||||||
TDGWTServiceAsync.INSTANCE.startTemplateDelete(templateDeleteSession,
|
TDGWTServiceAsync.INSTANCE.templateDelete(templateDeleteSession,
|
||||||
new AsyncCallback<Void>() {
|
new AsyncCallback<Void>() {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Log.debug("Delete Template Error: "
|
Log.debug("Delete Template Error: "
|
||||||
|
|
|
@ -14,10 +14,12 @@
|
||||||
|
|
||||||
<!-- <inherits name='org.gcube.portlets.user.td.ciw.csvimporterwidget' /> -->
|
<!-- <inherits name='org.gcube.portlets.user.td.ciw.csvimporterwidget' /> -->
|
||||||
|
|
||||||
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
|
||||||
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
|
|
||||||
<inherits
|
<inherits
|
||||||
name='org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent' />
|
name='org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent' />
|
||||||
|
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
||||||
|
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
|
||||||
|
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
|
||||||
|
|
||||||
<inherits
|
<inherits
|
||||||
name='org.gcube.portlets.user.td.expressionwidget.ExpressionWidget' />
|
name='org.gcube.portlets.user.td.expressionwidget.ExpressionWidget' />
|
||||||
<inherits name='org.gcube.portlets.user.td.tablewidget.TableWidget' />
|
<inherits name='org.gcube.portlets.user.td.tablewidget.TableWidget' />
|
||||||
|
|
|
@ -14,10 +14,12 @@
|
||||||
|
|
||||||
<!-- <inherits name='org.gcube.portlets.user.td.ciw.csvimporterwidget' /> -->
|
<!-- <inherits name='org.gcube.portlets.user.td.ciw.csvimporterwidget' /> -->
|
||||||
|
|
||||||
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
|
||||||
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
|
|
||||||
<inherits
|
<inherits
|
||||||
name='org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent' />
|
name='org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent' />
|
||||||
|
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
||||||
|
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
|
||||||
|
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
|
||||||
|
|
||||||
<inherits
|
<inherits
|
||||||
name='org.gcube.portlets.user.td.expressionwidget.ExpressionWidget' />
|
name='org.gcube.portlets.user.td.expressionwidget.ExpressionWidget' />
|
||||||
<inherits name='org.gcube.portlets.user.td.tablewidget.TableWidget' />
|
<inherits name='org.gcube.portlets.user.td.tablewidget.TableWidget' />
|
||||||
|
|
Loading…
Reference in New Issue