Updated Column Change Type

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@101660 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-11-20 10:52:08 +00:00
parent a2797d2c70
commit 1f55eac097
1 changed files with 67 additions and 5 deletions

View File

@ -41,6 +41,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredTy
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeMap;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.TimeDimensionType;
import com.allen_sauer.gwt.log.client.Log;
@ -90,10 +91,9 @@ public class ChangeColumnTypePanel extends FramedPanel implements
private String HEIGHT = "520px";
private EventBus eventBus;
private ChangeColumnTypeDialog parent;
// private TextField label = null;
private TRId trId;
private String columnName;
// private ColumnData column;
private ColumnData columnChangeType;
private ColumnData columnRequested;
private ColumnData connectionColumn;
private ComboBox<ColumnData> comboColumn = null;
@ -130,7 +130,6 @@ public class ChangeColumnTypePanel extends FramedPanel implements
private ChangeColumnTypeSession changeColumnTypeSession;
private boolean panelCreated;
private ColumnData columnChangeType;
public ChangeColumnTypePanel(TRId trId, String columnName, EventBus eventBus) {
setWidth(WIDTH);
@ -497,7 +496,6 @@ public class ChangeColumnTypePanel extends FramedPanel implements
});
}
// TODO
protected void addHandlersForComboColumnTypeCode(
final LabelProvider<ColumnTypeCodeElement> labelProvider) {
comboColumnTypeCode
@ -516,6 +514,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
ColumnTypeCodeElement columnType = event
.getSelectedItem();
updateColumnType(columnType.getCode());
updateConfBtnChange(columnType.getCode());
}
});
@ -817,7 +816,6 @@ public class ChangeColumnTypePanel extends FramedPanel implements
for (ColumnData cd : result) {
Log.debug("Column:" + cd.getColumnId());
if (cd.getColumnId().compareTo(columnId) == 0) {
columnChangeType=cd;
updateComboStatus(cd);
return;
}
@ -826,6 +824,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
}
protected void updateComboStatus(ColumnData cd) {
columnChangeType = cd;
Log.debug("Update Combos ColumnData: " + cd.toString());
changeColumnTypeSession = new ChangeColumnTypeSession();
changeColumnTypeSession.setColumnData(cd);
@ -881,6 +880,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
}
}
updateConfBtnChange(type);
}
public void update(TRId trId, String columnName) {
@ -929,6 +930,67 @@ public class ChangeColumnTypePanel extends FramedPanel implements
}
protected void updateConfBtnChange(ColumnTypeCode columnTypeCode) {
if (columnTypeCode == null) {
ColumnTypeCodeElement codeElement = comboColumnTypeCode.getValue();
if (codeElement == null) {
change.disable();
} else {
configureBtnChange(codeElement.getCode());
}
} else {
configureBtnChange(columnTypeCode);
}
}
// TODO
protected void configureBtnChange(ColumnTypeCode columnTypeCode) {
ColumnTypeCode sourceTypeCode = ColumnTypeMap
.getColumnTypeCode(columnChangeType.getTypeCode());
switch (sourceTypeCode) {
case ANNOTATION:
change.enable();
break;
case ATTRIBUTE:
change.enable();
break;
case CODE:
change.enable();
break;
case CODEDESCRIPTION:
change.enable();
break;
case CODENAME:
change.enable();
break;
case DIMENSION:
if (columnTypeCode.compareTo(ColumnTypeCode.DIMENSION) == 0
|| columnTypeCode.compareTo(ColumnTypeCode.TIMEDIMENSION) == 0) {
change.disable();
} else {
change.enable();
}
break;
case MEASURE:
change.enable();
break;
case TIMEDIMENSION:
if (columnTypeCode.compareTo(ColumnTypeCode.DIMENSION) == 0
|| columnTypeCode.compareTo(ColumnTypeCode.TIMEDIMENSION) == 0) {
change.disable();
} else {
change.enable();
}
break;
default:
change.enable();
break;
}
}
protected void onChangeTypeColumn() {
ColumnData columnData = comboColumn.getCurrentValue();