Updated ProgressBar set Progress 0
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-unionwizard-widget@98797 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
696c7af409
commit
24edd569eb
|
@ -68,18 +68,20 @@ public class ColumnMappingCard extends WizardCard {
|
|||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setEnableBackButton(false);
|
||||
|
||||
ArrayList<UnionColumnsMapping> mapMatch=columnMappingPanel.getSelectedMap();
|
||||
if(mapMatch==null){
|
||||
Log.debug("No column match created: "
|
||||
+mapMatch);
|
||||
ArrayList<UnionColumnsMapping> columnsMatch=columnMappingPanel.getSelectedMap();
|
||||
if(columnsMatch==null){
|
||||
Log.debug("No columns match created: "
|
||||
+columnsMatch);
|
||||
UtilsGXT3
|
||||
.info("Attentions",
|
||||
"Creates a valid map");
|
||||
"Creates a valid column map");
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
getWizardWindow().setEnableBackButton(true);
|
||||
|
||||
} else {
|
||||
|
||||
Log.debug("ColumnsMatch created: "+columnsMatch);
|
||||
unionSession.setColumnsMatch(columnsMatch);
|
||||
goNext();
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,6 +97,7 @@ public class ColumnMappingCard extends WizardCard {
|
|||
getWizardWindow().nextCard();
|
||||
} catch (Throwable e) {
|
||||
Log.error("goNext: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ import com.allen_sauer.gwt.log.client.Log;
|
|||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||
|
@ -57,7 +59,7 @@ public class ColumnMappingPanel extends ContentPanel {
|
|||
protected ArrayList<ColumnData> unionColumns;
|
||||
protected ResizeContainer thisPanel;
|
||||
|
||||
protected HashMap<ColumnData,ColumnData> columnMap;
|
||||
protected HashMap<ColumnData, ColumnData> columnMap;
|
||||
protected ArrayList<UnionColumnsMapping> listUnionColumnsMapping;
|
||||
|
||||
protected String itemIdSourceColumn = "itemIdSourceColumn";
|
||||
|
@ -205,9 +207,8 @@ public class ColumnMappingPanel extends ContentPanel {
|
|||
// Union Combo
|
||||
ColumnDataProperties propsUnionColumn = GWT
|
||||
.create(ColumnDataProperties.class);
|
||||
ListStore<ColumnData> storeComboUnionColumn = new ListStore<ColumnData>(
|
||||
final ListStore<ColumnData> storeComboUnionColumn = new ListStore<ColumnData>(
|
||||
propsUnionColumn.id());
|
||||
storeComboUnionColumn.addAll(unionColumns);
|
||||
|
||||
final ComboBox<ColumnData> comboUnionColumn = new ComboBox<ColumnData>(
|
||||
storeComboUnionColumn, propsUnionColumn.label());
|
||||
|
@ -215,6 +216,7 @@ public class ColumnMappingPanel extends ContentPanel {
|
|||
|
||||
Log.debug("ComboUnionColumn created");
|
||||
|
||||
comboUnionColumn.disable();
|
||||
comboUnionColumn.setEmptyText("Select a column...");
|
||||
comboUnionColumn.setWidth(COMBOWIDTH);
|
||||
comboUnionColumn.setEditable(false);
|
||||
|
@ -255,6 +257,30 @@ public class ColumnMappingPanel extends ContentPanel {
|
|||
});
|
||||
btnDel.setVisible(false);
|
||||
|
||||
comboSourceColumn
|
||||
.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<ColumnData> event) {
|
||||
comboUnionColumn.reset();
|
||||
storeComboUnionColumn.clear();
|
||||
|
||||
ColumnData selectedSourceColumn = event
|
||||
.getSelectedItem();
|
||||
storeComboUnionColumn.clear();
|
||||
for (ColumnData col : unionColumns) {
|
||||
if (col.getDataTypeName() == selectedSourceColumn
|
||||
.getDataTypeName()
|
||||
&& col.getTypeCode() == selectedSourceColumn
|
||||
.getTypeCode()) {
|
||||
storeComboUnionColumn.add(col);
|
||||
}
|
||||
}
|
||||
storeComboUnionColumn.commitChanges();
|
||||
comboUnionColumn.redraw();
|
||||
comboUnionColumn.enable();
|
||||
}
|
||||
});
|
||||
|
||||
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
|
@ -268,7 +294,6 @@ public class ColumnMappingPanel extends ContentPanel {
|
|||
vert.add(horiz);
|
||||
}
|
||||
|
||||
|
||||
protected void addColumnMap() {
|
||||
|
||||
final HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
|
@ -284,7 +309,7 @@ public class ColumnMappingPanel extends ContentPanel {
|
|||
.create(ColumnDataProperties.class);
|
||||
ListStore<ColumnData> storeComboSourceColumn = new ListStore<ColumnData>(
|
||||
propsSourceColumn.id());
|
||||
storeComboSourceColumn.addAll(unionColumns);
|
||||
storeComboSourceColumn.addAll(sourceColumns);
|
||||
|
||||
final ComboBox<ColumnData> comboSourceColumn = new ComboBox<ColumnData>(
|
||||
storeComboSourceColumn, propsSourceColumn.label());
|
||||
|
@ -300,9 +325,8 @@ public class ColumnMappingPanel extends ContentPanel {
|
|||
// Union Combo
|
||||
ColumnDataProperties propsUnionColumn = GWT
|
||||
.create(ColumnDataProperties.class);
|
||||
ListStore<ColumnData> storeComboUnionColumn = new ListStore<ColumnData>(
|
||||
final ListStore<ColumnData> storeComboUnionColumn = new ListStore<ColumnData>(
|
||||
propsUnionColumn.id());
|
||||
storeComboUnionColumn.addAll(unionColumns);
|
||||
|
||||
final ComboBox<ColumnData> comboUnionColumn = new ComboBox<ColumnData>(
|
||||
storeComboUnionColumn, propsUnionColumn.label());
|
||||
|
@ -310,6 +334,7 @@ public class ColumnMappingPanel extends ContentPanel {
|
|||
|
||||
Log.debug("ComboUnionColumn created");
|
||||
|
||||
comboUnionColumn.disable();
|
||||
comboUnionColumn.setEmptyText("Select a column...");
|
||||
comboUnionColumn.setWidth(COMBOWIDTH);
|
||||
comboUnionColumn.setEditable(false);
|
||||
|
@ -350,6 +375,31 @@ public class ColumnMappingPanel extends ContentPanel {
|
|||
});
|
||||
btnDel.setVisible(false);
|
||||
|
||||
comboSourceColumn
|
||||
.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<ColumnData> event) {
|
||||
comboUnionColumn.reset();
|
||||
storeComboUnionColumn.clear();
|
||||
|
||||
ColumnData selectedSourceColumn = event
|
||||
.getSelectedItem();
|
||||
storeComboUnionColumn.clear();
|
||||
for (ColumnData col : unionColumns) {
|
||||
if (col.getDataTypeName() == selectedSourceColumn
|
||||
.getDataTypeName()
|
||||
&& col.getTypeCode() == selectedSourceColumn
|
||||
.getTypeCode()) {
|
||||
storeComboUnionColumn.add(col);
|
||||
}
|
||||
}
|
||||
storeComboUnionColumn.commitChanges();
|
||||
comboUnionColumn.redraw();
|
||||
comboUnionColumn.enable();
|
||||
}
|
||||
});
|
||||
|
||||
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
|
||||
|
@ -367,29 +417,47 @@ public class ColumnMappingPanel extends ContentPanel {
|
|||
* @return
|
||||
*/
|
||||
protected ArrayList<UnionColumnsMapping> getSelectedMap() {
|
||||
listUnionColumnsMapping=new ArrayList<UnionColumnsMapping>();
|
||||
listUnionColumnsMapping = new ArrayList<UnionColumnsMapping>();
|
||||
|
||||
int lenght = vert.getWidgetCount();
|
||||
int i = 0;
|
||||
for (; i < lenght; i++) {
|
||||
HBoxLayoutContainer h = (HBoxLayoutContainer) vert.getWidget(i);
|
||||
if (h != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ComboBox<ColumnData> comboSourceColumn = (ComboBox<ColumnData>) h
|
||||
.getItemByItemId(itemIdSourceColumn);
|
||||
ColumnData sourceColumn = comboSourceColumn.getCurrentValue();
|
||||
if (sourceColumn != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ComboBox<ColumnData> comboUnionColumn= (ComboBox<ColumnData>) h
|
||||
.getItemByItemId(itemIdUnionColumn);
|
||||
ColumnData unionColumn = comboUnionColumn.getCurrentValue();
|
||||
if (unionColumn != null) {
|
||||
UnionColumnsMapping colMatch= new UnionColumnsMapping(sourceColumn, unionColumn);
|
||||
listUnionColumnsMapping.add(colMatch);
|
||||
TextField columnLabelField = (TextField) h
|
||||
.getItemByItemId(itemIdLabelColumn);
|
||||
if (columnLabelField != null) {
|
||||
String columnLabel = columnLabelField.getCurrentValue();
|
||||
if (columnLabel != null && !columnLabel.isEmpty()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ComboBox<ColumnData> comboSourceColumn = (ComboBox<ColumnData>) h
|
||||
.getItemByItemId(itemIdSourceColumn);
|
||||
ColumnData sourceColumn = comboSourceColumn
|
||||
.getCurrentValue();
|
||||
if (sourceColumn != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ComboBox<ColumnData> comboUnionColumn = (ComboBox<ColumnData>) h
|
||||
.getItemByItemId(itemIdUnionColumn);
|
||||
ColumnData unionColumn = comboUnionColumn
|
||||
.getCurrentValue();
|
||||
if (unionColumn != null) {
|
||||
UnionColumnsMapping colMatch = new UnionColumnsMapping(
|
||||
columnLabel, sourceColumn, unionColumn);
|
||||
listUnionColumnsMapping.add(colMatch);
|
||||
} else {
|
||||
Log.debug("Union Column is null");
|
||||
}
|
||||
} else {
|
||||
Log.debug("Source Column is null");
|
||||
}
|
||||
} else {
|
||||
Log.debug("Column Label is null");
|
||||
}
|
||||
} else {
|
||||
Log.debug("Column Label Field is null");
|
||||
}
|
||||
} else {
|
||||
|
||||
Log.debug("HorizontalContainer is null");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,8 +59,7 @@ public class UnionProgressBarUpdater implements UnionProgressListener {
|
|||
@Override
|
||||
public void operationUpdate(float elaborated) {
|
||||
Log.info("Elaborated: "+elaborated);
|
||||
if (elaborated == 0) progressBar.updateProgress(0, "Initializing...");
|
||||
if (elaborated>0 && elaborated<1) {
|
||||
if (elaborated>=0 && elaborated<1) {
|
||||
Log.trace("progress "+elaborated);
|
||||
int elab=new Float(elaborated*100).intValue();
|
||||
progressBar.updateProgress(elaborated,elab+"% Progress...");
|
||||
|
|
Loading…
Reference in New Issue