【发布时间】:2011-03-16 19:10:55
【问题描述】:
我将“topPanel”UiField 更改为引用 FlowPanel 而不是 SimplePanel。
--但是,当我这样做时,我的“视图”类中原来的“setWidget”方法不再有效。
我可以进行哪些调整(如果可以进行)以使 FlowPanel "@UiField" 能够正确编译和处理?
这里是“视图”类...
public class TopPanel extends Composite implements AcceptsOneWidget
{
-
-
-
//...prev...@UiField
//...prev...SimplePanel topPanel;
//...Trying to make this work...
@UiField
FlowPanel topPanel;
-
-
-
//...how should this method be modified or replaced to allow the FlowPanel "@UiField" to work?....
@Override
public void setWidget(IsWidget w)
{
topPanel.setWidget(w);
}
}
这里是 uiBinder 模板...
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style src="app.css" />
<g:HTMLPanel width="50%" height="50%">
<!-- <g:SimplePanel ui:field="topPanel"> -->
<g:FlowPanel ui:field="topPanel">
<g:Button text="from aaa: go to bbb" ui:field="topButtonA"></g:Button>
<g:Button text="from bbb: go to ccc" ui:field="topButtonB"></g:Button>
<g:Button text="from ccc: go to aaa" ui:field="topButtonC"></g:Button>
</g:FlowPanel>
</g:HTMLPanel>
</ui:UiBinder>
【问题讨论】:
-
您看到的具体异常或错误是什么?
-
"未定义 FlowPanel 类型的 setWidget(IsWidget) 方法"