Fixed maven-portal-bom
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@95955 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
373b2ef012
commit
13293d3b21
|
@ -3578,3 +3578,67 @@ Compiling...
|
|||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 0 cached/archived units. Used 0 / 2719 units from cache.
|
||||
Compiling...
|
||||
30% complete (ETR: 8 seconds)
|
||||
30% complete (ETR: 8 seconds)
|
||||
30% complete (ETR: 8 seconds)
|
||||
30% complete (ETR: 8 seconds)
|
||||
40% complete (ETR: 8 seconds)
|
||||
50% complete (ETR: 6 seconds)
|
||||
60% complete (ETR: 4 seconds)
|
||||
70% complete (ETR: 3 seconds)
|
||||
80% complete (ETR: 2 seconds)
|
||||
90% complete (ETR: 1 seconds)
|
||||
100% complete (ETR: 0 seconds)
|
||||
Compilation completed in 20.05 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 0 cached/archived units. Used 0 / 2719 units from cache.
|
||||
Compiling...
|
||||
60% complete (ETR: 2 seconds)
|
||||
60% complete (ETR: 2 seconds)
|
||||
60% complete (ETR: 2 seconds)
|
||||
60% complete (ETR: 2 seconds)
|
||||
60% complete (ETR: 2 seconds)
|
||||
60% complete (ETR: 2 seconds)
|
||||
60% complete (ETR: 2 seconds)
|
||||
70% complete (ETR: 2 seconds)
|
||||
80% complete (ETR: 1 seconds)
|
||||
90% complete (ETR: 1 seconds)
|
||||
100% complete (ETR: 0 seconds)
|
||||
Compilation completed in 9.81 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
|
|
1
pom.xml
1
pom.xml
|
@ -136,6 +136,7 @@
|
|||
<dependency>
|
||||
<groupId>com.allen-sauer.gwt.log</groupId>
|
||||
<artifactId>gwt-log</artifactId>
|
||||
<version>3.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.batch;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.ProgressDialogListener;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.ReplaceBatchColumnProgressDialog;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.ResubmitDialogListener;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.TaskResubmitProgressDialog;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResubmitSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceBatchColumnSession;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
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.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.RequestProperties;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
@ -24,37 +32,43 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ReplaceBatchDialog extends Window {
|
||||
public class ReplaceBatchDialog extends Window implements
|
||||
ProgressDialogListener, ResubmitDialogListener {
|
||||
protected String WIDTH = "650px";
|
||||
protected String HEIGHT = "530px";
|
||||
protected TRId trId;
|
||||
protected String columnName = null;
|
||||
protected RequestProperties requestProperties;
|
||||
protected EventBus eventBus;
|
||||
|
||||
protected String taskId;
|
||||
|
||||
public ReplaceBatchDialog(TRId trId, String columnName, EventBus eventBus) {
|
||||
this.trId = trId;
|
||||
this.columnName = columnName;
|
||||
this.eventBus = eventBus;
|
||||
taskId = null;
|
||||
initWindow();
|
||||
ReplaceBatchPanel batchRepalcePanel = new ReplaceBatchPanel(this, trId,
|
||||
columnName, eventBus);
|
||||
add(batchRepalcePanel);
|
||||
}
|
||||
|
||||
public ReplaceBatchDialog(TRId trId,
|
||||
RequestProperties requestProperties, EventBus eventBus) {
|
||||
Log.debug("ReplaceBatchDialog: "+trId+", RequestProperties:"+requestProperties);
|
||||
|
||||
public ReplaceBatchDialog(TRId trId, RequestProperties requestProperties,
|
||||
EventBus eventBus) {
|
||||
Log.debug("ReplaceBatchDialog: " + trId + ", RequestProperties:"
|
||||
+ requestProperties);
|
||||
this.trId = trId;
|
||||
this.requestProperties=requestProperties;
|
||||
this.requestProperties = requestProperties;
|
||||
this.eventBus = eventBus;
|
||||
taskId = (String) requestProperties.getMap().get(
|
||||
Constants.REQUEST_PROPERTIES_TASKID);
|
||||
Log.debug("Resubmit TaskId:" + taskId);
|
||||
initWindow();
|
||||
|
||||
ReplaceBatchPanel batchRepalcePanel = new ReplaceBatchPanel(this, trId,
|
||||
requestProperties, eventBus);
|
||||
add(batchRepalcePanel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void initWindow() {
|
||||
setWidth(WIDTH);
|
||||
|
@ -121,9 +135,105 @@ public class ReplaceBatchDialog extends Window {
|
|||
|
||||
protected void callReplaceBatchColumnProgressDialog() {
|
||||
ReplaceBatchColumnProgressDialog dialog = new ReplaceBatchColumnProgressDialog(
|
||||
this, eventBus);
|
||||
eventBus);
|
||||
dialog.add(this);
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
if (taskId != null) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
hide();
|
||||
} else {
|
||||
this.trId=trId;
|
||||
StartTaskResubmit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason) {
|
||||
UtilsGXT3.alert("Error in Replace Batch", reason);
|
||||
hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(TRId trId, String reason, String details) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
hide();
|
||||
|
||||
}
|
||||
|
||||
protected void StartTaskResubmit(){
|
||||
TaskResubmitSession taskResubmitSession=new TaskResubmitSession(trId,taskId);
|
||||
TDGWTServiceAsync.INSTANCE.startTaskResubmit(taskResubmitSession, new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Task Resubmit failed:"
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error on task resubmit",
|
||||
"Error on task resubmit (taskId="+taskId+")");
|
||||
}
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(Void v) {
|
||||
Log.trace("Started task resubmit");
|
||||
callForTaskResubmit();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected void callForTaskResubmit(){
|
||||
TaskResubmitProgressDialog dialog = new TaskResubmitProgressDialog(
|
||||
eventBus);
|
||||
dialog.add(this);
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void resubmitComplete(TRId trId) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
hide();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resubmitFailed(Throwable caught, String reason) {
|
||||
UtilsGXT3.alert("Error in Task Resubmit", reason);
|
||||
hide();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resubmitStopped(TRId trId, String reason, String details) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
hide();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.progress;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
public interface ProgressDialogListener {
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Called when the operation is stopped
|
||||
*
|
||||
* @param trId
|
||||
* @param reason
|
||||
* @param details
|
||||
*/
|
||||
public void operationStopped(TRId trId, String reason, String details);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,12 +1,9 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.progress;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.batch.ReplaceBatchDialog;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
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.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
|
@ -32,19 +29,19 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|||
*/
|
||||
public class ReplaceBatchColumnProgressDialog extends Window implements
|
||||
ReplaceBatchColumnProgressListener {
|
||||
protected ArrayList<ProgressDialogListener> listeners = new ArrayList<ProgressDialogListener>();
|
||||
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
protected String WIDTH = "400px";
|
||||
protected String HEIGHT = "120px";
|
||||
protected ReplaceBatchDialog parent;
|
||||
protected EventBus eventBus;
|
||||
protected ReplaceBatchColumnProgressUpdater progressUpdater;
|
||||
protected TextButton ok;
|
||||
protected TRId trId;
|
||||
private ChangeTableWhy why;
|
||||
private String reason;
|
||||
private String details;
|
||||
|
||||
public ReplaceBatchColumnProgressDialog(ReplaceBatchDialog parent,
|
||||
EventBus eventBus) {
|
||||
this.parent = parent;
|
||||
public ReplaceBatchColumnProgressDialog(EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
|
@ -90,6 +87,15 @@ public class ReplaceBatchColumnProgressDialog extends Window implements
|
|||
|
||||
}
|
||||
|
||||
|
||||
public void addProgressDialogListener(ProgressDialogListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeProgressDialogListener(ProgressDialogListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
public void operationInitializing() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
@ -103,8 +109,8 @@ public class ReplaceBatchColumnProgressDialog extends Window implements
|
|||
public void operationComplete(TRId trId) {
|
||||
Log.debug("Operation Complete return: " + trId.toString());
|
||||
this.trId = trId;
|
||||
why = ChangeTableWhy.TABLEUPDATED;
|
||||
updateInvocation();
|
||||
fireOperationComplete(trId);
|
||||
hide();
|
||||
}
|
||||
|
||||
public void operationFailed(Throwable caught, String reason,
|
||||
|
@ -113,19 +119,16 @@ public class ReplaceBatchColumnProgressDialog extends Window implements
|
|||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
ok.setVisible(true);
|
||||
this.trId = null;
|
||||
UtilsGXT3.alert("Error Replacing The Column Value", reason);
|
||||
fireOperationFailed(caught,reason);
|
||||
hide();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void updateInvocation() {
|
||||
if (trId != null) {
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
fireOperationStopped(trId, reason, details);
|
||||
}
|
||||
parent.hide();
|
||||
hide();
|
||||
|
||||
}
|
||||
|
@ -134,9 +137,11 @@ public class ReplaceBatchColumnProgressDialog extends Window implements
|
|||
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;
|
||||
this.reason=reason;
|
||||
this.details=details;
|
||||
ok.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,4 +155,21 @@ public class ReplaceBatchColumnProgressDialog extends Window implements
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
protected void fireOperationComplete(TRId trId) {
|
||||
for (ProgressDialogListener listener : listeners)
|
||||
listener.operationComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String reason) {
|
||||
for (ProgressDialogListener listener : listeners)
|
||||
listener.operationFailed(caught, reason);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (ProgressDialogListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.progress;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
public interface ResubmitDialogListener {
|
||||
|
||||
|
||||
/**
|
||||
* Called when the resubmit of task is complete.
|
||||
*/
|
||||
public void resubmitComplete(TRId trId);
|
||||
|
||||
/**
|
||||
* Called when the resubmit of task is failed.
|
||||
* @param caught the failure exception.
|
||||
* @param reason the failure reason.
|
||||
*/
|
||||
public void resubmitFailed(Throwable caught, String reason);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Called when the resubmit of task is stopped
|
||||
*
|
||||
* @param trId
|
||||
* @param reason
|
||||
* @param details
|
||||
*/
|
||||
public void resubmitStopped(TRId trId, String reason, String details);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.columnwidget.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 TaskResubmitProgressBarUpdater implements TaskResubmitProgressListener {
|
||||
|
||||
protected ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ProgressBar} updater.
|
||||
* @param progressBar the {@link ProgressBar} to update.
|
||||
*/
|
||||
public TaskResubmitProgressBarUpdater(ProgressBar progressBar) {
|
||||
this.progressBar = progressBar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
Log.info("Completed");
|
||||
progressBar.updateProgress(1, "Completed");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason, String failureDetails) {
|
||||
Log.info("Failed");
|
||||
progressBar.updateText("Failed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationInitializing() {
|
||||
Log.info("Inizializing");
|
||||
progressBar.updateProgress(0, "Initializing...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationUpdate(float elaborated) {
|
||||
Log.info("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 operationValidate(float elaborated) {
|
||||
Log.info("Validation Elaborated: "+elaborated);
|
||||
if (elaborated == 0) progressBar.updateProgress(0, "Start Validation...");
|
||||
if (elaborated>0 && elaborated<1) {
|
||||
Log.trace("Validation progress "+elaborated);
|
||||
int elab=new Float(elaborated*100).intValue();
|
||||
progressBar.updateProgress(elaborated,elab+"% Validation Progress...");
|
||||
}
|
||||
if (elaborated == 1) progressBar.updateProgress(1, "Validation...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(TRId trId,String reason, String details) {
|
||||
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]");
|
||||
progressBar.updateText("Validations failed");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationGeneratingView() {
|
||||
Log.info("Generating View...");
|
||||
progressBar.updateText("Generating View...");
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,180 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.progress;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
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;
|
||||
|
||||
/**
|
||||
* TaskResubmitProgressDialog is a Dialog that show progress of resubmit a Task
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TaskResubmitProgressDialog extends Window implements
|
||||
TaskResubmitProgressListener {
|
||||
protected ArrayList<ResubmitDialogListener> listeners = new ArrayList<ResubmitDialogListener>();
|
||||
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
protected String WIDTH = "400px";
|
||||
protected String HEIGHT = "120px";
|
||||
protected EventBus eventBus;
|
||||
protected TaskResubmitProgressUpdater progressUpdater;
|
||||
protected TextButton ok;
|
||||
protected TRId trId;
|
||||
private String reason;
|
||||
|
||||
private String details;
|
||||
|
||||
public TaskResubmitProgressDialog(
|
||||
EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(true);
|
||||
setModal(true);
|
||||
setHeadingText("Task Resubmit 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 TaskResubmitProgressUpdater();
|
||||
progressUpdater.addListener(new TaskResubmitProgressBarUpdater(
|
||||
progressBar));
|
||||
|
||||
progressUpdater.addListener(this);
|
||||
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
||||
show();
|
||||
ok.setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
public void addResubmitDialogListener(ResubmitDialogListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeResubmitDialogListener(ResubmitDialogListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationInitializing() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationUpdate(float elaborated) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
Log.debug("Operation Complete return: " + trId.toString());
|
||||
this.trId = trId;
|
||||
fireResubmitComplete(trId);
|
||||
hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason,
|
||||
String failureDetails) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
fireResubmitFailed(caught,reason);
|
||||
hide();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void updateInvocation() {
|
||||
if (trId != null) {
|
||||
fireResubmitStopped(trId, reason, details);
|
||||
}
|
||||
hide();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(TRId trId, String reason, String details) {
|
||||
Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason
|
||||
+ ", " + details + "]");
|
||||
this.trId = trId;
|
||||
this.reason=reason;
|
||||
this.details=details;
|
||||
ok.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationGeneratingView() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationValidate(float elaborated) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void fireResubmitComplete(TRId trId) {
|
||||
for (ResubmitDialogListener listener : listeners)
|
||||
listener.resubmitComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireResubmitFailed(Throwable caught, String reason) {
|
||||
for (ResubmitDialogListener listener : listeners)
|
||||
listener.resubmitFailed(caught, reason);
|
||||
}
|
||||
|
||||
protected void fireResubmitStopped(TRId trId, String reason, String details) {
|
||||
for (ResubmitDialogListener listener : listeners)
|
||||
listener.resubmitStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.columnwidget.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 TaskResubmitProgressListener {
|
||||
|
||||
/**
|
||||
* 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 there is a validate for the operation.
|
||||
* @param elaborated the elaborated part.
|
||||
*/
|
||||
public void operationValidate(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);
|
||||
|
||||
/**
|
||||
* Called when the operation is generating the view
|
||||
*/
|
||||
public void operationGeneratingView();
|
||||
|
||||
}
|
|
@ -0,0 +1,195 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.columnwidget.client.progress;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResubmitMonitor;
|
||||
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 TaskResubmitProgressUpdater extends Timer {
|
||||
|
||||
protected ArrayList<TaskResubmitProgressListener> listeners = new ArrayList<TaskResubmitProgressListener>();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Log.debug("requesting operation progress");
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getTaskResubmitMonitor(new AsyncCallback<TaskResubmitMonitor>() {
|
||||
|
||||
|
||||
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(TaskResubmitMonitor result) {
|
||||
Log.info("retrieved TaskResubmitMonitor: "
|
||||
+ result.getStatus());
|
||||
switch (result.getStatus()) {
|
||||
case INITIALIZING:
|
||||
Log.info("Initializing...");
|
||||
fireOperationInitializing();
|
||||
break;
|
||||
case ABORTED:
|
||||
cancel();
|
||||
Log.info("Delete Rows Operation Aborted");
|
||||
break;
|
||||
case IN_PROGRESS:
|
||||
fireOperationUpdate(result.getProgress());
|
||||
break;
|
||||
case VALIDATING_RULES:
|
||||
fireOperationValidate(result.getProgress());
|
||||
break;
|
||||
case GENERATING_VIEW:
|
||||
Log.info("Generating View...");
|
||||
fireOperationGeneratingView();
|
||||
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(TaskResubmitMonitor result) {
|
||||
Log.info("Task Resubmit Failed");
|
||||
Throwable th = null;
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
th = result.getError();
|
||||
failure = "Failed Client Library Task Resubmit";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
th = new Throwable("Failed");
|
||||
failure = "Failed Client Library Task Resubmit";
|
||||
details = "Task Resubmit failed";
|
||||
}
|
||||
|
||||
fireOperationFailed(th, failure, details);
|
||||
}
|
||||
|
||||
protected void stopMessage(TaskResubmitMonitor result) {
|
||||
Log.info("Task Resubmit Stopped");
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
failure = "Stopped task resubmit";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
failure = "Stopped task resubmit";
|
||||
details = "Task Resubmit 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 (TaskResubmitProgressListener listener : listeners)
|
||||
listener.operationInitializing();
|
||||
}
|
||||
|
||||
protected void fireOperationGeneratingView() {
|
||||
for (TaskResubmitProgressListener listener : listeners)
|
||||
listener.operationGeneratingView();
|
||||
}
|
||||
|
||||
protected void fireOperationUpdate(float elaborated) {
|
||||
for (TaskResubmitProgressListener listener : listeners)
|
||||
listener.operationUpdate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationValidate(float elaborated) {
|
||||
for (TaskResubmitProgressListener listener : listeners)
|
||||
listener.operationValidate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationComplete(TRId trId) {
|
||||
for (TaskResubmitProgressListener listener : listeners)
|
||||
listener.operationComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String failure,
|
||||
String failureDetails) {
|
||||
for (TaskResubmitProgressListener listener : listeners)
|
||||
listener.operationFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (TaskResubmitProgressListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new {@link TaskResubmitProgressListener} to this
|
||||
* {@link TaskResubmitProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to add.
|
||||
*/
|
||||
public void addListener(TaskResubmitProgressListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link TaskResubmitProgressListener} from this
|
||||
* {@link TaskResubmitProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to remove.
|
||||
*/
|
||||
public void removeListener(TaskResubmitProgressListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue