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

View File

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