Re: How can i pass an array through a runnable interface ?

2011-10-28 Thread Jens
Make your result final, e.g. onSuccess(final String[][] result). You can 
now use it inside the Runnable anonymous class.

Different way would be to create a class that implements Runnable. The 
class could have a constructor that takes the string array as argument, 
stores it in a field and then use it in its run() method.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/xE3gvj47iBwJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



How can i pass an array through a runnable interface ?

2011-10-27 Thread Laurent Pierre
Hi Chaps,

I'm doing a succesful call to a servlet which is returning a String array.
Array's datas should be used to display a pie chart.

What is the best way to pass these datas to createtable() in order to fill the 
data table ?

Did tried a couple of ideas but i had some error messages like 
referring-to-a-non-final-variable-data-inside-an-inner-class and others .
Can someone help me fix this because i'm beating around the bush ?

Regards,

Pierre
---

Service.callD(F,
new AsyncCallback() { 
public void onFailure(Throwable caught) {
dialogBox
.setText(Remote Procedure Call - Failure);
serverResponseLabel
.addStyleName(serverResponseLabelError);
serverResponseLabel.setHTML(SERVER_ERROR);
dialogBox.center();
closeButton.setFocus(true);
}

@Override
public void onSuccess(String[][] result) {

Runnable onLoadCallback = new Runnable() {
public void run() {


PieChart pie = new PieChart(createTable(), createOptions());

pie.addSelectHandler(createSelectHandler(pie));
horizontalPanel_2.add(pie);
}
};
VisualizationUtils.loadVisualizationApi(onLoadCallback, PieChart.PACKAGE);

}
--- 

private AbstractDataTable createTable() {


DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING, Libelle);
data.addColumn(ColumnType.NUMBER, Nombre);
data.addRows(4);
data.setValue(0, 0, Defaut 1);
data.setValue(0, 1, 14);
data.setValue(1, 0, Defaut 2);
data.setValue(1, 1, 10);
data.setValue(2, 0, Defaut 3);
data.setValue(2, 1, 25);
data.setValue(3, 0, Defaut 4);
data.setValue(3, 1, 2);

return data;
}
---

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.