Remove unused code, fix a few warnings and restore some inadvertent changes. Also...
[pithos] / src / gr / ebs / gss / client / AboutDialog.java
1 /*\r
2  * Copyright 2007, 2008, 2009 Electronic Business Systems Ltd.\r
3  *\r
4  * This file is part of GSS.\r
5  *\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
10  *\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
15  *\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
18  */\r
19 package gr.ebs.gss.client;\r
20 \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
32 \r
33 /**\r
34  * The 'about' dialog box.\r
35  */\r
36 public class AboutDialog extends DialogBox {\r
37 \r
38         /**\r
39          * The widget constructor.\r
40          */\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
49 \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
57                 outer.add(text);\r
58 \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
62 \r
63                         @Override\r
64                         public void onClick(ClickEvent event) {\r
65                                 hide();\r
66                         }\r
67                 });\r
68                 outer.add(confirm);\r
69                 outer.setCellHorizontalAlignment(confirm, HasHorizontalAlignment.ALIGN_CENTER);\r
70                 outer.setSpacing(8);\r
71                 setWidget(outer);\r
72         }\r
73 \r
74         @Override\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
84                                         hide();\r
85                                         break;\r
86                         }\r
87         }\r
88 \r
89 }\r