Updated Ambiguous

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@98560 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-07-10 16:16:46 +00:00
parent 494670918f
commit fa70ac92dc
9 changed files with 508 additions and 65 deletions

View File

@ -5146,3 +5146,67 @@ Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
40% complete (ETR: 8 seconds)
50% complete (ETR: 6 seconds)
60% complete (ETR: 4 seconds)
70% complete (ETR: 3 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 15.25 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: 10 seconds)
30% complete (ETR: 10 seconds)
30% complete (ETR: 10 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 14.96 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

View File

@ -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;
/**
@ -45,4 +47,27 @@ public class ChangeColumnTypeDialog extends Window {
}
/**
* {@inheritDoc}
*/
@Override
protected void initTools() {
super.initTools();
closeBtn.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
close();
}
});
}
public void close() {
hide();
}
}

View File

@ -8,6 +8,7 @@ import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingDialo
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;
@ -28,7 +29,10 @@ 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.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 org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
@ -77,7 +81,7 @@ import com.sencha.gxt.widget.core.client.info.Info;
*
*/
public class ChangeColumnTypePanel extends FramedPanel implements
CodelistSelectionListener, ColumnMappingListener {
CodelistSelectionListener, ColumnMappingListener, ProgressDialogListener{
protected String WIDTH = "640px";
protected String HEIGHT = "520px";
protected EventBus eventBus;
@ -927,8 +931,9 @@ public class ChangeColumnTypePanel extends FramedPanel implements
}
public void onSuccess(Void result) {
changeColumnTypeProgressDialog = new ChangeColumnTypeProgressDialog(
changeColumnTypeSession, eventBus);
callChangeColumnTypeProgressDialog();
}
});
@ -1085,4 +1090,46 @@ public class ChangeColumnTypePanel extends FramedPanel implements
}
public void close() {
if (parent != null) {
parent.close();
}
}
protected void callChangeColumnTypeProgressDialog(){
changeColumnTypeProgressDialog = new ChangeColumnTypeProgressDialog(
eventBus);
changeColumnTypeProgressDialog.addProgressDialogListener(this);
changeColumnTypeProgressDialog.show();
}
@Override
public void operationComplete(TRId trId) {
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.CHANGECOLUMNTYPE, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
close();
}
@Override
public void operationFailed(Throwable caught, String reason) {
UtilsGXT3.alert("Error in Change Column Type", reason);
close();
}
@Override
public void operationStopped(TRId trId, String reason, String details) {
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.CHANGECOLUMNTYPE, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
close();
}
}

View File

@ -2,14 +2,10 @@ package org.gcube.portlets.user.td.columnwidget.client;
import org.gcube.portlets.user.td.columnwidget.client.progress.ChangeColumnTypeProgressDialog;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
/**
*
@ -21,10 +17,10 @@ public class ColumnWidgetEntry implements EntryPoint {
public void onModuleLoad() {
EventBus eventBus= new SimpleEventBus();
//EventBus eventBus= new SimpleEventBus();
TRId trId=new TRId();
//For example Tabular Resource 1 and table 1
//For example Tabular Resource 7 and table 402
trId.setId("7");
trId.setTableId("402");
@ -37,9 +33,11 @@ public class ColumnWidgetEntry implements EntryPoint {
/*ChangeColumnTypeDialog changeColumnType=new ChangeColumnTypeDialog(trId,eventBus);
changeColumnType.show();
*/
ChangeColumnTypeSession changeColumnTypeSession=null;
ChangeColumnTypeProgressDialog c=new ChangeColumnTypeProgressDialog(changeColumnTypeSession, eventBus);
/*ChangeColumnTypeProgressDialog c=new ChangeColumnTypeProgressDialog(eventBus);
c.addProgressDialogListener(changeColumnType);
c.show();
*/
/*DialogCodelistSelection dcs=new DialogCodelistSelection();
dcs.show();

View File

@ -1,5 +1,8 @@
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;
@ -11,7 +14,14 @@ import org.gcube.portlets.user.td.gwtservice.shared.Constants;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.task.InvocationS;
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResumeSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ConditionCode;
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.gwtservice.shared.tr.column.mapping.ColumnMappingList;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
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;
@ -19,6 +29,9 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.RequestProperties;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeMap;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -42,6 +55,8 @@ public class ReplaceBatchDialog extends Window implements
protected RequestProperties requestProperties;
protected EventBus eventBus;
protected String taskId;
private InvocationS invocationS;
private ConditionCode conditionCode; // For Curation
public ReplaceBatchDialog(TRId trId, String columnName, EventBus eventBus) {
this.trId = trId;
@ -62,10 +77,13 @@ public class ReplaceBatchDialog extends Window implements
this.requestProperties = requestProperties;
this.eventBus = eventBus;
InvocationS invocationS=(InvocationS) requestProperties.getMap().get(
invocationS = (InvocationS) requestProperties.getMap().get(
Constants.REQUEST_PROPERTIES_INVOCATIONS);
taskId = invocationS.getTaskId();
conditionCode = (ConditionCode) requestProperties.getMap().get(
Constants.REQUEST_PROPERTIES_CONDITIONCODE);
Log.debug("Resume TaskId:" + taskId);
initWindow();
@ -79,12 +97,56 @@ public class ReplaceBatchDialog extends Window implements
setHeight(HEIGHT);
setBodyBorder(false);
setResizable(false);
setHeadingText("Replace Batch");
setClosable(true);
setModal(true);
forceLayoutOnResize = true;
getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch());
if (conditionCode == null) {
setHeadingText("Replace Batch");
getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch());
} else {
switch(conditionCode){
case AllowedColumnType:
break;
case AmbiguousValueOnExternalReference:
setHeadingText("Resolve Ambiguous Values");
break;
case CastValidation:
break;
case CodeNamePresence:
break;
case DuplicateTupleValidation:
break;
case DuplicateValueInColumn:
break;
case GenericTupleValidity:
break;
case GenericValidity:
break;
case MaxOneCodenameForDataLocale:
break;
case MissingValueOnExternalReference:
setHeadingText("Resolve Value on External Reference");
break;
case MustContainAtLeastOneDimension:
break;
case MustContainAtLeastOneMeasure:
break;
case MustHaveDataLocaleMetadataAndAtLeastOneLabel:
break;
case OnlyOneCodeColumn:
break;
case OnlyOneCodenameColumn:
break;
case ValidPeriodFormat:
break;
default:
setHeadingText("Replace Batch");
getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch());
break;
}
}
}
/**
@ -110,6 +172,54 @@ public class ReplaceBatchDialog extends Window implements
protected void startBatchReplace(
ReplaceBatchColumnSession replaceBatchColumnSession) {
if (conditionCode == null) {
callStartReplaceBatchColumn(replaceBatchColumnSession);
} else {
switch (conditionCode) {
case AllowedColumnType:
break;
case AmbiguousValueOnExternalReference:
callChangeColumnType(replaceBatchColumnSession);
break;
case CastValidation:
break;
case CodeNamePresence:
break;
case DuplicateTupleValidation:
break;
case DuplicateValueInColumn:
break;
case GenericTupleValidity:
break;
case GenericValidity:
break;
case MaxOneCodenameForDataLocale:
break;
case MissingValueOnExternalReference:
callStartReplaceBatchColumn(replaceBatchColumnSession);
break;
case MustContainAtLeastOneDimension:
break;
case MustContainAtLeastOneMeasure:
break;
case MustHaveDataLocaleMetadataAndAtLeastOneLabel:
break;
case OnlyOneCodeColumn:
break;
case OnlyOneCodenameColumn:
break;
case ValidPeriodFormat:
break;
default:
callStartReplaceBatchColumn(replaceBatchColumnSession);
break;
}
}
}
protected void callStartReplaceBatchColumn(
ReplaceBatchColumnSession replaceBatchColumnSession) {
TDGWTServiceAsync.INSTANCE.startReplaceBatchColumn(
replaceBatchColumnSession, new AsyncCallback<Void>() {
@ -134,7 +244,6 @@ public class ReplaceBatchDialog extends Window implements
}
});
}
protected void callReplaceBatchColumnProgressDialog() {
@ -147,6 +256,7 @@ public class ReplaceBatchDialog extends Window implements
@Override
public void operationComplete(TRId trId) {
this.trId = trId;
if (taskId == null) {
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
@ -154,8 +264,56 @@ public class ReplaceBatchDialog extends Window implements
eventBus.fireEvent(changeTableRequestEvent);
hide();
} else {
this.trId=trId;
StartTaskResume();
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;
}
}
}
}
@ -176,9 +334,11 @@ public class ReplaceBatchDialog extends Window implements
}
protected void StartTaskResume(){
TaskResumeSession taskResumeSession=new TaskResumeSession(trId,taskId);
TDGWTServiceAsync.INSTANCE.startTaskResume(taskResumeSession, new AsyncCallback<Void>() {
protected void StartTaskResume() {
TaskResumeSession taskResumeSession = new TaskResumeSession(trId,
taskId);
TDGWTServiceAsync.INSTANCE.startTaskResume(taskResumeSession,
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
@ -188,7 +348,8 @@ 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=" + taskId
+ ")");
}
close();
@ -203,16 +364,13 @@ public class ReplaceBatchDialog extends Window implements
});
}
protected void callForTaskResume(){
TaskResumeProgressDialog dialog = new TaskResumeProgressDialog(
eventBus);
protected void callForTaskResume() {
TaskResumeProgressDialog dialog = new TaskResumeProgressDialog(eventBus);
dialog.addResumeDialogListener(this);
dialog.show();
}
@Override
public void resumeComplete(TRId trId) {
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
@ -240,4 +398,70 @@ public class ReplaceBatchDialog extends Window implements
}
private void callChangeColumnType(
ReplaceBatchColumnSession replaceBatchColumnSession) {
Log.debug("ReplaceBatchColumnSession: "+replaceBatchColumnSession.toString());
ColumnData col = replaceBatchColumnSession.getColumnData();
ColumnTypeCode colTypeCode = ColumnTypeMap.getColumnTypeCode(col
.getTypeCode());
ColumnDataType colDataType = ColumnTypeMap.getColumnDataType(col
.getDataTypeName());
ColumnData codelistColumnReference = replaceBatchColumnSession
.getConnection();
ArrayList<ReplaceEntry> replaceEntryList = replaceBatchColumnSession
.getReplaceEntryList();
ArrayList<ColumnMappingData> mapping = new ArrayList<ColumnMappingData>();
for (ReplaceEntry re : replaceEntryList) {
DimensionRow sourceArg = new DimensionRow(re.getRowId(),
re.getValue());
DimensionRow targetArg = re.getReplacementDimensionRow();
ColumnMappingData columnMappingData = new ColumnMappingData(
sourceArg, targetArg);
mapping.add(columnMappingData);
}
ColumnMappingList columnMappingList = new ColumnMappingList("1", "map",
mapping);
ChangeColumnTypeSession changeColumnTypeSession = new ChangeColumnTypeSession(
col, colTypeCode, colDataType, ColumnTypeCode.DIMENSION,
ColumnDataType.Integer, codelistColumnReference,
columnMappingList);
Log.debug("ChangeColumnTypeSession: "+changeColumnTypeSession.toString());
TDGWTServiceAsync.INSTANCE.startChangeColumnType(
changeColumnTypeSession, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.debug("Change Column Type Error: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Change Column Type Error ",
"Error in invocation of change column type operation!");
}
}
public void onSuccess(Void result) {
callChangeColumnTypeProgressDialog();
}
});
}
protected void callChangeColumnTypeProgressDialog() {
ChangeColumnTypeProgressDialog changeColumnTypeProgressDialog = new ChangeColumnTypeProgressDialog(
eventBus);
changeColumnTypeProgressDialog.addProgressDialogListener(this);
changeColumnTypeProgressDialog.show();
}
}

View File

@ -174,6 +174,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
this.eventBus = eventBus;
this.conditionCode=null;
this.validationColumnColumnId=null;
connection = null;
hasValidationColumns = false;
Log.debug("Create BatchReplacePanel(): [" + trId.toString()
@ -652,15 +653,73 @@ public class ReplaceBatchPanel extends FramedPanel implements
}
//
protected ReplaceEntry getRecord(Occurrences entry) {
ReplaceEntry data = null;
if (column.isViewColumn()) {
data = new ReplaceEntry(entry.getValue(), entry.getRowId(),
entry.getNumber(), null, null);
if (conditionCode == null) {
if (column.isViewColumn()) {
data = new ReplaceEntry(entry.getValue(), entry.getRowId(),
entry.getNumber(), null, null);
} else {
data = new ReplaceEntry(entry.getValue(), entry.getNumber(), null,
null);
}
} else {
data = new ReplaceEntry(entry.getValue(), entry.getNumber(), null,
null);
switch (conditionCode) {
case AllowedColumnType:
break;
case AmbiguousValueOnExternalReference:
data = new ReplaceEntry(entry.getValue(), entry.getRowId(),
entry.getNumber(), null, null);
break;
case CastValidation:
break;
case CodeNamePresence:
break;
case DuplicateTupleValidation:
break;
case DuplicateValueInColumn:
break;
case GenericTupleValidity:
break;
case GenericValidity:
break;
case MaxOneCodenameForDataLocale:
break;
case MissingValueOnExternalReference:
if (column.isViewColumn()) {
data = new ReplaceEntry(entry.getValue(), entry.getRowId(),
entry.getNumber(), null, null);
} else {
data = new ReplaceEntry(entry.getValue(), entry.getNumber(), null,
null);
}
break;
case MustContainAtLeastOneDimension:
break;
case MustContainAtLeastOneMeasure:
break;
case MustHaveDataLocaleMetadataAndAtLeastOneLabel:
break;
case OnlyOneCodeColumn:
break;
case OnlyOneCodenameColumn:
break;
case ValidPeriodFormat:
break;
default:
if (column.isViewColumn()) {
data = new ReplaceEntry(entry.getValue(), entry.getRowId(),
entry.getNumber(), null, null);
} else {
data = new ReplaceEntry(entry.getValue(), entry.getNumber(), null,
null);
}
break;
}
}
return data;
}
@ -708,7 +767,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
protected void startReplaceBatch(
ArrayList<ReplaceEntry> effectiveReplaceList) {
ReplaceBatchColumnSession replaceBatchColumnSession = new ReplaceBatchColumnSession(
trId, column, effectiveReplaceList, column.isViewColumn());
trId, column, effectiveReplaceList, column.isViewColumn(),connection);
parent.startBatchReplace(replaceBatchColumnSession);
}

View File

@ -2,7 +2,6 @@ package org.gcube.portlets.user.td.columnwidget.client.mapping;
import java.util.ArrayList;
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
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;
@ -75,7 +74,7 @@ public class ColumnMappingDialog extends Window {
setClosable(true);
setModal(true);
forceLayoutOnResize = true;
getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch());
//getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch());
}

View File

@ -20,7 +20,7 @@ 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
* 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>
@ -38,7 +38,6 @@ public class AddColumnProgressDialog extends Window implements
protected TextButton ok;
protected TRId trId;
private String reason;
private String details;
public AddColumnProgressDialog(

View File

@ -1,12 +1,9 @@
package org.gcube.portlets.user.td.columnwidget.client.progress;
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
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;
@ -30,19 +27,20 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
*/
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 ChangeColumnTypeSession changeColumnTypeSession;
protected EventBus eventBus;
protected ChangeColumnTypeProgressUpdater progressUpdater;
protected TextButton ok;
protected TRId trId;
private ChangeTableWhy why;
private String reason;
private String details;
public ChangeColumnTypeProgressDialog(
ChangeColumnTypeSession changeColumnTypeSession, EventBus eventBus) {
this.changeColumnTypeSession = changeColumnTypeSession;
public ChangeColumnTypeProgressDialog(EventBus eventBus) {
this.eventBus = eventBus;
setWidth(WIDTH);
setHeight(HEIGHT);
@ -88,51 +86,64 @@ public class ChangeColumnTypeProgressDialog extends Window implements
}
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;
why = ChangeTableWhy.TABLEUPDATED;
updateInvocation();
fireOperationComplete(trId);
hide();
}
@Override
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 type", reason);
fireOperationFailed(caught,reason);
hide();
}
}
public void updateInvocation() {
if (trId != null) {
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.CHANGECOLUMNTYPE, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
fireOperationStopped(trId, reason, details);
}
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;
this.reason=reason;
this.details=details;
ok.setVisible(true);
}
@Override
@ -146,4 +157,21 @@ public class ChangeColumnTypeProgressDialog extends Window implements
// TODO Auto-generated method stub
}
protected void fireOperationComplete(TRId trId) {
for (ProgressDialogListener listener : listeners)
listener.operationComplete(trId);
}
protected void fireOperationFailed(Throwable caught, String reason) {
for (ProgressDialogListener listener : listeners)
listener.operationFailed(caught, reason);
}
protected void fireOperationStopped(TRId trId, String reason, String details) {
for (ProgressDialogListener listener : listeners)
listener.operationStopped(trId,reason, details);
}
}