Revision 1ac430a1 web_client/src/gr/grnet/pithos/web/client/GSS.java
b/web_client/src/gr/grnet/pithos/web/client/GSS.java | ||
---|---|---|
7 | 7 |
import com.google.gwt.core.client.Scheduler.ScheduledCommand; |
8 | 8 |
import com.google.gwt.user.client.ui.DockPanel; |
9 | 9 |
import com.google.gwt.user.client.ui.HasVerticalAlignment; |
10 |
import com.google.gwt.view.client.ListDataProvider; |
|
10 | 11 |
import gr.grnet.pithos.web.client.clipboard.Clipboard; |
11 | 12 |
import gr.grnet.pithos.web.client.commands.GetUserCommand; |
12 | 13 |
import gr.grnet.pithos.web.client.foldertree.AccountResource; |
14 |
import gr.grnet.pithos.web.client.foldertree.Folder; |
|
13 | 15 |
import gr.grnet.pithos.web.client.foldertree.FolderTreeView; |
16 |
import gr.grnet.pithos.web.client.foldertree.FolderTreeViewModel; |
|
14 | 17 |
import gr.grnet.pithos.web.client.rest.GetRequest; |
15 | 18 |
import gr.grnet.pithos.web.client.rest.RestException; |
16 | 19 |
import gr.grnet.pithos.web.client.rest.resource.FileResource; |
... | ... | |
25 | 28 |
import java.util.Arrays; |
26 | 29 |
import java.util.Date; |
27 | 30 |
import java.util.HashMap; |
31 |
import java.util.Iterator; |
|
28 | 32 |
import java.util.List; |
29 | 33 |
|
30 | 34 |
import com.google.gwt.core.client.EntryPoint; |
... | ... | |
191 | 195 |
*/ |
192 | 196 |
private String token; |
193 | 197 |
|
194 |
private FolderTreeView folderTreeView = new FolderTreeView(); |
|
198 |
private FolderTreeViewModel folderTreeViewModel = new FolderTreeViewModel(); |
|
199 |
|
|
200 |
private FolderTreeView folderTreeView = new FolderTreeView(folderTreeViewModel); |
|
195 | 201 |
|
196 | 202 |
private AccountResource account; |
197 | 203 |
|
... | ... | |
268 | 274 |
// Call the window resized handler to get the initial sizes setup. Doing |
269 | 275 |
// this in a deferred command causes it to occur after all widgets' |
270 | 276 |
// sizes have been computed by the browser. |
271 |
DeferredCommand.addCommand(new Command() {
|
|
277 |
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
|
272 | 278 |
|
273 | 279 |
@Override |
274 | 280 |
public void execute() { |
275 | 281 |
onWindowResized(Window.getClientHeight()); |
276 | 282 |
} |
277 | 283 |
}); |
284 |
|
|
285 |
Scheduler.get().scheduleDeferred(new ScheduledCommand() { |
|
286 |
@Override |
|
287 |
public void execute() { |
|
288 |
fetchAccount(); |
|
289 |
} |
|
290 |
}); |
|
278 | 291 |
} |
279 | 292 |
|
280 | 293 |
/** |
... | ... | |
313 | 326 |
Window.Location.assign(GWT.getModuleBaseURL() + "GSS.html"); |
314 | 327 |
} |
315 | 328 |
|
329 |
private void fetchAccount() { |
|
330 |
String path = getApiPath() + username + "?format=json"; |
|
331 |
|
|
332 |
GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(AccountResource.class, path) { |
|
333 |
@Override |
|
334 |
public void onSuccess(AccountResource result) { |
|
335 |
account = result; |
|
336 |
statusPanel.displayStats(account); |
|
337 |
folderTreeViewModel.initialize(account); |
|
338 |
} |
|
339 |
|
|
340 |
@Override |
|
341 |
public void onError(Throwable t) { |
|
342 |
GWT.log("Error getting account", t); |
|
343 |
if (t instanceof RestException) |
|
344 |
GSS.get().displayError("Error getting account: " + ((RestException) t).getHttpStatusText()); |
|
345 |
else |
|
346 |
GSS.get().displayError("System error fetching user data: " + t.getMessage()); |
|
347 |
} |
|
348 |
}; |
|
349 |
|
|
350 |
Scheduler.get().scheduleDeferred(getAccount); |
|
351 |
} |
|
352 |
|
|
316 | 353 |
/** |
317 | 354 |
* Clear the cookie and redirect the user to the logout page. |
318 | 355 |
*/ |
Also available in: Unified diff