commit after code review. 1.Abstract method changed. Abstract removed and a basic...
authorNatasa Kapravelou <akapravelou@gmail.com>
Wed, 2 Jun 2010 10:05:52 +0000 (13:05 +0300)
committerNatasa Kapravelou <akapravelou@gmail.com>
Wed, 2 Jun 2010 10:05:52 +0000 (13:05 +0300)
16 files changed:
src/gr/ebs/gss/client/PopupTree.java
src/gr/ebs/gss/client/rest/resource/FileResource.java
src/gr/ebs/gss/client/rest/resource/FolderResource.java
src/gr/ebs/gss/client/rest/resource/GroupResource.java
src/gr/ebs/gss/client/rest/resource/GroupUserResource.java
src/gr/ebs/gss/client/rest/resource/GroupsResource.java
src/gr/ebs/gss/client/rest/resource/OtherUserResource.java
src/gr/ebs/gss/client/rest/resource/OthersResource.java
src/gr/ebs/gss/client/rest/resource/RestResource.java
src/gr/ebs/gss/client/rest/resource/SearchResource.java
src/gr/ebs/gss/client/rest/resource/SharedResource.java
src/gr/ebs/gss/client/rest/resource/TagsResource.java
src/gr/ebs/gss/client/rest/resource/TrashResource.java
src/gr/ebs/gss/client/rest/resource/UploadStatusResource.java
src/gr/ebs/gss/client/rest/resource/UserResource.java
src/gr/ebs/gss/client/rest/resource/UserSearchResource.java

index 6076bf7..5ce35b6 100644 (file)
@@ -68,7 +68,7 @@ public class PopupTree extends Tree {
                                TreeItem item = event.getSelectedItem();
                                processItemSelected(item);
                                String path = GSS.get().getApiPath() + GSS.get().getCurrentUserResource().getUsername()+ "/";
-                               ((RestResource) GSS.get().getFolders().getCurrent().getUserObject()).updateHistoryAbs(item,path);
+                               ((RestResource) GSS.get().getFolders().getCurrent().getUserObject()).updateHistory(item,path);
                                }
                });
 
@@ -225,37 +225,4 @@ public class PopupTree extends Tree {
        public void setTreeSelectedItem(TreeItem newSelectedItem) {
                treeSelectedItem = newSelectedItem;
        }
-
-       /**
-        * construct the partial path of the selected TreeItem
-        *
-        * @param selectedItem the selectedItem to check
-        */
-       public String constructPartialPath(TreeItem selectedItem){
-          String result = DisplayHelper.trim(selectedItem.getText());
-          TreeItem parent = selectedItem.getParentItem();
-          while (!(DisplayHelper.trim(parent.getText()).equals("My Shared") || DisplayHelper.trim(parent.getText()).equals("Other's Shared")||DisplayHelper.trim(parent.getText()).equals("Trash"))){
-             result = DisplayHelper.trim(parent.getText()) + "/" + result;
-             if(result.equals("My Shared")||result.equals("Other's Shared")) return result;
-             parent = parent.getParentItem();
-          }
-
-          return result;
-       }
-       /**
-        * examine whether a folder name like "Trash", "My Shared", "Other's Shared" is inside path
-        *
-        * @param selectedItem the selectedTreeItem to check
-        */
-
-       public boolean containsFolder(TreeItem selectedItem, String folderName){
-               TreeItem parent = selectedItem.getParentItem();
-               while (parent != null){
-                       String parentItemText = parent.getText();
-                       String parentItemTextTr = DisplayHelper.trim(parentItemText);
-                       if(parentItemTextTr.equals(folderName)) return true;
-                       parent = parent.getParentItem();
-                       }
-               return false;
-       }
 }
index 64bdf9a..5424aa9 100644 (file)
@@ -31,7 +31,6 @@ 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.JSONString;
-import com.google.gwt.user.client.ui.TreeItem;
 
 /**
  * @author kman
@@ -534,12 +533,5 @@ public class FileResource extends RestResource {
                        return getDate(modificationDate.getTime());
                return null;
        }
-       /**
-        * Bugzilla – Bug 371, Add history support for folder navigation
-        */
-       public void updateHistoryAbs(TreeItem item, String path){
-               throw new UnsupportedOperationException();
-       }
-
 }
 
index f7431d7..40b3763 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Electronic Business Systems Ltd.
+ * Copyright 2009, 2010 Electronic Business Systems Ltd.
  *
  * This file is part of GSS.
  *
@@ -19,6 +19,7 @@
 
 package gr.ebs.gss.client.rest.resource;
 
+import gr.ebs.gss.client.DisplayHelper;
 import gr.ebs.gss.client.GSS;
 import gr.ebs.gss.client.rest.MultipleGetCommand;
 import gr.ebs.gss.client.rest.MultipleGetCommand.Cached;
@@ -509,13 +510,16 @@ public class FolderResource extends RestResource {
                filesExpanded = newFilesExpanded;
        }
 
+       /**
+        * history support for folder navigation
+        */
        @Override
-       public void updateHistoryAbs(TreeItem item, String path){
+       public void updateHistory(TreeItem item, String path){
                try{
                        if(getParentURI() == null){
-                               if(GSS.get().getFolders().getPopupTree().containsFolder(item, "Trash")){
+                               if(containsFolder(item, "Trash")){
 //                                     case: selected folders below Trash folder
-                                       String partialUri = GSS.get().getFolders().getPopupTree().constructPartialPath(item);
+                                       String partialUri = constructPartialPath(item);
                                        GSS.get().updateHistory("Files/trash/" + partialUri, item);
                                } else
 //                                     case: home folders are selected
@@ -528,13 +532,13 @@ public class FolderResource extends RestResource {
                                String newPath = getParentURI().substring(apiPath.lastIndexOf("/"));
                                GSS.get().updateHistory("Files"+ newPath + getName(), item);
                        }
-                       else if(GSS.get().getFolders().getPopupTree().containsFolder(item, "My Shared")){
+                       else if(containsFolder(item, "My Shared")){
 //                             case: selected folders below My Shared folder
-                               String partialUri = GSS.get().getFolders().getPopupTree().constructPartialPath(item);
+                               String partialUri = constructPartialPath(item);
                                GSS.get().updateHistory("Files/shared/" + partialUri, item);
-                       }else if(GSS.get().getFolders().getPopupTree().containsFolder(item, "Other's Shared")){
+                       }else if(containsFolder(item, "Other's Shared")){
 //                             case: selected folders below Other's Shared folder
-                               String partialPath = GSS.get().getFolders().getPopupTree().constructPartialPath(item);
+                               String partialPath = constructPartialPath(item);
                                GSS.get().updateHistory("Files/others/"+ partialPath, item);
                        }
                        else{
@@ -548,5 +552,37 @@ public class FolderResource extends RestResource {
                }
 
        }
+       /**
+        * construct the partial path of the selected TreeItem
+        *
+        * @param selectedItem the selectedItem to check
+        */
+       private String constructPartialPath(TreeItem selectedItem){
+          String result = DisplayHelper.trim(selectedItem.getText());
+          TreeItem parent = selectedItem.getParentItem();
+          while (!(DisplayHelper.trim(parent.getText()).equals("My Shared") || DisplayHelper.trim(parent.getText()).equals("Other's Shared")||DisplayHelper.trim(parent.getText()).equals("Trash"))){
+             result = DisplayHelper.trim(parent.getText()) + "/" + result;
+             if(result.equals("My Shared")||result.equals("Other's Shared")) return result;
+             parent = parent.getParentItem();
+          }
+
+          return result;
+       }
+       /**
+        * examine whether a folder name like "Trash", "My Shared", "Other's Shared" is inside path
+        *
+        * @param selectedItem the selectedTreeItem to check
+        */
+
+       private boolean containsFolder(TreeItem selectedItem, String folderName){
+               TreeItem parent = selectedItem.getParentItem();
+               while (parent != null){
+                       String parentItemText = parent.getText();
+                       String parentItemTextTr = DisplayHelper.trim(parentItemText);
+                       if(parentItemTextTr.equals(folderName)) return true;
+                       parent = parent.getParentItem();
+                       }
+               return false;
+       }
 
 }
index 90a6b7b..ab27aeb 100644 (file)
@@ -24,7 +24,6 @@ import java.util.List;
 import com.google.gwt.http.client.URL;
 import com.google.gwt.json.client.JSONArray;
 import com.google.gwt.json.client.JSONParser;
-import com.google.gwt.user.client.ui.TreeItem;
 
 /**
  * @author kman
@@ -73,12 +72,4 @@ public class GroupResource extends RestResource {
        public String getLastModifiedSince() {
                return null;
        }
-
-       /**
-        * Bugzilla – Bug 371, Add history support for folder navigation
-        */
-       public void updateHistoryAbs(TreeItem item, String path){
-               throw new UnsupportedOperationException();
-       }
-
 }
index 1f2c414..8bf1794 100644 (file)
@@ -20,7 +20,6 @@ package gr.ebs.gss.client.rest.resource;
 
 import com.google.gwt.json.client.JSONObject;
 import com.google.gwt.json.client.JSONParser;
-import com.google.gwt.user.client.ui.TreeItem;
 
 
 /**
@@ -103,12 +102,4 @@ public class GroupUserResource extends RestResource{
        public String getLastModifiedSince() {
                return null;
        }
-
-       /**
-        * Bugzilla – Bug 371, Add history support for folder navigation
-        */
-       public void updateHistoryAbs(TreeItem item, String path){
-               throw new UnsupportedOperationException();
-       }
-
 }
index fc1fbb8..c7e9551 100644 (file)
@@ -24,8 +24,6 @@ import java.util.List;
 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.user.client.ui.TreeItem;
-
 /**
  * @author kman
  */
@@ -73,11 +71,4 @@ public class GroupsResource extends RestResource {
        public String getLastModifiedSince() {
                return null;
        }
-       /**
-        * Bugzilla – Bug 371, Add history support for folder navigation
-        */
-       public void updateHistoryAbs(TreeItem item, String path){
-               throw new UnsupportedOperationException();
-       }
-
 }
index fcc84ca..6de9c41 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Electronic Business Systems Ltd.
+ * Copyright 2009, 2010 Electronic Business Systems Ltd.
  *
  * This file is part of GSS.
  *
@@ -237,16 +237,11 @@ public class OtherUserResource extends RestResource{
        public void setFilesExpanded(boolean newFilesExpanded) {
                filesExpanded = newFilesExpanded;
        }
-
        /**
-        * Bugzilla – Bug 371, Add history support for folder navigation
+        * history support for folder navigation
         */
        @Override
-       public void updateHistoryAbs(TreeItem item, String path){
-               try{
-                       GSS.get().updateHistory("Files/others/"+ getName(), item);
-               }catch(Exception e){
-                       throw new UnsupportedOperationException();
-               }
+       public void updateHistory(TreeItem item, String path){
+               GSS.get().updateHistory("Files/others/"+ getName(), item);
        }
 }
index e652631..0b2ee52 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Electronic Business Systems Ltd.
+ * Copyright 2009, 2010 Electronic Business Systems Ltd.
  *
  * This file is part of GSS.
  *
@@ -106,14 +106,10 @@ public class OthersResource extends RestResource {
        }
 
        /**
-        * Bugzilla – Bug 371, Add history support for folder navigation
+        * history support for folder navigation
         */
        @Override
-       public void updateHistoryAbs(TreeItem item, String path){
-               try{
-                       GSS.get().updateHistory("Files/"+ path.substring(path.lastIndexOf("/")+1) + "others/", item);
-               }catch(Exception e){
-                       throw new UnsupportedOperationException(e);
-               }
+       public void updateHistory(TreeItem item, String path){
+               GSS.get().updateHistory("Files/"+ path.substring(path.lastIndexOf("/")+1) + "others/", item);
        }
 }
index 81c71ec..8ac5d9e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Electronic Business Systems Ltd.
+ * Copyright 2009, 2010 Electronic Business Systems Ltd.
  *
  * This file is part of GSS.
  *
@@ -81,5 +81,7 @@ public abstract class RestResource implements Serializable{
 
        public abstract String getLastModifiedSince();
 
-       public abstract void updateHistoryAbs(TreeItem item, String path);
+       public void updateHistory(TreeItem item, String path){
+
+       }
 }
index cb002de..4f77ff9 100644 (file)
@@ -27,7 +27,6 @@ import com.google.gwt.http.client.URL;
 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.user.client.ui.TreeItem;
 
 /**
  * @author kman
@@ -123,11 +122,4 @@ public class SearchResource extends RestResource {
        public String getLastModifiedSince() {
                return null;
        }
-       /**
-        * Bugzilla – Bug 371, Add history support for folder navigation
-        */
-       public void updateHistoryAbs(TreeItem item, String path){
-               throw new UnsupportedOperationException();
-       }
-
 }
index d4ec4a6..8df24c5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Electronic Business Systems Ltd.
+ * Copyright 2009, 2010 Electronic Business Systems Ltd.
  *
  * This file is part of GSS.
  *
@@ -230,14 +230,10 @@ public class SharedResource extends RestResource{
                filesExpanded = newFilesExpanded;
        }
        /**
-        * Bugzilla – Bug 371, Add history support for folder navigation
+        * history support for folder navigation
         */
        @Override
-       public void updateHistoryAbs(TreeItem item, String path){
-               try{
-                       GSS.get().updateHistory("Files/"+ getUri().substring(path.lastIndexOf("/")+1), item);
-               }catch(Exception e){
-                       throw new UnsupportedOperationException(e);
-               }
+       public void updateHistory(TreeItem item, String path){
+               GSS.get().updateHistory("Files/"+ getUri().substring(path.lastIndexOf("/")+1), item);
        }
 }
index ddeca11..f6d786d 100644 (file)
@@ -23,7 +23,6 @@ import java.util.List;
 
 import com.google.gwt.json.client.JSONArray;
 import com.google.gwt.json.client.JSONParser;
-import com.google.gwt.user.client.ui.TreeItem;
 
 
 /**
@@ -68,10 +67,4 @@ public class TagsResource extends RestResource{
        public String getLastModifiedSince() {
                return null;
        }
-       /**
-        * Bugzilla – Bug 371, Add history support for folder navigation
-        */
-       public void updateHistoryAbs(TreeItem item, String path){
-               throw new UnsupportedOperationException();
-       }
 }
index c796659..5d50b03 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Electronic Business Systems Ltd.
+ * Copyright 2009, 2010 Electronic Business Systems Ltd.
  *
  * This file is part of GSS.
  *
@@ -201,13 +201,10 @@ public class TrashResource extends RestResource{
                return null;
        }
        /**
-        * Bugzilla – Bug 371, Add history support for folder navigation
+        * history support for folder navigation
         */
-       public void updateHistoryAbs(TreeItem item, String path){
-               try{
-                       GSS.get().updateHistory("Files/"+ getUri().substring(path.lastIndexOf("/")+1), item);
-               }catch (Exception e){
-                       throw new UnsupportedOperationException();
-               }
+       @Override
+       public void updateHistory(TreeItem item, String path){
+               GSS.get().updateHistory("Files/"+ getUri().substring(path.lastIndexOf("/")+1), item);
        }
 }
index ee16919..2c3424c 100644 (file)
@@ -20,7 +20,6 @@ package gr.ebs.gss.client.rest.resource;
 
 import com.google.gwt.json.client.JSONObject;
 import com.google.gwt.json.client.JSONParser;
-import com.google.gwt.user.client.ui.TreeItem;
 
 
 /**
@@ -89,11 +88,4 @@ public class UploadStatusResource extends RestResource{
        public String getLastModifiedSince() {
                return null;
        }
-       /**
-        * Bugzilla – Bug 371, Add history support for folder navigation
-        */
-       public void updateHistoryAbs(TreeItem item, String path){
-               throw new UnsupportedOperationException();
-       }
-
 }
index a59dca6..70f9d55 100644 (file)
@@ -22,7 +22,6 @@ import java.util.Date;
 
 import com.google.gwt.json.client.JSONObject;
 import com.google.gwt.json.client.JSONParser;
-import com.google.gwt.user.client.ui.TreeItem;
 
 /**
  * @author kman
@@ -348,10 +347,4 @@ public class UserResource extends RestResource {
        public String getLastModifiedSince() {
                return null;
        }
-       /**
-        * Bugzilla – Bug 371, Add history support for folder navigation
-        */
-       public void updateHistoryAbs(TreeItem item, String path){
-               throw new UnsupportedOperationException();
-       }
 }
index 334b2fe..41cdae9 100644 (file)
@@ -24,7 +24,6 @@ import java.util.List;
 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.user.client.ui.TreeItem;
 
 /**
  * A container for the results of a search query for users.
@@ -79,10 +78,4 @@ public class UserSearchResource extends RestResource {
        public String getLastModifiedSince() {
                return null;
        }
-       /**
-        * Bugzilla – Bug 371, Add history support for folder navigation
-        */
-       public void updateHistoryAbs(TreeItem item, String path){
-               throw new UnsupportedOperationException();
-       }
 }