问题描述
|
我正在尝试对GWT Mail App进行改造,以自己开发一个用于时间输入的应用程序-我对GWT还是很陌生,并且正在努力做某些事情。
这是我在主页上布置的代码,该页面获取锚定日期的列表,我想弹出一个对话框让用户输入时间。我设计了对话框和锚点,但不知道单击锚点时如何获得弹出窗口。谁能帮忙吗?我正在使用uiBinder来做到这一点。名为\'table \'的flexTable将具有锚点作为列之一。如果我的问题不清楚,请告诉我。与往常一样,非常感谢您的宝贵时间。
<g:DockLayoutPanel styleName=\'{style.outer}\' unit=\'EM\'>
<g:north size=\'8\'>
<g:HorizontalPanel width=\"300\">
<g:Label width=\"200\" styleName=\'{style.labelStyle}\'>Filter by Status : </g:Label>
<g:ListBox ui:field=\'listBox\' width=\"100\"></g:ListBox>
<mail:TimesheetEntryDialog ui:field=\'timesheetEntryDialog\' />
</g:HorizontalPanel>
</g:north>
<g:north size=\'5\'>
<g:VerticalPanel width=\"200\">
<g:Label ui:field=\'numberOfRecords\'></g:Label>
<g:FlexTable ui:field=\'header\' styleName=\'{style.header}\' cellSpacing=\'0\' cellPadding=\'0\'/>
</g:VerticalPanel>
</g:north>
<g:center>
<g:ScrollPanel>
<g:FlexTable ui:field=\'table\' styleName=\'{style.table}\' cellSpacing=\'0\' cellPadding=\'0\' width=\"100\"/>
</g:ScrollPanel>
</g:center>
弹出布局
<g:HTMLPanel width=\'24em\' styleName=\'{style.panel}\'>
<div style=\"width:100%;text-align:center\" class=\'{style.aboutText}\'>
<g:HTML ui:field=\"timesheetText\"></g:HTML>
</div>
<div class=\'{style.buttons}\'>
<g:Button text=\'Submit\' ui:field=\'submitButton\' />
</div>
<div class=\'{style.buttons}\'>
<g:Button text=\'Close\' ui:field=\'closeButton\' />
</div>
解决方法
您的Java文件应如下所示:
public class MyFoo extends Composite {
@UiField Button submitButton;
public MyFoo() {
initWidget(submitButton);
}
@UiHandler(\"submitButton\")
void handleClick(ClickEvent e) {
Label l = new Label(\"I am a dialog box\");
DialogBox dialog = new DialogBox();
dialog.setWidget(l);
dialog.center();
dialog.show();
}
}