【问题标题】:tablayoutpanel is not showing properlytablayoutpanel 显示不正确
【发布时间】:2012-07-02 11:37:28
【问题描述】:

我正在使用普通的 GWT 并尝试在弹出面板中显示 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());
}

}

【问题讨论】:

    标签: gwt


    【解决方案1】:

    尝试将TabLayoutPanel 包装在ResizeLayoutPanel 而不是HTMLPanel 中,或者为HTMLPanel 指定明确的尺寸

    【讨论】:

    • 谢谢。我将TabLayoutPanel 包裹在FlowPanel 中,但它不起作用,直到我意识到我应该使用ResizeLayoutPanel 来代替。
    猜你喜欢
    • 1970-01-01
    • 2013-05-13
    • 1970-01-01
    • 2020-10-30
    • 2018-06-11
    • 2015-05-06
    • 2012-09-02
    • 2013-07-05
    相关资源
    最近更新 更多