GWT:无法从DockLayoutPanel转换为Composite

时间:2011-03-26 14:42:38

标签: gwt uibinder

首先,我理解这意味着什么:DockLayoutPanel不扩展任何反过来扩展Composite的类。我只是不知道如何解决它。

我有一个类Mapmaker2.java,它是我整个应用程序的主要用户界面。基础是DockLayoutPanel,它又包含VerticalPanels,StackLayoutPanels等。由于这是一个MVP应用程序,我不想用uibinder模板标记我的EntryPoint类。

这是java类:

public class MapmakerView2 extends Composite {

@UiTemplate("MapmakerView2.ui.xml")
interface Binder extends UiBinder<Composite, MapmakerView2> {}

private static Binder binder = GWT.create(Binder.class);

@UiField StackLayoutPanel interfaceStack;

public MapmakerView2() {

    initWidget(binder.createAndBindUi(this));
}
}

这是uibinder模板:

 <ui:UiBinder> <!-- snipped out xmlns stuff -->
<g:DockLayoutPanel unit="PX">
    <g:north size="100">
        <g:VerticalPanel>
            <!-- Logo -->
            <!-- Login Link -->
        </g:VerticalPanel>
    </g:north>
    <g:west size="150">
        <g:StackLayoutPanel ui:field="interfaceStack" styleName="{style.shortcuts}" unit="PX">
            <g:stack>
                <g:header size="10">
                    <b>Features</b>
                </g:header>
                <mapmaker:FeaturesForm/>
            </g:stack>
            <g:stack size="10">
                <g:header  size="10">
                    <b>Export</b>
                </g:header>
                <mapmaker:ExportForm/>
            </g:stack>
            <g:stack>
                <g:header size="10">
                    <b>Admin</b>
                </g:header>
                <mapmaker:AdminForm/>
            </g:stack>
            <g:stack>
                <g:header size="10">
                    <b>Help</b>
                </g:header>
                <mapmaker:HelpForm/>
            </g:stack>
        </g:StackLayoutPanel>
    </g:west>
    <g:center>
        <!-- Display Map Here -->
        <mapmaker:MapBox/>
    </g:center>
    <g:south size="100">
        <!-- Display i18n disclaimer stuff here -->
        <mapmaker:Disclaimer/>
    </g:south>
</g:DockLayoutPanel>
</ui:UiBinder>

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:2)

只需替换

interface Binder extends UiBinder<Composite, MapmakerView2> {}

interface Binder extends UiBinder<Widget, MapmakerView2> {}

interface Binder extends UiBinder<DockLayoutPanel, MapmakerView2> {}