GWT History Mechanism
GWT History mechanism is similar to the Ajax history implementations such as RSH (Really Simple History). Basic idea is to track application internal state in the URL fragment identifier. Main advantages of this mechanism are:
GWT History Syntax
GWT History Tokens
A token is simply a string that the application can parse to return to a particular state. This token will be saved in browser history as a URL fragment (in the location bar, after the "#"), and this fragment is passed back to the application when the user goes back or forward in history, or follows a link.
Example: History token name javatpoint.
GWT History Common Methods
GWT History Example
GWT Hyperlink Widgets
Hyperlinks are convenient to use to incorporate history support into an application. Hyperlink widgets are GWT widgets that look like regular HTML anchors. You can associate a history token with the Hyperlink, and when it is clicked, the history token is automatically added to the browser history stack. The History.newItem(token) step is done automatically.
Handling an onValueChange() callback
The first step of handling the onValueChange() callback method in a ValueChangeHandler is to get the new history token with ValueChangeEvent.getValue() then we will parse the token. Once the token is parsed, we can reset the state of the application.
When the onValueChange() method is invoked, application handles two cases: