Monday, December 5, 2011

History tokens and vertical menu panel

Hi,
I am building a new application with a vertical panel menu, which
works fine,
but within some pages I have links to other pages ( which is a history
token),
but I need the vertical panel to slide to the correct group.
The links in the page work fine now, but the panel does not slide.
When I click a link from i.e. page1 to page2, the whole page reloads,
but the content is correct
(I also pass a parameter in the string with href='?dep=blah#page2')

I am not sure about the usage of History and fireCurrentHistory, but
without that the inter page links don't seem to work

--
public class GwtTest implements EntryPoint, ValueChangeHandler<String>
{
MenuBuilder mb;
public void onModuleLoad() {
mb = new MenuBuilder();
mb.buildMenuFromXml("Test");
hp = new HTMLPanel("<div id='printWidget'></div><div
id='dateWidget'></div><div id='reportWidget'></div>");
RootPanel.get("appPanel").add(hp);
DoHomePage.render(hp);
History.addValueChangeHandler(this);
if(History.getToken().isEmpty()) {
History.newItem("home");

}
History.fireCurrentHistoryState();
mb.setMenuPanelActive(History.getToken());
}

public void onValueChange(ValueChangeEvent event) {
if(History.getToken().equals("home")) {
hp.clear();
DoHomePage.render(hp);
mb.setMenuPanelActive(History.getToken());
}else if(History.getToken().equals("page1")) {
hp.clear();
DoPage1.render(hp);
mb.setMenuPanelActive(History.getToken());
}else if(History.getToken().equals("page2")) {
hp.clear();
DoPage2.render(hp);
mb.setMenuPanelActive(History.getToken());
}

}

}

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment