Reputation: 575
I want to use a link or a button like (a href="..."/>) in GWT with uiBinder.
I found the widget "hyperlink" but I don´t know how I use that.
Upvotes: 3
Views: 6420
Reputation: 696
Unless you need to programatically do things with the anchor, you can just add the html into the uibinder code directly. In fact, UIBinder is not just a WYSIWYG, but it is a place for you to enter as much native HTML as you can. That makes for leaner and faster web apps.
Upvotes: 2
Reputation: 41030
You should use the Anchor widget.
You can use a sample ClickHandler on it to detect the click event or use the default href with the constructor :
Anchor(boolean useDefaultHref)
You can also use the setter setHref(java.lang.String href)
In UiBinder :
<g:Anchor ui:field="mylink" href="/myurl">The link test</g:Anchor>
EDIT :
To open the link in a new tab, you should use the setTarget(String target) method like the following example :
setTarget("_blank");
Upvotes: 8