The GWT Class Anchor has the method Anchor.wrap()
which allows me to wrap an already existing HTML element. The issue is Anchor doesn't keep track of AJAX history and as such I'm using Hyperlink class, but this one doesn't have the wrap() method.
Thus, what is the best way using gwt to make an existing html <a href>
an Hyperlink if it doesn't have wrap()?
Please don't tell me implement the history behavior in Anchor click.
Hyperlink has a constructor that takes an Element as parameter. The catch is that this constructor is protected. A workaround would be to create a subclass to access the protected constructor, e.g.:
class MyHyperlink extends Hyperlink {
public MyHyperlink(Element element) {
super(element);
}
}
I did not actually try this, it's just an idea.