Add id to field with ui:field declaration

前端 未结 3 1264
面向向阳花
面向向阳花 2021-02-05 18:00

I\'m trying to declare these elements in my UiBinder XML:




        
3条回答
  •  无人共我
    2021-02-05 18:37

    You may simplify Thomas' answer (a bit) by accessing the id in uibinder like this:

    TextBox
    
    
    // In code behind:
    @UiField(provided = true)
    TextBox testTextBox = new TextBox();
    ...
    testTextBox.setId("test");
    this.initWidget(uiBinder.createAndBindUi(this));
    

    If you use GWT Bootstrap there is a handy feature that let's you wire up everything in xml only:

    TextBox
    
    

提交回复
热议问题