I'm not too experienced, even though I'm using GWT for about 2 years
now. My understanding is that you might want to look into Activities
and Places.
I myself solved this in a different manner. Once the user logs in with
username and password, I verify it (and display a loading-circle
meanwhile) and then I could fire a custom GwtEvent - e.g.
PageSwitchEvent. This PageSwitchEvent contains information regarding
which page to navigate to (read: which widget to display in the place
of the Login-panel).
When I fire this event, I tell him to switch to e.g. the Profile-Page
(a Page is - in my application - a widget, that derives from a
VerticalPanel). My base-class, which creates some basic user
interface, implements a handler for the PageSwitchEvent.
So once the PageSwitchEvent is fired, the handler-method inside my
base-class does this:
// Begin PageSwitchEventHandler methods
@Override
public void onSwitchPage(PageSwitchEvent event) {
ODrop.currentPage = event.getPageToSwitchTo();
// get the
current page
boolean pageAttached =
(this.getPageContainer().getWidgetCount() ==
3) ? true : false; // check whether a page is attached
if (pageAttached) {
this.getPageContainer().remove(this.getPageContainer().getWidget(2));
//
remove the last item, because this is the page
}
this.getPageContainer().add(ODrop.currentPage.getPageContent());
//
attach the new/current page
ODrop.currentPage.load();
// reload the page
}
// End PageSwitchEventHandler methods
It should be noted that my basic UI consists of a HorizontalPanel,
that has 3 cells: a StackPanel on the left, a narrow button in the
middle (which allows the user to show/hide the StackPanel) and a
"maincontent"-cell on the right. This "maincontent"-cell displays the
page currently selected by the user. So whenever I fire a
PageSwitchEvent, the existing Page (widget) is unattached and a new
one (that is passed along with the event and retrieved by
event.getPageToSwitchTo()) is attached. After attaching it, I call the
"load"-method of the newly attached page.
I'm not sure whether this is good (or even bad) practice, but it works
for me.
Igor.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.