i got it - it is similar with collections:
private static class LoadMaps<K,V> implements AsyncCallback<Map<K,V>>
{
                private Map<K,V> target;

                protected LoadMaps(TaskDoneEvent ev, Map<K,V> whereTo) {
                        target = whereTo;
                }

                @Override
                public void onFailure(Throwable caught) {
                        Window.alert(caught.getMessage());

                }

                @Override
                public void onSuccess(Map<K,V> result) {
                        target.putAll(result);
                }

        }

thx to both of you!

On 11 Apr., 14:00, tanteanni <tantea...@hotmail.com> wrote:
> i am fairly new to gwt and struggling some how on "correct"/"nice" RPC
> implementation (it is working but code becomes ugly). On my first GWT
> based apps i often load some lists/data from db into front end. (Lists
> to be used in combo boxes for instance).
>
> so if i have a widget that needs 3 different lists (probably
> List<String> or Map<String, String>) i specify a service-method for
> each list. the problem is to load all those lists, i have to implement
> one class (...implements AsyncCallback) for each list.
> but the only difference between this implementations is that they load
> the result in different lists:
> public void onSuccess(){
> list1 = result
>
> }
>
> so how to implement an abstract callback class that could load its
> "result" into a given list/object (- a field of mother class)
>
> (if "call by reference" would exist in java i would giv "list1" as an
> parameter for constructor and onSucces would load the result into this
> reference?!)
>
> an optimal implementation would be if the result type could be a
> generic type: A class lie this:
>
> class GeneralCallback<T> implements AsyncCallback<T>{
>       public GeneralCallback(T target){
>            ...
>
> }
>
>    public onSuccess(T result){
>      target = result;
>
> }
> }
>
> is it possible to get such an abstract callback class?

-- 
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.

Reply via email to