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 FieldLabel comboDimensionTypeLabel;
protected ListStore<TabResource> storeComboDimensionType;
protected ComboBox<ColumnData> comboColumnReferenceType = null;
protected FieldLabel comboColumnReferenceTypeLabel;
@ -281,7 +282,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
// comboDimensionType
TabResourceProperties propsDimensionType = GWT
.create(TabResourceProperties.class);
ListStore<TabResource> storeComboDimensionType = new ListStore<TabResource>(
storeComboDimensionType = new ListStore<TabResource>(
propsDimensionType.id());
comboDimensionType = new ComboBox<TabResource>(storeComboDimensionType,
@ -427,7 +428,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
});
}
//TODO
protected void addHandlersForComboColumnTypeCode(
final LabelProvider<ColumnTypeCodeElement> 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,

View File

@ -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;

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.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<ColumnMappingData>();
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<DimensionRow> comboSourceValue=(ComboBox<DimensionRow>) h.getItemByItemId(itemIdSourceValueArg);
DimensionRow sourceValue=comboSourceValue.getCurrentValue();
DimensionRow sourceValue=comboSourceValue.getValue();
if(sourceValue!=null){
@SuppressWarnings("unchecked")
ComboBox<DimensionRow> comboTargetValue=(ComboBox<DimensionRow>) 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);
}