Re: MVP in terms of UI and View
With regard to avoiding state in views, I've more or less followed this practice, but sometimes find it useful to cache re-usable DOM/Widget elements in views. In these cases, the view knows absolutely nothing about the general application state, but may keep track of a few minimal pieces of information that it can use to determine which, if any, cached Widgets it can re-use. For example, in one view I have a CellTree that I use for navigation, and the view caches CellTrees based on their root value. The activity (presenter) for that view first asks the view if it has an appropriate tree available in its cache. A new tree is created only if an appropriate one is not available. I think this makes sense because these Widgets are very view-specific. Caching them elsewhere would mean other parts of the app would have to understand (and become in some way coupled to) view-specific code. El 16/01/12 14:06, Thomas Broyer escribió: On Monday, January 16, 2012 8:44:22 AM UTC+1, Qrunk wrote: What does the following mean ?? GOALS in GWT Develeopment We need dumb Views, not dumb UIs (What does View mean here and whats UI in MVP ?? its confusing, , please explain with a small example, a simple one) A dumb view is a view that doesn't do too much (everything's controlled by the presenter), but that doesn't mean you UI has to be dumb too: you can have a very complex UI, with complex logic/behavior; the thing is: put it in the presenter, let the view be as dumb as possible. • Avoid state within Views (Which state is it talking about, please explain with a small example, a simple one) See answer in another thread. • Swap out Views for different platforms (What is the swapping thing here?? does he means change of different technology, say from GWT to Flex ) E.g. use a PushButton for desktop and a plain old Button (more lightweight, because native) for mobile. That doesn't change your presentation logic (i.e. your presenter code). -- 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/-/2NL-0Y1fGkwJ. 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. -- 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. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Request for comments on a custom framework
Hi, all, Like many other projects, our GWT app needed a general framework. We opted to create one, and since I haven't seen anything else that works exactly like ours, I thought I'd share what we've done, in the hopes that doing so might contribute something useful to the (already extensive) discussions on GWT MVP frameworks. We'd also love to hear any comments/criticisms/suggestions you may have...! In a nutshell: - The framework is component-based. (No hot-swapping of components, though---code must be recompiled in order to switch components in or out.) - Almost all objects are created in an injected context using GIN. - We extend the standard GWT Place, Activity and ActivityManager classes/interfaces (among others). - There are two kinds of components in the framework: those that provide activity/view/ui-region bindings for specific places, and those that provide other kinds of functionality. - Activities are a generified extension of GWT's Activity; Activity classes have generic parameters that associate them with a specific Place class, a View class, and a class that represents the component they're a part of. I'm not sure there's less boilerplate than in other MVP approaches. At least, though, it seems like everything is together that goes together, and we've got a decent, though very basic, path for encapsulating functionality in components as we complete and extend our app. And we got rid of the infamous if (place instanceof SomePlace) chain in ActivityMapper! Anyone who'd like to check it out can get it like this: $ git clone http://lais.mora.edu.mx/gitrepo/pescador.git/ $ cd webclient (note: other subdirectories of the repository have unrelated stuff that you'll probably want to ignore) Following are a few code snippets. Here's part of a simple activity: public class BodyStartPageActivityImpl extends WebClientActivityBaseBodyStartPageView, StartPagePlace, StartPagePAVComponent implements BodyStartPageActivity { @Inject public BodyStartPageActivityImpl( @Assisted StartPagePlace place) { super(place); } @Override public void start(AcceptsOneWidget container, EventBus eventBus) { BodyStartPageView view = getView(); view.setText(Body start page activity here...br /Another beautious line of start page.); container.setWidget(view); } [...] } As shown, the activity is created using GIN, so it can have almost anything injected via its constructor. It also gets access to the correct view and place instances. Here's a bit of a component that sets up activity/view/ui-region bindings for a place: public class ContentPAVComponentImpl extends PlaceActivityViewComponentBase ContentPAVComponent, ContentPlace implements ContentPAVComponent { @Inject public ContentPAVComponentImpl( ContentPlaceProvider contentPlaceProvider, ActivitiesFactoryContentPlace, HeadContentActivity headActivitiesFactory, ActivitiesFactoryContentPlace, BodyContentActivity bodyActivitiesFactory, ActivitiesFactoryContentPlace, BannerContentActivity bannerActivitiesFactory, ActivitiesFactoryContentPlace, WestContentActivity westActivitiesFactory) { super( ContentPAVComponent.class, contenido, contentPlaceProvider, ContentPlace.class); // set up regions and activities factories addRegionAndActivitiesFactory(Head.class, headActivitiesFactory); addRegionAndActivitiesFactory(Body.class, bodyActivitiesFactory); addRegionAndActivitiesFactory(Banner.class, bannerActivitiesFactory); addRegionAndActivitiesFactory(West.class, westActivitiesFactory); } public static class ContentGinModule extends AbstractGinModule { // GIN module for bindings specific to this component [...] } [...] } The component has a place provider and (GIN-generated) activity factories injected, which are passed along to the superclass. In turn, the superclass and other parts of the framework take care of starting the appropriate activities and views in the appropriate ui regions when the app goes to a place of the specified class. GIN bindings specific to this component are set up in the component's own GIN module. Finally, here's a bit of a ComponetSetup class, which ties everything together: public class ActiveComponentSetup extends ComponentSetup { /** * Activate all necessary {@link GinModule}s for DI in the components to use, * as well as for basic infrastructure and local GinModule. */
Re: Request for comments on a custom framework
Hi... El 29/11/11 17:50, Thomas Broyer escribió: I haven't looked at the code yet (not easy to read code on mobile) but I wonder how you manage the case where an activity can be used totally distinct places? In our project for instance, we show the same activity for an IllustrationPlace and a LegendPlace (a legend being the use of an illustration within a file): we show the information about the illustration in both cases. The way things are wired up right now, there are a couple options: 1) Set the activity's generic Place parameter to a common ancestor of the places where it'll appear. This could be the abstract class WebClientPlace, which is the ancestor of all places used in the framework, or it could be some other common ancestor lower down on the class hierarchy. In this case your activity could look like this: public class SomeCommonActivityImpl extends WebClientActivityBase SomeCommonView, AncestorOfPlacesWhereThisActivityIsUsed, SomeComponentProvidingCommonFunctionality implements SomeCommonActivity { [...] } Then, in the components that set up activity/view/ui-region bindings for the specific places where you want to use this activity, you'd just inject in an appropriate activity factory and bind it to a ui region, just like you'd do for any other activity. So you could have any number of components more or less like this: public class SpecificPAVComponentImpl extends PlaceActivityViewComponentBase SpecificPAVComponent, SpecificPlace implements SpecificPAVComponent { @Inject public SpecificPAVComponentImpl( SpecificPlaceProvider specificPlaceProvider, ActivitiesFactoryAncestorOfPlacesWhereThisActivityIsUsed, SomeCommonActivity someCommonActivitiesFactory, [...] ) { super([...]); addRegionAndActivitiesFactory(SomeUIRegion.class, someCommonActivitiesFactory); [...] } } Note that I haven't tried this yet, though I did think of this possibility, and in theory it would work. Note also that if you do it this way, the return type of the getPlace() method available in your activity would be AncestorOfPlacesWhereThisActivityIsUsed. For cases where you want to deal with your place instance as something more specific, see option (2), below. (Problems will arise if one needs to do this really a lot, and in many different ways, to the degree that the single-inheritance class hierarchy of Places becomes insufficient to express relevant commonalities and differences between places. Still, I'm sure the framework could be adapted to accommodate this---for example, rather than inheriting a common abstract Place class that inherits back to GWT's Place class, places could implement a common Place interface.) 2) Create an abstract class that provides the common functionality you need, and make specific activities that inherit it. This does work in the framework as it stands, and it's what I'm using for common functionality in the banner region of our app. So I have a StandardBannerActivityBase class that can be inherited by other activities. Many thanks again for your comments, suggestions, etc.! - Andrew -- 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. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Online Javadoc not up-to-date
Hi, all, Minor issue... The online Javadoc that the GWT documentation links to is not up-to-date. Compare: 404 Not Found: http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/client/ui/SimpleLayoutPanel.html Up-to-date goodness: http://google-web-toolkit.googlecode.com/svn/javadoc/2.3/com/google/gwt/user/client/ui/SimpleLayoutPanel.html Greetings, Andrew -- 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. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Need to change BackColor of Tree Item When I MouseOver on It
If you're using CellTree, see this thread, especially the last post, on how to set custom css styles for CellTree: https://groups.google.com/group/google-web-toolkit/browse_thread/thread/144b025bfa3421c3/c3eb2ad898ae06af Good luck! El 06/04/11 03:19, Nagendra escribió: I want to change color of tree Item on mouse Over Event ,I tried it by using CSS but can't get it pl. help how can i do it. for menu Item I get back color change when I mouse over but I didn't get for Tree Item -- 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. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
HorizontalSplitPanel with hide mechanism and no live update?
Hi, I need a panel like SplitLayoutPanel, but with the following features: - Some friendly way to hide and show a side panel (in my application, the West panel), such as a hide/show button. - Disable live resizing of the panels while the user drags the splitter---that is, when the user clicks on the splitter and moves the mouse, a semi-transparent line should appear and move with the mouse, and the actual panels should only resize when the user releases the mouse, but not during the dragging. (I need this because the size and nature of the content in my panels makes live resizing sluggish.) I expect the easiest way to do this is to subclass DockLayoutPanel, reusing what I can from SplitLayoutPanel. (SplitLayoutPanel itself is a subclass of DockLayoutPanel.) If anyone has any experience doing something similar, or has any suggestions or code samples for this, I'd really appreciate it. (I know such functionality is available with ext GWT and SmartGWT, but I'm not sure I'm ready to commit to a heavyweight JS framework---my app is quite light with plain GWT, which provides enough functionality in most cases.) Many thanks in advance! Greetings, Andrew -- 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. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.