Statistics
| Branch: | Tag: | Revision:

root / src / gr / ebs / gss / client / SessionExpiredDialog.java @ 4856bcbf

History | View | Annotate | Download (2.7 kB)

1 05f65955 koutsoub
/*
2 05f65955 koutsoub
 * Copyright 2009 Electronic Business Systems Ltd.
3 63faf404 pastith
 *
4 63faf404 pastith
 * This file is part of GSS.
5 63faf404 pastith
 *
6 63faf404 pastith
 * GSS is free software: you can redistribute it and/or modify
7 63faf404 pastith
 * it under the terms of the GNU General Public License as published by
8 63faf404 pastith
 * the Free Software Foundation, either version 3 of the License, or
9 63faf404 pastith
 * (at your option) any later version.
10 63faf404 pastith
 *
11 63faf404 pastith
 * GSS is distributed in the hope that it will be useful,
12 63faf404 pastith
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 63faf404 pastith
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 63faf404 pastith
 * GNU General Public License for more details.
15 63faf404 pastith
 *
16 63faf404 pastith
 * You should have received a copy of the GNU General Public License
17 63faf404 pastith
 * along with GSS.  If not, see <http://www.gnu.org/licenses/>.
18 05f65955 koutsoub
 */
19 05f65955 koutsoub
package gr.ebs.gss.client;
20 05f65955 koutsoub
21 afd3a0ef Giannis Koutsoubos
import com.google.gwt.dom.client.NativeEvent;
22 afd3a0ef Giannis Koutsoubos
import com.google.gwt.event.dom.client.ClickEvent;
23 afd3a0ef Giannis Koutsoubos
import com.google.gwt.event.dom.client.ClickHandler;
24 afd3a0ef Giannis Koutsoubos
import com.google.gwt.event.dom.client.KeyCodes;
25 afd3a0ef Giannis Koutsoubos
import com.google.gwt.user.client.Event.NativePreviewEvent;
26 05f65955 koutsoub
import com.google.gwt.user.client.ui.Button;
27 05f65955 koutsoub
import com.google.gwt.user.client.ui.DialogBox;
28 05f65955 koutsoub
import com.google.gwt.user.client.ui.HTML;
29 05f65955 koutsoub
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
30 05f65955 koutsoub
import com.google.gwt.user.client.ui.VerticalPanel;
31 05f65955 koutsoub
32 05f65955 koutsoub
33 05f65955 koutsoub
/**
34 05f65955 koutsoub
 * @author kman
35 05f65955 koutsoub
 *
36 05f65955 koutsoub
 */
37 05f65955 koutsoub
public class SessionExpiredDialog extends DialogBox {
38 05f65955 koutsoub
        /**
39 05f65955 koutsoub
         * The widget constructor.
40 05f65955 koutsoub
         */
41 05f65955 koutsoub
        public SessionExpiredDialog() {
42 05f65955 koutsoub
                // Set the dialog's caption.
43 05f65955 koutsoub
                setText("Session Expired");
44 05f65955 koutsoub
                setAnimationEnabled(true);
45 05f65955 koutsoub
                VerticalPanel outer = new VerticalPanel();
46 05f65955 koutsoub
47 05f65955 koutsoub
                // Create the text and set a style name so we can style it with CSS.
48 05f65955 koutsoub
                HTML text = new HTML("<p>Your session has expired. You will have to reauthenticate with your Identity Provider.</p> ");
49 05f65955 koutsoub
                text.setStyleName("gss-AboutText");
50 05f65955 koutsoub
                outer.add(text);
51 05f65955 koutsoub
52 05f65955 koutsoub
                // Create the 'OK' button, along with a listener that hides the dialog
53 05f65955 koutsoub
                // when the button is clicked.
54 afd3a0ef Giannis Koutsoubos
                Button confirm = new Button("Proceed", new ClickHandler() {
55 afd3a0ef Giannis Koutsoubos
                        @Override
56 afd3a0ef Giannis Koutsoubos
                        public void onClick(ClickEvent event) {
57 05f65955 koutsoub
                                GSS.get().authenticateUser();
58 05f65955 koutsoub
                                hide();
59 05f65955 koutsoub
                        }
60 05f65955 koutsoub
                });
61 05f65955 koutsoub
                outer.add(confirm);
62 05f65955 koutsoub
                outer.setCellHorizontalAlignment(confirm, HasHorizontalAlignment.ALIGN_CENTER);
63 05f65955 koutsoub
                outer.setSpacing(8);
64 05f65955 koutsoub
                setWidget(outer);
65 05f65955 koutsoub
        }
66 05f65955 koutsoub
67 63faf404 pastith
        @Override
68 afd3a0ef Giannis Koutsoubos
        protected void onPreviewNativeEvent(NativePreviewEvent preview) {
69 afd3a0ef Giannis Koutsoubos
                super.onPreviewNativeEvent(preview);
70 afd3a0ef Giannis Koutsoubos
71 afd3a0ef Giannis Koutsoubos
                NativeEvent evt = preview.getNativeEvent();
72 afd3a0ef Giannis Koutsoubos
                if (evt.getType().equals("keydown"))
73 afd3a0ef Giannis Koutsoubos
                        // Use the popup's key preview hooks to close the dialog when either
74 afd3a0ef Giannis Koutsoubos
                        // enter or escape is pressed.
75 afd3a0ef Giannis Koutsoubos
                        switch (evt.getKeyCode()) {
76 afd3a0ef Giannis Koutsoubos
                                case KeyCodes.KEY_ENTER:
77 afd3a0ef Giannis Koutsoubos
                                        GSS.get().authenticateUser();
78 afd3a0ef Giannis Koutsoubos
                                        hide();
79 afd3a0ef Giannis Koutsoubos
                                        break;
80 afd3a0ef Giannis Koutsoubos
                                case KeyCodes.KEY_ESCAPE:
81 afd3a0ef Giannis Koutsoubos
                                        hide();
82 afd3a0ef Giannis Koutsoubos
                                        break;
83 afd3a0ef Giannis Koutsoubos
                        }
84 05f65955 koutsoub
        }
85 05f65955 koutsoub
86 afd3a0ef Giannis Koutsoubos
87 afd3a0ef Giannis Koutsoubos
88 05f65955 koutsoub
}