2 * Copyright (c) 2011 Greek Research and Technology Network
\r
4 package gr.grnet.pithos.web.client;
\r
6 import com.google.gwt.core.client.GWT;
\r
7 import com.google.gwt.dom.client.NativeEvent;
\r
8 import com.google.gwt.event.dom.client.ClickEvent;
\r
9 import com.google.gwt.event.dom.client.ClickHandler;
\r
10 import com.google.gwt.event.dom.client.KeyCodes;
\r
11 import com.google.gwt.user.client.Event.NativePreviewEvent;
\r
12 import com.google.gwt.user.client.ui.Button;
\r
13 import com.google.gwt.user.client.ui.DialogBox;
\r
14 import com.google.gwt.user.client.ui.HTML;
\r
15 import com.google.gwt.user.client.ui.HasHorizontalAlignment;
\r
16 import com.google.gwt.user.client.ui.VerticalPanel;
\r
19 * The 'about' dialog box.
\r
21 public class AboutDialog extends DialogBox {
\r
24 * The widget constructor.
\r
26 public AboutDialog() {
\r
27 // Set the dialog's caption.
\r
28 Configuration conf = (Configuration) GWT.create(Configuration.class);
\r
29 String service = conf.serviceName();
\r
30 setText("About " + service);
\r
31 setAnimationEnabled(true);
\r
32 // A VerticalPanel that contains the 'about' label and the 'OK' button.
\r
33 final VerticalPanel outer = new VerticalPanel();
\r
35 // Create the 'about' text and set the style.
\r
36 final HTML text = new HTML("This is the Web client for the " + service +
\r
37 " service. You can use it to store, retrieve and share " +
\r
38 "files in the " + service + " server grid. <p>Pithos version: " +
\r
39 conf.version() + "<br> Service designed and implemented by " + "<a href='http://www.grnet.gr'>GRNET</a></p>");
\r
40 text.setStyleName("pithos-AboutText");
\r
43 // Create the 'OK' button, along with a listener that hides the dialog
\r
44 // when the button is clicked.
\r
45 final Button confirm = new Button("Close", new ClickHandler() {
\r
48 public void onClick(ClickEvent event) {
\r
53 outer.setCellHorizontalAlignment(confirm, HasHorizontalAlignment.ALIGN_CENTER);
\r
54 outer.setSpacing(8);
\r
59 protected void onPreviewNativeEvent(NativePreviewEvent preview) {
\r
60 super.onPreviewNativeEvent(preview);
\r
61 NativeEvent evt = preview.getNativeEvent();
\r
62 if (evt.getType().equals("keydown"))
\r
63 // Use the popup's key preview hooks to close the dialog when
\r
64 // either enter or escape is pressed.
\r
65 switch (evt.getKeyCode()) {
\r
66 case KeyCodes.KEY_ENTER:
\r
67 case KeyCodes.KEY_ESCAPE:
\r