GXT: UiBinder new instance of a Widget

南楼画角 提交于 2019-12-11 19:52:14

问题


I have a TextField form inside a window. Created with UiBinding. Next to the TextField is a button. I wanted to know if it was possible to create a new TextField widget when that button was pressed using UiBinder?

This is what I have:

Window class:

@UiField
TextField text;

@UiField
HorizontalPanel hPanel;
....
@UiHandler("addText")
public void onClick(SelectEvent event){
      hPanel.add(text);
}

My UiBinder file:

<gxt:Window ...(generic setup)...>
 <g:VerticalPanel>
  <gxt:FramedPanel>
   <container:VericalLayoutContainer>
    <container:child>
     <g:HorizontalPanel ui:field="hPanel">
      <form:FieldLabel text="Text">
       <form:Widget>
        <form:TextField ui:field="text"/>
       </form:Widget>
      </form:FieldLabel>
      <button:TextButton ui:field="addText"/>
     </g:HorizontalPanel>
    </container:child>
   </container:VericalLayoutContainer>
  </gxt:FramedPanel>
 </g:VerticalPanel>
</gxt:Window>

When I click the button it all it does is move the button from the right side of the text field to the left. I have more textfields in the window so I played around to see what it was really doing. It's taking that field and just moving it next to the button.

Is there a way I can create a new TextField underneath the original?


回答1:


Probably LazyDomElement will help you.



来源:https://stackoverflow.com/questions/11020042/gxt-uibinder-new-instance-of-a-widget

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!