Re: best/good practices to keep Model in sync with Activity/Place and a view.

2012-04-25 Thread tanteanni
Thanks - great idea,

so i inject the abstract class "com.google.gwt.core.client.Scheduler". Do i 
have to bind an instance or provider to it (the provider will call get())?

ok but this is an perfect answer for 
this
 thread. 
The question here is, is it good to connect the model this way? or general 
how do you connect the model (more than an object delivered by a service) 
with the presenter?

On Wednesday, 25 April 2012 11:14:05 UTC+2, Thomas Broyer wrote:
>
>
>
> On Wednesday, April 25, 2012 11:06:48 AM UTC+2, tanteanni wrote:
>>
>> Thx
>> The Problem about Scheduled command is that i loose test ability - one 
>> main reason i use MVP (want to test the P without GWTTestCase).
>
>
> Not if you inject the Scheduler into your activity (probably a mock one 
> then, or the StubScheduler implementation).
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/lSQOBOQGswEJ.
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.



Re: best/good practices to keep Model in sync with Activity/Place and a view.

2012-04-25 Thread Thomas Broyer


On Wednesday, April 25, 2012 11:06:48 AM UTC+2, tanteanni wrote:
>
> Thx
> The Problem about Scheduled command is that i loose test ability - one 
> main reason i use MVP (want to test the P without GWTTestCase).


Not if you inject the Scheduler into your activity (probably a mock one 
then, or the StubScheduler implementation).

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/OG_Gp-MQ7HQJ.
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.



Re: best/good practices to keep Model in sync with Activity/Place and a view.

2012-04-25 Thread tanteanni
Thx
The Problem about Scheduled command is that i loose test ability - one main 
reason i use MVP (want to test the P without GWTTestCase).

But the Question is how to design such DAO's - i guess that's where i am 
failing at the moment. My current DAO is firing events - not usable in 
activities start method without ScheduledCommand. But i also have DAO's 
that uses delegates to signal "data is ready". But how to godd/best 
integrate/design such DAO's in a gwt/mvp/a&p app? (and probably how to 
cut/split good services for them?)

On Wednesday, 25 April 2012 10:49:29 UTC+2, Thomas Broyer wrote:
>
>
> On Wednesday, April 25, 2012 8:07:00 AM UTC+2, tanteanni wrote:
>>
>> for example a showUserPlace and a EditUserPlace. Or in general there are 
>> often more than one usecase per "model". And if i want a distinct url per 
>> use case i need different places. This cases could probably solved by let 
>> one "userActivity" manage two presenters (edit and show user). But then i 
>> have the same issue- how to "inject" the synchronized model from activity 
>> in presenter.
>> But at the moment the problem is not that two activities. Now i have a 
>> very complicated logic on the model so i decided to put this logic out of 
>> activity/presenter (ui handling logic). here is the same problem how to let 
>> the activity interact with a model. (i linked the concrete problem above - 
>> for short: if used events i have the problem to register for an event and 
>> trigger an event(asking the model) all in start method seem to fail)
>>
>
> For the "data" thing, I think you simply need a "DAO" on the client-side 
> doing some caching.
>
> As for the events, call your getData() in a ScheduledCommand (use either 
> scheduleFinally or scheduleDeferred).
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/LnZ1uXlyx8MJ.
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.



Re: best/good practices to keep Model in sync with Activity/Place and a view.

2012-04-25 Thread Thomas Broyer

On Wednesday, April 25, 2012 8:07:00 AM UTC+2, tanteanni wrote:
>
> for example a showUserPlace and a EditUserPlace. Or in general there are 
> often more than one usecase per "model". And if i want a distinct url per 
> use case i need different places. This cases could probably solved by let 
> one "userActivity" manage two presenters (edit and show user). But then i 
> have the same issue- how to "inject" the synchronized model from activity 
> in presenter.
> But at the moment the problem is not that two activities. Now i have a 
> very complicated logic on the model so i decided to put this logic out of 
> activity/presenter (ui handling logic). here is the same problem how to let 
> the activity interact with a model. (i linked the concrete problem above - 
> for short: if used events i have the problem to register for an event and 
> trigger an event(asking the model) all in start method seem to fail)
>

For the "data" thing, I think you simply need a "DAO" on the client-side 
doing some caching.

As for the events, call your getData() in a ScheduledCommand (use either 
scheduleFinally or scheduleDeferred).

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/hPRRNRi5arUJ.
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.



Re: best/good practices to keep Model in sync with Activity/Place and a view.

2012-04-24 Thread tanteanni
for example a showUserPlace and a EditUserPlace. Or in general there are 
often more than one usecase per "model". And if i want a distinct url per 
use case i need different places. This cases could probably solved by let 
one "userActivity" manage two presenters (edit and show user). But then i 
have the same issue- how to "inject" the synchronized model from activity 
in presenter.
But at the moment the problem is not that two activities. Now i have a very 
complicated logic on the model so i decided to put this logic out of 
activity/presenter (ui handling logic). here is the same problem how to let 
the activity interact with a model. (i linked the concrete problem above - 
for short: if used events i have the problem to register for an event and 
trigger an event(asking the model) all in start method seem to fail)

On Tuesday, 24 April 2012 20:26:41 UTC+2, Jens wrote:
>
> Do you have a concrete example? So far I never stumbled upon a case where 
> I was thinking "hmm thats the same as in the other activity".
> In general two activities should do two different things, so if I have for 
> example an userId inside my place then the first activity would maybe fetch 
> the User model class to display general user information (not needed 
> relations would be null) and the second activity would fetch something 
> different based on the userId.
>
> -- J.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/oCHDPpwZu2gJ.
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.



Re: best/good practices to keep Model in sync with Activity/Place and a view.

2012-04-24 Thread Jens
Do you have a concrete example? So far I never stumbled upon a case where I 
was thinking "hmm thats the same as in the other activity".
In general two activities should do two different things, so if I have for 
example an userId inside my place then the first activity would maybe fetch 
the User model class to display general user information (not needed 
relations would be null) and the second activity would fetch something 
different based on the userId.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Eer70O4IEDIJ.
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.



best/good practices to keep Model in sync with Activity/Place and a view.

2012-04-24 Thread tanteanni
Since approximately one year i am coding with gwt and MVP pattern (also 
using "Activity" and "Places") . The VP-Part was never a big Problem. But i 
often stumbled over getting a "model" for current place or generally how to 
get from Place  to Model->Activity->View.
My main problem is that on start of an activity the model is mapped into a 
String (token of a place) and must be "resolved" to data objects (i.e. 
userId to userObject) . i think that is the main difference between 
"classic" MVP using an EventBus or other means to communicate state changes 
(via "real" objects) and A&P-based MVP that knows only two states: the 
current place.getWhere() and the next goTo(new Place) - each mapped to/from 
String mapped.
So whats the point: So far i tried many approaches to "resolve" the state, 
but all feels wrong:
The simplest is to  let the activity resolve the state by calling the 
needed async-services (to get an user for an userId). But as soon as two 
activity share the same place/model this code must be copied - bad. The 
other stuff i tried was even worse - my last 
attempt
 (also 
asked 
here)
 
didn't work.

My question is: What is best/good practice to implement such a state 
resolver classes? Are there any examples (Place->Model->Place)?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/mEWYIcPRsosJ.
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.