Alternative to UriFragmentUtil

After many tries and fails I have almost given up on UriFragmentUtil to change the URL fragment in the browser. Am I correct in thinking this will allow the back button to work?

I am using a viewManager which calls setContent on the main window which I thought might be replacing the mainWindow’s panel that the fragUtil is attached to. So I added a layout that doesn’t change to the window and setContent on the panel only, still no URI change. Any idea why my URI never changes?

I have attached the uriFragUtil to the main window, and also to a constant panel inside the window and neither works. I am injecting session scoped dependencies through Spring.

ViewManager…

public class ViewManager implements Serializable {
	private static final long serialVersionUID = -7726916144162039243L;
    HashMap<String, Layout> views = new HashMap<String, Layout>();
    Stack<Layout> screenStack = new Stack<Layout>();
    Panel mainPanel;
   
    public ViewManager (Panel panel) {
        this.mainPanel = panel;
    }
   
    public void init () {
    }
   
    /**
     * Switches content on a panel, can be used on Window or Panel.
      */
    public void switchScreen(Layout newView) {
        mainPanel.setContent(newView);
        mainPanel.requestRepaint();
    }
}

From Application…


ViewManager viewManager;
	// The URI fragment utility
    final UriFragmentUtility uriFragUtil = new UriFragmentUtility();
    Panel mainLayout = new Panel();
        
	@Override
	public void init() {
		setTheme("runo");
		setMainWindow(mainWindow);	
		
		mainWindow.addComponent(navigationMenuBar.getMenuBar());
		mainWindow.addComponent(mainLayout);		
	    mainLayout.addComponent(uriFragUtil);	    
		// Don't need viewManager from Spring, make a new one per session
		viewManager = new ViewManager(mainLayout);		
		switchScreen(ScreenType.LOGIN_SCREEN);
	}

        public void switchScreen(ScreenType screen) {
		uriFragUtil.setFragment(screen.getUriParameter(), true);
        viewManager.switchScreen(screen.getLayou());
        }