GXT:UiBinder小部件的新实例 [英] GXT: UiBinder new instance of a Widget
问题描述
我在窗口内有一个TextField表单.用UiBinding创建.在TextField旁边是一个按钮.我想知道当使用UiBinder按下该按钮时是否可以创建一个新的TextField小部件吗?
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?
这就是我所拥有的:
窗口类:
@UiField
TextField text;
@UiField
HorizontalPanel hPanel;
....
@UiHandler("addText")
public void onClick(SelectEvent event){
hPanel.add(text);
}
我的UiBinder文件:
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.
有没有办法在原始文本下方创建一个新的TextField?
Is there a way I can create a new TextField underneath the original?
推荐答案
可能 查看全文