Updated change column type
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@91006 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
641fa943cc
commit
b275648207
|
@ -574,3 +574,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...
|
||||
50% complete (ETR: 5 seconds)
|
||||
50% complete (ETR: 5 seconds)
|
||||
50% complete (ETR: 5 seconds)
|
||||
50% complete (ETR: 5 seconds)
|
||||
50% complete (ETR: 5 seconds)
|
||||
50% complete (ETR: 5 seconds)
|
||||
60% complete (ETR: 4 seconds)
|
||||
70% complete (ETR: 2 seconds)
|
||||
80% complete (ETR: 2 seconds)
|
||||
90% complete (ETR: 1 seconds)
|
||||
100% complete (ETR: 0 seconds)
|
||||
Compilation completed in 13.92 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
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.td.columnwidget.client;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.progress.ChangeColumnTypeProgressDialog;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataProperties;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataTypeProperties;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnTypeCodeProperties;
|
||||
|
@ -65,11 +66,12 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
protected ComboBox<ColumnDataTypeElement> comboAttributeType = null;
|
||||
protected FieldLabel comboAttributeTypeLabel;
|
||||
protected ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader;
|
||||
|
||||
|
||||
protected TextButton change;
|
||||
|
||||
|
||||
protected ChangeColumnTypeSession changeColumnTypeSession;
|
||||
|
||||
protected ChangeColumnTypeProgressDialog changeColumnTypeProgressDialog;
|
||||
|
||||
public ChangeColumnTypePanel(TRId trId, String columnName, EventBus eventBus) {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
|
@ -196,16 +198,16 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
"Attribute Type");
|
||||
comboAttributeTypeLabel.setVisible(false);
|
||||
|
||||
change=new TextButton("Change");
|
||||
SelectHandler changeHandler=new SelectHandler() {
|
||||
|
||||
change = new TextButton("Change");
|
||||
SelectHandler changeHandler = new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
onChangeTypeColumn();
|
||||
|
||||
onChangeTypeColumn();
|
||||
|
||||
}
|
||||
};
|
||||
change.addSelectHandler(changeHandler);
|
||||
|
||||
|
||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
v.add(new FieldLabel(comboColumn, "Column"), new VerticalLayoutData(1,
|
||||
-1));
|
||||
|
@ -213,8 +215,7 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
new VerticalLayoutData(1, -1));
|
||||
v.add(comboMeasureTypeLabel, new VerticalLayoutData(1, -1));
|
||||
v.add(comboAttributeTypeLabel, new VerticalLayoutData(1, -1));
|
||||
v.add(change, new VerticalLayoutData(-1, -1,
|
||||
new Margins(10, 0, 10, 0)));
|
||||
v.add(change, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0)));
|
||||
add(v, new VerticalLayoutData(-1, -1, new Margins()));
|
||||
|
||||
// addButton();
|
||||
|
@ -379,7 +380,7 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
|
||||
protected void updateComboStatus(ColumnData cd) {
|
||||
Log.debug("ColumnData: " + cd.toString());
|
||||
changeColumnTypeSession=new ChangeColumnTypeSession();
|
||||
changeColumnTypeSession = new ChangeColumnTypeSession();
|
||||
changeColumnTypeSession.setColumnData(cd);
|
||||
comboColumn.setValue(cd);
|
||||
comboColumnTypeCode.setValue(ColumnTypeCodeStore.selectedElement(cd
|
||||
|
@ -392,7 +393,7 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
.selectedMeasure(cd.getDataTypeName()));
|
||||
comboMeasureType.setValue(ColumnDataTypeStore
|
||||
.selectedMeasureElement(cd.getDataTypeName()));
|
||||
|
||||
|
||||
} else {
|
||||
if (type == ColumnTypeCode.ATTRIBUTE) {
|
||||
changeColumnTypeSession.setColumnDataType(ColumnDataTypeStore
|
||||
|
@ -411,81 +412,125 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
this.columnName = columnName;
|
||||
loader.load();
|
||||
}
|
||||
|
||||
|
||||
protected void onChangeTypeColumn(){
|
||||
|
||||
ColumnData columnData=comboColumn.getCurrentValue();
|
||||
if(columnData!=null){
|
||||
ColumnTypeCodeElement columnTypeCodeElement= comboColumnTypeCode.getCurrentValue();
|
||||
if(columnTypeCodeElement!=null){
|
||||
ColumnTypeCode type=columnTypeCodeElement.getCode();
|
||||
|
||||
protected void onChangeTypeColumn() {
|
||||
|
||||
ColumnData columnData = comboColumn.getCurrentValue();
|
||||
if (columnData != null) {
|
||||
ColumnTypeCodeElement columnTypeCodeElement = comboColumnTypeCode
|
||||
.getCurrentValue();
|
||||
if (columnTypeCodeElement != null) {
|
||||
ColumnTypeCode type = columnTypeCodeElement.getCode();
|
||||
if (type == ColumnTypeCode.MEASURE) {
|
||||
changeColumnTypeSession.setColumnTypeCodeTarget(type);
|
||||
ColumnDataTypeElement columnDataTypeElement=comboMeasureType.getCurrentValue();
|
||||
if(columnDataTypeElement!=null){
|
||||
ColumnDataType dataType=columnDataTypeElement.getType();
|
||||
if(dataType!=null){
|
||||
changeColumnTypeSession.setColumnDataTypeTarget(dataType);
|
||||
callChangeColumnToMeasure();
|
||||
ColumnDataTypeElement columnDataTypeElement = comboMeasureType
|
||||
.getCurrentValue();
|
||||
if (columnDataTypeElement != null) {
|
||||
ColumnDataType dataType = columnDataTypeElement
|
||||
.getType();
|
||||
if (dataType != null) {
|
||||
changeColumnTypeSession
|
||||
.setColumnDataTypeTarget(dataType);
|
||||
callChangeColumnType();
|
||||
} else {
|
||||
alert("Attention","Column data type not selected!");
|
||||
alert("Attention", "Column data type not selected!");
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
alert("Attention","Column data type not selected!");
|
||||
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);
|
||||
callChangeColumnToAttribute();
|
||||
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!");
|
||||
alert("Attention",
|
||||
"Column data type not selected!");
|
||||
}
|
||||
} else {
|
||||
alert("Attention","Column data type not selected!");
|
||||
alert("Attention", "Column data type not selected!");
|
||||
}
|
||||
} else {
|
||||
alert("Attention","This column type is not supported now!");
|
||||
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 {
|
||||
alert("Attention",
|
||||
"This column type is not supported now!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
alert("Attention","Select a column type!");
|
||||
alert("Attention", "Select a column type!");
|
||||
}
|
||||
} else {
|
||||
alert("Attention","Select a column!");
|
||||
alert("Attention", "Select a column!");
|
||||
}
|
||||
}
|
||||
|
||||
private void callChangeColumnToAttribute() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
private void callChangeColumnType() {
|
||||
TDGWTServiceAsync.INSTANCE.startChangeColumnType(
|
||||
changeColumnTypeSession, new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.debug("Change Column Type Error: "
|
||||
+ caught.getLocalizedMessage());
|
||||
alert("Change Column Type Error ",
|
||||
"Error in invocation of change column type operation!");
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
changeColumnTypeProgressDialog= new ChangeColumnTypeProgressDialog(changeColumnTypeSession, eventBus);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void callChangeColumnToMeasure() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
protected void alert(String title,String message){
|
||||
protected void alert(String title, String message) {
|
||||
final AlertMessageBox d = new AlertMessageBox(title, message);
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
|
||||
d.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ public class ChangeColumnTypeProgressDialog extends Window implements ChangeColu
|
|||
progressUpdater.addListener(new ChangeColumnTypeProgressBarUpdater(progressBar));
|
||||
|
||||
progressUpdater.addListener(this);
|
||||
show();
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue