multiple modules in GWT - gwt

I know there are many questions concerning this topic but after reading them all I'm even more confused.
I have an application that manages contacts. There are three pages:
Add contact
Show contacts
Modify contact
And now I have no idea what structure to give to my project: should I create three different modules? if so, what would be the best package structure? and how would I call other modules within a page? for example, from the 'add contact' page there should be a button to the 'show contacts' page, and from this one there should be button/links to 'modify contact' and 'add contact'.
would it be enough to add this line to the corresponding buttons event handlers?
Window.Location.assign("showcontacts.html");
(or just create a link to "showcontacts.html" if it's the case)?

GWT is not suited for applications with multiple pages. What you can do is
create a page with multiple div's. Create the links on the top of the page. When any of the link is clicked you can then show or hide divs as per your need. This is how I had done it for a different app.
Hope that helps

To allow multiple pages to be selectively displayed within a single module, I use one of two techniques:
use a SimplePanel or one of its
derivatives (e.g. LazyPanel,
ScrollPanel).Use setWidget to change
the page. Each "page" is a widget.
For example, I am doing a project
with a menubar. When "Home" menuitem
is clicked, the menu command
replaces the body of the simplepanel
by setting its widget to the Home
widget. Likewise for login, etc
menuitems.
A SimplePanel allows only one widget.
Therefore, you do not addWidget to it but setWidget to it.
use tab. Either TabLayoutPanel or
TabPanel. I prefer using the
TabLayoutPanel. You have to meticulously
set/design the CSS for TabLayoutPanel, otherwise
you would only see a blob of text hanging around.
I also try to encapsulate a "page" widget in a lazypanel (which is a derivative of a simple panel. That will prevent instantiation of any pages that may not be used in a module with a large number of "pages".
GWT is indeed suitable for ui presentation with multiple pages. In fact, one of the advantages of GWT over JSP is that you can change a page without a browser refresh/fetch flicker - one of the extremely strong reasons why you would want to use GWT for a web app with multiple pages.

Seems that GWT MVP framework suits your needs:
http://code.google.com/webtoolkit/articles/mvp-architecture.html

Related

Setup a notebook with tabs and multiple gtk input fields on each tab using glade

I am an experienced Fortran programmer and have used an in-house UI package for many years with similar concepts to that of glade (3.22). I'm completely new to glade so I must be doing something bad due to a lack of understanding. My glade setup only uses gtkWindow and a gtkNotebook with some child tabs. All I want to do is add multiple fields (boxes and labels mostly) to a tab which covers the complete window area. Then when I switch tabs, I need to see a completely different page with it's own fields, also using the complete window area. Adding just one gtkButton takes up the whole page for the current tab and I cannot add another gtkbutton to that page. How do I add another button to the same page? If this is a stupid question, are there any good videos that demonstrate how to do it please? :)
You can use the option Edit Page from General to edit each of the pages in the glade.
You can change this value, and edit pages one by one, like add some box/grid then add buttons/label.
For adding new pages, right-click on one page and select 'insert page after' or 'insert page before'
download the glade file from there: https://github.com/f4iteightiz/UWR_simulator
edit / look at (this is a notebook with several inputs / buttons all different in each tabs).
you will find few answers to your needs
You have to add a GtkBox or a GtkGrid to your notebook tab. And here you can read a bit on the difference between a box and a grid. There are of course a lot of other containers you could use to pack your widgets (in your case a button) into. Gtk3 only allows one widget per notebook page, so you have to add a multi-child widget to pack multiple widgets per page.

setting tab index for nested forms and canvas in smartgwt

I have a smart gwt application which includes VLayouts, HLayouts, DynamicForms, Canvas, etc in a nested fashion.
One form comes inside of another in many places across the application.
But the tab order (Navigation using Tab and Shift+Tab) is behaving in a random order in many places.
Can anyone provide some suggestions for overall archetecture of the application?
For example
Which method should be used vLaout.addMember(myPanel) or
vLayout.addChild(myPanel)?
How to properly nest the components?
should globalTabIndex be used ?
If two forms are added to a VLaoyout, how can I specify the TabIndex to specify which form's components should be focused first ?
I didnt find any proper documentaion in smartgwt website. Please help me. Any kind of suggestions will be helpful.
addMember(Widget widget) shall be used - at least in most cases.
Organize them in logical panels (all components of a form in a form container, all the forms in a layout container and all the layout containers in higher order layout containers)
Depends on your case. You are not very clear on what you want to achieve with it.
DynamicForm is a Canvas. Use focus() at the form you want to be shown firstly focused to the user.
The http://www.smartclient.com/smartgwt/javadoc if very useful to find out about the objects supported methods and actions.

Dynamically add tabs in Tablayoutpanle using UIBinder

To be clear i'm a newbie to GWT.I was looking around for samples to implement dynamic tabs, and found this link, http://www.java2s.com/Code/Java/GWT/AddingnewtabdynamicallyExtGWT.htm , in which they make use of GXT.But my question is,how can i implement dynamic views using UIBinder?.I want to implement something similar to browser tabs.Each newly created tab has a split panel view, whose content will be populated making a rpc request.My question is , how is the history mechanism handled when user switches between tabs?.Can anyone provide with samples?Thanks
You declare your TabLayoutPanel together with the initial/default tabs in UiBinder. Then you can add or remove tabs from this panel in your Java code.

Implement header, footer and menubar in Google Web Toolkit (GWT)

I just started learning Google Web Toolkit (GWT). How do I implement header, left navigation bar and footer in my GWT application?
How can i place the header and footer in one page and reuse the same in all other pages?
Please help me how can i achieve the above requirement?
I like using SplitLayoutPanel. Here you will basically only change the center panel and leave northe west etc alone.
You can find a very good overview here.
You can create a template in Ui:Binder with your basic layout, and use this template for all new pages.
Another option is to create a custom widget for you menu, header and footer. Then you again can use a template for new pages, but instead of including each button, label, etc., you just include your custom headerWidget, footerWidget and menuWidget.
As others already suggested, you use one of the LayoutPanels to organize your page. My favorite is LayoutPanel. You add your headerWidget, footerWidget, and menuWidget to this LayoutPanel and specify their position.
I recommend that you use a Ui:Binder for this: it's a more convenient way to do layouts, it's very visual (helps to cut on the number of mistakes), and much easier to maintain.

How to change only one widget and leave the others the same with GWT's built in MVP-framework?

I'm just getting started using the built in MVP framework in GWT 2.1 and I have, what I think, a very simple question.
When I read the official tutorial here or look at the gwt-plattform example here, one view always replaces another view.
But what if I want to have a specific widget on all my "pages".
As an example you can take the bar at the top of this page, with the StackExchange-logo, your user name and so on. That bar is the same on all pages you can visit, whether you look at a question or a user profile.
How would I get something similar with the MVP-framework?
Instead of using the RootPanel as the Activities' container, lay your header panel and SimplePanel inside the RootPanel and use the SimplePanel for your Activities.