GWT:无法从 DockLayoutPanel 转换为 Composite

发布于 2024-10-27 12:17:41 字数 2363 浏览 0 评论 0原文

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

我有一个类 Mapmaker2.java,它是我整个应用程序的主要用户界面。基础是 DockLayoutPanel,它又包含 VerticalPanel、StackLayoutPanel 等。由于这是一个 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>

有人可以帮忙吗?

First, I understand what this means: DockLayoutPanel does not extend any class that in turn extends Composite. I just don't know how to fix it.

I have a class, Mapmaker2.java, which is the primary user interface for my entire application. The base is a DockLayoutPanel, which in turn contains VerticalPanels, StackLayoutPanels, etc. Since this is an MVP application, I'd prefer not to mark up my EntryPoint class with a uibinder template.

Here is the java class:

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));
}
}

And here is the uibinder template:

 <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>

Can anyone assist?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

慕巷 2024-11-03 12:17:41

只需替换

interface Binder extends UiBinder<Composite, MapmakerView2> {}

interface Binder extends UiBinder<Widget, MapmakerView2> {}

interface Binder extends UiBinder<DockLayoutPanel, MapmakerView2> {}

Just replace

interface Binder extends UiBinder<Composite, MapmakerView2> {}

with

interface Binder extends UiBinder<Widget, MapmakerView2> {}

or

interface Binder extends UiBinder<DockLayoutPanel, MapmakerView2> {}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文