Updated Mapping

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@98237 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-07-01 17:02:23 +00:00
parent a2f2854dfd
commit 84343a0b74
3 changed files with 185 additions and 64 deletions

View File

@ -4794,3 +4794,99 @@ Compiling...
Compilation completed in 0.00 seconds Compilation completed in 0.00 seconds
Removing invalidated units Removing invalidated units
Finding entry point classes Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
60% complete (ETR: 3 seconds)
60% complete (ETR: 3 seconds)
60% complete (ETR: 3 seconds)
60% complete (ETR: 3 seconds)
60% complete (ETR: 3 seconds)
60% complete (ETR: 3 seconds)
60% complete (ETR: 3 seconds)
70% complete (ETR: 2 seconds)
80% complete (ETR: 1 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 9.10 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
20% complete (ETR: 13 seconds)
20% complete (ETR: 13 seconds)
20% complete (ETR: 13 seconds)
30% complete (ETR: 12 seconds)
40% complete (ETR: 10 seconds)
50% complete (ETR: 9 seconds)
60% complete (ETR: 7 seconds)
70% complete (ETR: 5 seconds)
80% complete (ETR: 3 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 20.45 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
40% complete (ETR: 6 seconds)
40% complete (ETR: 6 seconds)
40% complete (ETR: 6 seconds)
40% complete (ETR: 6 seconds)
40% complete (ETR: 6 seconds)
50% complete (ETR: 5 seconds)
60% complete (ETR: 4 seconds)
70% complete (ETR: 3 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 11.84 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes

View File

@ -41,6 +41,8 @@ public class DimensionRowSelectionDialog extends Window {
protected DimensionRow dimRow; protected DimensionRow dimRow;
protected CellData cellData; protected CellData cellData;
protected boolean workOnTable; protected boolean workOnTable;
protected boolean showValue;
protected boolean errorNotColored;
protected ArrayList<DimensionRowSelectionListener> listeners; protected ArrayList<DimensionRowSelectionListener> listeners;
@ -52,12 +54,34 @@ public class DimensionRowSelectionDialog extends Window {
public DimensionRowSelectionDialog(ColumnData column, CellData cellData, public DimensionRowSelectionDialog(ColumnData column, CellData cellData,
EventBus eventBus) { EventBus eventBus) {
this.workOnTable = false; this.workOnTable = false;
this.showValue = true;
this.errorNotColored=false;
config(column, cellData, eventBus); config(column, cellData, eventBus);
} }
public DimensionRowSelectionDialog(ColumnData column, CellData cellData, public DimensionRowSelectionDialog(ColumnData column, CellData cellData,
boolean workOnTable, EventBus eventBus) { boolean workOnTable, EventBus eventBus) {
this.workOnTable = workOnTable; this.workOnTable = workOnTable;
this.showValue = true;
this.errorNotColored=false;
config(column, cellData, eventBus);
}
public DimensionRowSelectionDialog(ColumnData column, CellData cellData,
boolean workOnTable, boolean showValue, EventBus eventBus) {
this.workOnTable = workOnTable;
this.showValue = showValue;
this.errorNotColored=false;
config(column, cellData, eventBus);
}
public DimensionRowSelectionDialog(ColumnData column, CellData cellData,
boolean workOnTable, boolean showValue, boolean errorNotColored, EventBus eventBus) {
this.workOnTable = workOnTable;
this.showValue = showValue;
this.errorNotColored = errorNotColored;
config(column, cellData, eventBus); config(column, cellData, eventBus);
} }
@ -82,11 +106,13 @@ public class DimensionRowSelectionDialog extends Window {
VerticalLayoutContainer v = new VerticalLayoutContainer(); VerticalLayoutContainer v = new VerticalLayoutContainer();
value = new TextField(); if (showValue) {
if (cellData.getValue() != null) { value = new TextField();
value.setValue(cellData.getValue()); if (cellData.getValue() != null) {
value.setValue(cellData.getValue());
}
value.setReadOnly(true);
} }
value.setReadOnly(true);
// Grid // Grid
tabularData = new TabularDataX(Constants.TDX_DATASOURCE_FACTORY_ID); tabularData = new TabularDataX(Constants.TDX_DATASOURCE_FACTORY_ID);
@ -101,6 +127,7 @@ public class DimensionRowSelectionDialog extends Window {
gridPanel = tabularData.getGridPanel(); gridPanel = tabularData.getGridPanel();
gridPanel.setHeaderVisible(false); gridPanel.setHeaderVisible(false);
gridPanel.setErrorNotColored(errorNotColored);
gridPanel.setSelectionModel(SelectionMode.SINGLE); gridPanel.setSelectionModel(SelectionMode.SINGLE);
Log.debug("SetVisibleOnlyColumn: " + column); Log.debug("SetVisibleOnlyColumn: " + column);
if (workOnTable) { if (workOnTable) {
@ -124,7 +151,9 @@ public class DimensionRowSelectionDialog extends Window {
} }
} }
} }
v.add(new FieldLabel(value, "Value"), new VerticalLayoutData(1, -1)); if (showValue) {
v.add(new FieldLabel(value, "Value"), new VerticalLayoutData(1, -1));
}
v.add(gridPanel, new VerticalLayoutData(1, 1)); v.add(gridPanel, new VerticalLayoutData(1, 1));
panel.add(v); panel.add(v);

View File

@ -51,10 +51,10 @@ import com.sencha.gxt.widget.core.client.form.FieldLabel;
public class ColumnMappingPanel extends FramedPanel { public class ColumnMappingPanel extends FramedPanel {
protected static final String WIDTH = "520px"; protected static final String WIDTH = "520px";
protected static final String HEIGHT = "400px"; protected static final String HEIGHT = "400px";
protected static final String COMBOWIDTH ="220px"; protected static final String COMBOWIDTH = "220px";
protected static final String CONTAINERHEIGHT = "340px"; protected static final String CONTAINERHEIGHT = "340px";
protected static final String CONTAINERWIDTH="500px"; protected static final String CONTAINERWIDTH = "500px";
protected ColumnMappingPanel thisPanel; protected ColumnMappingPanel thisPanel;
protected ColumnMappingDialog parent; protected ColumnMappingDialog parent;
@ -72,10 +72,10 @@ public class ColumnMappingPanel extends FramedPanel {
protected ColumnMappingList columnMappingList; protected ColumnMappingList columnMappingList;
protected ArrayList<ColumnMappingData> mapping; protected ArrayList<ColumnMappingData> mapping;
private TextButton btnSave; private TextButton btnSave;
private TextButton btnClose; private TextButton btnClose;
/** /**
* *
* *
@ -105,13 +105,13 @@ public class ColumnMappingPanel extends FramedPanel {
initPanel(); initPanel();
create(); create();
} }
protected void initPanel(){ protected void initPanel() {
setHeaderVisible(false); setHeaderVisible(false);
setBodyBorder(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();
@ -119,7 +119,7 @@ public class ColumnMappingPanel extends FramedPanel {
SimpleContainer container = new SimpleContainer(); SimpleContainer container = new SimpleContainer();
container.setHeight(CONTAINERHEIGHT); container.setHeight(CONTAINERHEIGHT);
container.setWidth(CONTAINERWIDTH); 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);
@ -152,22 +152,21 @@ public class ColumnMappingPanel extends FramedPanel {
flowButton.add(btnSave, new BoxLayoutData(new Margins(10, 4, 10, 4))); flowButton.add(btnSave, new BoxLayoutData(new Margins(10, 4, 10, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(10, 4, 10, 4))); flowButton.add(btnClose, new BoxLayoutData(new Margins(10, 4, 10, 4)));
vert = new VerticalLayoutContainer(); vert = new VerticalLayoutContainer();
vert.setScrollMode(ScrollMode.AUTO); vert.setScrollMode(ScrollMode.AUTO);
vert.setAdjustForScroll(true); vert.setAdjustForScroll(true);
setColumnMappingData(); setColumnMappingData();
container.add(vert); container.add(vert);
container.forceLayout(); container.forceLayout();
FieldLabel rowsLabel = new FieldLabel(null, "Select rows"); FieldLabel rowsLabel = new FieldLabel(null, "Select rows");
rowsLabel.getElement().applyStyles("font-weight:bold"); 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(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);
@ -175,49 +174,52 @@ public class ColumnMappingPanel extends FramedPanel {
} }
protected void save(){ protected void save() {
int lenght=vert.getWidgetCount(); int lenght = vert.getWidgetCount();
int i=0; int i = 0;
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) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
ComboBox<DimensionRow> comboSourceValue=(ComboBox<DimensionRow>) h.getItemByItemId(itemIdSourceValueArg); ComboBox<DimensionRow> comboSourceValue = (ComboBox<DimensionRow>) h
DimensionRow sourceValue=comboSourceValue.getValue(); .getItemByItemId(itemIdSourceValueArg);
if(sourceValue!=null){ DimensionRow sourceValue = comboSourceValue.getValue();
if (sourceValue != null) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
ComboBox<DimensionRow> comboTargetValue=(ComboBox<DimensionRow>) h.getItemByItemId(itemIdTargetValueArg); ComboBox<DimensionRow> comboTargetValue = (ComboBox<DimensionRow>) h
DimensionRow targetValue=comboTargetValue.getValue(); .getItemByItemId(itemIdTargetValueArg);
if(targetValue!=null){ DimensionRow targetValue = comboTargetValue.getValue();
ColumnMappingData columnMappingData=new ColumnMappingData(sourceValue,targetValue); if (targetValue != null) {
ColumnMappingData columnMappingData = new ColumnMappingData(
sourceValue, targetValue);
mapping.add(columnMappingData); mapping.add(columnMappingData);
} }
} }
} else { } else {
} }
} }
if(mapping.size()>0){ if (mapping.size() > 0) {
columnMappingList=new ColumnMappingList("1","map", mapping); columnMappingList = new ColumnMappingList("1", "map", mapping);
if(parent!=null){ if (parent != null) {
parent.saveMapping(columnMappingList); parent.saveMapping(columnMappingList);
} }
} else { } else {
UtilsGXT3.info("Attention", "Creates a valid mapping"); UtilsGXT3.info("Attention", "Creates a valid mapping");
btnSave.enable(); btnSave.enable();
} }
} }
protected void close(){ protected void close() {
if(parent!=null){ if (parent != null) {
parent.close(); parent.close();
} }
hide(); hide();
} }
protected void setColumnMappingData() { protected void setColumnMappingData() {
final HBoxLayoutContainer horiz = new HBoxLayoutContainer(); final HBoxLayoutContainer horiz = new HBoxLayoutContainer();
// Source Combo // Source Combo
@ -267,7 +269,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, true, eventBus); selectedColumn, cellData, true, false, true, eventBus);
dimensionRowSelectionDialog dimensionRowSelectionDialog
.addListener(sourceValueSelectedListener); .addListener(sourceValueSelectedListener);
dimensionRowSelectionDialog.show(); dimensionRowSelectionDialog.show();
@ -281,7 +283,7 @@ public class ColumnMappingPanel extends FramedPanel {
comboSourceValue.setEditable(false); comboSourceValue.setEditable(false);
comboSourceValue.setTriggerAction(TriggerAction.ALL); comboSourceValue.setTriggerAction(TriggerAction.ALL);
//Target Combo // Target Combo
DimensionRowsProperties propsTarget = GWT DimensionRowsProperties propsTarget = GWT
.create(DimensionRowsProperties.class); .create(DimensionRowsProperties.class);
ListStore<DimensionRow> storeComboTargetValue = new ListStore<DimensionRow>( ListStore<DimensionRow> storeComboTargetValue = new ListStore<DimensionRow>(
@ -324,11 +326,11 @@ public class ColumnMappingPanel extends FramedPanel {
comboTargetValue.collapse(); comboTargetValue.collapse();
CellData cellData = new CellData("", referenceColumn.getName(), CellData cellData = new CellData("", referenceColumn.getName(),
referenceColumn.getColumnId(), referenceColumn.getColumnId(), referenceColumn
referenceColumn.getLabel(), null, 0, 0); .getLabel(), null, 0, 0);
DimensionRowSelectionDialog dimensionRowSelectionDialog = new DimensionRowSelectionDialog( DimensionRowSelectionDialog dimensionRowSelectionDialog = new DimensionRowSelectionDialog(
referenceColumn, cellData, true, eventBus); referenceColumn, cellData, true, false, true, eventBus);
dimensionRowSelectionDialog dimensionRowSelectionDialog
.addListener(targetValueSelectedListener); .addListener(targetValueSelectedListener);
dimensionRowSelectionDialog.show(); dimensionRowSelectionDialog.show();
@ -342,9 +344,6 @@ public class ColumnMappingPanel extends FramedPanel {
comboTargetValue.setEditable(false); comboTargetValue.setEditable(false);
comboTargetValue.setTriggerAction(TriggerAction.ALL); comboTargetValue.setTriggerAction(TriggerAction.ALL);
final IconButton btnAdd = new IconButton(); final IconButton btnAdd = new IconButton();
btnAdd.setItemId(itemIdBtnAdd); btnAdd.setItemId(itemIdBtnAdd);
btnAdd.setIcon(ResourceBundle.INSTANCE.add()); btnAdd.setIcon(ResourceBundle.INSTANCE.add());
@ -379,7 +378,7 @@ public class ColumnMappingPanel extends FramedPanel {
} }
}); });
btnDel.setVisible(false); btnDel.setVisible(false);
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
horiz.setPack(BoxLayoutPack.START); horiz.setPack(BoxLayoutPack.START);
@ -387,7 +386,7 @@ public class ColumnMappingPanel extends FramedPanel {
horiz.add(comboTargetValue, 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(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(btnDel, new BoxLayoutData(new Margins(2, 1, 2, 1))); horiz.add(btnDel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
vert.add(horiz); vert.add(horiz);
} }
@ -441,7 +440,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, true, eventBus); selectedColumn, cellData, true, false, true, eventBus);
dimensionRowSelectionDialog dimensionRowSelectionDialog
.addListener(sourceValueSelectedListener); .addListener(sourceValueSelectedListener);
dimensionRowSelectionDialog.show(); dimensionRowSelectionDialog.show();
@ -455,7 +454,7 @@ public class ColumnMappingPanel extends FramedPanel {
comboSourceValue.setEditable(false); comboSourceValue.setEditable(false);
comboSourceValue.setTriggerAction(TriggerAction.ALL); comboSourceValue.setTriggerAction(TriggerAction.ALL);
//Target Combo // Target Combo
DimensionRowsProperties propsTarget = GWT DimensionRowsProperties propsTarget = GWT
.create(DimensionRowsProperties.class); .create(DimensionRowsProperties.class);
ListStore<DimensionRow> storeComboTargetValue = new ListStore<DimensionRow>( ListStore<DimensionRow> storeComboTargetValue = new ListStore<DimensionRow>(
@ -498,11 +497,11 @@ public class ColumnMappingPanel extends FramedPanel {
comboTargetValue.collapse(); comboTargetValue.collapse();
CellData cellData = new CellData("", referenceColumn.getName(), CellData cellData = new CellData("", referenceColumn.getName(),
referenceColumn.getColumnId(), referenceColumn.getColumnId(), referenceColumn
referenceColumn.getLabel(), null, 0, 0); .getLabel(), null, 0, 0);
DimensionRowSelectionDialog dimensionRowSelectionDialog = new DimensionRowSelectionDialog( DimensionRowSelectionDialog dimensionRowSelectionDialog = new DimensionRowSelectionDialog(
referenceColumn, cellData, true, eventBus); referenceColumn, cellData, true, false, true, eventBus);
dimensionRowSelectionDialog dimensionRowSelectionDialog
.addListener(targetValueSelectedListener); .addListener(targetValueSelectedListener);
dimensionRowSelectionDialog.show(); dimensionRowSelectionDialog.show();
@ -516,9 +515,6 @@ public class ColumnMappingPanel extends FramedPanel {
comboTargetValue.setEditable(false); comboTargetValue.setEditable(false);
comboTargetValue.setTriggerAction(TriggerAction.ALL); comboTargetValue.setTriggerAction(TriggerAction.ALL);
final IconButton btnAdd = new IconButton(); final IconButton btnAdd = new IconButton();
btnAdd.setItemId(itemIdBtnAdd); btnAdd.setItemId(itemIdBtnAdd);
btnAdd.setIcon(ResourceBundle.INSTANCE.add()); btnAdd.setIcon(ResourceBundle.INSTANCE.add());
@ -553,7 +549,7 @@ public class ColumnMappingPanel extends FramedPanel {
} }
}); });
btnDel.setVisible(true); btnDel.setVisible(true);
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
horiz.setPack(BoxLayoutPack.START); horiz.setPack(BoxLayoutPack.START);
@ -561,7 +557,7 @@ public class ColumnMappingPanel extends FramedPanel {
horiz.add(comboTargetValue, 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(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(btnDel, new BoxLayoutData(new Margins(2, 1, 2, 1))); horiz.add(btnDel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
vert.add(horiz); vert.add(horiz);
} }