using return of RPC

Hi everyone

I need to use the retun of a RPC

i have this RPC

final AsyncCallback<Result> searchCallback = new AsyncCallback<Result>() {

        public void onSuccess(Result results) {

            if (results.getReport() == null) {
 
                 SC.warn( " valori " + results.value());


        public void onFailure(Throwable caught) {
           
               SC.warn("ERROR");
          
        }

result.value return a List<String>

class Result

public class Result implements Serializable{
private List<String> val;

    public List<String> value() {
        return val;
    }

when i run my application the SC.warn( " valori " + results.value()) show me the right value, but now i need to use result.value in other class?

Can someone help me ??

Thanks to all!!!

If I am understanding your issue correctly, it’s not a SmartGWT issue, or even a GWT issue. More of just a UI design pattern. However you want to handle that is up to you (or more accurately, up to your requirements), but you might want to use some type of application wide object (something similar to an EventBus, perhaps) to store data like this that must be used throughout the application. If you use the EventBus approach, other views interested in this data can listen for the “Reports” object being available, and react accordingly.

The EventBus uses a traditional Listener pattern, but again, you can solve this problem several ways. Just use a solution that fits your application.

sorry but i don’t understand

is possible have a return from asyncallback to use in other classes?

in my example the " results.value()" return a list of string

i use this method for copy the value Collections.copy(PartData.lista, result.getTags());
is correct?

but i see after i go out from asynccallback i lost all information

final AsyncCallback<SearchResult> searchCallback = new AsyncCallback<SearchResult>() {

        public void onSuccess(SearchResult result) {

            if (result.getReport() == null) {
        

              
                Collections.copy(PartData.list, result.getTags());

Not knowing your exact use case, I will just provide some pseudo code to try and describe what I was meaning.

/*inside of class declaring the AsyncCallback */

//global object that is shared between views/presenters throughout the application
GlobalObject globalObj;

//constructor of this class gets the GlobalObject passed in

...

someMethod() {

    final AsyncCallback<SearchResult> searchCallback = new AsyncCallback<SearchResult>() {

        public void onSuccess(SearchResult result) {
            //do some stuff with the result
            //share the object globally
            globalObj.setSearchResult(result);
        }

    }
}

Make note that other views/presenters will have access to this same global object. If you would instead prefer to use a Listener pattern and have the other views/presenters register for events (e.g. SearchResultsFoundEvent), then you are free to set it up that way as well. I hope this is a bit more clear. Again, your problem sounds more like a general OO question, and not SmartGWT/GWT related.