Preliminary impl of others shared
authorChristos Stathis <chstath@ebs.gr>
Fri, 19 Aug 2011 15:55:32 +0000 (18:55 +0300)
committerChristos Stathis <chstath@ebs.gr>
Fri, 19 Aug 2011 15:55:32 +0000 (18:55 +0300)
43 files changed:
web_client/src/gr/grnet/pithos/web/client/Pithos.java
web_client/src/gr/grnet/pithos/web/client/SharingUsers.java [new file with mode: 0644]
web_client/src/gr/grnet/pithos/web/client/foldertree/Resource.java
web_client/src/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView.java [new file with mode: 0644]
web_client/src/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel.java [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$1.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$10.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$11.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$12.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$13.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$14.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$15.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$16.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$17$1$1.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$17$1.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$17.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$2.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$3.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$4.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$5.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$6.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$7.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$8.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$9.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/SharingUsers.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/foldertree/Resource.class
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView$BasicResources.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView$Images.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView$Templates.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$1.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$2.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$3.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$4.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$5.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$6.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$7$1.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$7.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$8.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$9$1.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$9.class [new file with mode: 0644]
web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel.class [new file with mode: 0644]

index ad5be52..daf4d09 100644 (file)
@@ -70,6 +70,8 @@ import gr.grnet.pithos.web.client.foldertree.FolderTreeViewModel;
 import gr.grnet.pithos.web.client.foldertree.Resource;
 import gr.grnet.pithos.web.client.mysharedtree.MysharedTreeView;
 import gr.grnet.pithos.web.client.mysharedtree.MysharedTreeViewModel;
+import gr.grnet.pithos.web.client.othersharedtree.OtherSharedTreeView;
+import gr.grnet.pithos.web.client.othersharedtree.OtherSharedTreeViewModel;
 import gr.grnet.pithos.web.client.rest.DeleteRequest;
 import gr.grnet.pithos.web.client.rest.GetRequest;
 import gr.grnet.pithos.web.client.rest.PutRequest;
@@ -140,6 +142,10 @@ public class Pithos implements EntryPoint, ResizeHandler {
        mysharedTreeView.updateFolder(f, showfiles);
     }
     
+    public void updateOtherSharedFolder(Folder f, boolean showfiles) {
+       otherSharedTreeView.updateFolder(f, showfiles);
+    }
+
     public void updateTag(Tag t) {
         tagTreeView.updateTag(t);
     }
@@ -243,6 +249,10 @@ public class Pithos implements EntryPoint, ResizeHandler {
     private MysharedTreeViewModel mysharedTreeViewModel;
     private MysharedTreeView mysharedTreeView;
 
+    private SingleSelectionModel<Folder> otherSharedTreeSelectionModel;
+    private OtherSharedTreeViewModel otherSharedTreeViewModel;
+    private OtherSharedTreeView otherSharedTreeView;
+
     private SingleSelectionModel<Tag> tagTreeSelectionModel;
     private TagTreeViewModel tagTreeViewModel;
     private TagTreeView tagTreeView;
@@ -329,6 +339,20 @@ public class Pithos implements EntryPoint, ResizeHandler {
         mysharedTreeViewModel = new MysharedTreeViewModel(this, mysharedTreeSelectionModel);
         mysharedTreeView = new MysharedTreeView(mysharedTreeViewModel);
 
+        otherSharedTreeSelectionModel = new SingleSelectionModel<Folder>();
+        otherSharedTreeSelectionModel.addSelectionChangeHandler(new Handler() {
+            @Override
+            public void onSelectionChange(SelectionChangeEvent event) {
+                if (otherSharedTreeSelectionModel.getSelectedObject() != null) {
+                    deselectOthers(otherSharedTreeSelectionModel);
+                    updateOtherSharedFolder(otherSharedTreeSelectionModel.getSelectedObject(), true);
+                }
+            }
+        });
+        selectionModels.add(otherSharedTreeSelectionModel);
+        otherSharedTreeViewModel = new OtherSharedTreeViewModel(this, otherSharedTreeSelectionModel);
+        otherSharedTreeView = new OtherSharedTreeView(otherSharedTreeViewModel);
+
         tagTreeSelectionModel = new SingleSelectionModel<Tag>();
         tagTreeSelectionModel.addSelectionChangeHandler(new Handler() {
             @Override
@@ -362,6 +386,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
 
         trees.add(folderTreeView);
         trees.add(mysharedTreeView);
+        trees.add(otherSharedTreeView);
 //        trees.add(tagTreeView);
         // Add the left and right panels to the split panel.
         splitPanel.setLeftWidget(trees);
@@ -852,4 +877,8 @@ public class Pithos implements EntryPoint, ResizeHandler {
     public void addSelectionModel(SingleSelectionModel model) {
        selectionModels.add(model);
     }
+
+       public OtherSharedTreeView getOtherSharedTreeView() {
+               return otherSharedTreeView;
+       }
 }
diff --git a/web_client/src/gr/grnet/pithos/web/client/SharingUsers.java b/web_client/src/gr/grnet/pithos/web/client/SharingUsers.java
new file mode 100644 (file)
index 0000000..4db725c
--- /dev/null
@@ -0,0 +1,45 @@
+package gr.grnet.pithos.web.client;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import com.google.gwt.http.client.Response;
+import com.google.gwt.json.client.JSONArray;
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONParser;
+import com.google.gwt.json.client.JSONValue;
+
+import gr.grnet.pithos.web.client.foldertree.Resource;
+
+public class SharingUsers extends Resource {
+       private List<String> users;
+
+       public static SharingUsers createFromResponse(Response response, SharingUsers result) {
+               SharingUsers u;
+               if (result == null)
+                       u = new SharingUsers();
+               else
+                       u = result;
+               u.populate(response);
+               return u;
+       }
+
+       private void populate(Response response) {
+               users = new ArrayList<String>();
+        JSONValue json = JSONParser.parseStrict(response.getText());
+        JSONArray array = json.isArray();
+        if (array != null) {
+            for (int i=0; i<array.size(); i++) {
+                JSONObject o = array.get(i).isObject();
+                if (o != null) {
+                       users.add(unmarshallString(o, "name"));
+                }
+            }
+        }
+       }
+
+       public List<String> getUsers() {
+               return users;
+       }
+}
index 84a46e0..2805434 100644 (file)
@@ -40,6 +40,9 @@ import com.google.gwt.i18n.client.DateTimeFormat;
 import com.google.gwt.json.client.JSONNumber;
 import com.google.gwt.json.client.JSONObject;
 import com.google.gwt.json.client.JSONString;
+
+import gr.grnet.pithos.web.client.SharingUsers;
+
 import java.util.Date;
 
 public class Resource {
@@ -99,6 +102,9 @@ public class Resource {
         else if (aClass.equals(File.class)) {
             result = (T) File.createFromResponse(owner, response, (File) result);
         }
+        else if (aClass.equals(SharingUsers.class)) {
+               result = (T) SharingUsers.createFromResponse(response, (SharingUsers) result);
+        }
         return result;
     }
 }
diff --git a/web_client/src/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView.java b/web_client/src/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView.java
new file mode 100644 (file)
index 0000000..8d97029
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2011 GRNET S.A. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials
+ *      provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and
+ * documentation are those of the authors and should not be
+ * interpreted as representing official policies, either expressed
+ * or implied, of GRNET S.A.
+ */
+
+package gr.grnet.pithos.web.client.othersharedtree;
+
+import gr.grnet.pithos.web.client.FolderContextMenu;
+import gr.grnet.pithos.web.client.foldertree.Folder;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.resources.client.ImageResource.ImageOptions;
+import com.google.gwt.safehtml.client.SafeHtmlTemplates;
+import com.google.gwt.safehtml.shared.SafeHtml;
+import com.google.gwt.user.cellview.client.CellTree;
+import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy;
+import com.google.gwt.user.cellview.client.TreeNode;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Tree;
+
+public class OtherSharedTreeView extends Composite {
+
+    public void updateChildren(Folder folder) {
+        TreeNode root = ((CellTree) getWidget()).getRootTreeNode();
+        updateChildren(root, folder);
+    }
+
+    private void updateChildren(TreeNode node, Folder folder) {
+        for (int i=0; i<node.getChildCount(); i++) {
+            if (node.isChildOpen(i)) {
+                if (folder.equals(node.getChildValue(i))) {
+                    node.setChildOpen(i, false, true);
+                    node.setChildOpen(i, true, true);
+                }
+                else {
+                    TreeNode n = node.setChildOpen(i, true);
+                    updateChildren(n, folder);
+                }
+            }
+        }
+    }
+
+    static interface BasicResources extends CellTree.Resources {
+
+        @ImageOptions(flipRtl = true)
+        @Source("gr/grnet/pithos/web/client/cellTreeClosedItem.gif")
+        ImageResource cellTreeClosedItem();
+
+        @ImageOptions(flipRtl = true)
+        @Source("gr/grnet/pithos/web/client/cellTreeLoadingBasic.gif")
+        ImageResource cellTreeLoading();
+
+        @ImageOptions(flipRtl = true)
+        @Source("gr/grnet/pithos/web/client/cellTreeOpenItem.gif")
+        ImageResource cellTreeOpenItem();
+
+        @Source({"gr/grnet/pithos/web/client/GssCellTreeBasic.css"})
+        CellTree.Style cellTreeStyle();
+    }
+
+    public static interface Images extends ClientBundle,Tree.Resources, FolderContextMenu.Images {
+
+        @Source("gr/grnet/pithos/resources/folder_home.png")
+        ImageResource home();
+
+        @Source("gr/grnet/pithos/resources/2folder22.png")
+        public ImageResource folderYellow();
+
+        @Source("gr/grnet/pithos/resources/mimetypes/document.png")
+        ImageResource document();
+
+        @Source("gr/grnet/pithos/resources/othersshared.png")
+        ImageResource othersShared();
+
+        @Source("gr/grnet/pithos/resources/myshared22.png")
+        ImageResource myShared();
+
+        @Source("gr/grnet/pithos/resources/folder_user.png")
+        ImageResource sharedFolder();
+
+        @Source("gr/grnet/pithos/resources/trash.png")
+        ImageResource trash();
+    }
+
+    static Images images = GWT.create(Images.class);
+
+    static interface Templates extends SafeHtmlTemplates {
+        public Templates INSTANCE = GWT.create(Templates.class);
+
+        @Template("<span>{0}</span>")
+        public SafeHtml nameSpan(String name);
+      }
+
+    private OtherSharedTreeViewModel model;
+
+    public OtherSharedTreeView(OtherSharedTreeViewModel viewModel) {
+        this.model = viewModel;
+        /*
+         * Create the tree using the model. We use <code>null</code> as the default
+         * value of the root node. The default value will be passed to
+         * CustomTreeModel#getNodeInfo();
+         */
+        CellTree.Resources res = GWT.create(BasicResources.class);
+        CellTree tree = new CellTree(model, null, res);
+        tree.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
+
+        initWidget(tree);
+    }
+
+
+    public Folder getSelection() {
+       return model.getSelection();
+    }
+
+    public void updateFolder(Folder folder, boolean showfiles) {
+        model.updateFolder(folder, showfiles);
+    }
+}
diff --git a/web_client/src/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel.java b/web_client/src/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel.java
new file mode 100644 (file)
index 0000000..9625491
--- /dev/null
@@ -0,0 +1,324 @@
+/*
+ * Copyright 2011 GRNET S.A. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials
+ *      provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and
+ * documentation are those of the authors and should not be
+ * interpreted as representing official policies, either expressed
+ * or implied, of GRNET S.A.
+ */
+
+package gr.grnet.pithos.web.client.othersharedtree;
+
+import gr.grnet.pithos.web.client.FolderContextMenu;
+import gr.grnet.pithos.web.client.Pithos;
+import gr.grnet.pithos.web.client.SharingUsers;
+import gr.grnet.pithos.web.client.foldertree.Folder;
+import gr.grnet.pithos.web.client.mysharedtree.MysharedTreeView;
+import gr.grnet.pithos.web.client.othersharedtree.OtherSharedTreeView.Templates;
+import gr.grnet.pithos.web.client.rest.GetRequest;
+import gr.grnet.pithos.web.client.rest.RestException;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.google.gwt.cell.client.AbstractCell;
+import com.google.gwt.cell.client.Cell;
+import com.google.gwt.cell.client.TextCell;
+import com.google.gwt.cell.client.ValueUpdater;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.event.dom.client.ContextMenuEvent;
+import com.google.gwt.safehtml.shared.SafeHtml;
+import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+import com.google.gwt.text.shared.SafeHtmlRenderer;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.ui.AbstractImagePrototype;
+import com.google.gwt.view.client.ListDataProvider;
+import com.google.gwt.view.client.SelectionChangeEvent;
+import com.google.gwt.view.client.SelectionChangeEvent.Handler;
+import com.google.gwt.view.client.SingleSelectionModel;
+import com.google.gwt.view.client.TreeViewModel;
+
+public class OtherSharedTreeViewModel implements TreeViewModel {
+
+    protected Pithos app;
+
+    private Cell<Folder> folderCell = new AbstractCell<Folder>(ContextMenuEvent.getType().getName()) {
+
+       @Override
+        public void render(Context context, Folder folder, SafeHtmlBuilder safeHtmlBuilder) {
+            String html = AbstractImagePrototype.create(OtherSharedTreeView.images.folderYellow()).getHTML();
+            safeHtmlBuilder.appendHtmlConstant(html);
+            safeHtmlBuilder.append(Templates.INSTANCE.nameSpan(folder.getName()));
+        }
+
+        @Override
+        public void onBrowserEvent(Context context, com.google.gwt.dom.client.Element parent, Folder folder, com.google.gwt.dom.client.NativeEvent event, ValueUpdater<Folder> valueUpdater) {
+            if (event.getType().equals(ContextMenuEvent.getType().getName())) {
+                OtherSharedTreeViewModel.this.selectionModel.setSelected(folder, true);
+                FolderContextMenu menu = new FolderContextMenu(app, OtherSharedTreeView.images, folder);
+                menu.setPopupPosition(event.getClientX(), event.getClientY());
+                menu.show();
+            }
+        }
+    };
+
+    private ListDataProvider<String> rootDataProvider = new ListDataProvider<String>();
+    private ListDataProvider<String> firstLevelDataProvider = new ListDataProvider<String>();
+
+    private Map<String, ListDataProvider<Folder>> userDataProviderMap = new HashMap<String, ListDataProvider<Folder>>();
+    private Map<Folder, ListDataProvider<Folder>> dataProviderMap = new HashMap<Folder, ListDataProvider<Folder>>();
+
+    private SingleSelectionModel<Folder> selectionModel;
+
+    public OtherSharedTreeViewModel(Pithos _app, SingleSelectionModel<Folder> selectionModel) {
+        app = _app;
+        this.selectionModel = selectionModel;
+    }
+
+    @Override
+    public <T> NodeInfo<?> getNodeInfo(T value) {
+        if (value == null) {
+            rootDataProvider.getList().add("Other 's Shared");
+            final SingleSelectionModel<String> selectionModel2 = new SingleSelectionModel<String>();
+            selectionModel2.addSelectionChangeHandler(new Handler() {
+
+                @Override
+                public void onSelectionChange(SelectionChangeEvent event) {
+                    if (selectionModel2.getSelectedObject() != null) {
+                       app.deselectOthers(selectionModel2);
+                    }
+                }
+            });
+            app.addSelectionModel(selectionModel2);
+            return new DefaultNodeInfo<String>(rootDataProvider, new TextCell(new SafeHtmlRenderer<String>() {
+                @Override
+                public SafeHtml render(String object) {
+                    SafeHtmlBuilder builder = new SafeHtmlBuilder();
+                    render(object, builder);
+                    return builder.toSafeHtml();
+                }
+
+                @Override
+                public void render(String object, SafeHtmlBuilder builder) {
+                    String html = AbstractImagePrototype.create(OtherSharedTreeView.images.othersShared()).getHTML();
+                    builder.appendHtmlConstant(html);
+                    builder.append(OtherSharedTreeView.Templates.INSTANCE.nameSpan(object));
+                }
+            }),  selectionModel2, null);
+        }
+        else if (value instanceof String) {
+               if (value.equals("Other 's Shared")) {
+                       fetchSharingUsers(firstLevelDataProvider);
+                   final SingleSelectionModel<String> selectionModel3 = new SingleSelectionModel<String>();
+                   selectionModel3.addSelectionChangeHandler(new Handler() {
+
+                       @Override
+                       public void onSelectionChange(SelectionChangeEvent event) {
+                           if (selectionModel3.getSelectedObject() != null) {
+                               app.deselectOthers(selectionModel3);
+                           }
+                       }
+                   });
+                   app.addSelectionModel(selectionModel3);
+                   return new DefaultNodeInfo<String>(firstLevelDataProvider, new TextCell(new SafeHtmlRenderer<String>() {
+
+                                       @Override
+                                       public SafeHtml render(String object) {
+                           SafeHtmlBuilder builder = new SafeHtmlBuilder();
+                           render(object, builder);
+                           return builder.toSafeHtml();
+                                       }
+
+                                       @Override
+                                       public void render(String object, SafeHtmlBuilder builder) {
+                           String html = AbstractImagePrototype.create(OtherSharedTreeView.images.folderYellow()).getHTML();
+                           builder.appendHtmlConstant(html);
+                           builder.append(OtherSharedTreeView.Templates.INSTANCE.nameSpan(object));
+                                       }
+                               }), selectionModel3, null);
+               }
+               else {
+                       return new DefaultNodeInfo<Folder>(new ListDataProvider<Folder>(), folderCell, selectionModel, null);
+               }
+        }
+        else {
+            final Folder f = (Folder) value;
+            if (dataProviderMap.get(f) == null) {
+                dataProviderMap.put(f, new ListDataProvider<Folder>());
+            }
+            final ListDataProvider<Folder> dataProvider = dataProviderMap.get(f);
+            fetchFolder(f, dataProvider, false);
+            return new DefaultNodeInfo<Folder>(dataProvider, folderCell, selectionModel, null);
+        }
+    }
+
+    private void fetchSharingUsers(final ListDataProvider<String> dataProvider) {
+        GetRequest<SharingUsers> getSharingUsers = new GetRequest<SharingUsers>(SharingUsers.class, app.getApiPath(), "", "?format=json") {
+            @Override
+            public void onSuccess(final SharingUsers result) {
+                dataProvider.getList().clear();
+                dataProvider.getList().addAll(result.getUsers());
+//                Iterator<Folder> iter = result.getSubfolders().iterator();
+//                fetchFolder(iter, new Command() {
+//                    @Override
+//                    public void execute() {
+//                        dataProvider.getList().clear();
+//                        dataProvider.getList().addAll(result.getSubfolders());
+//                    }
+//                });
+            }
+
+            @Override
+            public void onError(Throwable t) {
+                GWT.log("Error getting folder", t);
+                if (t instanceof RestException)
+                    app.displayError("Error getting folder: " + ((RestException) t).getHttpStatusText());
+                else
+                    app.displayError("System error fetching folder: " + t.getMessage());
+            }
+        };
+        getSharingUsers.setHeader("X-Auth-Token", app.getToken());
+        Scheduler.get().scheduleDeferred(getSharingUsers);
+       }
+
+    private void fetchSharedFolders(final ListDataProvider<Folder> dataProvider) {
+       Folder pithos = new Folder(Pithos.HOME_CONTAINER);
+       pithos.setContainer(Pithos.HOME_CONTAINER);
+        String path = "/" + pithos.getContainer()  + "?format=json&shared=";
+        GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, app.getApiPath(), app.getUsername(), path, pithos) {
+            @Override
+            public void onSuccess(final Folder result) {
+//                if (showfiles)
+//                    app.showFiles(result);
+                Iterator<Folder> iter = result.getSubfolders().iterator();
+                fetchFolder(iter, new Command() {
+                    @Override
+                    public void execute() {
+                        dataProvider.getList().clear();
+                        dataProvider.getList().addAll(result.getSubfolders());
+//                        app.getMySharedTreeView().updateChildren(f);
+                    }
+                });
+            }
+
+            @Override
+            public void onError(Throwable t) {
+                GWT.log("Error getting folder", t);
+                if (t instanceof RestException)
+                    app.displayError("Error getting folder: " + ((RestException) t).getHttpStatusText());
+                else
+                    app.displayError("System error fetching folder: " + t.getMessage());
+            }
+        };
+        getFolder.setHeader("X-Auth-Token", app.getToken());
+        Scheduler.get().scheduleDeferred(getFolder);
+       }
+
+       @Override
+    public boolean isLeaf(Object o) {
+        if (o instanceof Folder) {
+            Folder f = (Folder) o;
+            return f.getSubfolders().isEmpty();
+        }
+        return false;
+    }
+
+    protected void fetchFolder(final Iterator<Folder> iter, final Command callback) {
+        if (iter.hasNext()) {
+            final Folder f = iter.next();
+
+            String path = "/" + f.getContainer() + "?format=json&delimiter=/&prefix=" + f.getPrefix();
+            GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, app.getApiPath(), app.getUsername(), path, f) {
+                @Override
+                public void onSuccess(Folder result) {
+                    fetchFolder(iter, callback);
+                }
+
+                @Override
+                public void onError(Throwable t) {
+                    GWT.log("Error getting folder", t);
+                    if (t instanceof RestException)
+                        app.displayError("Error getting folder: " + ((RestException) t).getHttpStatusText());
+                    else
+                        app.displayError("System error fetching folder: " + t.getMessage());
+                }
+            };
+            getFolder.setHeader("X-Auth-Token", app.getToken());
+            Scheduler.get().scheduleDeferred(getFolder);
+        }
+        else if (callback != null)
+            callback.execute();
+    }
+
+    public Folder getSelection() {
+        return selectionModel.getSelectedObject();
+    }
+
+    public void updateFolder(Folder folder, boolean showfiles) {
+        if (dataProviderMap.get(folder) == null) {
+            dataProviderMap.put(folder, new ListDataProvider<Folder>());
+        }
+        final ListDataProvider<Folder> dataProvider = dataProviderMap.get(folder);
+        fetchFolder(folder, dataProvider, showfiles);
+    }
+
+    public void fetchFolder(final Folder f, final ListDataProvider<Folder> dataProvider, final boolean showfiles) {
+        String path = "/" + f.getContainer() + "?format=json&delimiter=/&prefix=" + f.getPrefix();
+        GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, app.getApiPath(), app.getUsername(), path, f) {
+            @Override
+            public void onSuccess(final Folder result) {
+                if (showfiles)
+                    app.showFiles(result);
+                Iterator<Folder> iter = result.getSubfolders().iterator();
+                fetchFolder(iter, new Command() {
+                    @Override
+                    public void execute() {
+                        dataProvider.getList().clear();
+                        dataProvider.getList().addAll(result.getSubfolders());
+                        app.getOtherSharedTreeView().updateChildren(f);
+                    }
+                });
+            }
+
+            @Override
+            public void onError(Throwable t) {
+                GWT.log("Error getting folder", t);
+                if (t instanceof RestException)
+                    app.displayError("Error getting folder: " + ((RestException) t).getHttpStatusText());
+                else
+                    app.displayError("System error fetching folder: " + t.getMessage());
+            }
+        };
+        getFolder.setHeader("X-Auth-Token", app.getToken());
+        Scheduler.get().scheduleDeferred(getFolder);
+    }
+}
index 355d9cb..81190ab 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$1.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$1.class differ
index 524453f..e36dafc 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$10.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$10.class differ
index 3abe1bb..89b5daf 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$11.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$11.class differ
index ce22c1d..f8a04e5 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$12.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$12.class differ
index 03ca2c2..76b4a0e 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$13.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$13.class differ
index 4678a54..c578e0b 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$14.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$14.class differ
index 383419b..114115a 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$15.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$15.class differ
index 9cc902d..c8d84c8 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$16.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$16.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$17$1$1.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$17$1$1.class
new file mode 100644 (file)
index 0000000..194a13b
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$17$1$1.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$17$1.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$17$1.class
new file mode 100644 (file)
index 0000000..1aea720
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$17$1.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$17.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$17.class
new file mode 100644 (file)
index 0000000..f9f421a
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$17.class differ
index 3cff5b2..2faaba5 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$2.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$2.class differ
index 60f471a..a43d1e3 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$3.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$3.class differ
index c0c887d..34866f2 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$4.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$4.class differ
index 508bee7..c37caa4 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$5.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$5.class differ
index dc069cb..0a79efb 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$6.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$6.class differ
index c284198..5c123c4 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$7.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$7.class differ
index 6a6ba65..4dc7745 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$8.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$8.class differ
index 65e3755..de77122 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$9.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos$9.class differ
index 0f6445a..ca7d683 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/Pithos.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/SharingUsers.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/SharingUsers.class
new file mode 100644 (file)
index 0000000..f99738e
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/SharingUsers.class differ
index eaedf96..20c1378 100644 (file)
Binary files a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/foldertree/Resource.class and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/foldertree/Resource.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView$BasicResources.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView$BasicResources.class
new file mode 100644 (file)
index 0000000..7d5673a
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView$BasicResources.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView$Images.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView$Images.class
new file mode 100644 (file)
index 0000000..b298a31
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView$Images.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView$Templates.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView$Templates.class
new file mode 100644 (file)
index 0000000..5eb5d01
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView$Templates.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView.class
new file mode 100644 (file)
index 0000000..eb2bb5f
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$1.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$1.class
new file mode 100644 (file)
index 0000000..c3220f4
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$1.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$2.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$2.class
new file mode 100644 (file)
index 0000000..f81835b
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$2.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$3.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$3.class
new file mode 100644 (file)
index 0000000..4afb8df
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$3.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$4.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$4.class
new file mode 100644 (file)
index 0000000..7cb927c
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$4.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$5.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$5.class
new file mode 100644 (file)
index 0000000..71fb90e
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$5.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$6.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$6.class
new file mode 100644 (file)
index 0000000..f34febb
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$6.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$7$1.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$7$1.class
new file mode 100644 (file)
index 0000000..0c6e590
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$7$1.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$7.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$7.class
new file mode 100644 (file)
index 0000000..90b974d
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$7.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$8.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$8.class
new file mode 100644 (file)
index 0000000..5a6c84c
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$8.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$9$1.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$9$1.class
new file mode 100644 (file)
index 0000000..4307493
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$9$1.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$9.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$9.class
new file mode 100644 (file)
index 0000000..01ac906
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel$9.class differ
diff --git a/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel.class b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel.class
new file mode 100644 (file)
index 0000000..d89fdf9
Binary files /dev/null and b/web_client/war/WEB-INF/classes/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel.class differ