Various CSS changes
[pithos] / web_client / src / gr / grnet / pithos / web / client / Pithos.java
index 050a297..75bda35 100644 (file)
@@ -77,6 +77,7 @@ import com.google.gwt.http.client.RequestCallback;
 import com.google.gwt.http.client.RequestException;
 import com.google.gwt.http.client.Response;
 import com.google.gwt.http.client.URL;
+import com.google.gwt.i18n.client.NumberFormat;
 import com.google.gwt.json.client.JSONArray;
 import com.google.gwt.json.client.JSONObject;
 import com.google.gwt.json.client.JSONParser;
@@ -267,27 +268,50 @@ public class Pithos implements EntryPoint, ResizeHandler {
        }
 
     private void initialize() {
-        VerticalPanel outer = new VerticalPanel();
+       boolean bareContent = Window.Location.getParameter("noframe") != null;
+       String contentWidth = bareContent ? "100%" : "75%";
+
+       VerticalPanel outer = new VerticalPanel();
         outer.setWidth("100%");
+       if (!bareContent) {
+               outer.addStyleName("pithos-outer");
+       }
 
-        topPanel = new TopPanel(this, Pithos.images);
-        topPanel.setWidth("75%");
-        outer.add(topPanel);
-        outer.setCellHorizontalAlignment(topPanel, HasHorizontalAlignment.ALIGN_CENTER);
+        if (!bareContent) {
+               topPanel = new TopPanel(this, Pithos.images);
+               topPanel.setWidth("100%");
+               outer.add(topPanel);
+               outer.setCellHorizontalAlignment(topPanel, HasHorizontalAlignment.ALIGN_CENTER);
+        }
         
-        messagePanel.setWidth("75%");
+        messagePanel.setWidth(contentWidth);
         messagePanel.setVisible(false);
         outer.add(messagePanel);
         outer.setCellHorizontalAlignment(messagePanel, HasHorizontalAlignment.ALIGN_CENTER);
 
-
-        // Inner contains the various lists.
-        inner.sinkEvents(Event.ONCONTEXTMENU);
-        inner.setWidth("100%");
-
-        HorizontalPanel rightside = new HorizontalPanel();
-        rightside.addStyleName("pithos-rightSide");
-        rightside.setSpacing(5);
+        HorizontalPanel header = new HorizontalPanel();
+        header.addStyleName("pithos-header");
+        HorizontalPanel leftHeader = new HorizontalPanel();
+        VerticalPanel uploadButtonPanel = new VerticalPanel();
+        upload = new Button("Upload File", new ClickHandler() {
+            @Override
+            public void onClick(@SuppressWarnings("unused") ClickEvent event) {
+                new UploadFileCommand(Pithos.this, null, getSelection()).execute();
+            }
+        });
+        upload.addStyleName("pithos-uploadButton");
+        uploadButtonPanel.add(upload);
+        uploadButtonPanel.setWidth("100%");
+        uploadButtonPanel.setHeight("60px");
+        uploadButtonPanel.setCellHorizontalAlignment(upload, HasHorizontalAlignment.ALIGN_LEFT);
+        uploadButtonPanel.setCellVerticalAlignment(upload, HasVerticalAlignment.ALIGN_MIDDLE);
+        leftHeader.add(uploadButtonPanel);
+        header.add(leftHeader);
+        header.setCellWidth(leftHeader, "35%");
+        
+        HorizontalPanel rightHeader = new HorizontalPanel();
+        rightHeader.addStyleName("pithos-rightSide");
+        rightHeader.setSpacing(5);
 
         toolsButton = new Button(AbstractImagePrototype.create(images.tools()).getHTML());
         toolsButton.addClickHandler(new ClickHandler() {
@@ -301,21 +325,27 @@ public class Pithos implements EntryPoint, ResizeHandler {
                 }
                        }
                });
-        rightside.add(toolsButton);
-        rightside.setCellHorizontalAlignment(toolsButton, HasHorizontalAlignment.ALIGN_LEFT);
+        rightHeader.add(toolsButton);
+        rightHeader.setCellHorizontalAlignment(toolsButton, HasHorizontalAlignment.ALIGN_LEFT);
         
         HorizontalPanel folderStatistics = new HorizontalPanel();
         folderStatistics.addStyleName("pithos-folderStatistics");
         numOfFiles = new HTML();
         folderStatistics.add(numOfFiles);
+        folderStatistics.setCellVerticalAlignment(numOfFiles, HasVerticalAlignment.ALIGN_MIDDLE);
         HTML numOfFilesLabel = new HTML(" Files");
         folderStatistics.add(numOfFilesLabel);
-        rightside.add(folderStatistics);
-        rightside.setCellHorizontalAlignment(folderStatistics, HasHorizontalAlignment.ALIGN_RIGHT);
-
-        inner.add(rightside);
-        inner.setCellVerticalAlignment(rightside, HasVerticalAlignment.ALIGN_MIDDLE);
-        inner.setCellHeight(rightside, "60px");
+        folderStatistics.setCellVerticalAlignment(numOfFilesLabel, HasVerticalAlignment.ALIGN_MIDDLE);
+        rightHeader.add(folderStatistics);
+        rightHeader.setCellHorizontalAlignment(folderStatistics, HasHorizontalAlignment.ALIGN_RIGHT);
+        header.add(rightHeader);
+        header.setCellVerticalAlignment(rightHeader, HasVerticalAlignment.ALIGN_MIDDLE);
+        header.setCellHeight(rightHeader, "60px");
+        outer.add(header);
+        outer.setCellHorizontalAlignment(header, HasHorizontalAlignment.ALIGN_CENTER);
+        // Inner contains the various lists.nner
+        inner.sinkEvents(Event.ONCONTEXTMENU);
+        inner.setWidth("100%");
 
         folderTreeSelectionModel = new SingleSelectionModel<Folder>();
         folderTreeSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@@ -325,7 +355,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
                     deselectOthers(folderTreeView, folderTreeSelectionModel);
                     applyPermissions(folderTreeSelectionModel.getSelectedObject());
                     Folder f = folderTreeSelectionModel.getSelectedObject();
-                    updateFolder(f, true, null);
+                    showFiles(f);
                 }
             }
         });
@@ -343,26 +373,13 @@ public class Pithos implements EntryPoint, ResizeHandler {
         trees = new VerticalPanel();
         trees.setWidth("100%");
 
-        VerticalPanel uploadButtonPanel = new VerticalPanel();
-        upload = new Button("Upload File", new ClickHandler() {
-            @Override
-            public void onClick(@SuppressWarnings("unused") ClickEvent event) {
-                new UploadFileCommand(Pithos.this, null, getSelection()).execute();
-            }
-        });
-        uploadButtonPanel.add(upload);
-        uploadButtonPanel.setWidth("100%");
-        uploadButtonPanel.setHeight("60px");
-        uploadButtonPanel.setCellHorizontalAlignment(upload, HasHorizontalAlignment.ALIGN_CENTER);
-        uploadButtonPanel.setCellVerticalAlignment(upload, HasVerticalAlignment.ALIGN_MIDDLE);
-        upload.addStyleName("pithos-uploadButton");
-        trees.add(uploadButtonPanel);
         
         HorizontalPanel treeHeader = new HorizontalPanel();
         treeHeader.addStyleName("pithos-treeHeader");
-        treeHeader.setWidth("100%");
         treeHeader.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
+        treeHeader.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
         HorizontalPanel statistics = new HorizontalPanel();
+        statistics.addStyleName("pithos-statistics");
         statistics.add(new HTML("Total Objects:&nbsp;"));
         totalFiles = new HTML();
         statistics.add(totalFiles);
@@ -375,8 +392,9 @@ public class Pithos implements EntryPoint, ResizeHandler {
         statistics.add(new HTML("&nbsp;("));
         usedPercent = new HTML();
         statistics.add(usedPercent);
-        statistics.add(new HTML("%)"));
+        statistics.add(new HTML(")"));
         treeHeader.add(statistics);
+        treeHeader.setCellHorizontalAlignment(statistics, HasHorizontalAlignment.ALIGN_LEFT);
         trees.add(treeHeader);
 
         trees.add(folderTreeView);
@@ -387,14 +405,16 @@ public class Pithos implements EntryPoint, ResizeHandler {
         splitPanel.setSplitPosition("35%");
         splitPanel.setSize("100%", "100%");
         splitPanel.addStyleName("pithos-splitPanel");
-        splitPanel.setWidth("75%");
+        splitPanel.setWidth(contentWidth);
         outer.add(splitPanel);
         outer.setCellHorizontalAlignment(splitPanel, HasHorizontalAlignment.ALIGN_CENTER);
 
-        statusPanel = new StatusPanel();
-        statusPanel.setWidth("75%");
-        outer.add(statusPanel);
-        outer.setCellHorizontalAlignment(statusPanel, HasHorizontalAlignment.ALIGN_CENTER);
+        if (!bareContent) {
+               statusPanel = new StatusPanel();
+               statusPanel.setWidth("100%");
+               outer.add(statusPanel);
+               outer.setCellHorizontalAlignment(statusPanel, HasHorizontalAlignment.ALIGN_CENTER);
+        }
 
         // Hook the window resize event, so that we can adjust the UI.
         Window.addResizeHandler(this);
@@ -432,9 +452,14 @@ public class Pithos implements EntryPoint, ResizeHandler {
                                                        trash = f;
                                                        break;
                                                }
-                                   folderTreeViewModel.initialize(account);
+                                   folderTreeViewModel.initialize(account, new Command() {
+                                                               
+                                                               @Override
+                                                               public void execute() {
+                                                   createMySharedTree();
+                                                               }
+                                                       });
                                    groupTreeViewModel.initialize();
-                                   createMySharedTree();
                                    showStatistics();
                                }
                                        }
@@ -604,7 +629,8 @@ public class Pithos implements EntryPoint, ResizeHandler {
        totalFiles.setHTML(String.valueOf(account.getNumberOfObjects()));
        usedBytes.setHTML(String.valueOf(account.getFileSizeAsString()));
        totalBytes.setHTML(String.valueOf(account.getQuotaAsString()));
-       usedPercent.setHTML(String.valueOf(account.getUsedPercentage()));
+       NumberFormat nf = NumberFormat.getPercentFormat();
+       usedPercent.setHTML(nf.format(account.getUsedPercentage()));
        }
 
        protected void createHomeContainer(final AccountResource _account, final Command callback) {