Updated Column Change Type
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@101656 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
93b75461b3
commit
a2797d2c70
|
@ -27,6 +27,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalExcept
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
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.exception.TDGWTSessionExpiredException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.RefColumn;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
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.mapping.ColumnMappingList;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
||||||
|
@ -72,7 +73,6 @@ import com.sencha.gxt.widget.core.client.event.TriggerClickEvent;
|
||||||
import com.sencha.gxt.widget.core.client.event.TriggerClickEvent.TriggerClickHandler;
|
import com.sencha.gxt.widget.core.client.event.TriggerClickEvent.TriggerClickHandler;
|
||||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
|
||||||
import com.sencha.gxt.widget.core.client.info.Info;
|
import com.sencha.gxt.widget.core.client.info.Info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,47 +86,51 @@ import com.sencha.gxt.widget.core.client.info.Info;
|
||||||
*/
|
*/
|
||||||
public class ChangeColumnTypePanel extends FramedPanel implements
|
public class ChangeColumnTypePanel extends FramedPanel implements
|
||||||
CodelistSelectionListener, ColumnMappingListener, MonitorDialogListener {
|
CodelistSelectionListener, ColumnMappingListener, MonitorDialogListener {
|
||||||
protected String WIDTH = "640px";
|
private String WIDTH = "640px";
|
||||||
protected String HEIGHT = "520px";
|
private String HEIGHT = "520px";
|
||||||
protected EventBus eventBus;
|
private EventBus eventBus;
|
||||||
protected ChangeColumnTypeDialog parent;
|
private ChangeColumnTypeDialog parent;
|
||||||
protected TextField label = null;
|
// private TextField label = null;
|
||||||
protected TRId trId;
|
private TRId trId;
|
||||||
protected String columnName;
|
private String columnName;
|
||||||
protected ColumnData column;
|
// private ColumnData column;
|
||||||
protected ComboBox<ColumnData> comboColumn = null;
|
private ColumnData columnRequested;
|
||||||
protected ComboBox<ColumnTypeCodeElement> comboColumnTypeCode = null;
|
private ColumnData connectionColumn;
|
||||||
|
private ComboBox<ColumnData> comboColumn = null;
|
||||||
|
private ComboBox<ColumnTypeCodeElement> comboColumnTypeCode = null;
|
||||||
|
|
||||||
protected ComboBox<ColumnDataTypeElement> comboMeasureType = null;
|
private ComboBox<ColumnDataTypeElement> comboMeasureType = null;
|
||||||
protected FieldLabel comboMeasureTypeLabel;
|
private FieldLabel comboMeasureTypeLabel;
|
||||||
|
|
||||||
protected ComboBox<ColumnDataTypeElement> comboAttributeType = null;
|
private ComboBox<ColumnDataTypeElement> comboAttributeType = null;
|
||||||
protected FieldLabel comboAttributeTypeLabel;
|
private FieldLabel comboAttributeTypeLabel;
|
||||||
|
|
||||||
protected ComboBox<TabResource> comboDimensionType = null;
|
private ComboBox<TabResource> comboDimensionType = null;
|
||||||
protected FieldLabel comboDimensionTypeLabel;
|
private FieldLabel comboDimensionTypeLabel;
|
||||||
protected ListStore<TabResource> storeComboDimensionType;
|
private ListStore<TabResource> storeComboDimensionType;
|
||||||
|
|
||||||
protected ComboBox<ColumnData> comboColumnReferenceType = null;
|
private ComboBox<ColumnData> comboColumnReferenceType = null;
|
||||||
protected FieldLabel comboColumnReferenceTypeLabel;
|
private FieldLabel comboColumnReferenceTypeLabel;
|
||||||
protected ListStore<ColumnData> storeComboColumnReferenceType;
|
private ListStore<ColumnData> storeComboColumnReferenceType;
|
||||||
|
|
||||||
protected ComboBox<ColumnMappingList> comboColumnMapping = null;
|
private ComboBox<ColumnMappingList> comboColumnMapping = null;
|
||||||
protected FieldLabel comboColumnMappingLabel;
|
private FieldLabel comboColumnMappingLabel;
|
||||||
protected ListStore<ColumnMappingList> storeComboColumnMapping;
|
private ListStore<ColumnMappingList> storeComboColumnMapping;
|
||||||
|
|
||||||
protected ComboBox<TimeDimensionTypeElement> comboTimeDimensionType = null;
|
private ComboBox<TimeDimensionTypeElement> comboTimeDimensionType = null;
|
||||||
protected FieldLabel comboTimeDimensionTypeLabel;
|
private FieldLabel comboTimeDimensionTypeLabel;
|
||||||
|
|
||||||
protected ComboBox<LocaleTypeElement> comboLocaleType = null;
|
private ComboBox<LocaleTypeElement> comboLocaleType = null;
|
||||||
protected FieldLabel comboLocaleTypeLabel;
|
private FieldLabel comboLocaleTypeLabel;
|
||||||
protected ListStore<LocaleTypeElement> storeComboLocaleType;
|
private ListStore<LocaleTypeElement> storeComboLocaleType;
|
||||||
|
|
||||||
protected ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader;
|
private ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader;
|
||||||
|
|
||||||
protected TextButton change;
|
private TextButton change;
|
||||||
|
|
||||||
protected ChangeColumnTypeSession changeColumnTypeSession;
|
private ChangeColumnTypeSession changeColumnTypeSession;
|
||||||
|
private boolean panelCreated;
|
||||||
|
private ColumnData columnChangeType;
|
||||||
|
|
||||||
public ChangeColumnTypePanel(TRId trId, String columnName, EventBus eventBus) {
|
public ChangeColumnTypePanel(TRId trId, String columnName, EventBus eventBus) {
|
||||||
setWidth(WIDTH);
|
setWidth(WIDTH);
|
||||||
|
@ -136,8 +140,60 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
||||||
this.trId = trId;
|
this.trId = trId;
|
||||||
this.columnName = columnName;
|
this.columnName = columnName;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
panelCreated = false;
|
||||||
|
retrieveColumnRequested();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void retrieveColumnRequested() {
|
||||||
|
|
||||||
|
TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName,
|
||||||
|
new AsyncCallback<ColumnData>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
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 column: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3
|
||||||
|
.alert("Error retrieving column",
|
||||||
|
"Error retrieving column on server!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ColumnData result) {
|
||||||
|
Log.debug("Retrieved Column: " + result);
|
||||||
|
if (result == null) {
|
||||||
|
UtilsGXT3.alert("Error",
|
||||||
|
"The requested column is null");
|
||||||
|
}
|
||||||
|
columnRequested = result;
|
||||||
|
if (panelCreated) {
|
||||||
|
loader.load();
|
||||||
|
} else {
|
||||||
|
panelCreated = true;
|
||||||
create();
|
create();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected void create() {
|
protected void create() {
|
||||||
|
|
||||||
|
@ -325,7 +381,6 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
||||||
comboColumnReferenceTypeLabel = new FieldLabel(
|
comboColumnReferenceTypeLabel = new FieldLabel(
|
||||||
comboColumnReferenceType, "Column");
|
comboColumnReferenceType, "Column");
|
||||||
|
|
||||||
// TODO
|
|
||||||
// ColumnMapping
|
// ColumnMapping
|
||||||
ColumnMappingListProperties propsColumnMapping = GWT
|
ColumnMappingListProperties propsColumnMapping = GWT
|
||||||
.create(ColumnMappingListProperties.class);
|
.create(ColumnMappingListProperties.class);
|
||||||
|
@ -749,20 +804,29 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setComboStatus(ArrayList<ColumnData> result) {
|
protected void setComboStatus(ArrayList<ColumnData> result) {
|
||||||
Log.debug("ColumnName:" + columnName);
|
Log.debug("ColumnRequested: " + columnRequested);
|
||||||
if (columnName != null) {
|
String columnId;
|
||||||
for (ColumnData cd : result) {
|
|
||||||
Log.debug("ColumnData name:" + cd.getName());
|
|
||||||
if (cd.getName().compareTo(columnName) == 0) {
|
|
||||||
|
|
||||||
|
if (columnRequested.isViewColumn()) {
|
||||||
|
columnId = columnRequested.getColumnViewData()
|
||||||
|
.getSourceTableDimensionColumnId();
|
||||||
|
} else {
|
||||||
|
columnId = columnRequested.getColumnId();
|
||||||
|
}
|
||||||
|
if (columnRequested != null) {
|
||||||
|
for (ColumnData cd : result) {
|
||||||
|
Log.debug("Column:" + cd.getColumnId());
|
||||||
|
if (cd.getColumnId().compareTo(columnId) == 0) {
|
||||||
|
columnChangeType=cd;
|
||||||
updateComboStatus(cd);
|
updateComboStatus(cd);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateComboStatus(ColumnData cd) {
|
protected void updateComboStatus(ColumnData cd) {
|
||||||
Log.debug("ColumnData: " + cd.toString());
|
Log.debug("Update Combos ColumnData: " + cd.toString());
|
||||||
changeColumnTypeSession = new ChangeColumnTypeSession();
|
changeColumnTypeSession = new ChangeColumnTypeSession();
|
||||||
changeColumnTypeSession.setColumnData(cd);
|
changeColumnTypeSession.setColumnData(cd);
|
||||||
comboColumn.setValue(cd);
|
comboColumn.setValue(cd);
|
||||||
|
@ -787,19 +851,32 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
||||||
if (type == ColumnTypeCode.CODENAME) {
|
if (type == ColumnTypeCode.CODENAME) {
|
||||||
setLocale(cd.getLocale());
|
setLocale(cd.getLocale());
|
||||||
} else {
|
} else {
|
||||||
// TODO Add TimeDimension and Dimension information to
|
|
||||||
// ColumnData
|
if (type == ColumnTypeCode.TIMEDIMENSION) {
|
||||||
/*
|
changeColumnTypeSession
|
||||||
* if (type == ColumnTypeCode.TIMEDIMENSION) {
|
.setTimeDimensionType(TimeDimensionTypeStore
|
||||||
* changeColumnTypeSession
|
.selectedTimeDimension(cd
|
||||||
* .setColumnDataType(ColumnDataTypeStore
|
.getPeriodDataType()
|
||||||
* .selectedAttribute(cd.getDataTypeName()));
|
.getPeriodDataTypeLabel()));
|
||||||
* comboTimeDimensionType.setValue(TimeDimensionTypeStore
|
comboTimeDimensionType.setValue(TimeDimensionTypeStore
|
||||||
* .selectedAttributeElement(cd.getDataTypeName())); } else
|
.selectedTimeDimensionElement(cd
|
||||||
* {
|
.getPeriodDataType()
|
||||||
*
|
.getPeriodDataTypeLabel()));
|
||||||
* }
|
} else {
|
||||||
*/
|
// TODO
|
||||||
|
if (type == ColumnTypeCode.DIMENSION) {
|
||||||
|
RefColumn refColumn = new RefColumn(
|
||||||
|
String.valueOf(cd.getRelationship()
|
||||||
|
.getTargetTableId()), cd
|
||||||
|
.getRelationship()
|
||||||
|
.getTargetColumnId());
|
||||||
|
retrieveConnectionForViewColumn(refColumn);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -809,7 +886,47 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
||||||
public void update(TRId trId, String columnName) {
|
public void update(TRId trId, String columnName) {
|
||||||
this.trId = trId;
|
this.trId = trId;
|
||||||
this.columnName = columnName;
|
this.columnName = columnName;
|
||||||
loader.load();
|
retrieveColumnRequested();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void retrieveConnectionForViewColumn(RefColumn refCol) {
|
||||||
|
Log.debug("Retrieve Connection For View Column: " + refCol);
|
||||||
|
TDGWTServiceAsync.INSTANCE.getConnection(refCol,
|
||||||
|
new AsyncCallback<ColumnData>() {
|
||||||
|
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
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 column failure:"
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3
|
||||||
|
.alert("Error retrieving connection",
|
||||||
|
"Error retrieving connection column");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSuccess(ColumnData result) {
|
||||||
|
Log.debug("Column: " + result);
|
||||||
|
connectionColumn = result;
|
||||||
|
retrieveTabularResource(result.getTrId());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onChangeTypeColumn() {
|
protected void onChangeTypeColumn() {
|
||||||
|
@ -988,7 +1105,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
||||||
Log.debug("Selected Codelist: " + tabResource);
|
Log.debug("Selected Codelist: " + tabResource);
|
||||||
comboDimensionType.setValue(tabResource, true);
|
comboDimensionType.setValue(tabResource, true);
|
||||||
|
|
||||||
retrieveColumnData(tabResource);
|
retrieveColumnsForDimension(tabResource.getTrId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1004,9 +1121,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void retrieveColumnData(TabResource tabResource) {
|
protected void retrieveColumnsForDimension(TRId trId) {
|
||||||
TDGWTServiceAsync.INSTANCE.getColumnsForDimension(
|
TDGWTServiceAsync.INSTANCE.getColumnsForDimension(trId,
|
||||||
tabResource.getTrId(),
|
|
||||||
new AsyncCallback<ArrayList<ColumnData>>() {
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1048,6 +1164,93 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void retrieveColumnsForSelectedDimension(TRId trId) {
|
||||||
|
TDGWTServiceAsync.INSTANCE.getColumnsForDimension(trId,
|
||||||
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
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!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ArrayList<ColumnData> result) {
|
||||||
|
comboColumnReferenceType.reset();
|
||||||
|
storeComboColumnReferenceType.clear();
|
||||||
|
storeComboColumnReferenceType.addAll(result);
|
||||||
|
storeComboColumnReferenceType.commitChanges();
|
||||||
|
comboColumnReferenceTypeLabel.setVisible(true);
|
||||||
|
comboColumnReferenceType.setValue(connectionColumn,
|
||||||
|
true);
|
||||||
|
forceLayout();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void retrieveTabularResource(TRId trId) {
|
||||||
|
TDGWTServiceAsync.INSTANCE.getTabResourceInformation(trId,
|
||||||
|
new AsyncCallback<TabResource>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
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 tabular resource: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3
|
||||||
|
.alert("Error retrieving tabular resource",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(TabResource result) {
|
||||||
|
comboDimensionType.setValue(result, true);
|
||||||
|
retrieveColumnsForSelectedDimension(result.getTrId());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected void retriveLocales() {
|
protected void retriveLocales() {
|
||||||
TDGWTServiceAsync.INSTANCE
|
TDGWTServiceAsync.INSTANCE
|
||||||
.getLocales(new AsyncCallback<ArrayList<String>>() {
|
.getLocales(new AsyncCallback<ArrayList<String>>() {
|
||||||
|
|
Loading…
Reference in New Issue