Search code examples
gwtuibinder

GWT: Cannot Convert From DockLayoutPanel to Composite


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?


Solution

  • Just replace

    interface Binder extends UiBinder<Composite, MapmakerView2> {}
    

    with

    interface Binder extends UiBinder<Widget, MapmakerView2> {}
    

    or

    interface Binder extends UiBinder<DockLayoutPanel, MapmakerView2> {}