Smaller font for the statistics (issue #2239)
[pithos-web-client] / src / gr / grnet / pithos / web / client / VersionsList.java
index 1e546a7..b3634a8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011 GRNET S.A. All rights reserved.
+ * Copyright 2011-2012 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -34,7 +34,7 @@
  */
 package gr.grnet.pithos.web.client;
 
-import gr.grnet.pithos.web.client.FilePropertiesDialog.Images;
+import gr.grnet.pithos.web.client.FileVersionsDialog.Images;
 import gr.grnet.pithos.web.client.foldertree.File;
 import gr.grnet.pithos.web.client.foldertree.Resource;
 import gr.grnet.pithos.web.client.foldertree.Version;
@@ -46,16 +46,23 @@ import java.util.List;
 import com.google.gwt.core.client.Scheduler;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.ScrollHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.http.client.Response;
 import com.google.gwt.http.client.URL;
 import com.google.gwt.i18n.client.DateTimeFormat;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.AbstractImagePrototype;
 import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.CustomScrollPanel;
 import com.google.gwt.user.client.ui.FlexTable;
 import com.google.gwt.user.client.ui.HTML;
 import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.NativeVerticalScrollbar;
+import com.google.gwt.user.client.ui.ScrollPanel;
 import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.VerticalScrollbar;
+import com.google.gwt.user.client.ui.Widget;
 
 public class VersionsList extends Composite {
 
@@ -67,13 +74,13 @@ public class VersionsList extends Composite {
     
     private Images images;
     
-    private VerticalPanel permPanel = new VerticalPanel();
+    private CustomScrollPanel permPanel = new CustomScrollPanel();
     
     private FlexTable permTable = new FlexTable();
 
-       FilePropertiesDialog container;
+    FileVersionsDialog container;
 
-       public VersionsList(Pithos _app, FilePropertiesDialog aContainer, final Images theImages, File _file, List<Version> theVersions) {
+       public VersionsList(Pithos _app, FileVersionsDialog aContainer, final Images theImages, File _file, List<Version> theVersions) {
         app = _app;
                images = theImages;
                container = aContainer;
@@ -89,7 +96,8 @@ public class VersionsList extends Composite {
                permTable.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
                permTable.getFlexCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);
                permPanel.add(permTable);
-               permPanel.addStyleName("pithos-TabPanelBottom");
+               permPanel.addStyleName("pithos-versionList");
+               permPanel.setSize("260px", "150px");
                permTable.addStyleName("pithos-permList");
                initWidget(permPanel);
                showVersionsTable();
@@ -102,7 +110,7 @@ public class VersionsList extends Composite {
                        HTML restoreVersion = new HTML("<a href='#' class='hidden-link info'><span>" + AbstractImagePrototype.create(images.restore()).getHTML() + "</span><div>Restore this Version</div></a>");
                        restoreVersion.addClickHandler(new ClickHandler() {
                                @Override
-                               public void onClick(@SuppressWarnings("unused") ClickEvent event) {
+                               public void onClick(ClickEvent event) {
                                        restoreVersion(v.getVersion());
                                }
                        });
@@ -115,8 +123,8 @@ public class VersionsList extends Composite {
                        HTML downloadHtml = new HTML("<a class='hidden-link info' href='#'><span>" + AbstractImagePrototype.create(images.download()).getHTML()+"</span><div>View this Version</div></a>");
                        downloadHtml.addClickHandler(new ClickHandler() {
                                @Override
-                               public void onClick(@SuppressWarnings("unused") ClickEvent event) {
-                                       String fileUrl = app.getApiPath() + file.getOwner() + file.getUri() + "?X-Auth-Token=" + app.getToken() + "&version=" + v.getVersion();
+                               public void onClick(ClickEvent event) {
+                                       String fileUrl = app.getApiPath() + file.getOwner() + file.getUri() + "?version=" + v.getVersion();
                                        Window.open(fileUrl, "_BLANK", "");
                                }
                        });
@@ -135,12 +143,13 @@ public class VersionsList extends Composite {
                PostRequest restoreVersion = new PostRequest(app.getApiPath(), file.getOwner(), path) {
                        
                        @Override
-                       public void onSuccess(@SuppressWarnings("unused") Resource result) {
+                       public void onSuccess(Resource result) {
                                container.hide();
                        }
                        
                        @Override
                        public void onError(Throwable t) {
+                               app.setError(t);
                 if (t instanceof RestException) {
                        if (((RestException) t).getHttpStatusCode() == Response.SC_NO_CONTENT)
                                onSuccess(null);