MVP with EventBus question - Google Web Toolkit | Google Groups - 0 views
-
Yeah, the one problem with UiBinder and MVP is this pattern collision.... UiBinder says, "view are directly attached to views". MVP says, "view's are attached to presenters, if you want to chain views the presenters control this". Consequently, you can't get UiBinder to create your @UiFields (i.e. empty constructor) and you can't get Gin to @Inject them into the view either... because they are in the presenter. Unless of course you use @Named+Singleton bindings in Gin and then both presenter and view will be injected with the same object. This is the one bit of boilerplate we're still writing.
-
I looked into that, and (unless I'm wrong), I think that @UiField(provided=true) will cause the UiBinder to look in the .ui.xml file for argument to satisfy Foo. In my case I am trying to "inject" an EventBus into the widget, not a visual element.
gwt-platform - Project Hosting on Google Code - 0 views
-
Moreover, GWTP strives to use the event bus in a clear and efficient way. Events are used to decouple loosely related objects, while direct method invocation is used to clarify the program flow between strongly coupled components. The result is an application that is easy to understand and that can grow with time.
Gwt 2.1 Activities + Code splitting + Gin - Google Web Toolkit | Google Groups - 0 views
-
I think the overall idea of activities is that they are short-lived instances, so they're effectively "lazily created" (actually, a new instance is created each time one is needed) and they don't need to be "awoken" because if they're not currently in use they're already "dead" and garbage collected. The ActivityManager (actually its associated ActivityMapper) will decide whether a particular activity is needed (and then instantiate it, possibly going through a GWT.runAsync for code splitting); the activity will listen to events its interested in *during its lifetime* (e.g. whether some object has changed or has been added or deleted, so it can update its view); but when it's done (stopped or cancelled), it's simply thrown away (the event bus passed to the start() method is a ResettableEventBus so all handlers have been automatically unregistered for you, which as a side effect allows the activity to be garbage collected). This is the (AIUI) intended use, but nothing forces you to write such short-lived instances: you can very well use singletons, but then you'll have the additional task of maintaining state between "runs" (start/stop or start/cancel), in which case your activity can listen to events from the event bus after being stopped/cancelled (just use the "real" event bus instead of the ResettableEventBus passed to the start() method); but it won't "ask to be revealed": navigation is handled at another layer, triggered on the PlaceController and handled by ActivityManagers.
GWT 2.1 hellomvp using GIN - Google Web Toolkit | Google Groups - 0 views
-
although we can't map a 1-Many relationship between a Place and an Activity, you can in fact map multiple places to the same activity and differentiate between the place with multiple init() methods in the activity.
Gwt 2.1 Activities + Code splitting + Gin - Google Web Toolkit | Google Groups - 0 views
-
I think the overall idea of activities is that they are short-lived instances, so they're effectively "lazily created" (actually, a new instance is created each time one is needed) and they don't need to be "awoken" because if they're not currently in use they're already "dead" and garbage collected. The ActivityManager (actually its associated ActivityMapper) will decide whether a particular activity is needed (and then instantiate it, possibly going through a GWT.runAsync for code splitting); the activity will listen to events its interested in *during its lifetime* (e.g. whether some object has changed or has been added or deleted, so it can update its view); but when it's done (stopped or cancelled), it's simply thrown away (the event bus passed to the start() method is a ResettableEventBus so all handlers have been automatically unregistered for you, which as a side effect allows the activity to be garbage collected). This is the (AIUI) intended use, but nothing forces you to write such short-lived instances: you can very well use singletons, but then you'll have the additional task of maintaining state between "runs" (start/stop or start/cancel), in which case your activity can listen to events from the event bus after being stopped/cancelled (just use the "real" event bus instead of the ResettableEventBus passed to the start() method); but it won't "ask to be revealed": navigation is handled at another layer, triggered on the PlaceController and handled by ActivityManagers.
GWT MVP Development with Activities and Places - Google Web Toolkit - Google Code - 2 views
-
An activity in GWT 2.1 is analogous to a presenter in MVP terminology. It contains no Widgets or UI code. Activities are started and stopped by an ActivityManager associated with a container Widget. A powerful new feature in GWT 2.1 is that an Activity can automatically display a warning confirmation when the Activity is about to be stopped (such as when the user navigates to a new Place). In addition, the ActivityManager warns the user before the window is about to be closed.
-
A place in GWT 2.1 is a Java object representing a particular state of the UI. A Place can be converted to and from a URL history token (see GWT's History object) by defining a PlaceTokenizer for each Place, and the PlaceHistoryHandler automatically updates the browser URL corresponding to each Place in your app.
-
A key concept of MVP development is that a view is defined by an interface.
- ...23 more annotations...
Gwt 2.1 Activities + Code splitting + Gin - Google Web Toolkit | Google Groups - 0 views
-
your ChatBoxPresenter isn't related to a "place", i.e. it's "awoken" based on a "business event", not a navigation event; and in other words, it's not an Activity: case made. Activities (ActivityManager) is limited in scope to reacting to place changes and navigation (not that you couldn't use the Activity "contract" in other scenarios, such as your "chat box", but the ActivityManager wouldn't be the right tool for the job, you'd have to find/write another "activity manager" for your different use case). In other words: GWT 2.1 Activities won't replace GWTP as a whole (and I believe, as I already said in the past, that it's not its goal either).
GWT 2.1 hellomvp using GIN - Google Web Toolkit | Google Groups - 0 views
-
The way we're minimizing code right now, is by creating some useful abstract tokenizers that handle the common use cases (no parameter tokenizer, key-value pair tokenizer). With those there are corresponding abstract tokenizers that handle creating the hashCode and equals methods. Aside from the 1:1 between Place and Activity, which bothers me in principle but may not be a practical concern just yet, it's coming along pretty nicely.
Sample App using DI/Gin, MVP, UiBinder, etc - Google Web Toolkit | Google Groups - 0 views
-
* I notice that you're injecting instances of your activities into your activity mapper. Activities are meant to be fairly lightweight objects, as opposed to the views that represent them, so they don't need to be singletons (which they effectively are since you have a single app with a single injected activity mapper). It's probably not necessarily a problem unless your activities have state associated with them (such as the entity that the user is currently working with), which you have to be careful to clear out between uses with different data. The same can be said about places.
-
My understanding is that you only want a single area of the shell to be managed by one ActivityManager. So if you have an entire shell/layout with more than one area that changes, let's say a main content area as well as a context menu (If I have MainAppPlace and SettingsAppPlace and OtherAppPlace both of which extend MainAppPlace, and you want to show a different context menu for Place of type SettingsAppPlace and places of type OtherAppPlace) I would just have main Shell that has a SimplePanel for content and Simplepanel for context_menu I just use an ActivityManager to control one spot of the main layout. is this not right? do you want your activitymanager controlling more than one area??
Hive Development Limited: Google Web Toolkit (GWT) MVP Example - 0 views
1 - 16 of 16
Showing 20▼ items per page