GWT Popup和UIBinder:面板还是DialogBox?

use*_*722 3 gwt uibinder

我有一个要求,当点击一个按钮时,应该提示用户弹出/对话框输入一些额外的细节,如姓氏,DOB等.我试图玩,window.confirm()但我认为这不适合我目的.有人可以帮助我如何通过UIBinder在GWT中实现这一目标吗?

我在UI binder.xml中试过这样的东西

<g:HTMLPanel visible="false" >
                                    <g:DialogBox ui:field="dialogPanel"
                                        animationEnabled="true" modal="false" glassEnabled="false">
                                        <g:caption>More Details</g:caption>
                                        <table>
                                            <tr>
                                                <td colspan="2" align="center">
                                                    <g:Datepicker ui:field="DOB">DOB:</g:Datepicker>
                                                </td>
                                            </tr>

                                            <tr>
                                                <td>UserName:</td>
                                                <td>
                                                    <g:TextBox ui:field="usernameTextBox" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td></td>
                                                <td align="right">
                                                    <g:Button ui:field="loginButton">OK</g:Button>
                                                </td>
                                            </tr>
                                        </table>
                                    </g:DialogBox>
                                </g:HTMLPanel>
Run Code Online (Sandbox Code Playgroud)

我不确定要使用哪一个:弹出窗口或对话框!

谢谢.

kro*_*oiz 11

这是使用uibinder的GWT对话框的框架:

MyDialogBox.java

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Widget;

public class MyDialogBox extends DialogBox {
    private static final Binder binder = GWT.create(Binder.class);
    interface Binder extends UiBinder<Widget, MyDialogBox> {
    }
    public MyDialogBox() {
        setWidget(binder.createAndBindUi(this));
        setAutoHideEnabled(true);
        setText("My Title");
        setGlassEnabled(true);
         center();
    } 
}
Run Code Online (Sandbox Code Playgroud)

MyDialog.ui.xml

<!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>
        .panel {
            background-color: ivory;
        }
    </ui:style>
    <g:FlowPanel styleName="{style.panel}">
    <g:Label>Dialog Content</g:Label>
    </g:FlowPanel>
    </ui:UiBinder>
Run Code Online (Sandbox Code Playgroud)

用它来表明:

MyDialogBox m = new MyDialogBox();
m.show();
Run Code Online (Sandbox Code Playgroud)