root / web_client / src / gr / grnet / pithos / web / client / UserDetailsPanel.java @ 5cd18037
History | View | Annotate | Download (1.7 kB)
1 |
/*
|
---|---|
2 |
* Copyright (c) 2011 Greek Research and Technology Network
|
3 |
*/
|
4 |
package gr.grnet.pithos.web.client; |
5 |
|
6 |
import gr.grnet.pithos.web.client.rest.resource.UserResource; |
7 |
|
8 |
import com.google.gwt.user.client.DeferredCommand; |
9 |
import com.google.gwt.user.client.IncrementalCommand; |
10 |
import com.google.gwt.user.client.ui.Composite; |
11 |
import com.google.gwt.user.client.ui.HTML; |
12 |
import com.google.gwt.user.client.ui.HasHorizontalAlignment; |
13 |
import com.google.gwt.user.client.ui.HorizontalPanel; |
14 |
|
15 |
/**
|
16 |
* The panel that displays a status bar with quota information.
|
17 |
*/
|
18 |
public class UserDetailsPanel extends Composite { |
19 |
public static final boolean DONE = false; |
20 |
|
21 |
/**
|
22 |
* The label that displays user information.
|
23 |
*/
|
24 |
private HTML userInfoLabel; |
25 |
|
26 |
/**
|
27 |
* The constructor of the user details panel.
|
28 |
*/
|
29 |
public UserDetailsPanel() {
|
30 |
final HorizontalPanel outer = new HorizontalPanel(); |
31 |
outer.setSpacing(8);
|
32 |
userInfoLabel = new HTML(" "); |
33 |
outer.add(userInfoLabel); |
34 |
outer.setCellHorizontalAlignment(userInfoLabel, HasHorizontalAlignment.ALIGN_RIGHT); |
35 |
outer.setStyleName("statusbar-inner");
|
36 |
|
37 |
initWidget(outer); |
38 |
|
39 |
// DeferredCommand.addCommand(new IncrementalCommand() {
|
40 |
//
|
41 |
// @Override
|
42 |
// public boolean execute() {
|
43 |
// return displayUserInfo();
|
44 |
// }
|
45 |
// });
|
46 |
} |
47 |
|
48 |
/**
|
49 |
* Display the user information on the panel.
|
50 |
*
|
51 |
* @return true if the work has been carried out successfully
|
52 |
*/
|
53 |
protected boolean displayUserInfo() { |
54 |
UserResource user = GSS.get().getCurrentUserResource(); |
55 |
if (user == null) |
56 |
return !DONE;
|
57 |
userInfoLabel.setHTML("<b>" + user.getName() + " \u0387 " + user.getUsername() + "</b>"); |
58 |
GSS.get().putUserToMap(user.getUsername(), user.getName()); |
59 |
return DONE;
|
60 |
} |
61 |
|
62 |
} |