Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@90543 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
2ea51304f5
commit
fe65f26a20
|
@ -55,9 +55,12 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
protected ComboBox<ColumnData> comboColumn = null;
|
||||
protected ComboBox<ColumnTypeCodeElement> comboColumnTypeCode = null;
|
||||
protected ComboBox<ColumnDataTypeElement> comboMeasureType = null;
|
||||
protected TextField labelColumn;
|
||||
protected FieldLabel comboMeasureTypeLabel;
|
||||
|
||||
protected ComboBox<ColumnDataTypeElement> comboAttributeType = null;
|
||||
protected FieldLabel comboAttributeTypeLabel;
|
||||
|
||||
protected TextField labelColumn;
|
||||
|
||||
public ChangeColumnTypePanel(TRId trId, String columnName) {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
|
@ -121,7 +124,7 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
Log.trace("ComboColumnTypeCode created");
|
||||
|
||||
addHandlersForComboColumnTypeCode(propsColumnTypeCode.label());
|
||||
|
||||
|
||||
comboColumnTypeCode.setEmptyText("Select a column type...");
|
||||
comboColumnTypeCode.setWidth(150);
|
||||
comboColumnTypeCode.setTypeAhead(true);
|
||||
|
@ -144,10 +147,31 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
comboMeasureType.setWidth(150);
|
||||
comboMeasureType.setTypeAhead(true);
|
||||
comboMeasureType.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
comboMeasureTypeLabel=new FieldLabel(comboMeasureType, "Measure Type");
|
||||
|
||||
comboMeasureTypeLabel = new FieldLabel(comboMeasureType, "Measure Type");
|
||||
comboMeasureTypeLabel.setVisible(false);
|
||||
|
||||
|
||||
// comboAttributeType
|
||||
ColumnDataTypeProperties propsAttributeType = GWT
|
||||
.create(ColumnDataTypeProperties.class);
|
||||
ListStore<ColumnDataTypeElement> storeComboAttributeType = new ListStore<ColumnDataTypeElement>(
|
||||
propsAttributeType.id());
|
||||
storeComboAttributeType.addAll(ColumnDataTypeStore.getAttributeType());
|
||||
|
||||
comboAttributeType = new ComboBox<ColumnDataTypeElement>(
|
||||
storeComboAttributeType, propsAttributeType.label());
|
||||
Log.trace("ComboAttributeType created");
|
||||
|
||||
addHandlersForComboAttributeType(propsAttributeType.label());
|
||||
|
||||
comboAttributeType.setEmptyText("Select a column type...");
|
||||
comboAttributeType.setWidth(150);
|
||||
comboAttributeType.setTypeAhead(true);
|
||||
comboAttributeType.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
comboAttributeTypeLabel = new FieldLabel(comboAttributeType, "Attribute Type");
|
||||
comboAttributeTypeLabel.setVisible(false);
|
||||
|
||||
labelColumn = new TextField();
|
||||
|
||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
|
@ -157,10 +181,9 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
-1));
|
||||
v.add(new FieldLabel(comboColumnTypeCode, "Column Type"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
v.add(comboMeasureTypeLabel,
|
||||
new VerticalLayoutData(1, -1));
|
||||
v.add(comboMeasureTypeLabel, new VerticalLayoutData(1, -1));
|
||||
v.add(comboAttributeTypeLabel, new VerticalLayoutData(1, -1));
|
||||
|
||||
|
||||
add(v, new VerticalLayoutData(-1, -1, new Margins()));
|
||||
addButton(new TextButton("Change"));
|
||||
}
|
||||
|
@ -191,60 +214,99 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
protected void addHandlersForComboColumnTypeCode(final LabelProvider<ColumnTypeCodeElement> labelProvider){
|
||||
comboColumnTypeCode.addSelectionHandler(new SelectionHandler<ColumnTypeCodeElement>() {
|
||||
public void onSelection(SelectionEvent<ColumnTypeCodeElement> event) {
|
||||
Info.display(
|
||||
"Type Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem()) + "!"));
|
||||
Log.debug("ComboColumnTypeCode selected: "+event.getSelectedItem());
|
||||
ColumnTypeCodeElement columnType=event.getSelectedItem();
|
||||
updateColumnType(columnType.getCode());
|
||||
}
|
||||
protected void addHandlersForComboColumnTypeCode(
|
||||
final LabelProvider<ColumnTypeCodeElement> labelProvider) {
|
||||
comboColumnTypeCode
|
||||
.addSelectionHandler(new SelectionHandler<ColumnTypeCodeElement>() {
|
||||
public void onSelection(
|
||||
SelectionEvent<ColumnTypeCodeElement> event) {
|
||||
Info.display(
|
||||
"Type Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem())
|
||||
+ "!"));
|
||||
Log.debug("ComboColumnTypeCode selected: "
|
||||
+ event.getSelectedItem());
|
||||
ColumnTypeCodeElement columnType = event
|
||||
.getSelectedItem();
|
||||
updateColumnType(columnType.getCode());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
protected void addHandlersForComboMeasureType(final LabelProvider<ColumnDataTypeElement> labelProvider){
|
||||
comboMeasureType.addSelectionHandler(new SelectionHandler<ColumnDataTypeElement>() {
|
||||
public void onSelection(SelectionEvent<ColumnDataTypeElement> event) {
|
||||
Info.display(
|
||||
"Type Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem()) + "!"));
|
||||
Log.debug("ComboMeasureType selected: "+event.getSelectedItem());
|
||||
ColumnDataTypeElement measureType=event.getSelectedItem();
|
||||
updateMeasureType(measureType.getType());
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
protected void addHandlersForComboMeasureType(
|
||||
final LabelProvider<ColumnDataTypeElement> labelProvider) {
|
||||
comboMeasureType
|
||||
.addSelectionHandler(new SelectionHandler<ColumnDataTypeElement>() {
|
||||
public void onSelection(
|
||||
SelectionEvent<ColumnDataTypeElement> event) {
|
||||
Info.display(
|
||||
"Type Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem())
|
||||
+ "!"));
|
||||
Log.debug("ComboMeasureType selected: "
|
||||
+ event.getSelectedItem());
|
||||
ColumnDataTypeElement measureType = event
|
||||
.getSelectedItem();
|
||||
updateMeasureType(measureType.getType());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected void updateColumnType(ColumnTypeCode type){
|
||||
if(type==ColumnTypeCode.MEASURE){
|
||||
protected void addHandlersForComboAttributeType(
|
||||
final LabelProvider<ColumnDataTypeElement> labelProvider) {
|
||||
comboAttributeType
|
||||
.addSelectionHandler(new SelectionHandler<ColumnDataTypeElement>() {
|
||||
public void onSelection(
|
||||
SelectionEvent<ColumnDataTypeElement> event) {
|
||||
Info.display(
|
||||
"Type Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem())
|
||||
+ "!"));
|
||||
Log.debug("ComboMeasureType selected: "
|
||||
+ event.getSelectedItem());
|
||||
ColumnDataTypeElement attributeType = event
|
||||
.getSelectedItem();
|
||||
updateAttributeType(attributeType.getType());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
protected void updateColumnType(ColumnTypeCode type) {
|
||||
if (type == ColumnTypeCode.MEASURE) {
|
||||
comboMeasureTypeLabel.setVisible(true);
|
||||
comboAttributeTypeLabel.setVisible(false);
|
||||
} else {
|
||||
comboMeasureTypeLabel.setVisible(false);
|
||||
if (type == ColumnTypeCode.ATTRIBUTE) {
|
||||
comboMeasureTypeLabel.setVisible(false);
|
||||
comboAttributeTypeLabel.setVisible(true);
|
||||
} else {
|
||||
comboMeasureTypeLabel.setVisible(false);
|
||||
comboAttributeTypeLabel.setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateMeasureType(ColumnDataType type){
|
||||
/*if(type==ColumnDataType.Integer){
|
||||
|
||||
} else {
|
||||
|
||||
}*/
|
||||
|
||||
protected void updateMeasureType(ColumnDataType type) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void updateAttributeType(ColumnDataType type) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void loadData(ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||
|
|
Loading…
Reference in New Issue