Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link-widget GWT - uiBinder

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.

like image 662
user959456 Avatar asked Dec 05 '25 02:12

user959456


2 Answers

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");
like image 71
Sandro Munda Avatar answered Dec 08 '25 01:12

Sandro Munda


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.

like image 32
Deanna Avatar answered Dec 07 '25 23:12

Deanna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!