0

我正在编写 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.

有人知道这个问题的解决方案吗?

4

1 回答 1

4

g:center只接受一个子元素。尝试将 CaptionPanel 包装在一个符合您需求的容器中,例如 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>
于 2013-08-22T10:04:26.353 回答