i'm just learning GWT MVP design pattern for weeks. now, i'd like to use this design pattern on a large web application. this application is a web ordering system wherein it has a login page and a main page. in the main page, it has buttons and a TabLayoutPanel wherein each tab contains the web ordering step - Tab1: select item(s) Tab2: view cart Tab3: post order.
Each tab has lots of widgets that manipulates the ordering process. now, i need to ask your idea on
how to properly separate each tab manipulation which follows the MVP pattern?
You question is not a black or white one. It depends on what the logical units of the problem are and how much interaction is on each tab. If the tabs are the main navigation between logical units of your application, I would say have a presenter for each tab (which also means an activity mapper for that area) - There would also be an presenter activity mapper for the non tabbed regions of your app also. But if each tab is just aspects of the process, then it may all logically fit in an overall presenter. Given what you said about the process, that it is kind of like a order wizard, I would tend to go with one presenter for the whole tabbed area where the presenter contained all the ordering knowledge and knew which step it was on.
Related
I have a page with an AjaxTabbedPanel with lots of tabs with content like charts, reports, etc., whose content is quite expensive to produce. Most users spend most of their time on the first panel and don't need to venture to the tabs with charts, reports etc.,
To avoid unnecessary work on the back end and provide a faster initial page render I thought it would be advantageous to avoid doing the work to populate a tab's contents until (and only if) the user clicks on a tab to activate and thus render that tab's content.
Of course the first tab will always load during initial page load as that is the one that is active by default but the other tabs' contents will lay dormant until the user clicks on the corresponding tab, avoiding doing any work for those dormant panels until necessary.
Is that possible?
I thought that I could possibly employ the AjaxLazyLoadedPanel but it seems to be designed for a different purpose and the lazy loaded panel is regularly polled until it is 'ready' but that's not what I need in my case: there's no need for polling, we will know when to render a panel's content i.e. when activation of the panel occurs.
TabbedPanel does not need a tab's content as long at is isn't shown.
Make sure that you implement ITab#getPanel() 'lazy', i.e. the panel is created only when that method is called the first time. See PanelCachingTab for inspiration.
Im developing a GTK+ 3 application that should be able to display multiple files in tabs. But a GtkNotebook widget is not suitable for this, as it implies a functionality where every single page is a separate container. In the case of my application I just need some sort of tab bar to connect to application's logic, which will then change the data displayed by the ever same set of widgets.
How can this be achieved without ugly workarounds?
I'm creating a web-site using GWT for the first time. The aplication has two Composite class, one of them is a menu and the other one is where I show de info about the specific menu that has been clicked. I'm using MVP, the class History and the interface ChangeValueHandler to switch among different pages.
I have one pair presenter-view for each Composite. The app begins well creating the menu and the section info. When you click in the menu it works fine showing the information and the token browser is changed. The thing is that if you load a page(eg: myapp.com#register) without loading the home page, it doesn't show you the menu. It loads the Composite section info, but not the Composite menu (the Composite menu is load with myapp.com#home).
I think it's because of a bad design of the application, but I don't know how to do that in other way. If the app only had one Composite it wouldn't be a problem, but when there are 2 or more Composite per page I don't know how to manage the whole thing to work properly.
It's difficult to tell what exactly is wrong, because of the lack of code. So I'm guessing. You should design to act on the PlaceChangeEvent instead of the ValueChangeEvent. That means a menu click should fire the place change and then the application will handle this event. That way you unbind the menu actions from your content pages. And think more of each page as a separate entity. Also take a look at the GWT Activity mechanism and how it helps having a main page that is always the same and on that main page a content area that changes depending on the page actually shown.
You should include your menu in each page instead of creating it once in the home page and then keeping it on screen. I assume you create the menu and add it to the DOM via
RootPanel.get().add(myMenuWidget);
If you are using UIBinder it should be pretty straightforward to include the menu in each page, just a matter of adding the corresponding tag in each .ui.xml file of your pages.
I am creating an Application which will be a Tab based application having separate pages for each Tab. I want use RibbonTab as the Tab.
On selecting one RibbonTab corresponding UserControl will be loaded in the below section.
Each RibbonTab and each UserControl should behave like a pair.
First Challenge - It would be easy to use single ViewModel for each RibbonTab-UserControl pair. But how to share single ViewwModel in to separate view.
Second Challenge - What is best way to implement this application
One Ribbontab and One UserControl is already ready. Waiting for how to associate those two.
I'm not clear on the First challenge could you elaborate it please and I'll edit the answer.
As for the second challenge I highly recomend choosing a framework as that will make implementing MVVM a little easier Framework Comparison
I use a ContentControl and ResourceDictionary to determine what view to display based on the bound ViewModel as in this example. That technique could be used for the tab control as well here are a couple links on how to implement this:
Microsoft Tab Controled application Tutorial
Tab Control Binding
I'm trying to use the GWT Activity & Place model, but I'm having some
troubles with it about how to use my activities.
I've got a LoginActivity which drives the user to another activity :
DemandsActivity.
My DemandsActivity manages a view ("DemandsView") which displays a
simple list of demands (with a CellTable).
The whole works fine.
I would like to be able to show the details of a demand, from a
selected line of my cellTable, by displaying
a DialogBox with the informations.
I thought I could use one more
activity to do that : DemandDetailsActivity.
But I don't know how to do that.
Or I've been wrong from the beginning. Maybe should I put several presenters (displays) into my activity ? One presenter to display my CellTable, and another one to display a selected element of my CellTable in a DialogBox, without changing Place ?
What do you think of that ?
Thanks
What you are trying to do is called master-detail view. People have been implementing it with GWT, just google around.
On a side note: in MVP parlance Activities are presenters and Views are displays, so when you say put several presenters (displays) into my activity it really makes no sense.
Presenters should correspond to a place and handle business logic. They should not be concerned with the display part. And they should be testable, which means they should run on desktop/server JRE without GWT client dependencies.
So, all the GUI building part should be inside Views. And, yes, you could have multiple Views per Activity if this makes sense. BUt, personally, I'd go with one View that shows details (possibly dialog) when Activity instructs it to.
You should normally have a one to one relationship between Places and Activities but you may have many Views per a given Activity. In the project I'm currently working on we create an interface per Presenter and its associated View and then have our Activities implement any Presenters for the Views it needs to display.