recover admin interface
[pithos] / src / gr / ebs / gss / client / AboutDialog.java
index 7fe8b1f..1adf09e 100644 (file)
 package gr.ebs.gss.client;\r
 \r
 import com.google.gwt.core.client.GWT;\r
+import com.google.gwt.dom.client.NativeEvent;\r
+import com.google.gwt.event.dom.client.ClickEvent;\r
+import com.google.gwt.event.dom.client.ClickHandler;\r
+import com.google.gwt.event.dom.client.KeyCodes;\r
+import com.google.gwt.user.client.Event.NativePreviewEvent;\r
 import com.google.gwt.user.client.ui.Button;\r
-import com.google.gwt.user.client.ui.ClickListener;\r
 import com.google.gwt.user.client.ui.DialogBox;\r
 import com.google.gwt.user.client.ui.HTML;\r
 import com.google.gwt.user.client.ui.HasHorizontalAlignment;\r
-import com.google.gwt.user.client.ui.KeyboardListener;\r
 import com.google.gwt.user.client.ui.VerticalPanel;\r
-import com.google.gwt.user.client.ui.Widget;\r
 \r
 /**\r
  * The 'about' dialog box.\r
@@ -42,22 +44,24 @@ public class AboutDialog extends DialogBox {
                String service = conf.serviceName();\r
                setText("About " + service);\r
                setAnimationEnabled(true);\r
-               // Create a VerticalPanel to contain the 'about' label and the 'OK'\r
-               // button.\r
+               // A VerticalPanel that contains the 'about' label and the 'OK' button.\r
                final VerticalPanel outer = new VerticalPanel();\r
 \r
-               // Create the 'about' text and set a style name so we can style it with CSS.\r
-               final HTML text = new HTML("This is the Web client for the " + service + " service. You " +\r
-                                       "can use it to store, retrieve and share files in the " + service + " server " +\r
-                                       "grid. <p>Design and implementation: <a href='http://www.ebs.gr' target='about'>EBS</a></p>");\r
+               // Create the 'about' text and set the style.\r
+               final HTML text = new HTML("This is the Web client for the " + service +\r
+                                       " service. You can use it to store, retrieve and share " +\r
+                                       "files in the " + service + " server grid. <p>Version: " +\r
+                                       conf.version() + "<br>Design and implementation: " +\r
+                                       "<a href='http://www.ebs.gr' target='about'>EBS</a></p>");\r
                text.setStyleName("gss-AboutText");\r
                outer.add(text);\r
 \r
                // Create the 'OK' button, along with a listener that hides the dialog\r
                // when the button is clicked.\r
-               final Button confirm = new Button("Close", new ClickListener() {\r
+               final Button confirm = new Button("Close", new ClickHandler() {\r
 \r
-                       public void onClick(Widget sender) {\r
+                       @Override\r
+                       public void onClick(ClickEvent event) {\r
                                hide();\r
                        }\r
                });\r
@@ -68,17 +72,18 @@ public class AboutDialog extends DialogBox {
        }\r
 \r
        @Override\r
-       public boolean onKeyDownPreview(final char key, final int modifiers) {\r
-               // Use the popup's key preview hooks to close the dialog when either\r
-               // enter or escape is pressed.\r
-               switch (key) {\r
-                       case KeyboardListener.KEY_ENTER:\r
-                       case KeyboardListener.KEY_ESCAPE:\r
-                               hide();\r
-                               break;\r
-               }\r
-\r
-               return true;\r
+       protected void onPreviewNativeEvent(NativePreviewEvent preview) {\r
+               super.onPreviewNativeEvent(preview);\r
+               NativeEvent evt = preview.getNativeEvent();\r
+               if (evt.getType().equals("keydown"))\r
+                       // Use the popup's key preview hooks to close the dialog when\r
+                       // either enter or escape is pressed.\r
+                       switch (evt.getKeyCode()) {\r
+                               case KeyCodes.KEY_ENTER:\r
+                               case KeyCodes.KEY_ESCAPE:\r
+                                       hide();\r
+                                       break;\r
+                       }\r
        }\r
 \r
 }\r