Your question is not exactly clear, but I'm pretty sure you shouldn't need
to add click handlers to a Hyperlink object, or create entries in the
History object yourself. Just construct it with the Token you want to go
to:
Hyperlink h = new Hyperlink("Navigate to Chemical", thePlaceToken);
And you shouldn't be building the token yourself. Thats whats Places are
for. Once you've got your parsing/splitting of parameters working correctly
(as I'm sure you have by this time. ) you should be constructing Places
like this:
ChemicalPlace newPlace = new ChemicalPlace(2105, "Chemical", 1 );
Now, newPlace.getToken() should return something like:
"&id=2105&tabName=Chemical&Page=1"
Thats not quite the *full* place URL that you need to pass to Hyperlink
however, to get that you should use your PlaceHistoryMapper, this will
prepend the PlaceName and the seperator to the token the place object
returns.
String thePlaceToken = MyPlaceHistoryMapper.getToken(newPlace); // Will
return 'ChemicalPlace:&id=2105&tabName=Chemical&Page=1'
...
Hyperlink link = new Hyperlink("Navigate to Chemical", thePlaceToken);
On Mon, Oct 17, 2011 at 7:07 PM, Rohan Aggarwal <
[email protected]> wrote:
> Hyperlink hyper = new Hyperlink();
> hyper.setHTML("Navigate to Chemical");
> hyper.addClickHandler(new ClickHandler() {
>
> @Override
> public void onClick(ClickEvent event) {
> PlaceController control = new PlaceController(eventBus);
> String token = "&id=2105&tabName=Chemical&Page=1";
> ChemicalPlace dh = new ChemicalPlace(token);
> control.goTo(dh);
> History.newItem(token);
> // event.preventDefault();
>
> }
>
> });
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.