I'm trying to fully understand Navigation in Vaadin 7. I read the Navigator Chapter in the Vaadin book but still have some practical questions.
Basically it is about using the bang (!). When do I need to set it and why?
- There is a view (myview)
- There is a parameter (param=X)
- The parameter is identifying a displayed label
Example for browser history:
I need to set the bang (!) or clicking back in the browser does not work, because the parameters is not passed the the views enter function:
private void showInfo(String info) {
infoLabel.setValue(info);
Page.getCurrent().setUriFragment("!" + "myview/param=" + info, false);
}
Example for navigation after button click:
I must not set the bang (!) or else the url fragment changes to "#!myview//param=X" (contains double /)
@Override
public void buttonClick(ClickEvent event) {
getUI().getNavigator().navigateTo("myview/param=X")
}
Am I mixing two concepts here or is there a utility that does that for me and I'm not knowing it? Or do I just have to know about these 2 cases and decide about the bang myself?
Thanks