Hi everybody,
I'm creating a website with GWT. I want to add CellTable into my project. 
The problem is that I have a lot of data to put into the tables. So, my 
website freeze and show my table after 2-3 minutes. 

I find on internet that multi-threads are impossible with GWT. So, what is 
the solution? Even if the user have to wait 2-3 minutes, I want to avoid 
the fact that it's freezing.

Any Ideas?

Thank you.

My code, maybe I can optimize it simply?

public void refreshTable(final ArrayList<String> arrListFilters, final 
ArrayList<String> arrListAll, String url) {

// Get the CQ result
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);

try {
Request response = builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
}

public void onResponseReceived(Request request, Response response) {
final json json = JsonUtils.unsafeEval(response.getText());

int i = 0;
int j = 0;
int tot;

// If there are too many results
if (json.getResultslength() > 10000) {
tot = 10000;
} else {
tot = json.getResultslength();
}

// Fill the list of rows
while (j < tot) {
i = 1;
List<String> rowTemp = new ArrayList<String>();
rowTemp.add(json.getDate(j));
// Get the data to get a price result for a specific
// customer query
arrListLnNb.add(json.getLineNb(j));
arrListId.add(json.getId(j));
arrListCqid.add(json.getCqid(j));
while (i < arrListFilters.size()) {
rowTemp.add(json.getResults(j, arrListAll.indexOf(arrListFilters.get(i))));

i = i + 1;
}
rowTemp.add("");
rows.add(rowTemp);
j = j + 1;

}

// Provide rows to the table
table.setRowCount(rows.size(), true);
table.setRowData(0, rows);

final ListDataProvider<List<String>> provider = new 
ListDataProvider<List<String>>(rows);

provider.addDataDisplay(table);

// Handler to sort the columns
List<List<String>> list1 = provider.getList();

ListHandler<List<String>> columnSortHandler = new 
ListHandler<List<String>>(list1);
i = 0;
while (i < table.getColumnCount()) {
final int columnIndex = i;
columnSortHandler.setComparator(table.getColumn(i), new 
Comparator<List<String>>() {
public int compare(List<String> o1, List<String> o2) {

if (o1 == o2) {
return 0;
}

// Compare the name columns.
if (o1 != null) {
return (o2 != null) ? o1.get(columnIndex).compareTo(o2.get(columnIndex)) : 
1;
}
return -1;

}
});

i = i + 1;
}

table.addColumnSortHandler(columnSortHandler);

i = 0;
while (i < table.getColumnCount()) {
table.getColumnSortList().push(table.getColumn(i));
i = i + 1;
}
}

});
} catch (RequestException e) {
}
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to