GWT UIBinder Tab panel

lalit picture lalit · Sep 21, 2010 · Viewed 9.5k times · Source

I want to put some anchor inside the body of tab panel with two tabs. But my anchors are not visible. The code is as follows

<g:TabLayoutPanel ui:field="lhsTabPanel" barUnit="PX" barHeight="60">
    <g:tab>
        <g:header>Analysis</g:header>
        <g:FlowPanel>
        <g:Anchor ui:field='personalInformation'>Personal Information</g:Anchor>
        </g:FlowPanel>
    </g:tab>
    <g:tab>
        <g:header>Comparison</g:header>
        <g:FlowPanel  ui:field="comparisonContent"/>                    
    </g:tab>                        
</g:TabLayoutPanel> 

The personal information tab is not visible

Answer

Riley Lark picture Riley Lark · Sep 22, 2010

TabLayoutPanels must be added to other widgets that implement ProvidesResize. For example, if you are adding this TabLayoutPanel to RootPanel instead of RootLayoutPanel, you won't be able to see the TabLayoutPanel because RootPanel does not implement ProvidesResize.

You can't see the contents of the tabs because the TabLayoutPanel does not know how big it should be. Try adding it to some descendant of a LayoutPanel and setting its size explicitly with the setWidgetLeftRight and related functions.

Check out http://code.google.com/webtoolkit/doc/latest/DevGuideUiPanels.html#LayoutPanels for more information.