Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@90892 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
27df4545a3
commit
28a75058a3
|
@ -21,8 +21,6 @@ import com.google.gwt.core.client.Scheduler;
|
||||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||||
|
@ -62,8 +60,8 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
protected FieldLabel comboMeasureTypeLabel;
|
protected FieldLabel comboMeasureTypeLabel;
|
||||||
protected ComboBox<ColumnDataTypeElement> comboAttributeType = null;
|
protected ComboBox<ColumnDataTypeElement> comboAttributeType = null;
|
||||||
protected FieldLabel comboAttributeTypeLabel;
|
protected FieldLabel comboAttributeTypeLabel;
|
||||||
|
|
||||||
protected TextField labelColumn;
|
protected TextField labelColumn;
|
||||||
|
protected ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader;
|
||||||
|
|
||||||
public ChangeColumnTypePanel(TRId trId, String columnName, EventBus eventBus) {
|
public ChangeColumnTypePanel(TRId trId, String columnName, EventBus eventBus) {
|
||||||
setWidth(WIDTH);
|
setWidth(WIDTH);
|
||||||
|
@ -74,6 +72,7 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
this.columnName = columnName;
|
this.columnName = columnName;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
|
//Column Data
|
||||||
ColumnDataProperties propsColumnData = GWT
|
ColumnDataProperties propsColumnData = GWT
|
||||||
.create(ColumnDataProperties.class);
|
.create(ColumnDataProperties.class);
|
||||||
ListStore<ColumnData> storeCombo = new ListStore<ColumnData>(
|
ListStore<ColumnData> storeCombo = new ListStore<ColumnData>(
|
||||||
|
@ -88,9 +87,10 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
loadData(loadConfig, callback);
|
loadData(loadConfig, callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
final ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader = new ListLoader<ListLoadConfig, ListLoadResult<ColumnData>>(
|
|
||||||
|
loader = new ListLoader<ListLoadConfig, ListLoadResult<ColumnData>>(
|
||||||
proxy);
|
proxy);
|
||||||
loader.setRemoteSort(false);
|
//loader.setRemoteSort(false);
|
||||||
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, ColumnData, ListLoadResult<ColumnData>>(
|
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, ColumnData, ListLoadResult<ColumnData>>(
|
||||||
storeCombo));
|
storeCombo));
|
||||||
Log.trace("LoaderCombo created");
|
Log.trace("LoaderCombo created");
|
||||||
|
@ -109,12 +109,14 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
};
|
};
|
||||||
Log.trace("Combo ColumnData created");
|
Log.trace("Combo ColumnData created");
|
||||||
|
|
||||||
addHandlersForEventObservation(comboColumn, propsColumnData.label());
|
//addHandlersForEventObservation(comboColumn, propsColumnData.label());
|
||||||
|
addHandlersForComboColumn(propsColumnData.label());
|
||||||
|
|
||||||
comboColumn.setLoader(loader);
|
comboColumn.setLoader(loader);
|
||||||
comboColumn.setEmptyText("Select a column...");
|
comboColumn.setEmptyText("Select a column...");
|
||||||
comboColumn.setWidth(150);
|
comboColumn.setWidth(150);
|
||||||
comboColumn.setTypeAhead(true);
|
comboColumn.setTypeAhead(false);
|
||||||
comboColumn.setEditable(true);
|
comboColumn.setEditable(false);
|
||||||
comboColumn.setTriggerAction(TriggerAction.ALL);
|
comboColumn.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
|
||||||
|
@ -191,35 +193,38 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
v.add(comboAttributeTypeLabel, new VerticalLayoutData(1, -1));
|
v.add(comboAttributeTypeLabel, new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
add(v, new VerticalLayoutData(-1, -1, new Margins()));
|
add(v, new VerticalLayoutData(-1, -1, new Margins()));
|
||||||
addButton(new TextButton("Change"));
|
add(new TextButton("Change"), new VerticalLayoutData(-1, -1, new Margins(10,0,10,0)));
|
||||||
|
|
||||||
|
//addButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> void addHandlersForEventObservation(ComboBox<T> combo,
|
|
||||||
final LabelProvider<T> labelProvider) {
|
|
||||||
combo.addValueChangeHandler(new ValueChangeHandler<T>() {
|
|
||||||
|
|
||||||
public void onValueChange(ValueChangeEvent<T> event) {
|
|
||||||
Info.display(
|
|
||||||
"Value Changed",
|
|
||||||
"New value: "
|
|
||||||
+ (event.getValue() == null ? "nothing"
|
|
||||||
: labelProvider.getLabel(event
|
|
||||||
.getValue()) + "!"));
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
protected void addHandlersForComboColumn(
|
||||||
combo.addSelectionHandler(new SelectionHandler<T>() {
|
final LabelProvider<ColumnData> labelProvider) {
|
||||||
public void onSelection(SelectionEvent<T> event) {
|
comboColumn
|
||||||
|
.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||||
|
public void onSelection(
|
||||||
|
SelectionEvent<ColumnData> event) {
|
||||||
Info.display(
|
Info.display(
|
||||||
"State Selected",
|
"Column Type Selected",
|
||||||
"You selected "
|
"You selected "
|
||||||
+ (event.getSelectedItem() == null ? "nothing"
|
+ (event.getSelectedItem() == null ? "nothing"
|
||||||
: labelProvider.getLabel(event
|
: labelProvider.getLabel(event
|
||||||
.getSelectedItem()) + "!"));
|
.getSelectedItem())
|
||||||
|
+ "!"));
|
||||||
|
Log.debug("ComboColumn selected: "
|
||||||
|
+ event.getSelectedItem());
|
||||||
|
ColumnData columnType = event
|
||||||
|
.getSelectedItem();
|
||||||
|
//updateColumnType(columnType.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void addHandlersForComboColumnTypeCode(
|
protected void addHandlersForComboColumnTypeCode(
|
||||||
final LabelProvider<ColumnTypeCodeElement> labelProvider) {
|
final LabelProvider<ColumnTypeCodeElement> labelProvider) {
|
||||||
comboColumnTypeCode
|
comboColumnTypeCode
|
||||||
|
@ -227,7 +232,7 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
public void onSelection(
|
public void onSelection(
|
||||||
SelectionEvent<ColumnTypeCodeElement> event) {
|
SelectionEvent<ColumnTypeCodeElement> event) {
|
||||||
Info.display(
|
Info.display(
|
||||||
"Type Selected",
|
"Column Type Selected",
|
||||||
"You selected "
|
"You selected "
|
||||||
+ (event.getSelectedItem() == null ? "nothing"
|
+ (event.getSelectedItem() == null ? "nothing"
|
||||||
: labelProvider.getLabel(event
|
: labelProvider.getLabel(event
|
||||||
|
@ -250,7 +255,7 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
public void onSelection(
|
public void onSelection(
|
||||||
SelectionEvent<ColumnDataTypeElement> event) {
|
SelectionEvent<ColumnDataTypeElement> event) {
|
||||||
Info.display(
|
Info.display(
|
||||||
"Type Selected",
|
"Measure Type Selected",
|
||||||
"You selected "
|
"You selected "
|
||||||
+ (event.getSelectedItem() == null ? "nothing"
|
+ (event.getSelectedItem() == null ? "nothing"
|
||||||
: labelProvider.getLabel(event
|
: labelProvider.getLabel(event
|
||||||
|
@ -273,13 +278,13 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
public void onSelection(
|
public void onSelection(
|
||||||
SelectionEvent<ColumnDataTypeElement> event) {
|
SelectionEvent<ColumnDataTypeElement> event) {
|
||||||
Info.display(
|
Info.display(
|
||||||
"Type Selected",
|
"Attribute Type Selected",
|
||||||
"You selected "
|
"You selected "
|
||||||
+ (event.getSelectedItem() == null ? "nothing"
|
+ (event.getSelectedItem() == null ? "nothing"
|
||||||
: labelProvider.getLabel(event
|
: labelProvider.getLabel(event
|
||||||
.getSelectedItem())
|
.getSelectedItem())
|
||||||
+ "!"));
|
+ "!"));
|
||||||
Log.debug("ComboMeasureType selected: "
|
Log.debug("ComboAttributeType selected: "
|
||||||
+ event.getSelectedItem());
|
+ event.getSelectedItem());
|
||||||
ColumnDataTypeElement attributeType = event
|
ColumnDataTypeElement attributeType = event
|
||||||
.getSelectedItem();
|
.getSelectedItem();
|
||||||
|
@ -290,6 +295,7 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateColumnType(ColumnTypeCode type) {
|
protected void updateColumnType(ColumnTypeCode type) {
|
||||||
|
Log.debug("Update ColumnTyepeCod"+type.toString());
|
||||||
if (type == ColumnTypeCode.MEASURE) {
|
if (type == ColumnTypeCode.MEASURE) {
|
||||||
comboMeasureTypeLabel.setVisible(true);
|
comboMeasureTypeLabel.setVisible(true);
|
||||||
comboAttributeTypeLabel.setVisible(false);
|
comboAttributeTypeLabel.setVisible(false);
|
||||||
|
@ -316,10 +322,6 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
|
|
||||||
protected void loadData(ListLoadConfig loadConfig,
|
protected void loadData(ListLoadConfig loadConfig,
|
||||||
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||||
new AsyncCallback<ArrayList<ColumnData>>() {
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,10 @@ public class ColumnTypeCodeStore implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -1908324094430432681L;
|
private static final long serialVersionUID = -1908324094430432681L;
|
||||||
|
|
||||||
protected static ArrayList<ColumnTypeCodeElement> store = new ArrayList<ColumnTypeCodeElement>();
|
protected static ArrayList<ColumnTypeCodeElement> store;
|
||||||
|
|
||||||
public static ArrayList<ColumnTypeCodeElement> getColumnTypeCodes(){
|
public static ArrayList<ColumnTypeCodeElement> getColumnTypeCodes(){
|
||||||
|
store = new ArrayList<ColumnTypeCodeElement>();
|
||||||
store.add(new ColumnTypeCodeElement(1,ColumnTypeCode.ANNOTATION));
|
store.add(new ColumnTypeCodeElement(1,ColumnTypeCode.ANNOTATION));
|
||||||
store.add(new ColumnTypeCodeElement(2,ColumnTypeCode.ATTRIBUTE));
|
store.add(new ColumnTypeCodeElement(2,ColumnTypeCode.ATTRIBUTE));
|
||||||
store.add(new ColumnTypeCodeElement(3,ColumnTypeCode.MEASURE));
|
store.add(new ColumnTypeCodeElement(3,ColumnTypeCode.MEASURE));
|
||||||
|
|
Loading…
Reference in New Issue