Hi all,
I've a Java code (GWT):
package com.practicum.client.out; import java.util.ArrayList; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Widget; import com.google.gwt.visualization.client.DataTable; import com.google.gwt.visualization.client.AbstractDataTable.ColumnType; import com.google.gwt.visualization.client.visualizations.corechart.AxisOptions; import com.google.gwt.visualization.client.visualizations.corechart.ColumnChart; import com.google.gwt.visualization.client.visualizations.corechart.CoreChart; import com.google.gwt.visualization.client.visualizations.corechart.Options; import com.practicum.client.Product; import com.practicum.client.rpc.ProductService; import com.practicum.client.rpc.ProductServiceAsync; public class DataOutColumnChart { private DataTable data = DataTable.create(); private Options options = CoreChart.createOptions(); private final ProductServiceAsync productService = GWT.create(ProductService.class); public DataOutColumnChart(Runnable runnable) { } public Widget createColumnChartView() { /* create a datatable */ data.addColumn(ColumnType.STRING, "Price"); data.addColumn(ColumnType.NUMBER, "EUR"); addData("A for Apple", 123); // THIS WORKS addData("B for Boy", 123); // THIS WORKS /* create column chart */ options.setWidth(400); options.setHeight(300); options.setBackgroundColor("#e8e8e9"); AxisOptions vAxisOptions = AxisOptions.create(); vAxisOptions.setMinValue(0); options.setVAxisOptions(vAxisOptions); return new ColumnChart(data, options); } public void getWinkels() { productService.getWinkels(new AsyncCallback<ArrayList<Product>>() { public void onFailure(Throwable caught) { } public void onSuccess(ArrayList<Product> result) { for (Product p : result) { addData("C for Candy", 123); // THIS DONT WORK? System.out.println(p.getWinkel()); // THIS WORKS } } }); } public void addData(String winkel, int prijs) { int rownr = data.addRow(); data.setValue(rownr, 0, winkel); data.setValue(rownr, 1, prijs); } }
Can someone explain me why line 30 and 31 works,
but line 51 not works? Simply nothing happens on line 52...
I've tried anything...
Thanks in advance!