Minor update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-unionwizard-widget@102104 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-12-15 16:26:02 +00:00 committed by Giancarlo Panichi
parent 69f8d6ddc4
commit f351397feb
1 changed files with 84 additions and 61 deletions

View File

@ -15,6 +15,8 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredE
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;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.RelationshipData;
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
@ -316,37 +318,10 @@ public class ColumnMappingPanel extends ContentPanel {
storeComboUnionColumn.commitChanges();
ColumnData selectedSourceColumn = event
.getSelectedItem();
for (ColumnData col : unionColumns) {
if (selectedSourceColumn.getDataTypeName()
.compareTo(ColumnDataType.Text.toString()) == 0
|| col.getDataTypeName().compareTo(
ColumnDataType.Text.toString()) == 0) {
storeComboUnionColumn.add(col);
} else {
if ((col.getDataTypeName().compareTo(
ColumnDataType.Integer.toString()) == 0 && selectedSourceColumn
.getDataTypeName().compareTo(
ColumnDataType.Numeric
.toString()) == 0)
|| (col.getDataTypeName().compareTo(
ColumnDataType.Numeric
.toString()) == 0 && selectedSourceColumn
.getDataTypeName().compareTo(
ColumnDataType.Integer
.toString()) == 0)) {
storeComboUnionColumn.add(col);
} else {
if (col.getDataTypeName().compareTo(
selectedSourceColumn
.getDataTypeName()) == 0) {
storeComboUnionColumn.add(col);
} else {
}
}
}
}
updateStoreComboUnionColumn(selectedSourceColumn,
storeComboUnionColumn);
storeComboUnionColumn.commitChanges();
comboUnionColumn.redraw();
comboUnionColumn.enable();
@ -458,40 +433,13 @@ public class ColumnMappingPanel extends ContentPanel {
comboUnionColumn.clear();
storeComboUnionColumn.clear();
storeComboUnionColumn.commitChanges();
ColumnData selectedSourceColumn = event
.getSelectedItem();
for (ColumnData col : unionColumns) {
if (selectedSourceColumn.getDataTypeName()
.compareTo(ColumnDataType.Text.toString()) == 0
|| col.getDataTypeName().compareTo(
ColumnDataType.Text.toString()) == 0) {
storeComboUnionColumn.add(col);
} else {
if ((col.getDataTypeName().compareTo(
ColumnDataType.Integer.toString()) == 0 && selectedSourceColumn
.getDataTypeName().compareTo(
ColumnDataType.Numeric
.toString()) == 0)
|| (col.getDataTypeName().compareTo(
ColumnDataType.Numeric
.toString()) == 0 && selectedSourceColumn
.getDataTypeName().compareTo(
ColumnDataType.Integer
.toString()) == 0)) {
storeComboUnionColumn.add(col);
} else {
if (col.getDataTypeName().compareTo(
selectedSourceColumn
.getDataTypeName()) == 0) {
storeComboUnionColumn.add(col);
} else {
}
}
}
}
updateStoreComboUnionColumn(selectedSourceColumn,
storeComboUnionColumn);
storeComboUnionColumn.commitChanges();
comboUnionColumn.redraw();
comboUnionColumn.enable();
@ -510,6 +458,81 @@ public class ColumnMappingPanel extends ContentPanel {
vert.add(horiz);
}
protected void updateStoreComboUnionColumn(ColumnData selectedSourceColumn,
ListStore<ColumnData> storeComboUnionColumn) {
for (ColumnData col : unionColumns) {
if (selectedSourceColumn.getTypeCode().compareTo(
ColumnTypeCode.DIMENSION.toString()) == 0) {
if (col.getTypeCode().compareTo(
ColumnTypeCode.DIMENSION.toString()) == 0) {
RelationshipData sourceRelData = selectedSourceColumn
.getRelationship();
RelationshipData colRelData = col.getRelationship();
if (sourceRelData != null
&& colRelData != null
&& sourceRelData.getTargetTableId() != null
&& colRelData.getTargetTableId() != null
&& sourceRelData.getTargetTableId().compareTo(
colRelData.getTargetTableId()) == 0) {
storeComboUnionColumn.add(col);
}
}
} else {
if (selectedSourceColumn.getTypeCode().compareTo(
ColumnTypeCode.TIMEDIMENSION.toString()) == 0) {
if (col.getTypeCode().compareTo(
ColumnTypeCode.TIMEDIMENSION.toString()) == 0) {
RelationshipData sourceRelData = selectedSourceColumn
.getRelationship();
RelationshipData colRelData = col.getRelationship();
if (sourceRelData != null
&& colRelData != null
&& sourceRelData.getTargetTableId() != null
&& colRelData.getTargetTableId() != null
&& sourceRelData.getTargetTableId().compareTo(
colRelData.getTargetTableId()) == 0
&& selectedSourceColumn.getPeriodDataType()
.compareTo(col.getPeriodDataType()) == 0) {
storeComboUnionColumn.add(col);
}
}
} else {
if (selectedSourceColumn.getDataTypeName().compareTo(
ColumnDataType.Text.toString()) == 0
|| col.getDataTypeName().compareTo(
ColumnDataType.Text.toString()) == 0) {
storeComboUnionColumn.add(col);
} else {
if ((col.getDataTypeName().compareTo(
ColumnDataType.Integer.toString()) == 0 && selectedSourceColumn
.getDataTypeName().compareTo(
ColumnDataType.Numeric.toString()) == 0)
|| (col.getDataTypeName().compareTo(
ColumnDataType.Numeric.toString()) == 0 && selectedSourceColumn
.getDataTypeName().compareTo(
ColumnDataType.Integer
.toString()) == 0)) {
storeComboUnionColumn.add(col);
} else {
if (col.getDataTypeName().compareTo(
selectedSourceColumn.getDataTypeName()) == 0) {
storeComboUnionColumn.add(col);
} else {
}
}
}
}
}
}
}
/**
*
* @return