Populating ListBox's using Activities and Places

23 views
Skip to first unread message

Craig

unread,
Jul 13, 2011, 5:31:25 AM7/13/11
to Google Web Toolkit
I have an application that uses the new Places and Activities
methodology.

In my View interfaces I have methods such as :

HasValue<String> getSubject();
HasValue<Type> getType();

Type is a simple POJO that has an id and name. The selections
available for this is driven from the result of an RPC call.

My question is where should this RPC call be placed? Should this be
initiated from the Activity start method, and call a new method on the
View interface "setPossibleTypes(List<Type> list)" ?

Or should inject the EventBus into the View Implementation and enable
the view to call and process the call ?

Many thanks

Craig

Thomas Broyer

unread,
Jul 13, 2011, 5:44:56 AM7/13/11
to google-we...@googlegroups.com
One of the goal of MVP is to make your presentation logic quickly & easily testable (in GWT, that means using "pure JUnit" rather than the sluggish GWTTestCase). As a result, you'd like to make you view as "dumb" as possible (without necessarily pushing everything to presenter though, as it'd lose readability and thus maintainability). So, you'd better put your RPC call in your presenter (activity).

Adam

unread,
Jul 13, 2011, 8:16:08 AM7/13/11
to Google Web Toolkit
We use a slight various of Thomas' suggestion. We introduced a new
interface / class called a "Broker" which we define all of our rpc
calling methods in. Then be default we typically have the activity
implement the Broker interface, but if need be we could have a new
class implement it. We pass the Broker to the View so if the view
needs access to rpc services it can call methods on the broker as need
be. This still allows for the View to be stupid, but can help keep
the activity code cleaner.

Thad

unread,
Jul 13, 2011, 11:15:24 AM7/13/11
to Google Web Toolkit
I'm stumped on how dumb I can make a particular view. Maybe this is
another thread, but I have a view with two FormPanels, each FormPanel
holding a FileUpload. In my onSubmitCompleteHandlers, I'd like the
view to respond, in once case by calling an RPC function. How do I get
all this into my presenter/Activity? Can I still use UiBinder?

On Jul 13, 5:44 am, Thomas Broyer <t.bro...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages