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.dom.client.NativeEvent;
\r
23 import com.google.gwt.event.dom.client.ClickEvent;
\r
24 import com.google.gwt.event.dom.client.ClickHandler;
\r
25 import com.google.gwt.event.dom.client.KeyCodes;
\r
26 import com.google.gwt.user.client.Event.NativePreviewEvent;
\r
27 import com.google.gwt.user.client.ui.Button;
\r
28 import com.google.gwt.user.client.ui.DialogBox;
\r
29 import com.google.gwt.user.client.ui.HTML;
\r
30 import com.google.gwt.user.client.ui.HasHorizontalAlignment;
\r
31 import com.google.gwt.user.client.ui.VerticalPanel;
\r
34 * The 'about' dialog box.
\r
36 public class AboutDialog extends DialogBox {
\r
39 * The widget constructor.
\r
41 public AboutDialog() {
\r
42 // Set the dialog's caption.
\r
43 Configuration conf = (Configuration) GWT.create(Configuration.class);
\r
44 String service = conf.serviceName();
\r
45 setText("About " + service);
\r
46 setAnimationEnabled(true);
\r
47 // A VerticalPanel that contains the 'about' label and the 'OK' button.
\r
48 final VerticalPanel outer = new VerticalPanel();
\r
50 // Create the 'about' text and set the style.
\r
51 final HTML text = new HTML("This is the Web client for the " + service +
\r
52 " service. You can use it to store, retrieve and share " +
\r
53 "files in the " + service + " server grid. <p>Design and" +
\r
54 " implementation: <a href='http://www.ebs.gr' " +
\r
55 "target='about'>EBS</a></p>");
\r
56 text.setStyleName("gss-AboutText");
\r
59 // Create the 'OK' button, along with a listener that hides the dialog
\r
60 // when the button is clicked.
\r
61 final Button confirm = new Button("Close", new ClickHandler() {
\r
64 public void onClick(ClickEvent event) {
\r
69 outer.setCellHorizontalAlignment(confirm, HasHorizontalAlignment.ALIGN_CENTER);
\r
70 outer.setSpacing(8);
\r
75 protected void onPreviewNativeEvent(NativePreviewEvent preview) {
\r
76 super.onPreviewNativeEvent(preview);
\r
77 NativeEvent evt = preview.getNativeEvent();
\r
78 if (evt.getType().equals("keydown"))
\r
79 // Use the popup's key preview hooks to close the dialog when
\r
80 // either enter or escape is pressed.
\r
81 switch (evt.getKeyCode()) {
\r
82 case KeyCodes.KEY_ENTER:
\r
83 case KeyCodes.KEY_ESCAPE:
\r