Thursday, October 27, 2011

How can i pass an array through a runnable interface ?

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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment