How to replace element with my GWT widget?

后端 未结 5 454
慢半拍i
慢半拍i 2021-02-02 01:46

Is it possible to replace known html element with my widget component? (Emphasis on the word \'replace\', I don\'t want to put the widget in th

5条回答
  •  清酒与你
    2021-02-02 02:10

    The solution is probably not so much different from what Igor suggested. I'd write something like this:

    RootPanel rootPanel = RootPanel.get();
    Element anchorElement = DOM.getElementById("tmpEl");
    Anchor anchor = Anchor.wrap(anchorElement);
    
    rootPanel.remove(anchor);
    rootPanel.insert(new HTML("
    ...
    ", 0);

提交回复
热议问题