Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-unionwizard-widget@98856 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
17e289dc61
commit
44e9a8afa0
|
@ -14,6 +14,7 @@ import org.gcube.portlets.user.td.unionwizardwidget.client.utils.UtilsGXT3;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
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.client.type.SessionExpiredType;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
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.wizardwidget.client.dataresource.ResourceBundle;
|
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
@ -48,7 +49,7 @@ import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||||
public class ColumnMappingPanel extends ContentPanel {
|
public class ColumnMappingPanel extends ContentPanel {
|
||||||
|
|
||||||
private static final String COMBOWIDTH = "200px";
|
private static final String COMBOWIDTH = "200px";
|
||||||
//private static final String COLUMNLABELWIDTH = "120px";
|
// private static final String COLUMNLABELWIDTH = "120px";
|
||||||
protected ResourceBundle res;
|
protected ResourceBundle res;
|
||||||
protected ColumnMappingCard parent;
|
protected ColumnMappingCard parent;
|
||||||
protected VerticalLayoutContainer vert;
|
protected VerticalLayoutContainer vert;
|
||||||
|
@ -76,7 +77,6 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
thisPanel = this;
|
thisPanel = this;
|
||||||
|
|
||||||
|
|
||||||
Log.debug("ColumnMappingPanel");
|
Log.debug("ColumnMappingPanel");
|
||||||
init();
|
init();
|
||||||
retrieveSourceColumns();
|
retrieveSourceColumns();
|
||||||
|
@ -84,10 +84,10 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
setHeaderVisible(false);
|
setHeaderVisible(false);
|
||||||
//setBodyBorder(false);
|
// setBodyBorder(false);
|
||||||
setBodyStyle("backgroundColor:#DFE8F6;");
|
setBodyStyle("backgroundColor:#DFE8F6;");
|
||||||
//new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
// new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
||||||
//Important: fixed rendering of widgets
|
// Important: fixed rendering of widgets
|
||||||
forceLayoutOnResize = true;
|
forceLayoutOnResize = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,18 +102,22 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
|
|
||||||
setColumnMap();
|
setColumnMap();
|
||||||
|
|
||||||
/*FieldLabel columnLabel = new FieldLabel(null, "Column Label");
|
/*
|
||||||
columnLabel.getElement().applyStyles("font-weight:bold");
|
* FieldLabel columnLabel = new FieldLabel(null, "Column Label");
|
||||||
columnLabel.setWidth(COLUMNLABELWIDTH);
|
* columnLabel.getElement().applyStyles("font-weight:bold");
|
||||||
columnLabel.setLabelSeparator("");*/
|
* columnLabel.setWidth(COLUMNLABELWIDTH);
|
||||||
|
* columnLabel.setLabelSeparator("");
|
||||||
|
*/
|
||||||
|
|
||||||
String currentTRLabel=parent.unionSession.getCurrentTabularResource().getName();
|
String currentTRLabel = parent.unionSession.getCurrentTabularResource()
|
||||||
|
.getName();
|
||||||
FieldLabel sourceColumnLabel = new FieldLabel(null, currentTRLabel);
|
FieldLabel sourceColumnLabel = new FieldLabel(null, currentTRLabel);
|
||||||
sourceColumnLabel.getElement().applyStyles("font-weight:bold");
|
sourceColumnLabel.getElement().applyStyles("font-weight:bold");
|
||||||
sourceColumnLabel.setWidth(COMBOWIDTH);
|
sourceColumnLabel.setWidth(COMBOWIDTH);
|
||||||
sourceColumnLabel.setLabelSeparator("");
|
sourceColumnLabel.setLabelSeparator("");
|
||||||
|
|
||||||
String unionTRLabel=parent.unionSession.getUnionTabularResource().getName();
|
String unionTRLabel = parent.unionSession.getUnionTabularResource()
|
||||||
|
.getName();
|
||||||
FieldLabel unionColumnLabel = new FieldLabel(null, unionTRLabel);
|
FieldLabel unionColumnLabel = new FieldLabel(null, unionTRLabel);
|
||||||
unionColumnLabel.getElement().applyStyles("font-weight:bold");
|
unionColumnLabel.getElement().applyStyles("font-weight:bold");
|
||||||
unionColumnLabel.setWidth(COMBOWIDTH);
|
unionColumnLabel.setWidth(COMBOWIDTH);
|
||||||
|
@ -123,20 +127,18 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
horiz.setPack(BoxLayoutPack.START);
|
horiz.setPack(BoxLayoutPack.START);
|
||||||
|
|
||||||
//horiz.add(columnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
// horiz.add(columnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
horiz.add(sourceColumnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
horiz.add(sourceColumnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
horiz.add(unionColumnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
horiz.add(unionColumnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VerticalLayoutContainer vPanel = new VerticalLayoutContainer();
|
VerticalLayoutContainer vPanel = new VerticalLayoutContainer();
|
||||||
vPanel.setScrollMode(ScrollMode.AUTO);
|
vPanel.setScrollMode(ScrollMode.AUTO);
|
||||||
vPanel.setAdjustForScroll(true);
|
vPanel.setAdjustForScroll(true);
|
||||||
|
|
||||||
|
vPanel.add(horiz, new VerticalLayoutData(1, -1,
|
||||||
vPanel.add(horiz, new VerticalLayoutData(1, -1, new Margins(1,1,1,10)));
|
new Margins(1, 1, 1, 10)));
|
||||||
vPanel.add(container, new VerticalLayoutData(1, -1, new Margins(1,1,1,10)));
|
vPanel.add(container, new VerticalLayoutData(1, -1, new Margins(1, 1,
|
||||||
|
1, 10)));
|
||||||
|
|
||||||
add(vPanel);
|
add(vPanel);
|
||||||
forceLayout();
|
forceLayout();
|
||||||
|
@ -210,10 +212,12 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
final HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
final HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||||
|
|
||||||
// Column Label
|
// Column Label
|
||||||
/*TextField columnLabel = new TextField();
|
/*
|
||||||
columnLabel.setItemId(itemIdLabelColumn);
|
* TextField columnLabel = new TextField();
|
||||||
columnLabel.setAllowBlank(false);
|
* columnLabel.setItemId(itemIdLabelColumn);
|
||||||
columnLabel.setWidth(COLUMNLABELWIDTH);*/
|
* columnLabel.setAllowBlank(false);
|
||||||
|
* columnLabel.setWidth(COLUMNLABELWIDTH);
|
||||||
|
*/
|
||||||
|
|
||||||
// Source Combo
|
// Source Combo
|
||||||
ColumnDataProperties propsSourceColumn = GWT
|
ColumnDataProperties propsSourceColumn = GWT
|
||||||
|
@ -298,11 +302,32 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
.getSelectedItem();
|
.getSelectedItem();
|
||||||
storeComboUnionColumn.clear();
|
storeComboUnionColumn.clear();
|
||||||
for (ColumnData col : unionColumns) {
|
for (ColumnData col : unionColumns) {
|
||||||
if (col.getDataTypeName() == selectedSourceColumn
|
if (selectedSourceColumn.getDataTypeName()
|
||||||
.getDataTypeName()
|
.compareTo(ColumnDataType.Text.toString()) == 0
|
||||||
&& col.getTypeCode() == selectedSourceColumn
|
|| col.getDataTypeName().compareTo(
|
||||||
.getTypeCode()) {
|
ColumnDataType.Text.toString()) == 0) {
|
||||||
storeComboUnionColumn.add(col);
|
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 {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
storeComboUnionColumn.commitChanges();
|
storeComboUnionColumn.commitChanges();
|
||||||
|
@ -314,7 +339,7 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
horiz.setPack(BoxLayoutPack.START);
|
horiz.setPack(BoxLayoutPack.START);
|
||||||
|
|
||||||
//horiz.add(columnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
// horiz.add(columnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
horiz.add(comboSourceColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
horiz.add(comboSourceColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
horiz.add(comboUnionColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
horiz.add(comboUnionColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
|
@ -328,10 +353,12 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
final HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
final HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||||
|
|
||||||
// Column Label
|
// Column Label
|
||||||
/*TextField columnLabel = new TextField();
|
/*
|
||||||
columnLabel.setItemId(itemIdLabelColumn);
|
* TextField columnLabel = new TextField();
|
||||||
columnLabel.setAllowBlank(false);
|
* columnLabel.setItemId(itemIdLabelColumn);
|
||||||
columnLabel.setWidth(COLUMNLABELWIDTH);*/
|
* columnLabel.setAllowBlank(false);
|
||||||
|
* columnLabel.setWidth(COLUMNLABELWIDTH);
|
||||||
|
*/
|
||||||
|
|
||||||
// Source Combo
|
// Source Combo
|
||||||
ColumnDataProperties propsSourceColumn = GWT
|
ColumnDataProperties propsSourceColumn = GWT
|
||||||
|
@ -416,11 +443,32 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
.getSelectedItem();
|
.getSelectedItem();
|
||||||
storeComboUnionColumn.clear();
|
storeComboUnionColumn.clear();
|
||||||
for (ColumnData col : unionColumns) {
|
for (ColumnData col : unionColumns) {
|
||||||
if (col.getDataTypeName() == selectedSourceColumn
|
if (selectedSourceColumn.getDataTypeName()
|
||||||
.getDataTypeName()
|
.compareTo(ColumnDataType.Text.toString()) == 0
|
||||||
&& col.getTypeCode() == selectedSourceColumn
|
|| col.getDataTypeName().compareTo(
|
||||||
.getTypeCode()) {
|
ColumnDataType.Text.toString()) == 0) {
|
||||||
storeComboUnionColumn.add(col);
|
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 {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
storeComboUnionColumn.commitChanges();
|
storeComboUnionColumn.commitChanges();
|
||||||
|
@ -432,7 +480,7 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
horiz.setPack(BoxLayoutPack.START);
|
horiz.setPack(BoxLayoutPack.START);
|
||||||
|
|
||||||
//horiz.add(columnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
// horiz.add(columnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
horiz.add(comboSourceColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
horiz.add(comboSourceColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
horiz.add(comboUnionColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
horiz.add(comboUnionColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
|
@ -453,23 +501,22 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
for (; i < lenght; i++) {
|
for (; i < lenght; i++) {
|
||||||
HBoxLayoutContainer h = (HBoxLayoutContainer) vert.getWidget(i);
|
HBoxLayoutContainer h = (HBoxLayoutContainer) vert.getWidget(i);
|
||||||
if (h != null) {
|
if (h != null) {
|
||||||
/*TextField columnLabelField = (TextField) h
|
/*
|
||||||
.getItemByItemId(itemIdLabelColumn);
|
* TextField columnLabelField = (TextField) h
|
||||||
if (columnLabelField != null) {
|
* .getItemByItemId(itemIdLabelColumn); if (columnLabelField !=
|
||||||
String columnLabel = columnLabelField.getCurrentValue();
|
* null) { String columnLabel =
|
||||||
if (columnLabel != null && !columnLabel.isEmpty()) {
|
* columnLabelField.getCurrentValue(); if (columnLabel != null
|
||||||
|
* && !columnLabel.isEmpty()) {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
ComboBox<ColumnData> comboSourceColumn = (ComboBox<ColumnData>) h
|
ComboBox<ColumnData> comboSourceColumn = (ComboBox<ColumnData>) h
|
||||||
.getItemByItemId(itemIdSourceColumn);
|
.getItemByItemId(itemIdSourceColumn);
|
||||||
ColumnData sourceColumn = comboSourceColumn
|
ColumnData sourceColumn = comboSourceColumn.getCurrentValue();
|
||||||
.getCurrentValue();
|
|
||||||
if (sourceColumn != null) {
|
if (sourceColumn != null) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
ComboBox<ColumnData> comboUnionColumn = (ComboBox<ColumnData>) h
|
ComboBox<ColumnData> comboUnionColumn = (ComboBox<ColumnData>) h
|
||||||
.getItemByItemId(itemIdUnionColumn);
|
.getItemByItemId(itemIdUnionColumn);
|
||||||
ColumnData unionColumn = comboUnionColumn
|
ColumnData unionColumn = comboUnionColumn.getCurrentValue();
|
||||||
.getCurrentValue();
|
|
||||||
if (unionColumn != null) {
|
if (unionColumn != null) {
|
||||||
UnionColumnsMapping colMatch = new UnionColumnsMapping(
|
UnionColumnsMapping colMatch = new UnionColumnsMapping(
|
||||||
"default", sourceColumn, unionColumn);
|
"default", sourceColumn, unionColumn);
|
||||||
|
@ -481,12 +528,9 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
Log.debug("Source Column is null");
|
Log.debug("Source Column is null");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
} else {
|
* } else { Log.debug("Column Label is null"); } } else {
|
||||||
Log.debug("Column Label is null");
|
* Log.debug("Column Label Field is null"); }
|
||||||
}
|
*/
|
||||||
} else {
|
|
||||||
Log.debug("Column Label Field is null");
|
|
||||||
}*/
|
|
||||||
} else {
|
} else {
|
||||||
Log.debug("HorizontalContainer is null");
|
Log.debug("HorizontalContainer is null");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue