In the following code; Types T, E are the same. But I cannot change E
to T as it won't compile, hence the explicit type cast in the
onSuccess method. Maybe there is a way to use the same generic type T
for the inner class ??? The different types make it difficult to read.


public abstract class HTMLGrid<T> extends Grid
        implements IsSortable, IsFilterable {

  protected class EntityCallback<E> implements AsyncCallback<E> {

    public void onFailure(Throwable caught) {
      setErrorMessage(caught.getMessage());
    }

    public void onSuccess(E result) {
      int index = dataSet.indexOf(result);
      if (index < 0) {
        dataSet.add((T)result);
      } else {
        dataSet.set(index, (T)result);
      }
    }

  }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to