Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/FLYSHeader.java @ 6437:0341504e9deb
Info-Button now leads to $WIKI_URL/Info. Ticket for authentication not implemented yet.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Wed, 26 Jun 2013 14:42:16 +0200 |
parents | ea9eef426962 |
children | 7106f9b75004 |
comparison
equal
deleted
inserted
replaced
6436:402e9eb2922d | 6437:0341504e9deb |
---|---|
10 | 10 |
11 import com.google.gwt.core.client.GWT; | 11 import com.google.gwt.core.client.GWT; |
12 import com.google.gwt.i18n.client.LocaleInfo; | 12 import com.google.gwt.i18n.client.LocaleInfo; |
13 import com.google.gwt.user.client.Window; | 13 import com.google.gwt.user.client.Window; |
14 import com.google.gwt.user.client.rpc.AsyncCallback; | 14 import com.google.gwt.user.client.rpc.AsyncCallback; |
15 | |
16 import com.smartgwt.client.types.Alignment; | 15 import com.smartgwt.client.types.Alignment; |
17 import com.smartgwt.client.types.VerticalAlignment; | 16 import com.smartgwt.client.types.VerticalAlignment; |
18 import com.smartgwt.client.util.BooleanCallback; | 17 import com.smartgwt.client.util.BooleanCallback; |
19 import com.smartgwt.client.util.SC; | 18 import com.smartgwt.client.util.SC; |
20 import com.smartgwt.client.widgets.Button; | 19 import com.smartgwt.client.widgets.Button; |
21 import com.smartgwt.client.widgets.Img; | 20 import com.smartgwt.client.widgets.Img; |
22 import com.smartgwt.client.widgets.Label; | 21 import com.smartgwt.client.widgets.Label; |
23 import com.smartgwt.client.widgets.layout.HLayout; | |
24 import com.smartgwt.client.widgets.events.ClickEvent; | 22 import com.smartgwt.client.widgets.events.ClickEvent; |
25 import com.smartgwt.client.widgets.events.ClickHandler; | 23 import com.smartgwt.client.widgets.events.ClickHandler; |
26 | 24 import com.smartgwt.client.widgets.layout.HLayout; |
25 | |
26 import org.dive4elements.river.client.client.Config; | |
27 import org.dive4elements.river.client.client.FLYS; | 27 import org.dive4elements.river.client.client.FLYS; |
28 import org.dive4elements.river.client.client.FLYSConstants; | 28 import org.dive4elements.river.client.client.FLYSConstants; |
29 import org.dive4elements.river.client.client.services.UserService; | 29 import org.dive4elements.river.client.client.services.UserService; |
30 import org.dive4elements.river.client.client.services.UserServiceAsync; | 30 import org.dive4elements.river.client.client.services.UserServiceAsync; |
31 import org.dive4elements.river.client.shared.model.User; | 31 import org.dive4elements.river.client.shared.model.User; |
32 | 32 |
33 | 33 |
34 /** | 34 /** |
35 * Header of the FLYS webpage/app. | |
36 * | |
35 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 37 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
36 */ | 38 */ |
37 public class FLYSHeader extends HLayout { | 39 public class FLYSHeader extends HLayout { |
38 | 40 |
39 /** The interface that provides the message resources. */ | 41 /** The interface that provides the message resources. */ |
40 private FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); | 42 private final FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); |
41 | 43 |
42 /** The height used for this header.*/ | 44 /** The height used for this header.*/ |
43 public static final int HEIGHT = 56; | 45 public static final int HEIGHT = 56; |
44 | 46 |
45 /** The height used for the images.*/ | 47 /** The height used for the images.*/ |
47 | 49 |
48 /** The user that is currently logged in. */ | 50 /** The user that is currently logged in. */ |
49 private User currentUser; | 51 private User currentUser; |
50 | 52 |
51 /** The label that displays the current logged in user. */ | 53 /** The label that displays the current logged in user. */ |
52 private Label userText; | 54 private final Label userText; |
53 | 55 |
54 /** The button to log the current user out.*/ | 56 /** The button to log the current user out.*/ |
55 private Button logout; | 57 private final Button logout; |
56 | 58 |
57 /** The button to open the project list.*/ | 59 /** The button to open the project list.*/ |
58 private Button projectList; | 60 private final Button projectList; |
59 | 61 |
60 /** The button to switch between the english and german version.*/ | 62 /** The button to switch between the english and german version.*/ |
61 private Button language; | 63 private final Button language; |
62 | 64 |
63 /** The button to open an info panel.*/ | 65 /** The button to open an info panel.*/ |
64 private Button info; | 66 private final Button info; |
65 | 67 |
66 private UserServiceAsync userService = | 68 private final UserServiceAsync userService = |
67 GWT.create(UserService.class); | 69 GWT.create(UserService.class); |
68 | 70 |
69 /** An instance to FLYS.*/ | 71 /** An instance to FLYS.*/ |
70 private FLYS flys; | 72 private final FLYS flys; |
71 | 73 |
72 | 74 |
73 public FLYSHeader(FLYS flys) { | 75 public FLYSHeader(FLYS flys) { |
74 this.flys = flys; | 76 this.flys = flys; |
75 | 77 |
92 logout.addClickHandler(new ClickHandler() { | 94 logout.addClickHandler(new ClickHandler() { |
93 @Override | 95 @Override |
94 public void onClick(ClickEvent event) { | 96 public void onClick(ClickEvent event) { |
95 GWT.log("Clicked 'logout' button."); | 97 GWT.log("Clicked 'logout' button."); |
96 userService.logoutCurrentUser(new AsyncCallback<Void>() { | 98 userService.logoutCurrentUser(new AsyncCallback<Void>() { |
99 @Override | |
97 public void onFailure(Throwable caught) { | 100 public void onFailure(Throwable caught) { |
98 } | 101 } |
99 | 102 |
103 @Override | |
100 public void onSuccess(Void result) { | 104 public void onSuccess(Void result) { |
101 /* Just reload the page. GGInAFilter is goint to redirect | 105 /* Just reload the page. GGInAFilter is goint to redirect |
102 * to the correct login page */ | 106 * to the correct login page */ |
103 Window.Location.reload(); | 107 Window.Location.reload(); |
104 } | 108 } |
130 | 134 |
131 info.addClickHandler(new ClickHandler() { | 135 info.addClickHandler(new ClickHandler() { |
132 @Override | 136 @Override |
133 public void onClick(ClickEvent event) { | 137 public void onClick(ClickEvent event) { |
134 GWT.log("Clicked 'info' button."); | 138 GWT.log("Clicked 'info' button."); |
135 GWT.log("IMPLEMENT the 'open info panel' function."); | 139 String wikiLink = Config.getInstance().getWikiUrl() + "/Info"; |
140 Window.open(wikiLink, "_blank", null); | |
136 } | 141 } |
137 }); | 142 }); |
138 init(); | 143 init(); |
139 } | 144 } |
140 | 145 |