diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java index 99661ea..fa9b601 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java @@ -97,6 +97,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements protected ComboBox comboDimensionType = null; protected FieldLabel comboDimensionTypeLabel; + protected ListStore storeComboDimensionType; protected ComboBox comboColumnReferenceType = null; protected FieldLabel comboColumnReferenceTypeLabel; @@ -281,7 +282,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements // comboDimensionType TabResourceProperties propsDimensionType = GWT .create(TabResourceProperties.class); - ListStore storeComboDimensionType = new ListStore( + storeComboDimensionType = new ListStore( propsDimensionType.id()); comboDimensionType = new ComboBox(storeComboDimensionType, @@ -427,7 +428,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements }); } - + + //TODO protected void addHandlersForComboColumnTypeCode( final LabelProvider labelProvider) { comboColumnTypeCode @@ -603,6 +605,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements }); } + //TODO protected void updateColumnType(ColumnTypeCode type) { Log.debug("Update ColumnTypeCode " + type.toString()); switch (type) { @@ -661,7 +664,11 @@ public class ChangeColumnTypePanel extends FramedPanel implements comboTimeDimensionTypeLabel.setVisible(false); break; } - + + //Reset comboDimensionType + comboDimensionType.reset(); + comboDimensionType.clear(); + storeComboDimensionType.commitChanges(); forceLayout(); } @@ -939,6 +946,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements public void selected(TabResource tabResource) { Log.debug("Selected Codelist: " + tabResource); comboDimensionType.setValue(tabResource, true); + retrieveColumnData(tabResource); } @@ -1035,18 +1043,21 @@ public class ChangeColumnTypePanel extends FramedPanel implements if (selectedColumn == null) { UtilsGXT3.alert("Attention", "Column not selected!"); + return; } - TabResource dimensionTR = comboDimensionType.getCurrentValue(); + TabResource dimensionTR = comboDimensionType.getValue(); if (dimensionTR == null) { UtilsGXT3.alert("Attention", "Codelist not selected!"); + return; } - ColumnData referenceColumn = comboColumnReferenceType.getCurrentValue(); + ColumnData referenceColumn = comboColumnReferenceType.getValue(); if (referenceColumn == null) { UtilsGXT3.alert("Attention", "Reference column not selected!"); + return; } ColumnMappingDialog columnMappingDialog = new ColumnMappingDialog(trId, diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingDialog.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingDialog.java index 2990c84..dbae38c 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingDialog.java @@ -21,8 +21,8 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; * */ public class ColumnMappingDialog extends Window { - protected String WIDTH = "650px"; - protected String HEIGHT = "530px"; + protected String WIDTH = "530px"; + protected String HEIGHT = "450px"; protected TRId trId; protected ColumnData selectedColumn; diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingPanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingPanel.java index 2e92b0e..88ccb53 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingPanel.java @@ -40,6 +40,7 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; 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.form.ComboBox; +import com.sencha.gxt.widget.core.client.form.FieldLabel; /** * @@ -48,11 +49,11 @@ import com.sencha.gxt.widget.core.client.form.ComboBox; * */ public class ColumnMappingPanel extends FramedPanel { - protected static final String WIDTH = "560px"; - protected static final String HEIGHT = "520px"; - protected static final String COMBOWIDTH ="120px"; - protected String CONTAINERHEIGHT = "520px"; - + protected static final String WIDTH = "520px"; + protected static final String HEIGHT = "400px"; + protected static final String COMBOWIDTH ="220px"; + protected static final String CONTAINERHEIGHT = "340px"; + protected static final String CONTAINERWIDTH="500px"; protected ColumnMappingPanel thisPanel; @@ -101,16 +102,24 @@ public class ColumnMappingPanel extends FramedPanel { + ", eventBus:" + eventBus + "]"); columnMappingList = new ColumnMappingList(); mapping = new ArrayList(); + initPanel(); create(); } + protected void initPanel(){ + setHeaderVisible(false); + setBodyBorder(false); + + } + protected void create() { itemIdSourceValueArg = "SourceArg" + selectedColumn.getName(); itemIdTargetValueArg = "TargetArg" + selectedColumn.getName(); SimpleContainer container = new SimpleContainer(); container.setHeight(CONTAINERHEIGHT); - + container.setWidth(CONTAINERWIDTH); + btnSave = new TextButton("Save"); btnSave.setIcon(ResourceBundle.INSTANCE.save()); btnSave.setIconAlign(IconAlign.RIGHT); @@ -141,8 +150,8 @@ public class ColumnMappingPanel extends FramedPanel { flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); flowButton.setPack(BoxLayoutPack.CENTER); - flowButton.add(btnSave, new BoxLayoutData(new Margins(2, 4, 2, 4))); - flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4))); + flowButton.add(btnSave, new BoxLayoutData(new Margins(10, 4, 10, 4))); + flowButton.add(btnClose, new BoxLayoutData(new Margins(10, 4, 10, 4))); vert = new VerticalLayoutContainer(); @@ -152,13 +161,17 @@ public class ColumnMappingPanel extends FramedPanel { setColumnMappingData(); container.add(vert); - container.forceLayout(); - + + FieldLabel rowsLabel = new FieldLabel(null, "Select rows"); + rowsLabel.getElement().applyStyles("font-weight:bold"); + VerticalLayoutContainer vPanel = new VerticalLayoutContainer(); + vPanel.add(rowsLabel,new VerticalLayoutData(1, -1, new Margins(1))); vPanel.add(container, new VerticalLayoutData(1, -1)); vPanel.add(flowButton, new VerticalLayoutData(1, -1, new Margins(1))); add(vPanel); + forceLayout(); } @@ -170,11 +183,11 @@ public class ColumnMappingPanel extends FramedPanel { if(h!=null){ @SuppressWarnings("unchecked") ComboBox comboSourceValue=(ComboBox) h.getItemByItemId(itemIdSourceValueArg); - DimensionRow sourceValue=comboSourceValue.getCurrentValue(); + DimensionRow sourceValue=comboSourceValue.getValue(); if(sourceValue!=null){ @SuppressWarnings("unchecked") ComboBox comboTargetValue=(ComboBox) h.getItemByItemId(itemIdTargetValueArg); - DimensionRow targetValue=comboTargetValue.getCurrentValue(); + DimensionRow targetValue=comboTargetValue.getValue(); if(targetValue!=null){ ColumnMappingData columnMappingData=new ColumnMappingData(sourceValue,targetValue); mapping.add(columnMappingData); @@ -191,6 +204,7 @@ public class ColumnMappingPanel extends FramedPanel { } } else { UtilsGXT3.info("Attention", "Creates a valid mapping"); + btnSave.enable(); } } @@ -253,7 +267,7 @@ public class ColumnMappingPanel extends FramedPanel { selectedColumn.getLabel(), null, 0, 0); DimensionRowSelectionDialog dimensionRowSelectionDialog = new DimensionRowSelectionDialog( - selectedColumn, cellData, false, eventBus); + selectedColumn, cellData, true, eventBus); dimensionRowSelectionDialog .addListener(sourceValueSelectedListener); dimensionRowSelectionDialog.show(); @@ -369,10 +383,10 @@ public class ColumnMappingPanel extends FramedPanel { horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); horiz.setPack(BoxLayoutPack.START); - horiz.add(comboSourceValue, new BoxLayoutData(new Margins(2, 4, 2, 4))); - horiz.add(comboTargetValue, new BoxLayoutData(new Margins(2, 4, 2, 4))); - horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 4, 2, 4))); - horiz.add(btnDel, new BoxLayoutData(new Margins(2, 4, 2, 4))); + horiz.add(comboSourceValue, new BoxLayoutData(new Margins(2, 1, 2, 1))); + horiz.add(comboTargetValue, new BoxLayoutData(new Margins(2, 1, 2, 1))); + horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1))); + horiz.add(btnDel, new BoxLayoutData(new Margins(2, 1, 2, 1))); vert.add(horiz); } @@ -427,7 +441,7 @@ public class ColumnMappingPanel extends FramedPanel { selectedColumn.getLabel(), null, 0, 0); DimensionRowSelectionDialog dimensionRowSelectionDialog = new DimensionRowSelectionDialog( - selectedColumn, cellData, false, eventBus); + selectedColumn, cellData, true, eventBus); dimensionRowSelectionDialog .addListener(sourceValueSelectedListener); dimensionRowSelectionDialog.show(); @@ -538,15 +552,15 @@ public class ColumnMappingPanel extends FramedPanel { } }); - btnDel.setVisible(false); + btnDel.setVisible(true); horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); horiz.setPack(BoxLayoutPack.START); - horiz.add(comboSourceValue, new BoxLayoutData(new Margins(2, 4, 2, 4))); - horiz.add(comboTargetValue, new BoxLayoutData(new Margins(2, 4, 2, 4))); - horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 4, 2, 4))); - horiz.add(btnDel, new BoxLayoutData(new Margins(2, 4, 2, 4))); + horiz.add(comboSourceValue, new BoxLayoutData(new Margins(2, 1, 2, 1))); + horiz.add(comboTargetValue, new BoxLayoutData(new Margins(2, 1, 2, 1))); + horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1))); + horiz.add(btnDel, new BoxLayoutData(new Margins(2, 1, 2, 1))); vert.add(horiz); }