我正在写GWT客户端。
这是我的代码:
<g:center type="g:SingleChildWidgetType">
<g:CaptionPanel captionText="Foreign Data" ui:field="cpForeignData">
<g:ResizeLayoutPanel width="100%" height="100%">
<p2:DataGrid ui:field="dataForeign" width="100%" height="100%" />
</g:ResizeLayoutPanel>
</g:CaptionPanel>
<g:CaptionPanel captionText="Merged Data" ui:field="cpMergedData">
<g:ResizeLayoutPanel width="100%" height="100%">
<p2:DataGrid width="100%" height="100%" ui:field="dataMerged" />
</g:ResizeLayoutPanel>
</g:CaptionPanel>
</g:center>
在第二个字幕面板的开头出现错误:
cvc-complex-type.2.4.d: Invalid content was found starting with element 'g:CaptionPanel'. No child element is expected at this point.
有人知道这个问题的解决方案吗?
最佳答案
g:center仅接受一个子元素。尝试将CaptionPanels包装在一个符合您需求的容器中,例如VerticalPanel:
<g:center type="g:SingleChildWidgetType">
<g:VerticalPanel>
<g:CaptionPanel captionText="Foreign Data" ui:field="cpForeignData">
<g:ResizeLayoutPanel width="100%" height="100%">
<p2:DataGrid ui:field="dataForeign" width="100%" height="100%" />
</g:ResizeLayoutPanel>
</g:CaptionPanel>
<g:CaptionPanel captionText="Merged Data" ui:field="cpMergedData">
<g:ResizeLayoutPanel width="100%" height="100%">
<p2:DataGrid width="100%" height="100%" ui:field="dataMerged" />
</g:ResizeLayoutPanel>
</g:CaptionPanel>
</g:VerticalPanel>
</g:center>