Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@97918 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-06-27 13:50:06 +00:00
parent 3e746340be
commit 4a149b7194
3 changed files with 55 additions and 30 deletions

View File

@ -97,6 +97,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
protected ComboBox<TabResource> comboDimensionType = null; protected ComboBox<TabResource> comboDimensionType = null;
protected FieldLabel comboDimensionTypeLabel; protected FieldLabel comboDimensionTypeLabel;
protected ListStore<TabResource> storeComboDimensionType;
protected ComboBox<ColumnData> comboColumnReferenceType = null; protected ComboBox<ColumnData> comboColumnReferenceType = null;
protected FieldLabel comboColumnReferenceTypeLabel; protected FieldLabel comboColumnReferenceTypeLabel;
@ -281,7 +282,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
// comboDimensionType // comboDimensionType
TabResourceProperties propsDimensionType = GWT TabResourceProperties propsDimensionType = GWT
.create(TabResourceProperties.class); .create(TabResourceProperties.class);
ListStore<TabResource> storeComboDimensionType = new ListStore<TabResource>( storeComboDimensionType = new ListStore<TabResource>(
propsDimensionType.id()); propsDimensionType.id());
comboDimensionType = new ComboBox<TabResource>(storeComboDimensionType, comboDimensionType = new ComboBox<TabResource>(storeComboDimensionType,
@ -427,7 +428,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
}); });
} }
//TODO
protected void addHandlersForComboColumnTypeCode( protected void addHandlersForComboColumnTypeCode(
final LabelProvider<ColumnTypeCodeElement> labelProvider) { final LabelProvider<ColumnTypeCodeElement> labelProvider) {
comboColumnTypeCode comboColumnTypeCode
@ -603,6 +605,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
}); });
} }
//TODO
protected void updateColumnType(ColumnTypeCode type) { protected void updateColumnType(ColumnTypeCode type) {
Log.debug("Update ColumnTypeCode " + type.toString()); Log.debug("Update ColumnTypeCode " + type.toString());
switch (type) { switch (type) {
@ -661,7 +664,11 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboTimeDimensionTypeLabel.setVisible(false); comboTimeDimensionTypeLabel.setVisible(false);
break; break;
} }
//Reset comboDimensionType
comboDimensionType.reset();
comboDimensionType.clear();
storeComboDimensionType.commitChanges();
forceLayout(); forceLayout();
} }
@ -939,6 +946,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
public void selected(TabResource tabResource) { public void selected(TabResource tabResource) {
Log.debug("Selected Codelist: " + tabResource); Log.debug("Selected Codelist: " + tabResource);
comboDimensionType.setValue(tabResource, true); comboDimensionType.setValue(tabResource, true);
retrieveColumnData(tabResource); retrieveColumnData(tabResource);
} }
@ -1035,18 +1043,21 @@ public class ChangeColumnTypePanel extends FramedPanel implements
if (selectedColumn == null) { if (selectedColumn == null) {
UtilsGXT3.alert("Attention", UtilsGXT3.alert("Attention",
"Column not selected!"); "Column not selected!");
return;
} }
TabResource dimensionTR = comboDimensionType.getCurrentValue(); TabResource dimensionTR = comboDimensionType.getValue();
if (dimensionTR == null) { if (dimensionTR == null) {
UtilsGXT3.alert("Attention", UtilsGXT3.alert("Attention",
"Codelist not selected!"); "Codelist not selected!");
return;
} }
ColumnData referenceColumn = comboColumnReferenceType.getCurrentValue(); ColumnData referenceColumn = comboColumnReferenceType.getValue();
if (referenceColumn == null) { if (referenceColumn == null) {
UtilsGXT3.alert("Attention", UtilsGXT3.alert("Attention",
"Reference column not selected!"); "Reference column not selected!");
return;
} }
ColumnMappingDialog columnMappingDialog = new ColumnMappingDialog(trId, ColumnMappingDialog columnMappingDialog = new ColumnMappingDialog(trId,

View File

@ -21,8 +21,8 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
* *
*/ */
public class ColumnMappingDialog extends Window { public class ColumnMappingDialog extends Window {
protected String WIDTH = "650px"; protected String WIDTH = "530px";
protected String HEIGHT = "530px"; protected String HEIGHT = "450px";
protected TRId trId; protected TRId trId;
protected ColumnData selectedColumn; protected ColumnData selectedColumn;

View File

@ -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;
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;
/** /**
* *
@ -48,11 +49,11 @@ import com.sencha.gxt.widget.core.client.form.ComboBox;
* *
*/ */
public class ColumnMappingPanel extends FramedPanel { public class ColumnMappingPanel extends FramedPanel {
protected static final String WIDTH = "560px"; protected static final String WIDTH = "520px";
protected static final String HEIGHT = "520px"; protected static final String HEIGHT = "400px";
protected static final String COMBOWIDTH ="120px"; protected static final String COMBOWIDTH ="220px";
protected String CONTAINERHEIGHT = "520px"; protected static final String CONTAINERHEIGHT = "340px";
protected static final String CONTAINERWIDTH="500px";
protected ColumnMappingPanel thisPanel; protected ColumnMappingPanel thisPanel;
@ -101,16 +102,24 @@ public class ColumnMappingPanel extends FramedPanel {
+ ", eventBus:" + eventBus + "]"); + ", eventBus:" + eventBus + "]");
columnMappingList = new ColumnMappingList(); columnMappingList = new ColumnMappingList();
mapping = new ArrayList<ColumnMappingData>(); mapping = new ArrayList<ColumnMappingData>();
initPanel();
create(); create();
} }
protected void initPanel(){
setHeaderVisible(false);
setBodyBorder(false);
}
protected void create() { protected void create() {
itemIdSourceValueArg = "SourceArg" + selectedColumn.getName(); itemIdSourceValueArg = "SourceArg" + selectedColumn.getName();
itemIdTargetValueArg = "TargetArg" + selectedColumn.getName(); itemIdTargetValueArg = "TargetArg" + selectedColumn.getName();
SimpleContainer container = new SimpleContainer(); SimpleContainer container = new SimpleContainer();
container.setHeight(CONTAINERHEIGHT); container.setHeight(CONTAINERHEIGHT);
container.setWidth(CONTAINERWIDTH);
btnSave = new TextButton("Save"); btnSave = new TextButton("Save");
btnSave.setIcon(ResourceBundle.INSTANCE.save()); btnSave.setIcon(ResourceBundle.INSTANCE.save());
btnSave.setIconAlign(IconAlign.RIGHT); btnSave.setIconAlign(IconAlign.RIGHT);
@ -141,8 +150,8 @@ public class ColumnMappingPanel extends FramedPanel {
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER); flowButton.setPack(BoxLayoutPack.CENTER);
flowButton.add(btnSave, 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(2, 4, 2, 4))); flowButton.add(btnClose, new BoxLayoutData(new Margins(10, 4, 10, 4)));
vert = new VerticalLayoutContainer(); vert = new VerticalLayoutContainer();
@ -152,13 +161,17 @@ public class ColumnMappingPanel extends FramedPanel {
setColumnMappingData(); setColumnMappingData();
container.add(vert); container.add(vert);
container.forceLayout(); container.forceLayout();
FieldLabel rowsLabel = new FieldLabel(null, "Select rows");
rowsLabel.getElement().applyStyles("font-weight:bold");
VerticalLayoutContainer vPanel = new VerticalLayoutContainer(); VerticalLayoutContainer vPanel = new VerticalLayoutContainer();
vPanel.add(rowsLabel,new VerticalLayoutData(1, -1, new Margins(1)));
vPanel.add(container, new VerticalLayoutData(1, -1)); vPanel.add(container, new VerticalLayoutData(1, -1));
vPanel.add(flowButton, new VerticalLayoutData(1, -1, new Margins(1))); vPanel.add(flowButton, new VerticalLayoutData(1, -1, new Margins(1)));
add(vPanel); add(vPanel);
forceLayout();
} }
@ -170,11 +183,11 @@ public class ColumnMappingPanel extends FramedPanel {
if(h!=null){ if(h!=null){
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
ComboBox<DimensionRow> comboSourceValue=(ComboBox<DimensionRow>) h.getItemByItemId(itemIdSourceValueArg); ComboBox<DimensionRow> comboSourceValue=(ComboBox<DimensionRow>) h.getItemByItemId(itemIdSourceValueArg);
DimensionRow sourceValue=comboSourceValue.getCurrentValue(); DimensionRow sourceValue=comboSourceValue.getValue();
if(sourceValue!=null){ if(sourceValue!=null){
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
ComboBox<DimensionRow> comboTargetValue=(ComboBox<DimensionRow>) h.getItemByItemId(itemIdTargetValueArg); ComboBox<DimensionRow> comboTargetValue=(ComboBox<DimensionRow>) h.getItemByItemId(itemIdTargetValueArg);
DimensionRow targetValue=comboTargetValue.getCurrentValue(); DimensionRow targetValue=comboTargetValue.getValue();
if(targetValue!=null){ if(targetValue!=null){
ColumnMappingData columnMappingData=new ColumnMappingData(sourceValue,targetValue); ColumnMappingData columnMappingData=new ColumnMappingData(sourceValue,targetValue);
mapping.add(columnMappingData); mapping.add(columnMappingData);
@ -191,6 +204,7 @@ public class ColumnMappingPanel extends FramedPanel {
} }
} else { } else {
UtilsGXT3.info("Attention", "Creates a valid mapping"); UtilsGXT3.info("Attention", "Creates a valid mapping");
btnSave.enable();
} }
} }
@ -253,7 +267,7 @@ public class ColumnMappingPanel extends FramedPanel {
selectedColumn.getLabel(), null, 0, 0); selectedColumn.getLabel(), null, 0, 0);
DimensionRowSelectionDialog dimensionRowSelectionDialog = new DimensionRowSelectionDialog( DimensionRowSelectionDialog dimensionRowSelectionDialog = new DimensionRowSelectionDialog(
selectedColumn, cellData, false, eventBus); selectedColumn, cellData, true, eventBus);
dimensionRowSelectionDialog dimensionRowSelectionDialog
.addListener(sourceValueSelectedListener); .addListener(sourceValueSelectedListener);
dimensionRowSelectionDialog.show(); dimensionRowSelectionDialog.show();
@ -369,10 +383,10 @@ public class ColumnMappingPanel extends FramedPanel {
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
horiz.setPack(BoxLayoutPack.START); horiz.setPack(BoxLayoutPack.START);
horiz.add(comboSourceValue, 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, 4, 2, 4))); horiz.add(comboTargetValue, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 4, 2, 4))); horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(btnDel, new BoxLayoutData(new Margins(2, 4, 2, 4))); horiz.add(btnDel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
vert.add(horiz); vert.add(horiz);
} }
@ -427,7 +441,7 @@ public class ColumnMappingPanel extends FramedPanel {
selectedColumn.getLabel(), null, 0, 0); selectedColumn.getLabel(), null, 0, 0);
DimensionRowSelectionDialog dimensionRowSelectionDialog = new DimensionRowSelectionDialog( DimensionRowSelectionDialog dimensionRowSelectionDialog = new DimensionRowSelectionDialog(
selectedColumn, cellData, false, eventBus); selectedColumn, cellData, true, eventBus);
dimensionRowSelectionDialog dimensionRowSelectionDialog
.addListener(sourceValueSelectedListener); .addListener(sourceValueSelectedListener);
dimensionRowSelectionDialog.show(); dimensionRowSelectionDialog.show();
@ -538,15 +552,15 @@ public class ColumnMappingPanel extends FramedPanel {
} }
}); });
btnDel.setVisible(false); btnDel.setVisible(true);
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
horiz.setPack(BoxLayoutPack.START); horiz.setPack(BoxLayoutPack.START);
horiz.add(comboSourceValue, 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, 4, 2, 4))); horiz.add(comboTargetValue, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 4, 2, 4))); horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(btnDel, new BoxLayoutData(new Margins(2, 4, 2, 4))); horiz.add(btnDel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
vert.add(horiz); vert.add(horiz);
} }