Revision 1ac430a1 web_client/src/gr/grnet/pithos/web/client/StatusPanel.java
b/web_client/src/gr/grnet/pithos/web/client/StatusPanel.java | ||
---|---|---|
21 | 21 |
import com.google.gwt.user.client.ui.HTML; |
22 | 22 |
import com.google.gwt.user.client.ui.HasHorizontalAlignment; |
23 | 23 |
import com.google.gwt.user.client.ui.HorizontalPanel; |
24 |
import java.util.Date; |
|
24 | 25 |
|
25 | 26 |
/** |
26 | 27 |
* The panel that displays a status bar with quota information. |
... | ... | |
102 | 103 |
outer.setCellHorizontalAlignment(right, HasHorizontalAlignment.ALIGN_RIGHT); |
103 | 104 |
|
104 | 105 |
initWidget(outer); |
105 |
|
|
106 |
Scheduler.get().scheduleDeferred(new ScheduledCommand() { |
|
107 |
@Override |
|
108 |
public void execute() { |
|
109 |
AccountResource account = GSS.get().getAccount(); |
|
110 |
displayStats(account); |
|
111 |
} |
|
112 |
}); |
|
113 | 106 |
} |
114 | 107 |
|
115 | 108 |
/** |
116 | 109 |
* Refresh the widget with the provided statistics. |
117 | 110 |
*/ |
118 |
private void displayStats(AccountResource account) {
|
|
111 |
public void displayStats(AccountResource account) {
|
|
119 | 112 |
if (account.getNumberOfObjects() == 1) |
120 | 113 |
fileCountLabel.setHTML("1 object"); |
121 | 114 |
else |
... | ... | |
133 | 126 |
quotaLabel.setHTML(account.getQuotaLeftAsString() +" free"); |
134 | 127 |
} |
135 | 128 |
final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a"); |
136 |
lastLoginLabel.setHTML(formatter.format(account.getLastLogin())); |
|
137 |
currentLoginLabel.setHTML(formatter.format(account.getCurrentLogin())); |
|
129 |
Date login = account.getLastLogin(); |
|
130 |
lastLoginLabel.setHTML(login == null ? "" : formatter.format(login)); |
|
131 |
|
|
132 |
login = account.getCurrentLogin(); |
|
133 |
currentLoginLabel.setHTML(login == null ? "" : formatter.format(login)); |
|
138 | 134 |
} |
139 | 135 |
|
140 | 136 |
/** |
141 | 137 |
* Requests updated quota information from the server and refreshes |
142 | 138 |
* the display. |
143 | 139 |
*/ |
140 |
//TODO: This should not be done here |
|
144 | 141 |
public void updateStats() { |
145 | 142 |
final GSS app = GSS.get(); |
146 | 143 |
String path = app.getApiPath() + app.getUsername(); |
Also available in: Unified diff