From 36dc8e18c4feab11d07578cc4bc9cd57580f4156 Mon Sep 17 00:00:00 2001 From: Christos Stathis Date: Thu, 11 Aug 2011 19:41:44 +0300 Subject: [PATCH] Added shibboleth support (untested) --- src/gr/grnet/pithos/resources/database.png | Bin 774 -> 0 bytes src/gr/grnet/pithos/resources/greenled.png | Bin 474 -> 0 bytes src/gr/grnet/pithos/resources/redled.png | Bin 494 -> 0 bytes src/gr/grnet/pithos/resources/windowlist.png | Bin 542 -> 0 bytes src/gr/grnet/pithos/resources/xclock.png | Bin 937 -> 0 bytes src/gr/grnet/pithos/resources/yellowled.png | Bin 436 -> 0 bytes src/gr/grnet/pithos/web/client/Configuration.java | 17 +- .../pithos/web/client/Configuration.properties | 6 +- src/gr/grnet/pithos/web/client/FileList.java | 20 --- src/gr/grnet/pithos/web/client/Pithos.java | 167 +++---------------- src/gr/grnet/pithos/web/client/StatusPanel.java | 168 +++----------------- 11 files changed, 50 insertions(+), 328 deletions(-) delete mode 100644 src/gr/grnet/pithos/resources/database.png delete mode 100644 src/gr/grnet/pithos/resources/greenled.png delete mode 100644 src/gr/grnet/pithos/resources/redled.png delete mode 100644 src/gr/grnet/pithos/resources/windowlist.png delete mode 100755 src/gr/grnet/pithos/resources/xclock.png delete mode 100644 src/gr/grnet/pithos/resources/yellowled.png diff --git a/src/gr/grnet/pithos/resources/database.png b/src/gr/grnet/pithos/resources/database.png deleted file mode 100644 index ee17b387605ef8794ed4e4f802582ab4ea12c542..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 774 zcmV+h1Nr=kP))b5~c zNUwn%y@J9;u&KlqP&Q>7S~aMOi`qmYt?GzY4z;ZW|BPomo|%tDZDf2l=Pb_qocHMH zXe`97Ti>j2Z(qGpuh%~<7TtBw#_e|Z&qm|?;kYp-1+wQyv~>vH*fCV+ugnWos_mnk_l;=GMS_# zNkSCGgkeOf6qIVUOJBWvH~j6@tHUOMKGn;WmF2I~G$+qushNgkzNIcI$N*i6*0fk|_Z<|a~27?iWLcyK^W)8-#YxRc1 z5Ge(&`yL>rKuY^RsHSO*MiH(nhl>E?*Qj$=+wJG5GD zbY17=%M)vH1=BQzI6OQ?N=c(}M6cJQ-EJeL!{y6WeBZ|~bb7r3mC6TV5s<8|E{E0X z5}F2{=U`bTN-2a81VKO$6aXld0({?#76Ib;xarpGTPT$i1U}o_b)GcM5IvrZA7Ov~EwzfvOd;x&-^8vNmrC_Q} zO+b#vQz*D(Sw^+G%--HFXFvt$7=R4~FJ3%X z*RFl`Nv*c(1c6VjR%LVZL)O<Gj5e^N@F0z++Tr3`GCruh8& z^&4MoY;1j;WfZ&JGu?3WO@9#AZ4t{?CJONICf3&%uC;&^qCa`4~#z&fF z6hX_gEa@txj)5bf33P!7$Y+50n5|{cpBWfWb3WhvF9sD2Pv@&bsQ>@~07*qoM6N<$ Ef`5c?xBvhE diff --git a/src/gr/grnet/pithos/resources/greenled.png b/src/gr/grnet/pithos/resources/greenled.png deleted file mode 100644 index ac8972e2c88039a7402227a731be953de7084367..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 474 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh3?wzC-F*zCI14-?iy0WWg+Q3`(%rg0KtYyt zM_)$IPK1G{7gs6-fX8|DVBvK_Z?3ND78B$fSW7%r*>s{tU9|Ahu{UgJdFz!S2Ms<-s7E z!NAbSz+A$>T+htX$i$k*!q&>hUd6ys%)k}M$(_c)-ND7($<0&6ERe?_(9188CoUBu zAw5M>rhr3XhMZEpsOoHGwL)>-R2_rGx>l>qZKqh;&oX!2oHyq?yp^_lKUJ8 wQ?E|wyb#@2HuL)0i8%*cxvrEq)QjJnbFVdQ&MBb@07e#@;{X5v diff --git a/src/gr/grnet/pithos/resources/redled.png b/src/gr/grnet/pithos/resources/redled.png deleted file mode 100644 index afa477274e2bb7c27cb67bad87551e5910880b71..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 494 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xa&H|6fVg?3oArNM~bhqvgP>?0v z(btiIVPjv-@4(4GzCyA`kS_y6l_~>6Lo)-z&;LOBB?CjL0RzLU1O^7H84L{K`IF+0 zx-l>?rg*wIhE&{2`t$$4J+mc)LPLZDi?Xuv4CBd-j*K2xnF|>NxE-$6Fg)UQxHIG2 zfe#ES44Zfq8YB*~1SkhgW(>&LUs%=CFl!wL^ZWPHd3f&cH?FDsJN4nUpXog5{4uPO z4>+#WFfL(NXgDC1ZfMk$V>@=j9t`)j56O7x>%#@U6O7+t%6n%_h>z z{{H_DbjFMY=T@@cWV!Z*Ggg@6e}cfj-+c!oTB8|WiLx~?G-dKISn|6HbJRPh{Z9yZ z{P!foS9@j$hK&xUTn>M}FlU_B*D-T4(0?q?7O{YlMS$C;W`Aw7*0F^jzspZ~!N8#~ zBiJ73Ox}0$JjW|3g97rDFIe2w@bVB9cxy85}Sb4q9e07w(HNB{r; diff --git a/src/gr/grnet/pithos/resources/windowlist.png b/src/gr/grnet/pithos/resources/windowlist.png deleted file mode 100644 index 9f0104abde4f9a2144a6ada1c1073dade4a49fa0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 542 zcmV+(0^$9MP)}` zrE2zqdS^%WeX;rJ$p4IF1wE-{LY_^=w=P&LwcOV*XHpb9sY_qxf z4TzYXJxZZam>CmjH-81|A3jeq--9(V0Df+569mDSjc5_B&R^P%sSXxVO5yuH&tE+4 zkKSt$!FdkrEFuMfa*`H4ZaR{Usu zCx7M6t#b?BO{1HfK7Z|@h!y~xbF_mlYwx~H-N#@efP|koB3jJuqO8M@d)zpCjJPvI z(e!RVb(reM<-TY&4D5_>D4D=>`riV{1Xe5(kH=#J!id2+5BDDlJm+CVBa2ImPc}Yn zYz6J0lR0tf!oqyhhb9xWI=Y0Geck|@V z_$r^A9zOZ}3x{8S^3haK4tc<_1S}zFS}uxO2j6^uWn<=(_fOiDOP}8xEQ}rf^vtP? zI=!&mq^lK+>J5jkZW(lIyG6^p7M(Ad^tJum=Kad z3W0Ocvu)Uf$G-G1!Vw7$1+M(G3PtIMB#EG6A1Uqm9?}alUogtp^wF{GXdojAsOcJh znVUsKiD8g*A?{S*>*KL>y@K?}5Lm%Lr`19-#2~zXD$9mO4{_4y#AAtwfRL9U`Cu9k zq*D-l47^$czLk08cbvb z@8{u(r7$U*xX;g^=K_M4Lo5=2FTlbhP%w<+a-Hqdfsb1Aw8g|2lv1hij}im|^*XEy+-D!>&VF$G zSZ8nZ+yD8-+wun^Lx)DP<5SXr67Nx$svD}hwwRxD+SMF@&fV}o@AHHT$V#0@00000 LNkvXXu0mjfu^G!P diff --git a/src/gr/grnet/pithos/resources/yellowled.png b/src/gr/grnet/pithos/resources/yellowled.png deleted file mode 100644 index b09507d1bd1d9d9e89a956dba802a21374899ae3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 436 zcmV;l0ZaagP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ-DoI2^RCwB*l21y*KorKmhzFR33$sbGbRz_Wf(s!% zfuaYfNAM3_=%KD*k!C*Xb*TLXdv&O|tm?=8?=qM1*y+ zDN7VZ&|IJ348S3`K#1j*$5*&eMuy2m5k)WnZsX2Tp6(mOyBY8e)I$sJ`1xpgMVB{d z#1UI3J^7n+q9!ML1JQ{4%&oZhhWuqg!sx_}xpXR%l1>SHIp7B}O&Z=m8zfs6@lKWt z3xLItUV2~{6iJ2ErrYBgyDS#*Ue+o}vvB^Tn{I#ikfa!T6fpaP``i^rcYmiYQP=B38V1h=4j^U e)ce(keyProvider); - Handler selectionHandler = new SelectionChangeEvent.Handler() { - @Override - public void onSelectionChange(SelectionChangeEvent event) { - if(getSelectedFiles().size() == 1) - app.setCurrentSelection(getSelectedFiles().get(0)); - else - app.setCurrentSelection(getSelectedFiles()); - } - }; - selectionModel.addSelectionChangeHandler(selectionHandler); - celltable.setSelectionModel(selectionModel, GSSSelectionEventManager. createDefaultManager()); celltable.setPageSize(Pithos.VISIBLE_FILE_COUNT); @@ -507,8 +496,6 @@ public class FileList extends Composite { // showingStats = "" + (startIndex + 1) + " - " + max + " of " + count + " files" + " (" + FileResource.getFileSizeAsString(folderTotalSize) + ")"; } showCellTable(); - updateCurrentlyShowingStats(); - } /** @@ -551,13 +538,6 @@ public class FileList extends Composite { } /** - * Update status panel with currently showing file stats. - */ - public void updateCurrentlyShowingStats() { - app.getStatusPanel().updateCurrentlyShowing(showingStats); - } - - /** * Fill the file cache with data. */ public void setFiles(final List _files) { diff --git a/src/gr/grnet/pithos/web/client/Pithos.java b/src/gr/grnet/pithos/web/client/Pithos.java index 7732612..153664f 100644 --- a/src/gr/grnet/pithos/web/client/Pithos.java +++ b/src/gr/grnet/pithos/web/client/Pithos.java @@ -149,7 +149,7 @@ public class Pithos implements EntryPoint, ResizeHandler { * An aggregate image bundle that pulls together all the images for this * application into a single bundle. */ - public interface Images extends ClientBundle, TopPanel.Images, StatusPanel.Images, FilePropertiesDialog.Images, MessagePanel.Images, FileList.Images { + public interface Images extends ClientBundle, TopPanel.Images, FilePropertiesDialog.Images, MessagePanel.Images, FileList.Images { @Source("gr/grnet/pithos/resources/document.png") ImageResource folders(); @@ -266,7 +266,6 @@ public class Pithos implements EntryPoint, ResizeHandler { int tabIndex = event.getSelectedItem(); switch (tabIndex) { case 0: - fileList.updateCurrentlyShowingStats(); break; } } @@ -321,7 +320,7 @@ public class Pithos implements EntryPoint, ResizeHandler { outer.add(topPanel); outer.add(messagePanel); outer.add(splitPanel); - statusPanel = new StatusPanel(this, Pithos.images); + statusPanel = new StatusPanel(); outer.add(statusPanel); outer.setWidth("100%"); outer.setCellHorizontalAlignment(messagePanel, HasHorizontalAlignment.ALIGN_CENTER); @@ -402,36 +401,41 @@ public class Pithos implements EntryPoint, ResizeHandler { * Parse and store the user credentials to the appropriate fields. */ private boolean parseUserCredentials() { - Configuration conf = (Configuration) GWT.create(Configuration.class); - String cookie = conf.authCookie(); - String auth = Cookies.getCookie(cookie); - if (auth == null) { - authenticateUser(); - return false; - } - else { - String[] authSplit = auth.split("\\" + conf.cookieSeparator(), 2); - if (authSplit.length != 2) { + username = Window.Location.getParameter("user"); + token = Window.Location.getParameter("token"); + Configuration conf = (Configuration) GWT.create(Configuration.class); + if (username == null || username.length() == 0 || token == null || token.length() == 0) { + String cookie = conf.authCookie(); + String auth = Cookies.getCookie(cookie); + if (auth == null) { authenticateUser(); return false; } else { - username = authSplit[0]; - token = authSplit[1]; - return true; + String[] authSplit = auth.split("\\" + conf.cookieSeparator(), 2); + if (authSplit.length != 2) { + authenticateUser(); + return false; + } + else { + username = authSplit[0]; + token = authSplit[1]; + return true; + } } } - } + else { + Cookies.setCookie(conf.authCookie(), username + conf.cookieSeparator() + token); + return true; + } + } /** * Redirect the user to the login page for authentication. */ protected void authenticateUser() { Configuration conf = (Configuration) GWT.create(Configuration.class); - -// Window.Location.assign(GWT.getModuleBaseURL() + conf.loginUrl() + "?next=" + Window.Location.getHref()); - Cookies.setCookie(conf.authCookie(), "test" + conf.cookieSeparator() + "0000"); - Window.Location.assign(GWT.getModuleBaseURL() + "pithos.html"); + Window.Location.assign(Window.Location.getHost() + conf.loginUrl() + "?next=" + Window.Location.getHref()); } private void fetchAccount() { @@ -441,7 +445,6 @@ public class Pithos implements EntryPoint, ResizeHandler { @Override public void onSuccess(AccountResource result) { account = result; - statusPanel.displayStats(account); inner.selectTab(0); if (account.getContainers().isEmpty()) createHomeContainers(); @@ -484,20 +487,6 @@ public class Pithos implements EntryPoint, ResizeHandler { } /** - * Clear the cookie and redirect the user to the logout page. - */ - void logout() { - Configuration conf = (Configuration) GWT.create(Configuration.class); - String cookie = conf.authCookie(); - String domain = Window.Location.getHostName(); - String path = Window.Location.getPath(); - Cookies.setCookie(cookie, "", null, domain, path, false); - String baseUrl = GWT.getModuleBaseURL(); - String homeUrl = baseUrl.substring(0, baseUrl.indexOf(path)); - Window.Location.assign(homeUrl + conf.logoutUrl()); - } - - /** * Creates an HTML fragment that places an image & caption together, for use * in a group header. * @@ -515,7 +504,7 @@ public class Pithos implements EntryPoint, ResizeHandler { private void onWindowResized(int height) { // Adjust the split panel to take up the available room in the window. - int newHeight = height - splitPanel.getAbsoluteTop() - 44; + int newHeight = height - splitPanel.getAbsoluteTop() - 60; if (newHeight < 1) newHeight = 1; splitPanel.setHeight("" + newHeight); @@ -528,31 +517,6 @@ public class Pithos implements EntryPoint, ResizeHandler { onWindowResized(height); } - public boolean isFileListShowing() { - int tab = inner.getTabBar().getSelectedTab(); - if (tab == 0) - return true; - return false; - } - - public boolean isSearchResultsShowing() { - int tab = inner.getTabBar().getSelectedTab(); - if (tab == 2) - return true; - return false; - } - - /** - * A native JavaScript method to reach out to the browser's window and - * invoke its resizeTo() method. - * - * @param x the new width - * @param y the new height - */ - public static native void resizeTo(int x, int y) /*-{ - $wnd.resizeTo(x,y); - }-*/; - /** * Display an error message. * @@ -581,33 +545,6 @@ public class Pithos implements EntryPoint, ResizeHandler { } /** - * Retrieve the folders. - * - * @return the folders - - public Folders getFolders() { - return folders; - }*/ - - /** - * Retrieve the currentSelection. - * - * @return the currentSelection - */ - public Object getCurrentSelection() { - return currentSelection; - } - - /** - * Modify the currentSelection. - * - * @param newCurrentSelection the currentSelection to set - */ - public void setCurrentSelection(Object newCurrentSelection) { - currentSelection = newCurrentSelection; - } - - /** * Retrieve the fileList. * * @return the fileList @@ -664,25 +601,6 @@ public class Pithos implements EntryPoint, ResizeHandler { } /** - * Convert server date to local time according to browser timezone - * and format it according to localized pattern. - * Time is always formatted to 24hr format. - * NB: This assumes that server runs in UTC timezone. Otherwise - * we would need to adjust for server time offset as well. - * - * @param date - * @return String - */ - public static String formatLocalDateTime(Date date) { - Date convertedDate = new Date(date.getTime() - date.getTimezoneOffset()); - final DateTimeFormat dateFormatter = DateTimeFormat.getShortDateFormat(); - final DateTimeFormat timeFormatter = DateTimeFormat.getFormat("HH:mm"); - String datePart = dateFormatter.format(convertedDate); - String timePart = timeFormatter.format(convertedDate); - return datePart + " " + timePart; - } - - /** * History support for folder navigation * adds a new browser history entry * @@ -696,39 +614,6 @@ public class Pithos implements EntryPoint, ResizeHandler { History.newItem(key); } - /** - * This method examines the token input and add a "/" at the end in case it's omitted. - * This happens only in Files/trash/, Files/shared/, Files/others. - * - * @param tokenInput - * @return the formated token with a "/" at the end or the same tokenInput parameter - */ - - private String handleSpecialFolderNames(String tokenInput){ - List pathsToCheck = Arrays.asList("Files/trash", "Files/shared", "Files/others"); - if(pathsToCheck.contains(tokenInput)) - return tokenInput + "/"; - return tokenInput; - - } - - /** - * Reject illegal resource names, like '.' or '..' or slashes '/'. - */ - static boolean isValidResourceName(String name) { - if (".".equals(name) || "..".equals(name) || name.contains("/")) - return false; - return true; - } - - public void putUserToMap(String _userName, String _userFullName){ - userFullNameMap.put(_userName, _userFullName); - } - - public String findUserFullName(String _userName){ - return userFullNameMap.get(_userName); - } - public void deleteFolder(final Folder folder) { String path = getApiPath() + getUsername() + "/" + folder.getContainer() + "?format=json&delimiter=/&prefix=" + folder.getPrefix(); RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, path); diff --git a/src/gr/grnet/pithos/web/client/StatusPanel.java b/src/gr/grnet/pithos/web/client/StatusPanel.java index 99a420c..4a06cbb 100644 --- a/src/gr/grnet/pithos/web/client/StatusPanel.java +++ b/src/gr/grnet/pithos/web/client/StatusPanel.java @@ -34,13 +34,6 @@ */ package gr.grnet.pithos.web.client; -import com.google.gwt.core.client.Scheduler; -import gr.grnet.pithos.web.client.foldertree.AccountResource; -import gr.grnet.pithos.web.client.rest.GetRequest; -import gr.grnet.pithos.web.client.rest.RestException; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.user.client.ui.AbstractImagePrototype; @@ -48,158 +41,37 @@ import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HorizontalPanel; -import java.util.Date; +import com.google.gwt.user.client.ui.VerticalPanel; /** * The panel that displays a status bar with quota information. */ public class StatusPanel extends Composite { - public static final boolean DONE = false; - private HTML fileCountLabel = new HTML(""); - private HTML fileSizeLabel = new HTML(""); - private HTML quotaIcon = new HTML(""); - private HTML quotaLabel = new HTML(""); - private HTML lastLoginLabel = new HTML(""); - private HTML currentLoginLabel = new HTML(""); - private HTML currentlyShowingLabel = new HTML(""); /** - * An image bundle for this widget's images. - */ - public interface Images extends ClientBundle { - - @Source("gr/grnet/pithos/resources/windowlist.png") - ImageResource totalFiles(); - - @Source("gr/grnet/pithos/resources/database.png") - ImageResource totalSize(); - - @Source("gr/grnet/pithos/resources/redled.png") - ImageResource redSize(); - - @Source("gr/grnet/pithos/resources/greenled.png") - ImageResource greenSize(); - - @Source("gr/grnet/pithos/resources/yellowled.png") - ImageResource yellowSize(); - - @Source("gr/grnet/pithos/resources/xclock.png") - ImageResource lastLogin(); - } - - private final Images images; - - private Pithos app; - - /** * The constructor of the status panel. - * - * @param theImages the supplied images */ - public StatusPanel(Pithos _app, Images theImages) { - app = _app; - images = theImages; + public StatusPanel() { HorizontalPanel outer = new HorizontalPanel(); outer.setWidth("100%"); - outer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); - - HorizontalPanel left = new HorizontalPanel(); - left.setSpacing(8); - HorizontalPanel middle = new HorizontalPanel(); - middle.setSpacing(8); - HorizontalPanel right = new HorizontalPanel(); - right.setSpacing(8); - outer.add(left); - outer.add(middle); - outer.add(right); - left.add(new HTML("Totals: ")); - left.add(AbstractImagePrototype.create(images.totalFiles()).createImage()); - left.add(fileCountLabel); - left.add(AbstractImagePrototype.create(images.totalSize()).createImage()); - left.add(fileSizeLabel); - quotaIcon.setHTML(AbstractImagePrototype.create(images.greenSize()).getHTML()); - left.add(quotaIcon); - left.add(quotaLabel); - middle.add(AbstractImagePrototype.create(images.lastLogin()).createImage()); - middle.add(new HTML("Last login: ")); - middle.add(lastLoginLabel); - middle.add(new HTML("\u0387 Current session login: ")); - middle.add(currentLoginLabel); - right.add(currentlyShowingLabel); - outer.setStyleName("statusbar-inner"); - left.setStyleName("statusbar-inner"); - middle.setStyleName("statusbar-inner"); - right.setStyleName("statusbar-inner"); - outer.setCellHorizontalAlignment(right, HasHorizontalAlignment.ALIGN_RIGHT); - + outer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); + + VerticalPanel inner = new VerticalPanel(); + inner.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); + HorizontalPanel firstLine = new HorizontalPanel(); + firstLine.setSpacing(8); + firstLine.add(new HTML("About |")); + firstLine.add(new HTML("Help |")); + firstLine.add(new HTML("Contact |")); + firstLine.add(new HTML("Terms |")); + firstLine.add(new HTML("Privacy")); + inner.add(firstLine); + + HorizontalPanel secondLine = new HorizontalPanel(); + secondLine.add(new HTML("Copyright (C) 2011 Greek Research and Technology Network")); + inner.add(secondLine); + + outer.add(inner); initWidget(outer); } - - /** - * Refresh the widget with the provided statistics. - */ - public void displayStats(AccountResource account) { - if (account.getNumberOfObjects() == 1) - fileCountLabel.setHTML("1 object"); - else - fileCountLabel.setHTML(account.getNumberOfObjects() + " objects"); - fileSizeLabel.setHTML(account.getFileSizeAsString() + " used"); - long pc = (long) ((double) account.getBytesRemaining()/(account.getBytesRemaining() + account.getBytesUsed()) + 0.5); - if (pc < 10) { - quotaIcon.setHTML(AbstractImagePrototype.create(images.redSize()).getHTML()); - quotaLabel.setHTML(account.getQuotaLeftAsString() + " free"); - } else if(pc<20) { - quotaIcon.setHTML(AbstractImagePrototype.create(images.yellowSize()).getHTML()); - quotaLabel.setHTML(account.getQuotaLeftAsString() +" free"); - } else { - quotaIcon.setHTML(AbstractImagePrototype.create(images.greenSize()).getHTML()); - quotaLabel.setHTML(account.getQuotaLeftAsString() +" free"); - } - final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a"); - Date login = account.getLastLogin(); - lastLoginLabel.setHTML(login == null ? "" : formatter.format(login)); - - login = account.getCurrentLogin(); - currentLoginLabel.setHTML(login == null ? "" : formatter.format(login)); - } - - /** - * Requests updated quota information from the server and refreshes - * the display. - */ - //TODO: This should not be done here - public void updateStats() { - GetRequest getAccount = new GetRequest(AccountResource.class, app.getApiPath(), app.getUsername(), "") { - @Override - public void onSuccess(AccountResource result) { - displayStats(result); - } - - @Override - public void onError(Throwable t) { - if(t instanceof RestException) - app.displayError("Unable to fetch quota:" + - ((RestException)t).getHttpStatusText()); - else - app.displayError("System error fetching quota:" + - t.getMessage()); - GWT.log("ERR", t); - } - }; - getAccount.setHeader("X-Auth-Token", app.getToken()); - Scheduler.get().scheduleDeferred(getAccount); - } - - /** - * Displays the statistics for the current folder. - * - * @param text the statistics to display - */ - public void updateCurrentlyShowing(String text) { - if (text == null) - currentlyShowingLabel.setText(""); - else - currentlyShowingLabel.setHTML(" Showing: " + text); - } - } -- 1.7.10.4