On 3 oct, 17:24, Brian <
hibr...@gmail.com> wrote:
> Tricky, but doesn't quite work in my attempts.
>
> Both HTMLPanel.add() and HTMLPanel.addAndReplaceElement() puts a
> newline before the link, so I end up with:
>
> blah blah
> link
> blah blah
>
> instead of: blah blah link blah blah
>
> I'm putting the HTMLPanel in a FlexTable's cell.
It has nothing to do with the HTMLPanel actually, but a problem with
the Hyperlink widget: it's made up of a DIV wrapping an A, that's this
DIV wrapper that's causing the line breaks, because a DIV is
display:block by default.
I'd suggest replacing the Hyperlink with an Anchor+ClickListener.
I'd also use a FlowPanel+InlineLabels but it's up to you, the
HTMLPanel should work like a charm too:
FlowPanel container = new FlowPanel();
container.add(new InlineLabel("some text ");
Anchor link = new Anchor("link", "#token");
link.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
History.newItem("token");
DOM.eventGetCurrentEvent().preventDefault();
}
});
container.add(link);
container.add(new InlineLabel(" some more text");
...and/or you could "vote for" (i.e. "star") the issue 2901:
http://code.google.com/p/google-web-toolkit/issues/detail?id=2901