Hey everybody,
I´m new to vaadin and I´m trying to implement a history function with UriFragmentUtility.
I´ve a main window which extends the Window.class.
In my window I´ve:
private UriFragmentUtility fragmentUtility variable.
[indent]
[/indent]this.fragmentUtility = new UriFragmentUtility();
[indent]
[/indent]this.addComponent(this.fragmentUtility);
[indent]
[/indent]this.fragmentUtility.addListener(another Class = Sidemap);
And a function:
public void setNewFragment (String fragment){
[indent]
[/indent]this.fragmentUtility.setFragment(fragment);
}
In the Sidemap class(which is the listener) I implemented the function:
@Override
public void fragmentChanged(FragmentChangedEvent source) {
[indent]
[/indent]System.out.println("Event Fired:" + source.getUriFragmentUtility().getFragment());
}
When I start my application the log says:
And the url does not add the fragment.
I don´t know, why there is a second log with an empty fragment. It seems that my fragment is replaced or deleted immediately.
When I´m calling the fragmentUtility.setFragment method during a button click event, everything works just fine(just one log, and the url changes)!
Where is my mistake? I just want to edit the fragment in my url, when I call my method setnewFragment…
I really hope that somebody can help me.
Greetings Basti