Hi all,

Is there any other solution if not using MVP, just a plain project
with UiBinder widgets?
e.g.
main app has user data, determined at runtime; some widgets should be
able to read and write to this.

I looked at
http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html#Share_resource_instances
but it seems this is just static data.

Also looked at
http://blog.jeffdouglas.com/2010/02/24/gwt-uibinder-passing-objects-to-widgets/
but it doesn't seem possible to write back to main app data.

Thx

On Apr 1, 10:36 am, Abdullah Shaikh <abdullah.shaik...@gmail.com>
wrote:
> Cool .. I will try this out ... thanks
>
> - Abdullah
>
> On Thu, Apr 1, 2010 at 12:58 PM, Subhrajyoti Moitra
> <subhrajyo...@gmail.com>wrote:
>
>
>
> > In my AppController i have this in bind().
>
> > this.eventBus.addHandler(LoginEvent.TYPE,new LoginEventHandler() {
>
> >             public void onLoginEvent(LoginEvent event) {
> >                 final String token=History.getToken();
> >                 authService.login(event.getUsername(), event.getPassword(),
> > event.getOptions(), new AsyncCallback<UserSession>() {
> >                     public void onFailure(Throwable error) {
>
> > AdminAppController.this.lp.getDisplay().enableLoginView();
>
> > AdminAppController.this.lp.getDisplay().setError(error);
> > *                        AdminAppController.loggedInUserSession=null;*
> >                     }
> >                     public void onSuccess(UserSession session) {
> >                         *AdminAppController.loggedInUserSession=session;*
> >                         doLoginSuccess(token);//i do some more stuff here..
> >                     };
> >                 });
>
> >             }
> >         });
> > -------------------------------
>
> > public class AdminAppController implements ValueChangeHandler<String>,
> > Presenter{
>
> > .....
> > private static UserSession loggedInUserSession=null;
> > public static UserSession getLoggedInUserSession(){
> >         return loggedInUserSession;
> >     }
>
> > .........
> > }
>
> > On logout i set this loggedInUSerSession to null.
>
> > From any other view u can call the static method to get the object.
>
> > "I can see is can I can pass the data to the presenter..." since this is a
> > static info, u dont need to pass this info.
>
> > This solution is with problems, for example if your async call takes a long
> > time to return, the view trying to use this info would receive null, so u
> > have to take care of this case too. Using Timers might help.
>
> > Keen to know how others are solving this issue.
>
> > Thanks,
> > Subhro.
>
> > On Thu, Apr 1, 2010 at 12:39 PM, Abdullah Shaikh <
> > abdullah.shaik...@gmail.com> wrote:
>
> >> Hi Subhro,
>
> >> Yes I am using MVP pattern, and as I have a EventBus in my AppPresenter,
> >> which handles the LoginEvent, I can store the data in my controller, but 
> >> how
> >> do I access them in my other view/presenter, one way I can see is can I can
> >> pass the data to the presenter while I am creating them in my controller.
>
> >> Is there anything I am missing ?
>
> >> Thanks
> >> Abdullah
>
> >> On Thu, Apr 1, 2010 at 12:11 PM, Subhrajyoti Moitra <
> >> subhrajyo...@gmail.com> wrote:
>
> >>> Hello,
>
> >>> if u are using MVP pattern u must be having a AppController class to
> >>> control the application flow and listen to history events (if required).
> >>> The shared data can be stored as static objects on the AppController. On
> >>> successful login you can set this static field. From any other "view" u 
> >>> can
> >>> ask the AppController for the object.
> >>> This data can be any GWT compatible object.
>
> >>> How are other folks on the list solving this problem?
>
> >>> Thanks,
> >>> Subhro.
>
> >>> On Thu, Apr 1, 2010 at 11:39 AM, Abdullah Shaikh <
> >>> abdullah.shaik...@gmail.com> wrote:
>
> >>>> Hi All,
>
> >>>> After the user logins, I get some data from the server and takes him to
> >>>> the home page, and I want to have access to this data over all the pages 
> >>>> on
> >>>> which the user navigates, I dont want to pass this data throughout all 
> >>>> the
> >>>> pages, is there any to way to share this data, I thought of using
> >>>> Dictionary, is it ok to use it for this purspose or is there any other 
> >>>> way ?
>
> >>>> Thanks,
> >>>> Abdullah
>
> >>>> --
> >>>> 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-tool...@googlegroups.com.
> >>>> To unsubscribe from this group, send email to
> >>>> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubs­cr...@googlegroups.com>
> >>>> .
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/google-web-toolkit?hl=en.
>
> >>>  --
> >>> 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<google-web-toolkit%2bunsubs­cr...@googlegroups.com>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/google-web-toolkit?hl=en.
>
> >>  --
> >> 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-tool...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubs­cr...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/google-web-toolkit?hl=en.
>
> >  --
> > 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-tool...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubs­cr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.- Hide quoted text -
>
> - Show quoted text -

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