01: package org.drools.brms.client.common;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import com.google.gwt.user.client.Command;
20: import com.google.gwt.user.client.ui.Button;
21: import com.google.gwt.user.client.ui.ClickListener;
22: import com.google.gwt.user.client.ui.DialogBox;
23: import com.google.gwt.user.client.ui.HorizontalPanel;
24: import com.google.gwt.user.client.ui.Widget;
25:
26: /**
27: * A simple confirmation dialog.
28: *
29: * @author Michael Neale
30: *
31: */
32: public class YesNoDialog extends DialogBox {
33:
34: public YesNoDialog(String message, final Command yes) {
35: setText(message);
36:
37: Button y = new Button("Yes");
38: Button n = new Button("No");
39:
40: y.addClickListener(new ClickListener() {
41: public void onClick(Widget w) {
42: yes.execute();
43: hide();
44: }
45: });
46:
47: n.addClickListener(new ClickListener() {
48: public void onClick(Widget w) {
49: hide();
50: }
51:
52: });
53:
54: HorizontalPanel horiz = new HorizontalPanel();
55: horiz.add(y);
56: horiz.add(n);
57:
58: setWidget(horiz);
59: }
60:
61: }
|