Updated OperationMonitor
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@99294 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
41fecb1994
commit
9526fa1d40
13
.classpath
13
.classpath
|
@ -22,18 +22,18 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/giancarlo/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/gwt-user.jar">
|
||||
<classpathentry kind="lib" path="/home/giancarlo/gwt-2.5.1/gwt-user.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="file:/home/giancarlo/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/doc/javadoc/"/>
|
||||
<attribute name="javadoc_location" value="file:/home/giancarlo/gwt-2.5.1/doc/javadoc/"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/giancarlo/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/gwt-dev.jar">
|
||||
<classpathentry kind="lib" path="/home/giancarlo/gwt-2.5.1/gwt-dev.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="file:/home/giancarlo/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/doc/javadoc/"/>
|
||||
<attribute name="javadoc_location" value="file:/home/giancarlo/gwt-2.5.1/doc/javadoc/"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/giancarlo/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/validation-api-1.0.0.GA.jar" sourcepath="/home/giancarlo/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/validation-api-1.0.0.GA-sources.jar"/>
|
||||
<classpathentry kind="lib" path="/home/giancarlo/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/validation-api-1.0.0.GA-sources.jar"/>
|
||||
<classpathentry kind="lib" path="/home/giancarlo/gwt-2.5.1/validation-api-1.0.0.GA.jar" sourcepath="/home/giancarlo/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/validation-api-1.0.0.GA-sources.jar"/>
|
||||
<classpathentry kind="lib" path="/home/giancarlo/gwt-2.5.1/validation-api-1.0.0.GA-sources.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -44,5 +44,6 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
|
||||
<classpathentry kind="output" path="target/tabular-data-column-widget-1.3.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
128
.gwt/.gwt-log
128
.gwt/.gwt-log
|
@ -5594,3 +5594,131 @@ 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...
|
||||
10% complete (ETR: 28 seconds)
|
||||
10% complete (ETR: 28 seconds)
|
||||
20% complete (ETR: 22 seconds)
|
||||
30% complete (ETR: 16 seconds)
|
||||
40% complete (ETR: 13 seconds)
|
||||
50% complete (ETR: 9 seconds)
|
||||
60% complete (ETR: 7 seconds)
|
||||
70% complete (ETR: 5 seconds)
|
||||
80% complete (ETR: 3 seconds)
|
||||
90% complete (ETR: 1 seconds)
|
||||
100% complete (ETR: 0 seconds)
|
||||
Compilation completed in 16.26 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...
|
||||
20% complete (ETR: 17 seconds)
|
||||
20% complete (ETR: 17 seconds)
|
||||
20% complete (ETR: 17 seconds)
|
||||
30% complete (ETR: 16 seconds)
|
||||
40% complete (ETR: 13 seconds)
|
||||
50% complete (ETR: 10 seconds)
|
||||
60% complete (ETR: 8 seconds)
|
||||
70% complete (ETR: 6 seconds)
|
||||
80% complete (ETR: 3 seconds)
|
||||
90% complete (ETR: 2 seconds)
|
||||
100% complete (ETR: 0 seconds)
|
||||
Compilation completed in 20.02 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...
|
||||
30% complete (ETR: 11 seconds)
|
||||
30% complete (ETR: 11 seconds)
|
||||
30% complete (ETR: 11 seconds)
|
||||
30% complete (ETR: 11 seconds)
|
||||
40% complete (ETR: 9 seconds)
|
||||
50% complete (ETR: 7 seconds)
|
||||
60% complete (ETR: 5 seconds)
|
||||
70% complete (ETR: 4 seconds)
|
||||
80% complete (ETR: 2 seconds)
|
||||
90% complete (ETR: 1 seconds)
|
||||
100% complete (ETR: 0 seconds)
|
||||
Compilation completed in 13.64 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...
|
||||
10% complete (ETR: 25 seconds)
|
||||
10% complete (ETR: 25 seconds)
|
||||
20% complete (ETR: 23 seconds)
|
||||
30% complete (ETR: 19 seconds)
|
||||
40% complete (ETR: 15 seconds)
|
||||
50% complete (ETR: 11 seconds)
|
||||
60% complete (ETR: 9 seconds)
|
||||
70% complete (ETR: 6 seconds)
|
||||
80% complete (ETR: 4 seconds)
|
||||
90% complete (ETR: 2 seconds)
|
||||
100% complete (ETR: 0 seconds)
|
||||
Compilation completed in 21.72 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
|
||||
|
|
11
pom.xml
11
pom.xml
|
@ -123,6 +123,7 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- TDX Source -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
|
@ -130,7 +131,15 @@
|
|||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</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>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- LOGGING -->
|
||||
<dependency>
|
||||
<groupId>com.allen-sauer.gwt.log</groupId>
|
||||
|
|
|
@ -33,21 +33,25 @@ public class ChangeColumnTypeDialog extends Window {
|
|||
}
|
||||
|
||||
protected void create(TRId trId, String columnName, EventBus eventBus) {
|
||||
this.trId=trId;
|
||||
this.columnName=columnName;
|
||||
initWindow();
|
||||
ChangeColumnTypePanel changeColumnTypePanel= new ChangeColumnTypePanel(trId, columnName, eventBus);
|
||||
add(changeColumnTypePanel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void initWindow() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(false);
|
||||
setHeadingText("Change Column Type");
|
||||
//getHeader().setIcon(Resources.IMAGES.side_list());
|
||||
this.trId=trId;
|
||||
this.columnName=columnName;
|
||||
|
||||
ChangeColumnTypePanel changeColumnTypePanel= new ChangeColumnTypePanel(trId, columnName, eventBus);
|
||||
add(changeColumnTypePanel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -7,8 +7,6 @@ import org.gcube.portlets.user.td.columnwidget.client.dimension.CodelistSelectio
|
|||
import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingDialog;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingListProperties;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingListener;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.ChangeColumnTypeProgressDialog;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.ProgressDialogListener;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataPropertiesCombo;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataTypeProperties;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnTypeCodeProperties;
|
||||
|
@ -30,6 +28,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||
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;
|
||||
|
@ -82,8 +82,8 @@ import com.sencha.gxt.widget.core.client.info.Info;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ChangeColumnTypePanel extends FramedPanel implements
|
||||
CodelistSelectionListener, ColumnMappingListener, ProgressDialogListener{
|
||||
public class ChangeColumnTypePanel extends FramedPanel implements
|
||||
CodelistSelectionListener, ColumnMappingListener, MonitorDialogListener{
|
||||
protected String WIDTH = "640px";
|
||||
protected String HEIGHT = "520px";
|
||||
protected EventBus eventBus;
|
||||
|
@ -125,7 +125,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
protected TextButton change;
|
||||
|
||||
protected ChangeColumnTypeSession changeColumnTypeSession;
|
||||
protected ChangeColumnTypeProgressDialog changeColumnTypeProgressDialog;
|
||||
|
||||
|
||||
public ChangeColumnTypePanel(TRId trId, String columnName, EventBus eventBus) {
|
||||
setWidth(WIDTH);
|
||||
|
@ -927,7 +927,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
|
||||
private void callChangeColumnType() {
|
||||
TDGWTServiceAsync.INSTANCE.startChangeColumnType(
|
||||
changeColumnTypeSession, new AsyncCallback<Void>() {
|
||||
changeColumnTypeSession, new AsyncCallback<String>() {
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
|
@ -941,9 +941,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
}
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
callChangeColumnTypeProgressDialog();
|
||||
|
||||
public void onSuccess(String taskId) {
|
||||
openMonitorDialog(taskId);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1108,13 +1107,13 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected void callChangeColumnTypeProgressDialog(){
|
||||
changeColumnTypeProgressDialog = new ChangeColumnTypeProgressDialog(
|
||||
eventBus);
|
||||
changeColumnTypeProgressDialog.addProgressDialogListener(this);
|
||||
changeColumnTypeProgressDialog.show();
|
||||
}
|
||||
|
||||
///
|
||||
protected void openMonitorDialog(String taskId){
|
||||
MonitorDialog monitorDialog=new MonitorDialog(taskId,eventBus);
|
||||
monitorDialog.add(this);
|
||||
monitorDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
|
@ -1122,14 +1121,14 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.CHANGECOLUMNTYPE, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason) {
|
||||
UtilsGXT3.alert("Error in Change Column Type", reason);
|
||||
public void operationFailed(Throwable caught, String reason, String details) {
|
||||
UtilsGXT3.alert(reason, details);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1139,8 +1138,21 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
ChangeTableRequestType.CHANGECOLUMNTYPE, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationAborted() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationPutInBackground() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
|||
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.widget.core.client.Window;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||
|
||||
/**
|
||||
|
@ -34,9 +36,41 @@ public class DeleteColumnDialog extends Window {
|
|||
this.trId = trId;
|
||||
this.columnName = columnName;
|
||||
this.eventBus=eventBus;
|
||||
setBodyBorder(false);
|
||||
initWindow();
|
||||
|
||||
DeleteColumnPanel deleteColumnPanel= new DeleteColumnPanel(trId, columnName, eventBus);
|
||||
add(deleteColumnPanel);
|
||||
}
|
||||
|
||||
protected void initWindow() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(false);
|
||||
setHeadingText("Delete Columns");
|
||||
//getHeader().setIcon(Resources.IMAGES.side_list());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void initTools() {
|
||||
super.initTools();
|
||||
|
||||
closeBtn.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void close() {
|
||||
hide();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.gcube.portlets.user.td.columnwidget.client;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.DeleteColumnProgressDialog;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataProperties;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
||||
|
@ -11,7 +10,12 @@ import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.DeleteColumnSession;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||
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;
|
||||
|
||||
|
@ -59,11 +63,12 @@ import com.sencha.gxt.widget.core.client.grid.Grid;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class DeleteColumnPanel extends FramedPanel {
|
||||
public class DeleteColumnPanel extends FramedPanel implements
|
||||
MonitorDialogListener {
|
||||
protected String WIDTH = "640px";
|
||||
protected String HEIGHT = "520px";
|
||||
protected EventBus eventBus;
|
||||
protected ChangeColumnTypeDialog parent;
|
||||
protected DeleteColumnDialog parent;
|
||||
protected TextField label = null;
|
||||
protected TRId trId;
|
||||
protected String columnName;
|
||||
|
@ -77,7 +82,7 @@ public class DeleteColumnPanel extends FramedPanel {
|
|||
protected FieldLabel columnsSelectLabel;
|
||||
|
||||
protected DeleteColumnSession deleteColumnSession;
|
||||
protected DeleteColumnProgressDialog deleteColumnProgressDialog;
|
||||
|
||||
private ListStore<ColumnData> store;
|
||||
|
||||
public DeleteColumnPanel(TRId trId, String columnName, EventBus eventBus) {
|
||||
|
@ -89,8 +94,8 @@ public class DeleteColumnPanel extends FramedPanel {
|
|||
init();
|
||||
build();
|
||||
}
|
||||
|
||||
public void init(){
|
||||
|
||||
public void init() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
|
@ -178,7 +183,6 @@ public class DeleteColumnPanel extends FramedPanel {
|
|||
delete.setIconAlign(IconAlign.RIGHT);
|
||||
delete.setTitle("Delete Column");
|
||||
|
||||
|
||||
SelectHandler deleteHandler = new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
|
@ -259,7 +263,7 @@ public class DeleteColumnPanel extends FramedPanel {
|
|||
deleteColumnSession = new DeleteColumnSession(trId, columns);
|
||||
|
||||
TDGWTServiceAsync.INSTANCE.startDeleteColumn(deleteColumnSession,
|
||||
new AsyncCallback<Void>() {
|
||||
new AsyncCallback<String>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
|
@ -274,13 +278,64 @@ public class DeleteColumnPanel extends FramedPanel {
|
|||
}
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
deleteColumnProgressDialog = new DeleteColumnProgressDialog(
|
||||
deleteColumnSession, eventBus);
|
||||
public void onSuccess(String taskId) {
|
||||
openMonitorDialog(taskId);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void close() {
|
||||
if (parent != null) {
|
||||
parent.close();
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
protected void openMonitorDialog(String taskId) {
|
||||
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
|
||||
monitorDialog.add(this);
|
||||
monitorDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.DELETECOLUMN, 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.DELETECOLUMN, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationAborted() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationPutInBackground() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
|||
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.widget.core.client.Window;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||
|
||||
/**
|
||||
|
@ -34,9 +36,41 @@ public class LabelColumnDialog extends Window {
|
|||
this.trId = trId;
|
||||
this.columnName = columnName;
|
||||
this.eventBus=eventBus;
|
||||
setBodyBorder(false);
|
||||
initWindow();
|
||||
|
||||
LabelColumnPanel labelColumnPanel= new LabelColumnPanel(trId, columnName, eventBus);
|
||||
add(labelColumnPanel);
|
||||
}
|
||||
|
||||
protected void initWindow() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(false);
|
||||
setHeadingText("Label Columns");
|
||||
//getHeader().setIcon(Resources.IMAGES.side_list());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void initTools() {
|
||||
super.initTools();
|
||||
|
||||
closeBtn.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void close() {
|
||||
hide();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.gcube.portlets.user.td.columnwidget.client;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.LabelColumnProgressDialog;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataPropertiesCombo;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
||||
|
@ -10,7 +9,12 @@ import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.LabelColumnSession;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||
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;
|
||||
|
||||
|
@ -54,7 +58,8 @@ import com.sencha.gxt.widget.core.client.info.Info;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class LabelColumnPanel extends FramedPanel {
|
||||
public class LabelColumnPanel extends FramedPanel implements
|
||||
MonitorDialogListener {
|
||||
protected String WIDTH = "640px";
|
||||
protected String HEIGHT = "520px";
|
||||
protected EventBus eventBus;
|
||||
|
@ -69,7 +74,6 @@ public class LabelColumnPanel extends FramedPanel {
|
|||
protected TextButton change;
|
||||
|
||||
protected LabelColumnSession labelColumnSession;
|
||||
protected LabelColumnProgressDialog labelColumnProgressDialog;
|
||||
|
||||
public LabelColumnPanel(TRId trId, String columnName, EventBus eventBus) {
|
||||
setWidth(WIDTH);
|
||||
|
@ -142,7 +146,6 @@ public class LabelColumnPanel extends FramedPanel {
|
|||
change.setIconAlign(IconAlign.RIGHT);
|
||||
change.setTitle("Change Column Label");
|
||||
|
||||
|
||||
change.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
|
@ -267,7 +270,7 @@ public class LabelColumnPanel extends FramedPanel {
|
|||
|
||||
private void callLabelColumn() {
|
||||
TDGWTServiceAsync.INSTANCE.startLabelColumn(labelColumnSession,
|
||||
new AsyncCallback<Void>() {
|
||||
new AsyncCallback<String>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
|
@ -282,13 +285,63 @@ public class LabelColumnPanel extends FramedPanel {
|
|||
}
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
labelColumnProgressDialog = new LabelColumnProgressDialog(
|
||||
labelColumnSession, eventBus);
|
||||
public void onSuccess(String taskId) {
|
||||
openMonitorDialog(taskId) ;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if (parent != null) {
|
||||
parent.close();
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
protected void openMonitorDialog(String taskId) {
|
||||
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
|
||||
monitorDialog.add(this);
|
||||
monitorDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.CHANGECOLUMNLABEL, 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.CHANGECOLUMNLABEL, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationAborted() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationPutInBackground() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,11 +2,6 @@ package org.gcube.portlets.user.td.columnwidget.client.batch;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.ChangeColumnTypeProgressDialog;
|
||||
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.ResumeDialogListener;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.TaskResumeProgressDialog;
|
||||
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;
|
||||
|
@ -20,6 +15,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceBatchColumnSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceEntry;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingData;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||
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;
|
||||
|
@ -41,15 +38,19 @@ 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 implements
|
||||
ProgressDialogListener, ResumeDialogListener {
|
||||
public class ReplaceBatchDialog extends Window implements MonitorDialogListener {
|
||||
// ProgressDialogListener, ResumeDialogListener {
|
||||
protected enum CALLTYPE {
|
||||
REPLACEBATH, RESUME;
|
||||
}
|
||||
protected String WIDTH = "650px";
|
||||
protected String HEIGHT = "530px";
|
||||
protected TRId trId;
|
||||
protected String columnName = null;
|
||||
protected RequestProperties requestProperties;
|
||||
protected EventBus eventBus;
|
||||
protected String taskId;
|
||||
protected String taskIdOfInvocationS;
|
||||
protected CALLTYPE callType;
|
||||
private InvocationS invocationS;
|
||||
private ConditionCode conditionCode; // For Curation
|
||||
|
||||
|
@ -63,13 +64,13 @@ public class ReplaceBatchDialog extends Window implements
|
|||
this.trId = trId;
|
||||
this.columnName = columnName;
|
||||
this.eventBus = eventBus;
|
||||
taskId = null;
|
||||
taskIdOfInvocationS = null;
|
||||
initWindow();
|
||||
ReplaceBatchPanel batchRepalcePanel = new ReplaceBatchPanel(this, trId,
|
||||
columnName, eventBus);
|
||||
add(batchRepalcePanel);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param trId
|
||||
|
@ -86,19 +87,19 @@ public class ReplaceBatchDialog extends Window implements
|
|||
|
||||
invocationS = (InvocationS) requestProperties.getMap().get(
|
||||
Constants.REQUEST_PROPERTIES_INVOCATIONS);
|
||||
taskId = invocationS.getTaskId();
|
||||
taskIdOfInvocationS = invocationS.getTaskId();
|
||||
|
||||
conditionCode = (ConditionCode) requestProperties.getMap().get(
|
||||
Constants.REQUEST_PROPERTIES_CONDITIONCODE);
|
||||
|
||||
Log.debug("Resume TaskId:" + taskId);
|
||||
Log.debug("Resume TaskId:" + taskIdOfInvocationS);
|
||||
initWindow();
|
||||
|
||||
ReplaceBatchPanel batchRepalcePanel = new ReplaceBatchPanel(this, trId,
|
||||
requestProperties, eventBus);
|
||||
add(batchRepalcePanel);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -115,7 +116,7 @@ public class ReplaceBatchDialog extends Window implements
|
|||
setHeadingText("Replace Batch");
|
||||
getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch());
|
||||
} else {
|
||||
switch(conditionCode){
|
||||
switch (conditionCode) {
|
||||
case AllowedColumnType:
|
||||
break;
|
||||
case AmbiguousValueOnExternalReference:
|
||||
|
@ -154,7 +155,7 @@ public class ReplaceBatchDialog extends Window implements
|
|||
setHeadingText("Replace Batch");
|
||||
getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch());
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +175,7 @@ public class ReplaceBatchDialog extends Window implements
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -182,7 +183,7 @@ public class ReplaceBatchDialog extends Window implements
|
|||
hide();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param replaceBatchColumnSession
|
||||
|
@ -234,7 +235,7 @@ public class ReplaceBatchDialog extends Window implements
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param replaceBatchColumnSession
|
||||
|
@ -242,7 +243,7 @@ public class ReplaceBatchDialog extends Window implements
|
|||
protected void callStartReplaceBatchColumn(
|
||||
ReplaceBatchColumnSession replaceBatchColumnSession) {
|
||||
TDGWTServiceAsync.INSTANCE.startReplaceBatchColumn(
|
||||
replaceBatchColumnSession, new AsyncCallback<Void>() {
|
||||
replaceBatchColumnSession, new AsyncCallback<String>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
|
@ -258,114 +259,33 @@ public class ReplaceBatchDialog extends Window implements
|
|||
|
||||
}
|
||||
|
||||
public void onSuccess(Void v) {
|
||||
public void onSuccess(String taskId) {
|
||||
Log.trace("Started batch replace ");
|
||||
callReplaceBatchColumnProgressDialog();
|
||||
callReplaceBatchColumnProgressDialog(taskId);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected void callReplaceBatchColumnProgressDialog() {
|
||||
ReplaceBatchColumnProgressDialog dialog = new ReplaceBatchColumnProgressDialog(
|
||||
eventBus);
|
||||
dialog.addProgressDialogListener(this);
|
||||
dialog.show();
|
||||
|
||||
// TODO
|
||||
protected void callReplaceBatchColumnProgressDialog(String taskId) {
|
||||
callType=CALLTYPE.REPLACEBATH;
|
||||
openMonitorDialog(taskId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
this.trId = trId;
|
||||
if (taskId == null) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
hide();
|
||||
} else {
|
||||
if (conditionCode == null) {
|
||||
startTaskResume();
|
||||
} else {
|
||||
switch (conditionCode) {
|
||||
case AllowedColumnType:
|
||||
break;
|
||||
case AmbiguousValueOnExternalReference:
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACEBATCH, trId,
|
||||
why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
hide();
|
||||
break;
|
||||
case CastValidation:
|
||||
break;
|
||||
case CodeNamePresence:
|
||||
break;
|
||||
case DuplicateTupleValidation:
|
||||
break;
|
||||
case DuplicateValueInColumn:
|
||||
break;
|
||||
case GenericTupleValidity:
|
||||
break;
|
||||
case GenericValidity:
|
||||
break;
|
||||
case MaxOneCodenameForDataLocale:
|
||||
break;
|
||||
case MissingValueOnExternalReference:
|
||||
startTaskResume();
|
||||
break;
|
||||
case MustContainAtLeastOneDimension:
|
||||
break;
|
||||
case MustContainAtLeastOneMeasure:
|
||||
break;
|
||||
case MustHaveDataLocaleMetadataAndAtLeastOneLabel:
|
||||
break;
|
||||
case OnlyOneCodeColumn:
|
||||
break;
|
||||
case OnlyOneCodenameColumn:
|
||||
break;
|
||||
case ValidPeriodFormat:
|
||||
break;
|
||||
default:
|
||||
startTaskResume();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@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 startTaskResume() {
|
||||
TaskResumeSession taskResumeSession = new TaskResumeSession(trId,
|
||||
taskId);
|
||||
taskIdOfInvocationS);
|
||||
TDGWTServiceAsync.INSTANCE.startTaskResume(taskResumeSession,
|
||||
new AsyncCallback<Void>() {
|
||||
new AsyncCallback<String>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
|
@ -375,31 +295,32 @@ public class ReplaceBatchDialog extends Window implements
|
|||
Log.error("Task Resume failed:"
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error on task resume",
|
||||
"Error on task resume (taskId=" + taskId
|
||||
+ ")");
|
||||
"Error on task resume (taskId="
|
||||
+ taskIdOfInvocationS + ")");
|
||||
}
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(Void v) {
|
||||
public void onSuccess(String taskId) {
|
||||
Log.trace("Started task resume");
|
||||
callForTaskResume();
|
||||
callForTaskResume(taskId);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param mapping
|
||||
*/
|
||||
protected void startTaskResume(ArrayList<ColumnMappingData> mapping, ColumnData column) {
|
||||
protected void startTaskResume(ArrayList<ColumnMappingData> mapping,
|
||||
ColumnData column) {
|
||||
TaskResumeSession taskResumeSession = new TaskResumeSession(trId,
|
||||
taskId, mapping, column, invocationS);
|
||||
taskIdOfInvocationS, mapping, column, invocationS);
|
||||
TDGWTServiceAsync.INSTANCE.startTaskResume(taskResumeSession,
|
||||
new AsyncCallback<Void>() {
|
||||
new AsyncCallback<String>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
|
@ -409,59 +330,35 @@ public class ReplaceBatchDialog extends Window implements
|
|||
Log.error("Task Resume failed:"
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error on task resume",
|
||||
"Error on task resume (taskId=" + taskId
|
||||
+ ")");
|
||||
"Error on task resume (taskId="
|
||||
+ taskIdOfInvocationS + ")");
|
||||
}
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(Void v) {
|
||||
public void onSuccess(String taskId) {
|
||||
Log.trace("Started task resume");
|
||||
callForTaskResume();
|
||||
callForTaskResume(taskId);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected void callForTaskResume() {
|
||||
TaskResumeProgressDialog dialog = new TaskResumeProgressDialog(eventBus);
|
||||
dialog.addResumeDialogListener(this);
|
||||
dialog.show();
|
||||
|
||||
protected void callForTaskResume(String taskId) {
|
||||
callType=CALLTYPE.RESUME;
|
||||
openMonitorDialog(taskId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeComplete(TRId trId) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
hide();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeFailed(Throwable caught, String reason) {
|
||||
UtilsGXT3.alert("Error in Task Resume", reason);
|
||||
hide();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeStopped(TRId trId, String reason, String details) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
hide();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -469,10 +366,11 @@ public class ReplaceBatchDialog extends Window implements
|
|||
*/
|
||||
private void callResumeOnChangeColumnType(
|
||||
ReplaceBatchColumnSession replaceBatchColumnSession) {
|
||||
Log.debug("ReplaceBatchColumnSession: "+replaceBatchColumnSession.toString());
|
||||
|
||||
ColumnData col=replaceBatchColumnSession.getColumnData();
|
||||
|
||||
Log.debug("ReplaceBatchColumnSession: "
|
||||
+ replaceBatchColumnSession.toString());
|
||||
|
||||
ColumnData col = replaceBatchColumnSession.getColumnData();
|
||||
|
||||
ArrayList<ReplaceEntry> replaceEntryList = replaceBatchColumnSession
|
||||
.getReplaceEntryList();
|
||||
ArrayList<ColumnMappingData> mapping = new ArrayList<ColumnMappingData>();
|
||||
|
@ -485,19 +383,143 @@ public class ReplaceBatchDialog extends Window implements
|
|||
sourceArg, targetArg);
|
||||
mapping.add(columnMappingData);
|
||||
}
|
||||
|
||||
|
||||
startTaskResume(mapping, col);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
protected void callChangeColumnTypeProgressDialog() {
|
||||
ChangeColumnTypeProgressDialog changeColumnTypeProgressDialog = new ChangeColumnTypeProgressDialog(
|
||||
eventBus);
|
||||
changeColumnTypeProgressDialog.addProgressDialogListener(this);
|
||||
changeColumnTypeProgressDialog.show();
|
||||
}
|
||||
*/
|
||||
|
||||
///
|
||||
protected void openMonitorDialog(String taskId) {
|
||||
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
|
||||
monitorDialog.add(this);
|
||||
monitorDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
switch(callType){
|
||||
case REPLACEBATH:
|
||||
this.trId = trId;
|
||||
if (taskIdOfInvocationS == null) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
} else {
|
||||
if (conditionCode == null) {
|
||||
startTaskResume();
|
||||
} else {
|
||||
switch (conditionCode) {
|
||||
case AllowedColumnType:
|
||||
break;
|
||||
case AmbiguousValueOnExternalReference:
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACEBATCH, trId,
|
||||
why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
break;
|
||||
case CastValidation:
|
||||
break;
|
||||
case CodeNamePresence:
|
||||
break;
|
||||
case DuplicateTupleValidation:
|
||||
break;
|
||||
case DuplicateValueInColumn:
|
||||
break;
|
||||
case GenericTupleValidity:
|
||||
break;
|
||||
case GenericValidity:
|
||||
break;
|
||||
case MaxOneCodenameForDataLocale:
|
||||
break;
|
||||
case MissingValueOnExternalReference:
|
||||
startTaskResume();
|
||||
break;
|
||||
case MustContainAtLeastOneDimension:
|
||||
break;
|
||||
case MustContainAtLeastOneMeasure:
|
||||
break;
|
||||
case MustHaveDataLocaleMetadataAndAtLeastOneLabel:
|
||||
break;
|
||||
case OnlyOneCodeColumn:
|
||||
break;
|
||||
case OnlyOneCodenameColumn:
|
||||
break;
|
||||
case ValidPeriodFormat:
|
||||
break;
|
||||
default:
|
||||
startTaskResume();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case RESUME:
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
hide();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason, String details) {
|
||||
switch(callType){
|
||||
case REPLACEBATH:
|
||||
UtilsGXT3.alert("Error in Replace Batch", reason);
|
||||
close();
|
||||
break;
|
||||
case RESUME:
|
||||
UtilsGXT3.alert("Error in Task Resume", reason);
|
||||
hide();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationAborted() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationPutInBackground() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@ import java.util.Date;
|
|||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.dimension.CodelistSelectionDialog;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.dimension.CodelistSelectionListener;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.AddColumnProgressDialog;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.ProgressDialogListener;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataPropertiesCombo;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataTypeProperties;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnTypeCodeProperties;
|
||||
|
@ -28,6 +26,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.tr.DefNewColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||
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;
|
||||
|
@ -72,7 +72,7 @@ import com.sencha.gxt.widget.core.client.info.Info;
|
|||
*
|
||||
*/
|
||||
public class AddColumnPanel extends FramedPanel implements
|
||||
CodelistSelectionListener, ProgressDialogListener {
|
||||
CodelistSelectionListener, MonitorDialogListener {
|
||||
protected static final String WIDTH = "640px";
|
||||
protected static final String HEIGHT = "520px";
|
||||
|
||||
|
@ -106,8 +106,7 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
protected ListStore<LocaleTypeElement> storeComboLocaleType;
|
||||
|
||||
protected AddColumnSession addColumnSession;
|
||||
protected AddColumnProgressDialog addColumnProgressDialog;
|
||||
|
||||
|
||||
protected TextButton btnAddColumn;
|
||||
|
||||
protected TextField label;
|
||||
|
@ -806,7 +805,7 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
private void callAddColumm() {
|
||||
Log.debug(addColumnSession.toString());
|
||||
TDGWTServiceAsync.INSTANCE.startAddColumn(addColumnSession,
|
||||
new AsyncCallback<Void>() {
|
||||
new AsyncCallback<String>() {
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
|
@ -820,12 +819,8 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
}
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
addColumnProgressDialog = new AddColumnProgressDialog(
|
||||
eventBus);
|
||||
addColumnProgressDialog
|
||||
.addProgressDialogListener(thisPanel);
|
||||
addColumnProgressDialog.show();
|
||||
public void onSuccess(String taskId) {
|
||||
openMonitorDialog(taskId);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -933,11 +928,20 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void close() {
|
||||
if (parent != null) {
|
||||
parent.close();
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
protected void openMonitorDialog(String taskId) {
|
||||
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
|
||||
monitorDialog.add(this);
|
||||
monitorDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
|
@ -946,13 +950,13 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
ChangeTableRequestType.ADDCOLUMN, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason) {
|
||||
UtilsGXT3.alert("Error in Add Column", reason);
|
||||
public void operationFailed(Throwable caught, String reason, String details) {
|
||||
UtilsGXT3.alert(reason, details);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -962,6 +966,19 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
ChangeTableRequestType.ADDCOLUMN, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationAborted() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationPutInBackground() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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 AddColumnProgressBarUpdater implements AddColumnProgressListener {
|
||||
|
||||
protected ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ProgressBar} updater.
|
||||
* @param progressBar the {@link ProgressBar} to update.
|
||||
*/
|
||||
public AddColumnProgressBarUpdater(ProgressBar progressBar) {
|
||||
this.progressBar = progressBar;
|
||||
this.progressBar.updateProgress(0, "Please Wait...");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@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 && 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...");
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,178 +0,0 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* AddColumnProgressDialog is a Dialog that show progress of AddColumn
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class AddColumnProgressDialog extends Window implements
|
||||
AddColumnProgressListener {
|
||||
protected ArrayList<ProgressDialogListener> listeners = new ArrayList<ProgressDialogListener>();
|
||||
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
protected String WIDTH = "400px";
|
||||
protected String HEIGHT = "120px";
|
||||
protected EventBus eventBus;
|
||||
protected AddColumnProgressUpdater progressUpdater;
|
||||
protected TextButton ok;
|
||||
protected TRId trId;
|
||||
private String reason;
|
||||
private String details;
|
||||
|
||||
public AddColumnProgressDialog(
|
||||
EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(true);
|
||||
setModal(true);
|
||||
setHeadingText("Add Column 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 AddColumnProgressUpdater();
|
||||
progressUpdater.addListener(new AddColumnProgressBarUpdater(
|
||||
progressBar));
|
||||
|
||||
progressUpdater.addListener(this);
|
||||
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
||||
show();
|
||||
ok.setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
public void addProgressDialogListener(ProgressDialogListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeProgressDialogListener(ProgressDialogListener 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;
|
||||
fireOperationComplete(trId);
|
||||
hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason,
|
||||
String failureDetails) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
fireOperationFailed(caught,reason);
|
||||
hide();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void updateInvocation() {
|
||||
if (trId != null) {
|
||||
fireOperationStopped(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 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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 AddColumnProgressListener {
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
}
|
|
@ -1,195 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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.monitor.AddColumnMonitor;
|
||||
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 AddColumnProgressUpdater extends Timer {
|
||||
|
||||
protected ArrayList<AddColumnProgressListener> listeners = new ArrayList<AddColumnProgressListener>();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Log.debug("requesting operation progress");
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getAddColumnMonitor(new AsyncCallback<AddColumnMonitor>() {
|
||||
|
||||
|
||||
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(AddColumnMonitor result) {
|
||||
Log.info("retrieved AddColumnMonitor: "
|
||||
+ result.getStatus());
|
||||
switch (result.getStatus()) {
|
||||
case INITIALIZING:
|
||||
Log.info("Initializing...");
|
||||
fireOperationInitializing();
|
||||
break;
|
||||
case ABORTED:
|
||||
cancel();
|
||||
Log.info("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 :"
|
||||
+ result.getTrId());
|
||||
fireOperationComplete(result.getTrId());
|
||||
break;
|
||||
default:
|
||||
Log.info("Unknow State");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void errorMessage(AddColumnMonitor result) {
|
||||
Log.info("AddColumn Failed");
|
||||
Throwable th = null;
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
th = result.getError();
|
||||
failure = "Failed Client Library Add Column";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
th = new Throwable("Failed");
|
||||
failure = "Failed Client Library Add Columnn";
|
||||
details = "Add Column failed";
|
||||
}
|
||||
|
||||
fireOperationFailed(th, failure, details);
|
||||
}
|
||||
|
||||
protected void stopMessage(AddColumnMonitor result) {
|
||||
Log.info("Add Column Stopped");
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
failure = "Stopped add column";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
failure = "Stopped add column";
|
||||
details = "Add Column 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 (AddColumnProgressListener listener : listeners)
|
||||
listener.operationInitializing();
|
||||
}
|
||||
|
||||
protected void fireOperationGeneratingView() {
|
||||
for (AddColumnProgressListener listener : listeners)
|
||||
listener.operationGeneratingView();
|
||||
}
|
||||
|
||||
protected void fireOperationUpdate(float elaborated) {
|
||||
for (AddColumnProgressListener listener : listeners)
|
||||
listener.operationUpdate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationValidate(float elaborated) {
|
||||
for (AddColumnProgressListener listener : listeners)
|
||||
listener.operationValidate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationComplete(TRId trId) {
|
||||
for (AddColumnProgressListener listener : listeners)
|
||||
listener.operationComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String failure,
|
||||
String failureDetails) {
|
||||
for (AddColumnProgressListener listener : listeners)
|
||||
listener.operationFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (AddColumnProgressListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new {@link AddColumnProgressListener} to this
|
||||
* {@link AddColumnProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to add.
|
||||
*/
|
||||
public void addListener(AddColumnProgressListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link AddColumnProgressListener} from this
|
||||
* {@link AddColumnProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to remove.
|
||||
*/
|
||||
public void removeListener(AddColumnProgressListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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 ChangeColumnTypeProgressBarUpdater implements ChangeColumnTypeProgressListener {
|
||||
|
||||
protected ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ProgressBar} updater.
|
||||
* @param progressBar the {@link ProgressBar} to update.
|
||||
*/
|
||||
public ChangeColumnTypeProgressBarUpdater(ProgressBar progressBar) {
|
||||
this.progressBar = progressBar;
|
||||
this.progressBar.updateProgress(0, "Please Wait...");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
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 && 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...");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,177 +0,0 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ChangeColumnTypeProgressDialog extends Window implements
|
||||
ChangeColumnTypeProgressListener {
|
||||
protected ArrayList<ProgressDialogListener> listeners = new ArrayList<ProgressDialogListener>();
|
||||
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
protected String WIDTH = "400px";
|
||||
protected String HEIGHT = "120px";
|
||||
|
||||
protected EventBus eventBus;
|
||||
protected ChangeColumnTypeProgressUpdater progressUpdater;
|
||||
protected TextButton ok;
|
||||
protected TRId trId;
|
||||
private String reason;
|
||||
private String details;
|
||||
|
||||
public ChangeColumnTypeProgressDialog(EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(true);
|
||||
setModal(true);
|
||||
setHeadingText("Change Column Type 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 ChangeColumnTypeProgressUpdater();
|
||||
progressUpdater.addListener(new ChangeColumnTypeProgressBarUpdater(
|
||||
progressBar));
|
||||
|
||||
progressUpdater.addListener(this);
|
||||
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
||||
show();
|
||||
ok.setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
public void addProgressDialogListener(ProgressDialogListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeProgressDialogListener(ProgressDialogListener 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;
|
||||
fireOperationComplete(trId);
|
||||
hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason,
|
||||
String failureDetails) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
fireOperationFailed(caught,reason);
|
||||
hide();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void updateInvocation() {
|
||||
if (trId != null) {
|
||||
fireOperationStopped(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 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.columnwidget.client.progress;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface ChangeColumnTypeProgressListener {
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
}
|
|
@ -1,192 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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.tr.column.type.ChangeColumnTypeMonitor;
|
||||
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 ChangeColumnTypeProgressUpdater extends Timer {
|
||||
|
||||
protected ArrayList<ChangeColumnTypeProgressListener> listeners = new ArrayList<ChangeColumnTypeProgressListener>();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Log.debug("requesting operation progress");
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getChangeColumnTypeMonitor(new AsyncCallback<ChangeColumnTypeMonitor>() {
|
||||
|
||||
|
||||
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(ChangeColumnTypeMonitor result) {
|
||||
Log.info("retrieved CMonitor: "
|
||||
+ result.getStatus());
|
||||
switch (result.getStatus()) {
|
||||
case INITIALIZING:
|
||||
Log.info("Initializing...");
|
||||
fireOperationInitializing();
|
||||
break;
|
||||
case ABORTED:
|
||||
cancel();
|
||||
Log.info("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("Succeded TableId :"
|
||||
+ result.getTrId());
|
||||
fireOperationComplete(result.getTrId());
|
||||
break;
|
||||
default:
|
||||
Log.info("Unknow State");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void errorMessage(ChangeColumnTypeMonitor result) {
|
||||
Log.info("Change Column Type Failed");
|
||||
Throwable th = null;
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
th = result.getError();
|
||||
failure = "Failed Client Library Changing Column Type";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
th = new Throwable("Failed");
|
||||
failure = "Failed Client Library Changing Column Type";
|
||||
details = "Error Changing Column Type";
|
||||
}
|
||||
|
||||
fireOperationFailed(th, failure, details);
|
||||
}
|
||||
|
||||
protected void stopMessage(ChangeColumnTypeMonitor result) {
|
||||
Log.info("Change Column Type Stopped");
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
failure = "Stopped changing the column type";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
failure = "Stopped changing the column type";
|
||||
details = "Change the column type 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 (ChangeColumnTypeProgressListener listener : listeners)
|
||||
listener.operationInitializing();
|
||||
}
|
||||
|
||||
protected void fireOperationGeneratingView() {
|
||||
for (ChangeColumnTypeProgressListener listener : listeners)
|
||||
listener.operationGeneratingView();
|
||||
}
|
||||
|
||||
|
||||
protected void fireOperationUpdate(float elaborated) {
|
||||
for (ChangeColumnTypeProgressListener listener : listeners)
|
||||
listener.operationUpdate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationValidate(float elaborated) {
|
||||
for (ChangeColumnTypeProgressListener listener : listeners)
|
||||
listener.operationValidate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationComplete(TRId trId) {
|
||||
for (ChangeColumnTypeProgressListener listener : listeners)
|
||||
listener.operationComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String failure,
|
||||
String failureDetails) {
|
||||
for (ChangeColumnTypeProgressListener listener : listeners)
|
||||
listener.operationFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (ChangeColumnTypeProgressListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new {@link ChangeColumnTypeProgressListener} to this
|
||||
* {@link ChangeColumnTypeProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to add.
|
||||
*/
|
||||
public void addListener(ChangeColumnTypeProgressListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link ChangeColumnTypeProgressListener} from this
|
||||
* {@link ChangeColumnTypeProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to remove.
|
||||
*/
|
||||
public void removeListener(ChangeColumnTypeProgressListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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 DeleteColumnProgressBarUpdater implements DeleteColumnProgressListener {
|
||||
|
||||
protected ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ProgressBar} updater.
|
||||
* @param progressBar the {@link ProgressBar} to update.
|
||||
*/
|
||||
public DeleteColumnProgressBarUpdater(ProgressBar progressBar) {
|
||||
this.progressBar = progressBar;
|
||||
this.progressBar.updateProgress(0, "Please Wait...");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@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("Elaborated: "+elaborated);
|
||||
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...");
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,150 +0,0 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.progress;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.DeleteColumnSession;
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class DeleteColumnProgressDialog extends Window implements
|
||||
DeleteColumnProgressListener {
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
protected String WIDTH = "400px";
|
||||
protected String HEIGHT = "120px";
|
||||
protected DeleteColumnSession deleteColumnSession;
|
||||
protected EventBus eventBus;
|
||||
protected DeleteColumnProgressUpdater progressUpdater;
|
||||
protected TextButton ok;
|
||||
protected TRId trId;
|
||||
private ChangeTableWhy why;
|
||||
|
||||
public DeleteColumnProgressDialog(DeleteColumnSession deleteColumnSession,
|
||||
EventBus eventBus) {
|
||||
this.deleteColumnSession = deleteColumnSession;
|
||||
this.eventBus = eventBus;
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(true);
|
||||
setModal(true);
|
||||
setHeadingText("Delete Column 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 DeleteColumnProgressUpdater();
|
||||
progressUpdater.addListener(new DeleteColumnProgressBarUpdater(
|
||||
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) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
ok.setVisible(true);
|
||||
this.trId = null;
|
||||
UtilsGXT3.alert("Error Deleting Column", reason);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateInvocation() {
|
||||
if (trId != null) {
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.DELETECOLUMN, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationGeneratingView() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationValidate(float elaborated) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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 DeleteColumnProgressListener {
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
}
|
|
@ -1,195 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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.monitor.DeleteColumnMonitor;
|
||||
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 DeleteColumnProgressUpdater extends Timer {
|
||||
|
||||
protected ArrayList<DeleteColumnProgressListener> listeners = new ArrayList<DeleteColumnProgressListener>();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Log.debug("requesting operation progress");
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getDeleteColumnMonitor(new AsyncCallback<DeleteColumnMonitor>() {
|
||||
|
||||
|
||||
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(DeleteColumnMonitor result) {
|
||||
Log.info("retrieved DeleteMonitor: "
|
||||
+ result.getStatus());
|
||||
switch (result.getStatus()) {
|
||||
case INITIALIZING:
|
||||
Log.info("Initializing...");
|
||||
fireOperationInitializing();
|
||||
break;
|
||||
case ABORTED:
|
||||
cancel();
|
||||
Log.info("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("Succeded TableId :"
|
||||
+ result.getTrId());
|
||||
fireOperationComplete(result.getTrId());
|
||||
break;
|
||||
default:
|
||||
Log.info("Unknow State");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void errorMessage(DeleteColumnMonitor result) {
|
||||
Log.info("Delete Column Failed");
|
||||
Throwable th = null;
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
th = result.getError();
|
||||
failure = "Failed Client Library Delete Column";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
th = new Throwable("Failed");
|
||||
failure = "Failed Client Library Delete Column";
|
||||
details = "Error Delete Column";
|
||||
}
|
||||
|
||||
|
||||
fireOperationFailed(th, failure, details);
|
||||
}
|
||||
|
||||
protected void stopMessage(DeleteColumnMonitor result) {
|
||||
Log.info("Delete Column Stopped");
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
failure = "Stopped delete column";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
failure = "Stopped delete column";
|
||||
details = "Delete the column 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 (DeleteColumnProgressListener listener : listeners)
|
||||
listener.operationInitializing();
|
||||
}
|
||||
|
||||
protected void fireOperationGeneratingView() {
|
||||
for (DeleteColumnProgressListener listener : listeners)
|
||||
listener.operationGeneratingView();
|
||||
}
|
||||
|
||||
protected void fireOperationUpdate(float elaborated) {
|
||||
for (DeleteColumnProgressListener listener : listeners)
|
||||
listener.operationUpdate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationValidate(float elaborated) {
|
||||
for (DeleteColumnProgressListener listener : listeners)
|
||||
listener.operationValidate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationComplete(TRId trId) {
|
||||
for (DeleteColumnProgressListener listener : listeners)
|
||||
listener.operationComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String failure,
|
||||
String failureDetails) {
|
||||
for (DeleteColumnProgressListener listener : listeners)
|
||||
listener.operationFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (DeleteColumnProgressListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new {@link DeleteColumnProgressListener} to this
|
||||
* {@link DeleteColumnProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to add.
|
||||
*/
|
||||
public void addListener(DeleteColumnProgressListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link DeleteColumnProgressListener} from this
|
||||
* {@link DeleteColumnProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to remove.
|
||||
*/
|
||||
public void removeListener(DeleteColumnProgressListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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 LabelColumnProgressBarUpdater implements LabelColumnProgressListener {
|
||||
|
||||
protected ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ProgressBar} updater.
|
||||
* @param progressBar the {@link ProgressBar} to update.
|
||||
*/
|
||||
public LabelColumnProgressBarUpdater(ProgressBar progressBar) {
|
||||
this.progressBar = progressBar;
|
||||
this.progressBar.updateProgress(0, "Please Wait...");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@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("Elaborated: "+elaborated);
|
||||
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...");
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,151 +0,0 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.progress;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.LabelColumnSession;
|
||||
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;
|
||||
|
||||
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 LabelColumnProgressDialog extends Window implements
|
||||
LabelColumnProgressListener {
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
protected String WIDTH = "400px";
|
||||
protected String HEIGHT = "120px";
|
||||
protected LabelColumnSession labelColumnSession;
|
||||
protected EventBus eventBus;
|
||||
protected LabelColumnProgressUpdater progressUpdater;
|
||||
protected TextButton ok;
|
||||
protected TRId trId;
|
||||
private ChangeTableWhy why;
|
||||
|
||||
public LabelColumnProgressDialog(LabelColumnSession labelColumnSession,
|
||||
EventBus eventBus) {
|
||||
this.labelColumnSession = labelColumnSession;
|
||||
this.eventBus = eventBus;
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(true);
|
||||
setModal(true);
|
||||
setHeadingText("Change The Column Label 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 LabelColumnProgressUpdater();
|
||||
progressUpdater.addListener(new LabelColumnProgressBarUpdater(
|
||||
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) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
ok.setVisible(true);
|
||||
this.trId = null;
|
||||
UtilsGXT3.alert("Error Changing The Column Label", reason);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateInvocation() {
|
||||
if (trId != null) {
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.CHANGECOLUMNLABEL, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationGeneratingView() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationValidate(float elaborated) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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 LabelColumnProgressListener {
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
|
@ -1,196 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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.monitor.LabelColumnMonitor;
|
||||
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 LabelColumnProgressUpdater extends Timer {
|
||||
|
||||
protected ArrayList<LabelColumnProgressListener> listeners = new ArrayList<LabelColumnProgressListener>();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Log.debug("requesting operation progress");
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getLabelColumnMonitor(new AsyncCallback<LabelColumnMonitor>() {
|
||||
|
||||
|
||||
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(LabelColumnMonitor result) {
|
||||
Log.info("retrieved LabelColumnMonitor: "
|
||||
+ result.getStatus());
|
||||
switch (result.getStatus()) {
|
||||
case INITIALIZING:
|
||||
Log.info("Change Label Column Initializing...");
|
||||
fireOperationInitializing();
|
||||
break;
|
||||
case ABORTED:
|
||||
cancel();
|
||||
Log.info("Change The Column Label 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("Succeded TableId :"
|
||||
+ result.getTrId());
|
||||
fireOperationComplete(result.getTrId());
|
||||
break;
|
||||
default:
|
||||
Log.info("Unknow State");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void errorMessage(LabelColumnMonitor result) {
|
||||
Log.info("Change the column label Failed");
|
||||
Throwable th = null;
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
th = result.getError();
|
||||
failure = "Failed Client Library Changing the column label";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
th = new Throwable("Failed");
|
||||
failure = "Failed Client Library Changing the column label";
|
||||
details = "Change the column label failed";
|
||||
}
|
||||
|
||||
|
||||
fireOperationFailed(th, failure, details);
|
||||
}
|
||||
|
||||
protected void stopMessage(LabelColumnMonitor result) {
|
||||
Log.info("Change Label Stopped");
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
failure = "Stopped";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
failure = "Stopped";
|
||||
details = "Stopped changing the column label ";
|
||||
}
|
||||
|
||||
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 (LabelColumnProgressListener listener : listeners)
|
||||
listener.operationInitializing();
|
||||
}
|
||||
|
||||
protected void fireOperationGeneratingView() {
|
||||
for (LabelColumnProgressListener listener : listeners)
|
||||
listener.operationGeneratingView();
|
||||
}
|
||||
|
||||
protected void fireOperationUpdate(float elaborated) {
|
||||
for (LabelColumnProgressListener listener : listeners)
|
||||
listener.operationUpdate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationValidate(float elaborated) {
|
||||
for (LabelColumnProgressListener listener : listeners)
|
||||
listener.operationValidate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationComplete(TRId trId) {
|
||||
for (LabelColumnProgressListener listener : listeners)
|
||||
listener.operationComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String failure,
|
||||
String failureDetails) {
|
||||
for (LabelColumnProgressListener listener : listeners)
|
||||
listener.operationFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (LabelColumnProgressListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new {@link LabelColumnProgressListener} to this
|
||||
* {@link LabelColumnProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to add.
|
||||
*/
|
||||
public void addListener(LabelColumnProgressListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link LabelColumnProgressListener} from this
|
||||
* {@link LabelColumnProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to remove.
|
||||
*/
|
||||
public void removeListener(LabelColumnProgressListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
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,94 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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 ReplaceBatchColumnProgressBarUpdater implements ReplaceBatchColumnProgressListener {
|
||||
|
||||
protected ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ProgressBar} updater.
|
||||
* @param progressBar the {@link ProgressBar} to update.
|
||||
*/
|
||||
public ReplaceBatchColumnProgressBarUpdater(ProgressBar progressBar) {
|
||||
this.progressBar = progressBar;
|
||||
this.progressBar.updateProgress(0, "Please Wait...");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@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("Elaborated: "+elaborated);
|
||||
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...");
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,175 +0,0 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* ReplaceBatchColumnProgressDialog is a Dialog that show progress of replace
|
||||
* batch the column value
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 EventBus eventBus;
|
||||
protected ReplaceBatchColumnProgressUpdater progressUpdater;
|
||||
protected TextButton ok;
|
||||
protected TRId trId;
|
||||
private String reason;
|
||||
private String details;
|
||||
|
||||
public ReplaceBatchColumnProgressDialog(EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(true);
|
||||
setModal(true);
|
||||
setHeadingText("Replace Batch 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 ReplaceBatchColumnProgressUpdater();
|
||||
progressUpdater.addListener(new ReplaceBatchColumnProgressBarUpdater(
|
||||
progressBar));
|
||||
|
||||
progressUpdater.addListener(this);
|
||||
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
||||
show();
|
||||
ok.setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void addProgressDialogListener(ProgressDialogListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeProgressDialogListener(ProgressDialogListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
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;
|
||||
fireOperationComplete(trId);
|
||||
hide();
|
||||
}
|
||||
|
||||
public void operationFailed(Throwable caught, String reason,
|
||||
String failureDetails) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
fireOperationFailed(caught,reason);
|
||||
hide();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void updateInvocation() {
|
||||
if (trId != null) {
|
||||
fireOperationStopped(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 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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 ReplaceBatchColumnProgressListener {
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
|
@ -1,195 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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.monitor.ReplaceBatchColumnMonitor;
|
||||
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 ReplaceBatchColumnProgressUpdater extends Timer {
|
||||
|
||||
protected ArrayList<ReplaceBatchColumnProgressListener> listeners = new ArrayList<ReplaceBatchColumnProgressListener>();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Log.debug("requesting operation progress");
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getReplaceBatchColumnMonitor(new AsyncCallback<ReplaceBatchColumnMonitor>() {
|
||||
|
||||
|
||||
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(ReplaceBatchColumnMonitor result) {
|
||||
Log.info("retrieved ReplaceBatchColumnMonitor: "
|
||||
+ result.getStatus());
|
||||
switch (result.getStatus()) {
|
||||
case INITIALIZING:
|
||||
Log.info("Replace Batch Initializing...");
|
||||
fireOperationInitializing();
|
||||
break;
|
||||
case ABORTED:
|
||||
cancel();
|
||||
Log.info("Replace Batch Aborted");
|
||||
break;
|
||||
case IN_PROGRESS:
|
||||
fireOperationUpdate(result.getProgress());
|
||||
break;
|
||||
case VALIDATING_RULES:
|
||||
fireOperationValidate(result.getProgress());
|
||||
break;
|
||||
case GENERATING_VIEW:
|
||||
Log.info("Generating View...");
|
||||
fireOperationGeneratingView();
|
||||
case STOPPED:
|
||||
cancel();
|
||||
stopMessage(result);
|
||||
break;
|
||||
case FAILED:
|
||||
cancel();
|
||||
errorMessage(result);
|
||||
break;
|
||||
case SUCCEDED:
|
||||
cancel();
|
||||
Log.info("Replace Batch fisnish:"
|
||||
+ result.getTrId());
|
||||
fireOperationComplete(result.getTrId());
|
||||
break;
|
||||
default:
|
||||
Log.info("Unknow State");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void errorMessage(ReplaceBatchColumnMonitor result) {
|
||||
Log.info("Batch Replace Failed");
|
||||
Throwable th = null;
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
th = result.getError();
|
||||
failure = "Failed Client Library";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
th = new Throwable("Failed");
|
||||
failure = "Failed Client Library";
|
||||
details = "Batch replace failed";
|
||||
}
|
||||
|
||||
|
||||
fireOperationFailed(th, failure, details);
|
||||
}
|
||||
|
||||
protected void stopMessage(ReplaceBatchColumnMonitor result) {
|
||||
Log.info("Batch Replace Stopped");
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
failure = "Stopped";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
failure = "Stopped";
|
||||
details = "Stopped batch replace";
|
||||
}
|
||||
|
||||
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 (ReplaceBatchColumnProgressListener listener : listeners)
|
||||
listener.operationInitializing();
|
||||
}
|
||||
|
||||
protected void fireOperationGeneratingView() {
|
||||
for (ReplaceBatchColumnProgressListener listener : listeners)
|
||||
listener.operationGeneratingView();
|
||||
}
|
||||
|
||||
protected void fireOperationUpdate(float elaborated) {
|
||||
for (ReplaceBatchColumnProgressListener listener : listeners)
|
||||
listener.operationUpdate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationValidate(float elaborated) {
|
||||
for (ReplaceBatchColumnProgressListener listener : listeners)
|
||||
listener.operationValidate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationComplete(TRId trId) {
|
||||
for (ReplaceBatchColumnProgressListener listener : listeners)
|
||||
listener.operationComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String failure,
|
||||
String failureDetails) {
|
||||
for (ReplaceBatchColumnProgressListener listener : listeners)
|
||||
listener.operationFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (ReplaceBatchColumnProgressListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new {@link } to this
|
||||
* {@link ReplaceBatchColumnProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to add.
|
||||
*/
|
||||
public void addListener(ReplaceBatchColumnProgressListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link } from this
|
||||
* {@link ReplaceBatchColumnProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to remove.
|
||||
*/
|
||||
public void removeListener(ReplaceColumnProgressListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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 ReplaceColumnProgressBarUpdater implements ReplaceColumnProgressListener {
|
||||
|
||||
protected ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ProgressBar} updater.
|
||||
* @param progressBar the {@link ProgressBar} to update.
|
||||
*/
|
||||
public ReplaceColumnProgressBarUpdater(ProgressBar progressBar) {
|
||||
this.progressBar = progressBar;
|
||||
this.progressBar.updateProgress(0, "Please Wait...");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@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 && 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...");
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.progress;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.replace.ReplaceDialog;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* ReplaceColumnProgressDialog is a Dialog that show progress of replace the
|
||||
* column value
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ReplaceColumnProgressDialog extends Window implements
|
||||
ReplaceColumnProgressListener {
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
protected String WIDTH = "400px";
|
||||
protected String HEIGHT = "120px";
|
||||
protected ReplaceDialog parent;
|
||||
protected EventBus eventBus;
|
||||
protected ReplaceColumnProgressUpdater progressUpdater;
|
||||
protected TextButton ok;
|
||||
protected TRId trId;
|
||||
private ChangeTableWhy why;
|
||||
|
||||
public ReplaceColumnProgressDialog(ReplaceDialog replaceDialog,
|
||||
EventBus eventBus) {
|
||||
this.parent = replaceDialog;
|
||||
this.eventBus = eventBus;
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(true);
|
||||
setModal(true);
|
||||
setHeadingText("Replace The Column Value 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 ReplaceColumnProgressUpdater();
|
||||
progressUpdater.addListener(new ReplaceColumnProgressBarUpdater(
|
||||
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) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
ok.setVisible(true);
|
||||
this.trId = null;
|
||||
UtilsGXT3.alert("Error Replacing The Column Value", reason);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateInvocation() {
|
||||
if (trId != null) {
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACE, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
}
|
||||
parent.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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationGeneratingView() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationValidate(float elaborated) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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 ReplaceColumnProgressListener {
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
}
|
|
@ -1,195 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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.monitor.ReplaceColumnMonitor;
|
||||
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 ReplaceColumnProgressUpdater extends Timer {
|
||||
|
||||
protected ArrayList<ReplaceColumnProgressListener> listeners = new ArrayList<ReplaceColumnProgressListener>();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Log.debug("requesting operation progress");
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getReplaceColumnMonitor(new AsyncCallback<ReplaceColumnMonitor>() {
|
||||
|
||||
|
||||
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(ReplaceColumnMonitor result) {
|
||||
Log.info("retrieved ReplaceColumnMonitor: "
|
||||
+ result.getStatus());
|
||||
switch (result.getStatus()) {
|
||||
case INITIALIZING:
|
||||
Log.info("Replace Column Value Initializing...");
|
||||
fireOperationInitializing();
|
||||
break;
|
||||
case ABORTED:
|
||||
cancel();
|
||||
Log.info("Replace Column Value 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();
|
||||
case STOPPED:
|
||||
cancel();
|
||||
stopMessage(result);
|
||||
break;
|
||||
case FAILED:
|
||||
cancel();
|
||||
errorMessage(result);
|
||||
break;
|
||||
case SUCCEDED:
|
||||
cancel();
|
||||
Log.info("ReplaceColumn fisnish:"
|
||||
+ result.getTrId());
|
||||
fireOperationComplete(result.getTrId());
|
||||
break;
|
||||
default:
|
||||
Log.info("Unknow State");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void errorMessage(ReplaceColumnMonitor result) {
|
||||
Log.info("Replace the column value Failed");
|
||||
Throwable th = null;
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
th = result.getError();
|
||||
failure = "Failed Client Library Replacing the column value";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
th = new Throwable("Failed");
|
||||
failure = "Failed Client Library Replacing the column value";
|
||||
details = "Replace the column value failed";
|
||||
}
|
||||
|
||||
|
||||
fireOperationFailed(th, failure, details);
|
||||
}
|
||||
|
||||
protected void stopMessage(ReplaceColumnMonitor result) {
|
||||
Log.info("Replace Column Value Stopped");
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
failure = "Stopped";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
failure = "Stopped";
|
||||
details = "Stopped replacing the column value";
|
||||
}
|
||||
|
||||
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 (ReplaceColumnProgressListener listener : listeners)
|
||||
listener.operationInitializing();
|
||||
}
|
||||
|
||||
protected void fireOperationGeneratingView() {
|
||||
for (ReplaceColumnProgressListener listener : listeners)
|
||||
listener.operationGeneratingView();
|
||||
}
|
||||
|
||||
protected void fireOperationUpdate(float elaborated) {
|
||||
for (ReplaceColumnProgressListener listener : listeners)
|
||||
listener.operationUpdate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationValidate(float elaborated) {
|
||||
for (ReplaceColumnProgressListener listener : listeners)
|
||||
listener.operationValidate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationComplete(TRId trId) {
|
||||
for (ReplaceColumnProgressListener listener : listeners)
|
||||
listener.operationComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String failure,
|
||||
String failureDetails) {
|
||||
for (ReplaceColumnProgressListener listener : listeners)
|
||||
listener.operationFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (ReplaceColumnProgressListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new {@link } to this
|
||||
* {@link ReplaceColumnProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to add.
|
||||
*/
|
||||
public void addListener(ReplaceColumnProgressListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link } from this
|
||||
* {@link ReplaceColumnProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to remove.
|
||||
*/
|
||||
public void removeListener(ReplaceColumnProgressListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
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);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.progress;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
public interface ResumeDialogListener {
|
||||
|
||||
|
||||
/**
|
||||
* Called when the resume of task is complete.
|
||||
*/
|
||||
public void resumeComplete(TRId trId);
|
||||
|
||||
/**
|
||||
* Called when the resume of task is failed.
|
||||
* @param caught the failure exception.
|
||||
* @param reason the failure reason.
|
||||
*/
|
||||
public void resumeFailed(Throwable caught, String reason);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Called when the resume of task is stopped
|
||||
*
|
||||
* @param trId
|
||||
* @param reason
|
||||
* @param details
|
||||
*/
|
||||
public void resumeStopped(TRId trId, String reason, String details);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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;
|
||||
this.progressBar.updateProgress(0, "Please Wait...");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@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 && 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...");
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,180 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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();
|
||||
|
||||
}
|
|
@ -1,195 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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.monitor.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("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);
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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 TaskResumeProgressBarUpdater implements TaskResumeProgressListener {
|
||||
|
||||
protected ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ProgressBar} updater.
|
||||
* @param progressBar the {@link ProgressBar} to update.
|
||||
*/
|
||||
public TaskResumeProgressBarUpdater(ProgressBar progressBar) {
|
||||
this.progressBar = progressBar;
|
||||
this.progressBar.updateProgress(0, "Please Wait...");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@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 && 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...");
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,180 +0,0 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* TaskResumeProgressDialog is a Dialog that show progress of resume a Task
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TaskResumeProgressDialog extends Window implements
|
||||
TaskResumeProgressListener {
|
||||
protected ArrayList<ResumeDialogListener> listeners = new ArrayList<ResumeDialogListener>();
|
||||
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
protected String WIDTH = "400px";
|
||||
protected String HEIGHT = "120px";
|
||||
protected EventBus eventBus;
|
||||
protected TaskResumeProgressUpdater progressUpdater;
|
||||
protected TextButton ok;
|
||||
protected TRId trId;
|
||||
private String reason;
|
||||
|
||||
private String details;
|
||||
|
||||
public TaskResumeProgressDialog(
|
||||
EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(true);
|
||||
setModal(true);
|
||||
setHeadingText("Task Resume 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 TaskResumeProgressUpdater();
|
||||
progressUpdater.addListener(new TaskResumeProgressBarUpdater(
|
||||
progressBar));
|
||||
|
||||
progressUpdater.addListener(this);
|
||||
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
||||
show();
|
||||
ok.setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
public void addResumeDialogListener(ResumeDialogListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeResumeDialogListener(ResumeDialogListener 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;
|
||||
fireResumeComplete(trId);
|
||||
hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason,
|
||||
String failureDetails) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
fireResumeFailed(caught,reason);
|
||||
hide();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void updateInvocation() {
|
||||
if (trId != null) {
|
||||
fireResumeStopped(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 fireResumeComplete(TRId trId) {
|
||||
for (ResumeDialogListener listener : listeners)
|
||||
listener.resumeComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireResumeFailed(Throwable caught, String reason) {
|
||||
for (ResumeDialogListener listener : listeners)
|
||||
listener.resumeFailed(caught, reason);
|
||||
}
|
||||
|
||||
protected void fireResumeStopped(TRId trId, String reason, String details) {
|
||||
for (ResumeDialogListener listener : listeners)
|
||||
listener.resumeStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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 TaskResumeProgressListener {
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
}
|
|
@ -1,195 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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.monitor.TaskResumeMonitor;
|
||||
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 TaskResumeProgressUpdater extends Timer {
|
||||
|
||||
protected ArrayList<TaskResumeProgressListener> listeners = new ArrayList<TaskResumeProgressListener>();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Log.debug("requesting operation progress");
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getTaskResumeMonitor(new AsyncCallback<TaskResumeMonitor>() {
|
||||
|
||||
|
||||
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(TaskResumeMonitor result) {
|
||||
Log.info("retrieved TaskResumeMonitor: "
|
||||
+ result.getStatus());
|
||||
switch (result.getStatus()) {
|
||||
case INITIALIZING:
|
||||
Log.info("Initializing...");
|
||||
fireOperationInitializing();
|
||||
break;
|
||||
case ABORTED:
|
||||
cancel();
|
||||
Log.info("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(TaskResumeMonitor result) {
|
||||
Log.info("Task Resume Failed");
|
||||
Throwable th = null;
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
th = result.getError();
|
||||
failure = "Failed Client Library Task Resume";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
th = new Throwable("Failed");
|
||||
failure = "Failed Client Library Task Resume";
|
||||
details = "Task Resume failed";
|
||||
}
|
||||
|
||||
fireOperationFailed(th, failure, details);
|
||||
}
|
||||
|
||||
protected void stopMessage(TaskResumeMonitor result) {
|
||||
Log.info("Task Resume Stopped");
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
failure = "Stopped task resume";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
failure = "Stopped task resume";
|
||||
details = "Task Resume 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 (TaskResumeProgressListener listener : listeners)
|
||||
listener.operationInitializing();
|
||||
}
|
||||
|
||||
protected void fireOperationGeneratingView() {
|
||||
for (TaskResumeProgressListener listener : listeners)
|
||||
listener.operationGeneratingView();
|
||||
}
|
||||
|
||||
protected void fireOperationUpdate(float elaborated) {
|
||||
for (TaskResumeProgressListener listener : listeners)
|
||||
listener.operationUpdate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationValidate(float elaborated) {
|
||||
for (TaskResumeProgressListener listener : listeners)
|
||||
listener.operationValidate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationComplete(TRId trId) {
|
||||
for (TaskResumeProgressListener listener : listeners)
|
||||
listener.operationComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String failure,
|
||||
String failureDetails) {
|
||||
for (TaskResumeProgressListener listener : listeners)
|
||||
listener.operationFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (TaskResumeProgressListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new {@link TaskResumeProgressListener} to this
|
||||
* {@link TaskResumeProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to add.
|
||||
*/
|
||||
public void addListener(TaskResumeProgressListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link TaskResumeProgressListener} from this
|
||||
* {@link TaskResumeProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to remove.
|
||||
*/
|
||||
public void removeListener(TaskResumeProgressListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
|
@ -5,7 +5,6 @@ import java.util.Date;
|
|||
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionDialog;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionListener;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowsProperties;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.ReplaceColumnProgressDialog;
|
||||
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;
|
||||
|
@ -13,7 +12,12 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpire
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnSession;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||
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.CellData;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
@ -52,7 +56,8 @@ import com.sencha.gxt.widget.core.client.form.TextField;
|
|||
*
|
||||
*/
|
||||
public class ReplacePanel extends FramedPanel implements
|
||||
DimensionRowSelectionListener {
|
||||
DimensionRowSelectionListener,
|
||||
MonitorDialogListener {
|
||||
private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
|
||||
|
||||
protected String WIDTH = "500px";
|
||||
|
@ -382,12 +387,12 @@ public class ReplacePanel extends FramedPanel implements
|
|||
Log.debug(replaceColumnSession.toString());
|
||||
}
|
||||
TDGWTServiceAsync.INSTANCE.startReplaceColumn(replaceColumnSession,
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
new AsyncCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
public void onSuccess(String taskId) {
|
||||
Log.debug("Submitted replace column value");
|
||||
callReplaceColumnProgressDialog();
|
||||
openMonitorDialog(taskId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -409,16 +414,9 @@ public class ReplacePanel extends FramedPanel implements
|
|||
|
||||
}
|
||||
|
||||
protected void callReplaceColumnProgressDialog() {
|
||||
ReplaceColumnProgressDialog dialog = new ReplaceColumnProgressDialog(
|
||||
parent, eventBus);
|
||||
dialog.show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
parent.close();
|
||||
}
|
||||
|
||||
|
||||
protected void addHandlersForComboDimensionType(
|
||||
final LabelProvider<DimensionRow> labelProvider) {
|
||||
|
@ -466,4 +464,56 @@ public class ReplacePanel extends FramedPanel implements
|
|||
dimensionRow = null;
|
||||
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if (parent != null) {
|
||||
parent.close();
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
protected void openMonitorDialog(String taskId) {
|
||||
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
|
||||
monitorDialog.add(this);
|
||||
monitorDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.COLUMNREPLACE, 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.COLUMNREPLACE, trId, why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationAborted() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationPutInBackground() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
<inherits name='com.sencha.gxt.ui.GXT' />
|
||||
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
|
||||
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
||||
|
||||
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
|
||||
|
||||
<inherits name="org.gcube.portlets.user.tdwx.TabularDataWidgetX" />
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue