2 * Copyright 2007, 2008, 2009 Electronic Business Systems Ltd.
\r
4 * This file is part of GSS.
\r
6 * GSS is free software: you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation, either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * GSS is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with GSS. If not, see <http://www.gnu.org/licenses/>.
\r
19 package gr.ebs.gss.client;
\r
21 import com.google.gwt.core.client.GWT;
\r
22 import com.google.gwt.user.client.ui.Button;
\r
23 import com.google.gwt.user.client.ui.ClickListener;
\r
24 import com.google.gwt.user.client.ui.DialogBox;
\r
25 import com.google.gwt.user.client.ui.HTML;
\r
26 import com.google.gwt.user.client.ui.HasHorizontalAlignment;
\r
27 import com.google.gwt.user.client.ui.HorizontalPanel;
\r
28 import com.google.gwt.user.client.ui.KeyboardListener;
\r
29 import com.google.gwt.user.client.ui.VerticalPanel;
\r
30 import com.google.gwt.user.client.ui.Widget;
\r
33 * The 'quit' dialog box.
\r
35 public class QuitDialog extends DialogBox {
\r
38 * The widget's constructor.
\r
40 public QuitDialog() {
\r
41 Configuration conf = (Configuration) GWT.create(Configuration.class);
\r
42 String service = conf.serviceName();
\r
43 setText("Quit " + service);
\r
45 VerticalPanel outer = new VerticalPanel();
\r
46 HorizontalPanel buttons = new HorizontalPanel();
\r
48 HTML text = new HTML("Are you sure you want to quit " + service + "?");
\r
49 text.setStyleName("gss-AboutText");
\r
52 // Create the 'Quit' button, along with a listener that hides the dialog
\r
53 // when the button is clicked and quits the application.
\r
54 Button quit = new Button("Quit", new ClickListener() {
\r
56 public void onClick(Widget sender) {
\r
62 buttons.setCellHorizontalAlignment(quit, HasHorizontalAlignment.ALIGN_CENTER);
\r
63 // Create the 'Cancel' button, along with a listener that hides the
\r
64 // dialog when the button is clicked.
\r
65 Button cancel = new Button("Cancel", new ClickListener() {
\r
67 public void onClick(Widget sender) {
\r
71 buttons.add(cancel);
\r
72 buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
\r
73 buttons.setSpacing(8);
\r
75 outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);
\r
80 public boolean onKeyDownPreview(char key, int modifiers) {
\r
81 // Use the popup's key preview hooks to close the dialog when either
\r
82 // enter or escape is pressed.
\r
84 case KeyboardListener.KEY_ENTER:
\r
88 case KeyboardListener.KEY_ESCAPE:
\r