2012-07-02 42 views
2

我正在使用普通的GWT並試圖在popip面板中顯示tablayoutpanel,但是當我顯示彈出式面板時佈局完全搞砸了,我不知道是什麼問題。如果有人能告訴我這個鱈魚有什麼問題。tablayoutpanel顯示不正確

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' 
xmlns:g='urn:import:com.google.gwt.user.client.ui' 
ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat' 
ui:generateKeys='com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator' 
ui:generateLocales='default'> 

<ui:style> 
    .tabPanelExample1 
    { 
     margin: 10px; 
    } 
    </ui:style> 

<!-- Defining constant variable for using VRS internationalisation messages --> 
<ui:with field='constants' type='com.vermilionsoftware.vrsgwtp.client.VRSGWTConstants'/> 

<g:DialogBox width="800" height="600"> 
    <g:HTMLPanel> 
     <g:TabLayoutPanel ui:field="tabPanel" barUnit="PX" 
      barHeight="60" width="375px" height="150px"> 
      <g:tab> 
       <g:header> 
        UiBinder Tab 1 
       </g:header> 
       <g:HTML> 
        Hello tab 1 
        <br /> 
        Good bye! 
       </g:HTML> 
      </g:tab> 
      <g:tab> 
       <g:header> 
        UiBinder Tab 2 
       </g:header> 
       <g:HTML> 
        <h2>Hello tab 2</h2> 
       </g:HTML> 
      </g:tab> 
      <g:tab> 
       <g:header> 
        UiBinder Tab 3 
       </g:header> 
       <g:HTML> 
        <strong> 
         <i> 
          <u>Hello tab number 3</u> 
         </i> 
        </strong> 
       </g:HTML> 
      </g:tab> 
     </g:TabLayoutPanel> 
    </g:HTMLPanel> 
</g:DialogBox> 

MyView的類是:

public class ColourSelectorView extends PopupViewWithUiHandlers<ReportLayoutUiHandlers> implements ColourSelectorPresenter.MyView { 

private final Widget widget; 
private static ColourSelectorViewUIBinder uiBinder = GWT.create(ColourSelectorViewUIBinder.class); 

public interface ColourSelectorViewUIBinder extends UiBinder<Widget, ColourSelectorView> { 
} 

@Inject 
public ColourSelectorView(EventBus eventBus) { 
super(eventBus); 
widget = uiBinder.createAndBindUi(this); 
} 

@Override 
public Widget asWidget() { 
    return widget; 
} 

}

,我的演講是:

public class ColourSelectorPresenter extends 
    PresenterWidget<ColourSelectorPresenter.MyView> { 

public interface MyView extends PopupView { 
    // TODO Put your view methods here 
} 

@Inject 
public ColourSelectorPresenter(final EventBus eventBus, final MyView view) { 
    super(eventBus, view); 
} 

@Override 
protected void onBind() { 
    super.onBind(); 
} 

@Override 
protected void onReveal() { 
    super.onReveal(); 

    Window.alert(this.getWidget().getElement().getInnerHTML()); 
} 

}

回答

2

嘗試包在ResizeLayoutPanel而不是HTMLPanelTabLayoutPanel或爲HTMLPanel

+0

由於指定明確的尺寸。我正在將'TabLayoutPanel'封裝在'FlowPanel'中,並且它不工作,直到我意識到我應該使用'ResizeLayoutPanel'。 – Marcelo