Reputation: 7694
I've just started learning UiBinder approach and having a stupid problem with g:Anchor
. Whenever I construct Anchor
directly from Java code, it's displayed as a "normal link", so it's blue, underlined and when I move mouse pointer to it, it gets switched from I-Beam to normal arrow.
When I use UiBinder and define my UI like this:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<g:Anchor ui:field="anchor" />
</ui:UiBinder>
The result I get is a blue text, but it's neither underlined nor mouse pointer becomes normal arrow when I move it to this link. The only solution I've found is
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<g:Anchor ui:field="anchor" href="javascript:;" />
</ui:UiBinder>
Is there a "correct" approach to achieve the same behavior without copypasting that href
attribute everywhere?
Upvotes: 1
Views: 2683
Reputation: 64561
See http://code.google.com/p/google-web-toolkit/issues/detail?id=4502
But the thing is that you shouldn't use an Anchor if you don't have an href
to set on it. If you want something that looks and feels like an anchor but doesn't link to some URL, then use a Label or HTML with the appropriate styling and a ClickHandler
; don't abuse anchors for things that aren't links.
Upvotes: 7