Fixed Final and Lock error

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@100209 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-09-25 16:44:21 +00:00
parent 4dfe6711ff
commit 683366a81d
1 changed files with 100 additions and 56 deletions

View File

@ -23,6 +23,8 @@ import org.gcube.portlets.user.td.columnwidget.client.store.TimeDimensionTypeEle
import org.gcube.portlets.user.td.columnwidget.client.store.TimeDimensionTypeStore;
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
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.TabResource;
@ -82,8 +84,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, MonitorDialogListener{
public class ChangeColumnTypePanel extends FramedPanel implements
CodelistSelectionListener, ColumnMappingListener, MonitorDialogListener {
protected String WIDTH = "640px";
protected String HEIGHT = "520px";
protected EventBus eventBus;
@ -125,7 +127,6 @@ public class ChangeColumnTypePanel extends FramedPanel implements
protected TextButton change;
protected ChangeColumnTypeSession changeColumnTypeSession;
public ChangeColumnTypePanel(TRId trId, String columnName, EventBus eventBus) {
setWidth(WIDTH);
@ -379,7 +380,6 @@ public class ChangeColumnTypePanel extends FramedPanel implements
change.setIconAlign(IconAlign.RIGHT);
change.setTitle("Change Column Type");
SelectHandler changeHandler = new SelectHandler() {
public void onSelect(SelectEvent event) {
@ -404,8 +404,10 @@ public class ChangeColumnTypePanel extends FramedPanel implements
new Margins(1)));
v.add(comboColumnReferenceTypeLabel, new VerticalLayoutData(1, -1,
new Margins(1)));
/*v.add(comboColumnMappingLabel, new VerticalLayoutData(1, -1,
new Margins(1)));*/
/*
* v.add(comboColumnMappingLabel, new VerticalLayoutData(1, -1, new
* Margins(1)));
*/
v.add(comboTimeDimensionTypeLabel, new VerticalLayoutData(1, -1,
new Margins(1)));
v.add(change, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0)));
@ -439,8 +441,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
});
}
//TODO
// TODO
protected void addHandlersForComboColumnTypeCode(
final LabelProvider<ColumnTypeCodeElement> labelProvider) {
comboColumnTypeCode
@ -564,15 +566,15 @@ public class ChangeColumnTypePanel extends FramedPanel implements
+ "!"));
Log.debug("ComboColumnReferenceType selected: "
+ event.getSelectedItem());
//TODO Mapping fix
// TODO Mapping fix
/*
comboColumnMapping.reset();
storeComboColumnMapping.clear();
storeComboColumnMapping.commitChanges();
comboColumnMappingLabel.setVisible(true);
forceLayout();
*/
* comboColumnMapping.reset();
* storeComboColumnMapping.clear();
* storeComboColumnMapping.commitChanges();
* comboColumnMappingLabel.setVisible(true);
* forceLayout();
*/
}
@ -620,7 +622,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
});
}
//TODO
// TODO
protected void updateColumnType(ColumnTypeCode type) {
Log.debug("Update ColumnTypeCode: " + type);
switch (type) {
@ -679,8 +681,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboTimeDimensionTypeLabel.setVisible(false);
break;
}
//Reset comboDimensionType
// Reset comboDimensionType
comboDimensionType.reset();
comboDimensionType.clear();
storeComboDimensionType.commitChanges();
@ -713,11 +715,23 @@ public class ChangeColumnTypePanel extends FramedPanel implements
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("load combo failure:"
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrieving columns of tabular resource:"
+ trId.getId());
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Final",
caught.getLocalizedMessage());
} else {
Log.error("load combo failure:"
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrieving columns of tabular resource:"
+ trId.getId());
}
}
}
callback.onFailure(caught);
}
@ -933,17 +947,29 @@ public class ChangeColumnTypePanel extends FramedPanel implements
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!");
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Final",
caught.getLocalizedMessage());
} 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(String taskId) {
openMonitorDialog(taskId);
}
});
@ -961,7 +987,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
public void selected(TabResource tabResource) {
Log.debug("Selected Codelist: " + tabResource);
comboDimensionType.setValue(tabResource, true);
retrieveColumnData(tabResource);
}
@ -989,10 +1015,23 @@ public class ChangeColumnTypePanel extends FramedPanel implements
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.debug("Error retrieving columns: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving columns",
"Error retrieving columns on server!");
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Final",
caught.getLocalizedMessage());
} else {
Log.debug("Error retrieving columns: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error retrieving columns",
"Error retrieving columns on server!");
}
}
}
}
@ -1019,9 +1058,21 @@ public class ChangeColumnTypePanel extends FramedPanel implements
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.debug(caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving locales",
caught.getLocalizedMessage());
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Final",
caught.getLocalizedMessage());
} else {
Log.debug(caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving locales",
caught.getLocalizedMessage());
}
}
}
}
@ -1056,22 +1107,19 @@ public class ChangeColumnTypePanel extends FramedPanel implements
protected void callColumnMappingDialog() {
ColumnData selectedColumn = comboColumn.getCurrentValue();
if (selectedColumn == null) {
UtilsGXT3.alert("Attention",
"Column not selected!");
UtilsGXT3.alert("Attention", "Column not selected!");
return;
}
TabResource dimensionTR = comboDimensionType.getValue();
if (dimensionTR == null) {
UtilsGXT3.alert("Attention",
"Codelist not selected!");
UtilsGXT3.alert("Attention", "Codelist not selected!");
return;
}
ColumnData referenceColumn = comboColumnReferenceType.getValue();
if (referenceColumn == null) {
UtilsGXT3.alert("Attention",
"Reference column not selected!");
UtilsGXT3.alert("Attention", "Reference column not selected!");
return;
}
@ -1100,17 +1148,15 @@ public class ChangeColumnTypePanel extends FramedPanel implements
}
public void close() {
if (parent != null) {
parent.close();
}
}
///
protected void openMonitorDialog(String taskId){
MonitorDialog monitorDialog=new MonitorDialog(taskId,eventBus);
// /
protected void openMonitorDialog(String taskId) {
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
monitorDialog.addProgressDialogListener(this);
monitorDialog.show();
}
@ -1121,14 +1167,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, String details) {
UtilsGXT3.alert(reason, details);
close();
}
@Override
@ -1138,21 +1184,19 @@ public class ChangeColumnTypePanel extends FramedPanel implements
ChangeTableRequestType.CHANGECOLUMNTYPE, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
close();
}
@Override
public void operationAborted() {
close();
}
@Override
public void operationPutInBackground() {
close();
}
}