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.event.logical.shared.SelectionEvent;
|
||||
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.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||
|
@ -62,8 +60,8 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
protected FieldLabel comboMeasureTypeLabel;
|
||||
protected ComboBox<ColumnDataTypeElement> comboAttributeType = null;
|
||||
protected FieldLabel comboAttributeTypeLabel;
|
||||
|
||||
protected TextField labelColumn;
|
||||
protected ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader;
|
||||
|
||||
public ChangeColumnTypePanel(TRId trId, String columnName, EventBus eventBus) {
|
||||
setWidth(WIDTH);
|
||||
|
@ -74,6 +72,7 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
this.columnName = columnName;
|
||||
this.eventBus = eventBus;
|
||||
|
||||
//Column Data
|
||||
ColumnDataProperties propsColumnData = GWT
|
||||
.create(ColumnDataProperties.class);
|
||||
ListStore<ColumnData> storeCombo = new ListStore<ColumnData>(
|
||||
|
@ -88,9 +87,10 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
loadData(loadConfig, callback);
|
||||
}
|
||||
};
|
||||
final ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader = new ListLoader<ListLoadConfig, ListLoadResult<ColumnData>>(
|
||||
|
||||
loader = new ListLoader<ListLoadConfig, ListLoadResult<ColumnData>>(
|
||||
proxy);
|
||||
loader.setRemoteSort(false);
|
||||
//loader.setRemoteSort(false);
|
||||
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, ColumnData, ListLoadResult<ColumnData>>(
|
||||
storeCombo));
|
||||
Log.trace("LoaderCombo created");
|
||||
|
@ -109,12 +109,14 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
};
|
||||
Log.trace("Combo ColumnData created");
|
||||
|
||||
addHandlersForEventObservation(comboColumn, propsColumnData.label());
|
||||
//addHandlersForEventObservation(comboColumn, propsColumnData.label());
|
||||
addHandlersForComboColumn(propsColumnData.label());
|
||||
|
||||
comboColumn.setLoader(loader);
|
||||
comboColumn.setEmptyText("Select a column...");
|
||||
comboColumn.setWidth(150);
|
||||
comboColumn.setTypeAhead(true);
|
||||
comboColumn.setEditable(true);
|
||||
comboColumn.setTypeAhead(false);
|
||||
comboColumn.setEditable(false);
|
||||
comboColumn.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
|
||||
|
@ -191,35 +193,38 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
v.add(comboAttributeTypeLabel, new VerticalLayoutData(1, -1));
|
||||
|
||||
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()) + "!"));
|
||||
|
||||
}
|
||||
});
|
||||
combo.addSelectionHandler(new SelectionHandler<T>() {
|
||||
public void onSelection(SelectionEvent<T> event) {
|
||||
|
||||
protected void addHandlersForComboColumn(
|
||||
final LabelProvider<ColumnData> labelProvider) {
|
||||
comboColumn
|
||||
.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||
public void onSelection(
|
||||
SelectionEvent<ColumnData> event) {
|
||||
Info.display(
|
||||
"State Selected",
|
||||
"Column Type Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem()) + "!"));
|
||||
.getSelectedItem())
|
||||
+ "!"));
|
||||
Log.debug("ComboColumn selected: "
|
||||
+ event.getSelectedItem());
|
||||
ColumnData columnType = event
|
||||
.getSelectedItem();
|
||||
//updateColumnType(columnType.getCode());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected void addHandlersForComboColumnTypeCode(
|
||||
final LabelProvider<ColumnTypeCodeElement> labelProvider) {
|
||||
comboColumnTypeCode
|
||||
|
@ -227,7 +232,7 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
public void onSelection(
|
||||
SelectionEvent<ColumnTypeCodeElement> event) {
|
||||
Info.display(
|
||||
"Type Selected",
|
||||
"Column Type Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
|
@ -250,7 +255,7 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
public void onSelection(
|
||||
SelectionEvent<ColumnDataTypeElement> event) {
|
||||
Info.display(
|
||||
"Type Selected",
|
||||
"Measure Type Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
|
@ -273,13 +278,13 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
public void onSelection(
|
||||
SelectionEvent<ColumnDataTypeElement> event) {
|
||||
Info.display(
|
||||
"Type Selected",
|
||||
"Attribute Type Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem())
|
||||
+ "!"));
|
||||
Log.debug("ComboMeasureType selected: "
|
||||
Log.debug("ComboAttributeType selected: "
|
||||
+ event.getSelectedItem());
|
||||
ColumnDataTypeElement attributeType = event
|
||||
.getSelectedItem();
|
||||
|
@ -290,6 +295,7 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
}
|
||||
|
||||
protected void updateColumnType(ColumnTypeCode type) {
|
||||
Log.debug("Update ColumnTyepeCod"+type.toString());
|
||||
if (type == ColumnTypeCode.MEASURE) {
|
||||
comboMeasureTypeLabel.setVisible(true);
|
||||
comboAttributeTypeLabel.setVisible(false);
|
||||
|
@ -316,10 +322,6 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
|||
|
||||
protected void loadData(ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||
|
||||
|
||||
|
||||
|
||||
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||
|
||||
|
|
|
@ -18,9 +18,10 @@ public class ColumnTypeCodeStore implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = -1908324094430432681L;
|
||||
|
||||
protected static ArrayList<ColumnTypeCodeElement> store = new ArrayList<ColumnTypeCodeElement>();
|
||||
protected static ArrayList<ColumnTypeCodeElement> store;
|
||||
|
||||
public static ArrayList<ColumnTypeCodeElement> getColumnTypeCodes(){
|
||||
store = new ArrayList<ColumnTypeCodeElement>();
|
||||
store.add(new ColumnTypeCodeElement(1,ColumnTypeCode.ANNOTATION));
|
||||
store.add(new ColumnTypeCodeElement(2,ColumnTypeCode.ATTRIBUTE));
|
||||
store.add(new ColumnTypeCodeElement(3,ColumnTypeCode.MEASURE));
|
||||
|
|
Loading…
Reference in New Issue