I need to manage a Hyperlink object in GWT. What i need is :
1 - add it into a span (like InlineLabel)
I tried Hyperlink affitta_3_span_1=new Hyperlink(result.get(i)[0], "");
, but it create somethings like this :
<div class="affitta_3_span_1">
<a href="#">t1</a>
</div>
in fact i need this :
<span class="affitta_3_span_1">
<a href="#">t1</a>
</span>
2 - manage Hyperlink History token
I put my internal links such Hyperlink affitta_3_span_1=new Hyperlink(result.get(i)[1], "article/"+result.get(i)[0])
but i don't know how to get the parameter on token when they call the onValueChange() function. How can I do it?
Cheers
Use an Anchor
. The output is just an <a>
tag that has no <div>
or <span>
around it, but if you need a <span>
you can add it with an HTML panel.
To set a URL that history can access, just put a #
at the beginning. Something like
myAnchor.setText(result.get(i)[1]);
myAnchor.setUrl("#article/"+result.get(i)[0]);
Now, when you click myAnchor, onValueChange will be passed the token "article/whatever". The unfortunate side effect is that your urls look like http://example.com/#article/whatever, but that's the only way to get the token to the History object with just GWT.