Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gwt custom widget with child elements configuration in UIBinder (like CustomButton)

Tags:

gwt

uibinder

I've faced with a task to create custom widget, it has container behavior -- 3 panels inside. And i would like to use it in general UIBinder way like CustomButton

 <u:MyWidget>
   <u:image><g:Image .../></u:image>
   <u:mainContent><g:Panel.../></u:mainContent>
 </u:MyWinget>

Is it possible to define that custom child elements somehow or maybe it is predefined thing in the UIBuilder?

Thanks in advance

like image 660
zaletniy Avatar asked Dec 04 '11 13:12

zaletniy


1 Answers

Correct way to do it is to use the UiChild annotation.

public class MyWidget extends Composite {
  public MyWidget() {
    // ...
  }

  @UiChild( tagname = "image" )
  void addImage(Image image) {
    // ...
  } 

  @UiChild( tagname = "mainContent" )
  void addMainContent(Widget contentWidget) {
  }
}
like image 100
Strelok Avatar answered Oct 07 '22 23:10

Strelok