开发者

MVP - What adjustment must be made to enable a "UiField FlowPanel" to work (rather than "UiField SimplePanel"?

I changed my "topPanel" UiField to refer to a FlowPanel rather than a SimplePanel.

--But, when I do this, the original "setWidget" method in my "View" class is no longer valid.

What adjustment (--if any can be made) can I make to allow the FlowPanel "@UiField" to be compile and process correctly?

Here is the "View" Class...

    public class TopPanel extends Composite implements AcceptsOneWidget 
    {
    -
    -
    -
    //...prev...@UiField
    //...prev...SimplePanel topPanel;

    //...Trying to make this work...
    @UiField
    FlowPanel topPanel;    
    -
    -
    -
    //...how should this method be modified or replaced to allow the FlowPanel "@UiField" to work?....
    @Override
    public void setW开发者_运维问答idget(IsWidget w)
    {
        topPanel.setWidget(w);
    }    
}

Here is the uiBinder template...

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui">
    <ui:style src="app.css" />
    <g:HTMLPanel width="50%" height="50%">
        <!--  <g:SimplePanel ui:field="topPanel"> -->   
        <g:FlowPanel ui:field="topPanel">
            <g:Button text="from aaa: go to bbb" ui:field="topButtonA"></g:Button>
            <g:Button text="from bbb: go to ccc" ui:field="topButtonB"></g:Button>
            <g:Button text="from ccc: go to aaa" ui:field="topButtonC"></g:Button>
        </g:FlowPanel>
    </g:HTMLPanel>
</ui:UiBinder>


try:

topPanel.insert(w,0)

instead of

topPanel.setWidget(w)


If you want to add the widget below/after the buttons contained in the topPanel, you should use:

topPanel.add(w)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜