Updated ChangeColumnTypePanel

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@92466 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-02-28 10:02:03 +00:00
parent 035de0495a
commit 6590d42e11
2 changed files with 115 additions and 82 deletions

View File

@ -1222,3 +1222,35 @@ 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...
30% complete (ETR: 17 seconds)
30% complete (ETR: 17 seconds)
30% complete (ETR: 17 seconds)
30% complete (ETR: 17 seconds)
40% complete (ETR: 13 seconds)
50% complete (ETR: 9 seconds)
60% complete (ETR: 6 seconds)
70% complete (ETR: 4 seconds)
80% complete (ETR: 3 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 20.30 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

@ -85,7 +85,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
protected FieldLabel comboDimensionTypeLabel;
protected ComboBox<ColumnData> comboColumnReferenceType = null;
protected FieldLabel comboColumnReferenceTypeLabel;
protected ListStore<ColumnData> storeComboColumnReferenceType;
protected ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader;
protected TextButton change;
@ -242,9 +243,11 @@ public class ChangeColumnTypePanel extends FramedPanel implements
// ColumnReferenceType
ColumnDataProperties propsColumnReferenceType = GWT
.create(ColumnDataProperties.class);
ListStore<ColumnData> storeComboColumnReferenceType = new ListStore<ColumnData>(
storeComboColumnReferenceType = new ListStore<ColumnData>(
propsColumnReferenceType.id());
comboColumnReferenceType = new ComboBox<ColumnData>(
storeComboColumnReferenceType, propsColumnReferenceType.label());
Log.trace("ComboColumnReferenceType created");
@ -260,7 +263,6 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnReferenceType, "Column");
comboColumnReferenceTypeLabel.setVisible(false);
// Change
change = new TextButton("Change");
SelectHandler changeHandler = new SelectHandler() {
@ -280,6 +282,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
v.add(comboMeasureTypeLabel, new VerticalLayoutData(1, -1));
v.add(comboAttributeTypeLabel, new VerticalLayoutData(1, -1));
v.add(comboDimensionTypeLabel, new VerticalLayoutData(1, -1));
v.add(comboColumnReferenceTypeLabel, new VerticalLayoutData(1, -1));
v.add(change, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0)));
add(v, new VerticalLayoutData(-1, -1, new Margins()));
@ -389,31 +392,28 @@ public class ChangeColumnTypePanel extends FramedPanel implements
});
}
protected void addHandlersForComboColumnReferenceType(
final LabelProvider<ColumnData> labelProvider) {
comboColumnReferenceType
.addSelectionHandler(new SelectionHandler<ColumnData>() {
public void onSelection(
SelectionEvent<ColumnData> event) {
Info.display(
"Column Reference Selected",
"You selected "
+ (event.getSelectedItem() == null ? "nothing"
: labelProvider.getLabel(event
.getSelectedItem())
+ "!"));
Log.debug("ComboColumnReferenceType selected: "
+ event.getSelectedItem());
}
.addSelectionHandler(new SelectionHandler<ColumnData>() {
public void onSelection(SelectionEvent<ColumnData> event) {
Info.display(
"Column Reference Selected",
"You selected "
+ (event.getSelectedItem() == null ? "nothing"
: labelProvider.getLabel(event
.getSelectedItem())
+ "!"));
Log.debug("ComboColumnReferenceType selected: "
+ event.getSelectedItem());
});
}
});
}
protected void updateColumnType(ColumnTypeCode type) {
Log.debug("Update ColumnTypeCode " + type.toString());
@ -421,20 +421,24 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboMeasureTypeLabel.setVisible(true);
comboAttributeTypeLabel.setVisible(false);
comboDimensionTypeLabel.setVisible(false);
comboColumnReferenceTypeLabel.setVisible(false);
} else {
if (type == ColumnTypeCode.ATTRIBUTE) {
comboMeasureTypeLabel.setVisible(false);
comboAttributeTypeLabel.setVisible(true);
comboDimensionTypeLabel.setVisible(false);
comboColumnReferenceTypeLabel.setVisible(false);
} else {
if (type == ColumnTypeCode.DIMENSION) {
comboMeasureTypeLabel.setVisible(false);
comboAttributeTypeLabel.setVisible(false);
comboDimensionTypeLabel.setVisible(true);
comboColumnReferenceTypeLabel.setVisible(false);
} else {
comboMeasureTypeLabel.setVisible(false);
comboAttributeTypeLabel.setVisible(false);
comboDimensionTypeLabel.setVisible(false);
comboColumnReferenceTypeLabel.setVisible(false);
}
}
@ -537,9 +541,11 @@ public class ChangeColumnTypePanel extends FramedPanel implements
.getCurrentValue();
if (columnTypeCodeElement != null) {
ColumnTypeCode type = columnTypeCodeElement.getCode();
if (type == ColumnTypeCode.MEASURE) {
ColumnDataTypeElement columnDataTypeElement;
switch (type) {
case MEASURE:
changeColumnTypeSession.setColumnTypeCodeTarget(type);
ColumnDataTypeElement columnDataTypeElement = comboMeasureType
columnDataTypeElement = comboMeasureType
.getCurrentValue();
if (columnDataTypeElement != null) {
ColumnDataType dataType = columnDataTypeElement
@ -555,66 +561,56 @@ public class ChangeColumnTypePanel extends FramedPanel implements
} else {
alert("Attention", "Column data type not selected!");
}
} else {
if (type == ColumnTypeCode.ATTRIBUTE) {
changeColumnTypeSession.setColumnTypeCodeTarget(type);
ColumnDataTypeElement columnDataTypeElement = comboAttributeType
.getCurrentValue();
if (columnDataTypeElement != null) {
ColumnDataType dataType = columnDataTypeElement
.getType();
if (dataType != null) {
changeColumnTypeSession
.setColumnDataTypeTarget(dataType);
callChangeColumnType();
} else {
alert("Attention",
"Column data type not selected!");
}
break;
case ATTRIBUTE:
changeColumnTypeSession.setColumnTypeCodeTarget(type);
columnDataTypeElement = comboAttributeType
.getCurrentValue();
if (columnDataTypeElement != null) {
ColumnDataType dataType = columnDataTypeElement
.getType();
if (dataType != null) {
changeColumnTypeSession
.setColumnDataTypeTarget(dataType);
callChangeColumnType();
} else {
alert("Attention", "Column data type not selected!");
}
} else {
if (type == ColumnTypeCode.CODE) {
changeColumnTypeSession
.setColumnTypeCodeTarget(type);
callChangeColumnType();
} else {
if (type == ColumnTypeCode.CODENAME) {
changeColumnTypeSession
.setColumnTypeCodeTarget(type);
callChangeColumnType();
} else {
if (type == ColumnTypeCode.CODEDESCRIPTION) {
changeColumnTypeSession
.setColumnTypeCodeTarget(type);
callChangeColumnType();
} else {
if (type == ColumnTypeCode.ANNOTATION) {
changeColumnTypeSession
.setColumnTypeCodeTarget(type);
callChangeColumnType();
} else {
if (type == ColumnTypeCode.DIMENSION) {
changeColumnTypeSession
.setColumnTypeCodeTarget(type);
callChangeColumnType();
} else {
alert("Attention",
"This column type is not supported now!");
}
}
}
}
}
alert("Attention", "Column data type not selected!");
}
break;
case CODE:
changeColumnTypeSession.setColumnTypeCodeTarget(type);
callChangeColumnType();
break;
case CODENAME:
changeColumnTypeSession.setColumnTypeCodeTarget(type);
callChangeColumnType();
break;
case CODEDESCRIPTION:
changeColumnTypeSession.setColumnTypeCodeTarget(type);
callChangeColumnType();
break;
case ANNOTATION:
changeColumnTypeSession.setColumnTypeCodeTarget(type);
callChangeColumnType();
break;
case DIMENSION:
changeColumnTypeSession.setColumnTypeCodeTarget(type);
ColumnData columnReference = comboColumnReferenceType
.getCurrentValue();
if (columnReference != null) {
changeColumnTypeSession
.setCodelistColumnReference(columnReference);
callChangeColumnType();
} else {
alert("Attention", "No column reference selected!");
}
break;
default:
alert("Attention", "This column type is not supported now!");
break;
}
} else {
alert("Attention", "Select a column type!");
@ -624,10 +620,10 @@ public class ChangeColumnTypePanel extends FramedPanel implements
}
}
private void callChangeColumnType() {
TDGWTServiceAsync.INSTANCE.startChangeColumnType(
changeColumnTypeSession, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
Log.debug("Change Column Type Error: "
+ caught.getLocalizedMessage());
@ -685,7 +681,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
}
protected void retriveColumnData(TabResource tabResource) {
TDGWTServiceAsync.INSTANCE.getColumns(tabResource.getTrId(),
TDGWTServiceAsync.INSTANCE.getColumnsForDimension(tabResource.getTrId(),
new AsyncCallback<ArrayList<ColumnData>>() {
@Override
@ -699,7 +695,12 @@ public class ChangeColumnTypePanel extends FramedPanel implements
@Override
public void onSuccess(ArrayList<ColumnData> result) {
storeComboColumnReferenceType.clear();
storeComboColumnReferenceType.addAll(result);
storeComboColumnReferenceType.commitChanges();
comboColumnReferenceTypeLabel.setVisible(true);
}
});