CSS fun
authorChristos Stathis <chstath@ebs.gr>
Wed, 19 Oct 2011 13:38:46 +0000 (16:38 +0300)
committerChristos Stathis <chstath@ebs.gr>
Wed, 19 Oct 2011 13:38:46 +0000 (16:38 +0300)
src/gr/grnet/pithos/web/client/Pithos.java
src/gr/grnet/pithos/web/client/PithosCellTreeBasic.css
src/gr/grnet/pithos/web/client/foldertree/FolderTreeView.java
src/gr/grnet/pithos/web/client/foldertree/FolderTreeViewModel.java
src/gr/grnet/pithos/web/client/grouptree/GroupTreeViewModel.java
src/gr/grnet/pithos/web/public/pithos.css

index 3dde305..214135e 100644 (file)
@@ -91,6 +91,7 @@ import com.google.gwt.user.client.History;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.AbstractImagePrototype;
 import com.google.gwt.user.client.ui.Button;
+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.HasVerticalAlignment;
@@ -244,6 +245,8 @@ public class Pithos implements EntryPoint, ResizeHandler {
     protected AccountResource account;
     
     Folder trash;
+    
+    List<Composite> treeViews = new ArrayList<Composite>();
 
     @SuppressWarnings("rawtypes") List<SingleSelectionModel> selectionModels = new ArrayList<SingleSelectionModel>();
     
@@ -292,6 +295,8 @@ public class Pithos implements EntryPoint, ResizeHandler {
         HorizontalPanel header = new HorizontalPanel();
         header.addStyleName("pithos-header");
         header.setWidth(contentWidth);
+        if (bareContent)
+               header.addStyleName("pithos-header-noframe");
         HorizontalPanel leftHeader = new HorizontalPanel();
         VerticalPanel uploadButtonPanel = new VerticalPanel();
         upload = new Button("Upload File", new ClickHandler() {
@@ -355,25 +360,24 @@ public class Pithos implements EntryPoint, ResizeHandler {
                 if (folderTreeSelectionModel.getSelectedObject() != null) {
                     deselectOthers(folderTreeView, folderTreeSelectionModel);
                     applyPermissions(folderTreeSelectionModel.getSelectedObject());
-                    folderTreeView.addStyleName("cellTreeWidget-selectedTree");
                     Folder f = folderTreeSelectionModel.getSelectedObject();
                     showFiles(f);
                 }
-                else
-                    folderTreeView.removeStyleName("cellTreeWidget-selectedTree");
             }
         });
         selectionModels.add(folderTreeSelectionModel);
 
         folderTreeViewModel = new FolderTreeViewModel(this, folderTreeSelectionModel);
         folderTreeView = new FolderTreeView(folderTreeViewModel);
-
+        treeViews.add(folderTreeView);
+        
         fileList = new FileList(this, images, folderTreeView);
         inner.add(fileList);
 
         groupTreeViewModel = new GroupTreeViewModel(this);
         groupTreeView = new GroupTreeView(groupTreeViewModel);
-
+        treeViews.add(groupTreeView);
+        
         trees = new VerticalPanel();
         trees.setWidth("100%");
 
@@ -419,6 +423,8 @@ public class Pithos implements EntryPoint, ResizeHandler {
                outer.add(statusPanel);
                outer.setCellHorizontalAlignment(statusPanel, HasHorizontalAlignment.ALIGN_CENTER);
         }
+        else
+               splitPanel.addStyleName("pithos-splitPanel-noframe");
 
         // Hook the window resize event, so that we can adjust the UI.
         Window.addResizeHandler(this);
@@ -492,6 +498,13 @@ public class Pithos implements EntryPoint, ResizeHandler {
        @SuppressWarnings({ "rawtypes", "unchecked" })
        public void deselectOthers(TreeView _selectedTree, SingleSelectionModel model) {
        selectedTree = _selectedTree;
+       
+       for (Composite c : treeViews)
+               if (c.equals(selectedTree))
+                       c.addStyleName("cellTreeWidget-selectedTree");
+               else
+                       c.removeStyleName("cellTreeWidget-selectedTree");
+       
         for (SingleSelectionModel s : selectionModels)
             if (!s.equals(model))
                 s.setSelected(s.getSelectedObject(), false);
@@ -710,7 +723,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
 
        protected void onWindowResized(int height) {
                // Adjust the split panel to take up the available room in the window.
-               int newHeight = height - splitPanel.getAbsoluteTop() - 60;
+               int newHeight = height - splitPanel.getAbsoluteTop();
                if (newHeight < 1)
                        newHeight = 1;
                splitPanel.setHeight("" + newHeight);
@@ -1116,10 +1129,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
                            deselectOthers(mysharedTreeView, mysharedTreeSelectionModel);
                            upload.setEnabled(false);
                            updateSharedFolder(mysharedTreeSelectionModel.getSelectedObject(), true);
-                           mysharedTreeView.addStyleName("cellTreeWidget-selectedTree");
                        }
-                else
-                    mysharedTreeView.removeStyleName("cellTreeWidget-selectedTree");
                    }
                });
                selectionModels.add(mysharedTreeSelectionModel);
@@ -1129,7 +1139,8 @@ public class Pithos implements EntryPoint, ResizeHandler {
                        @Override
                        public void execute() {
                            mysharedTreeView = new MysharedTreeView(mysharedTreeViewModel);
-                               trees.insert(mysharedTreeView, 3);
+                               trees.insert(mysharedTreeView, 2);
+                               treeViews.add(mysharedTreeView);
                                createOtherSharedTree();
                        }
                });
@@ -1142,12 +1153,10 @@ public class Pithos implements EntryPoint, ResizeHandler {
                    public void onSelectionChange(@SuppressWarnings("unused") SelectionChangeEvent event) {
                        if (otherSharedTreeSelectionModel.getSelectedObject() != null) {
                            deselectOthers(otherSharedTreeView, otherSharedTreeSelectionModel);
+                           otherSharedTreeView.addStyleName("cellTreeWidget-selectedTree");
                            applyPermissions(otherSharedTreeSelectionModel.getSelectedObject());
                            updateOtherSharedFolder(otherSharedTreeSelectionModel.getSelectedObject(), true);
-                           otherSharedTreeView.addStyleName("cellTreeWidget-selectedTree");
                        }
-                else
-                    otherSharedTreeView.removeStyleName("cellTreeWidget-selectedTree");
                    }
                });
                selectionModels.add(otherSharedTreeSelectionModel);
@@ -1157,7 +1166,8 @@ public class Pithos implements EntryPoint, ResizeHandler {
                        @Override
                        public void execute() {
                            otherSharedTreeView = new OtherSharedTreeView(otherSharedTreeViewModel);
-                               trees.insert(otherSharedTreeView, 4);
+                               trees.insert(otherSharedTreeView, 3);
+                               treeViews.add(otherSharedTreeView);
                        }
                });
        }
index 9f66186..c82fce2 100644 (file)
   outline: none;
 }
 
+.cellTreeItemValue img {
+       vertical-align: middle;
+}
+
 .cellTreeItem:HOVER {
        background-color: #A1C8DB;
 }
index 9a6cc61..72d59fd 100644 (file)
@@ -145,7 +145,7 @@ public class FolderTreeView extends Composite implements TreeView {
     static interface Templates extends SafeHtmlTemplates {
         public Templates INSTANCE = GWT.create(Templates.class);
 
-        @Template("<span class='pithos-folderLabel'>{0}</span>")
+        @Template("<span style='vertical-align: middle;'>{0}</span>")
         public SafeHtml nameSpan(String name);
 
         @Template("<span class='pithos-folderLabel'>{0}</span>")
index 085b496..abcc81d 100644 (file)
@@ -59,6 +59,7 @@ import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
 import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.ui.AbstractImagePrototype;
 import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.UIObject;
 import com.google.gwt.view.client.AsyncDataProvider;
 import com.google.gwt.view.client.HasData;
 import com.google.gwt.view.client.ListDataProvider;
index 201e46e..bf70121 100644 (file)
@@ -140,11 +140,8 @@ public class GroupTreeViewModel implements TreeViewModel {
                        public void onSelectionChange(SelectionChangeEvent event) {
                                if (rootSelectionModel.getSelectedObject() != null) {
                                        app.deselectOthers(app.getGroupTreeView(), rootSelectionModel);
-                                       app.getGroupTreeView().addStyleName("cellTreeWidget-selectedTree");
                                        app.showFiles(new HashSet<File>());
                                }
-                else
-                    app.getGroupTreeView().removeStyleName("cellTreeWidget-selectedTree");
                        }
                });
 
index f26ca67..1c2914f 100644 (file)
@@ -4,6 +4,7 @@ body {
        font-size: 16px;
        margin: 8px;
        margin-top: 3px;
+       background-color: transparent;
 }
 
 table td {
@@ -343,6 +344,10 @@ table.pithos-permList.props-labels {
        margin-bottom: 34px;
 }
 
+.pithos-splitPanel-noframe {
+       margin-bottom: 0;
+}
+
 /* Use the background color for the splitter. */
 .gwt-HorizontalSplitPanel .hsplitter {
        cursor: move;
@@ -405,7 +410,10 @@ table.pithos-permList.props-labels {
        margin-top: 34;
 }
 
+.pithos-header-noframe {
+       margin-top: 0;
+}
+
 .cellTreeWidget-selectedTree {
     background-color: #a1c8da;
 }
-