From ea30dad976ab66e896b71ec7fb7db093bc5d06f2 Mon Sep 17 00:00:00 2001 From: Christos Stathis Date: Mon, 25 Jun 2012 18:15:58 +0300 Subject: [PATCH] Empty trash deletes everything under trash by using the deleteFolder method --- src/gr/grnet/pithos/web/client/FileList.java | 26 -------- src/gr/grnet/pithos/web/client/Pithos.java | 42 +++++++----- .../grnet/pithos/web/client/animation/FadeIn.java | 4 -- .../grnet/pithos/web/client/animation/FadeOut.java | 4 -- .../web/client/commands/EmptyTrashCommand.java | 22 +----- .../commands/ResreshOthersSharesCommand.java | 55 --------------- .../web/client/foldertree/FolderTreeViewModel.java | 2 - .../pithos/web/client/grouptree/GroupTreeView.java | 1 - src/gr/grnet/pithos/web/client/tagtree/Tag.java | 70 -------------------- .../web/client/tagtree/TagTreeViewModel.java | 1 - 10 files changed, 28 insertions(+), 199 deletions(-) delete mode 100644 src/gr/grnet/pithos/web/client/commands/ResreshOthersSharesCommand.java diff --git a/src/gr/grnet/pithos/web/client/FileList.java b/src/gr/grnet/pithos/web/client/FileList.java index bcd0cd2..556e5a1 100644 --- a/src/gr/grnet/pithos/web/client/FileList.java +++ b/src/gr/grnet/pithos/web/client/FileList.java @@ -401,13 +401,8 @@ public class FileList extends Composite { }); celltable.setSelectionModel(selectionModel, PithosSelectionEventManager. createDefaultManager()); -// celltable.setPageSize(Pithos.VISIBLE_FILE_COUNT); sinkEvents(Event.ONCONTEXTMENU); -// sinkEvents(Event.ONMOUSEUP); -// sinkEvents(Event.ONMOUSEDOWN); -// sinkEvents(Event.ONCLICK); -// sinkEvents(Event.ONKEYDOWN); sinkEvents(Event.ONDBLCLICK); Pithos.preventIESelection(); } @@ -419,27 +414,6 @@ public class FileList extends Composite { @Override public void onBrowserEvent(Event event) { -// if (files == null || files.size() == 0) { -// if (DOM.eventGetType(event) == Event.ONCONTEXTMENU && getSelectedFiles().size() == 0) { -// contextMenu = new FileContextMenu(images, false, true); -// contextMenu.show(); -// event.preventDefault(); -// event.cancelBubble(true); -// } -// return; -// } -// if (DOM.eventGetType(event) == Event.ONCONTEXTMENU && getSelectedFiles().size() != 0) { -// GWT.log("*****GOING TO SHOW CONTEXT MENU ****", null); -// contextMenu = new FileContextMenu(images, false, false); -// contextMenu = contextMenu.onEvent(event); -// event.cancelBubble(true); -// event.preventDefault(); -// } else if (DOM.eventGetType(event) == Event.ONCONTEXTMENU && getSelectedFiles().size() == 0) { -// contextMenu = new FileContextMenu(images, false, true); -// contextMenu = contextMenu.onEmptyEvent(event); -// event.cancelBubble(true); -// event.preventDefault(); -// } else if (DOM.eventGetType(event) == Event.ONDBLCLICK) if (getSelectedFiles().size() == 1) { File file = getSelectedFiles().get(0); diff --git a/src/gr/grnet/pithos/web/client/Pithos.java b/src/gr/grnet/pithos/web/client/Pithos.java index 992916f..d9fca75 100644 --- a/src/gr/grnet/pithos/web/client/Pithos.java +++ b/src/gr/grnet/pithos/web/client/Pithos.java @@ -488,20 +488,20 @@ public class Pithos implements EntryPoint, ResizeHandler { } }); - Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { - - @Override - public boolean execute() { - Folder f = getSelection(); - if (f != null) { - if (getSelectedTree().equals(folderTreeView)) - updateFolder(f, true, null, false); - else if (getSelectedTree().equals(mysharedTreeView)) - updateSharedFolder(f, true); - } - return true; - } - }, 3000); +// Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { +// +// @Override +// public boolean execute() { +// Folder f = getSelection(); +// if (f != null) { +// if (getSelectedTree().equals(folderTreeView)) +// updateFolder(f, true, null, false); +// else if (getSelectedTree().equals(mysharedTreeView)) +// updateSharedFolder(f, true); +// } +// return true; +// } +// }, 3000); } public void applyPermissions(Folder f) { @@ -892,7 +892,7 @@ public class Pithos implements EntryPoint, ResizeHandler { else if (o != null) { String subdir = o.get("subdir").isString().stringValue(); subdir = subdir.substring(0, subdir.length() - 1); - String path = getApiPath() + getUsername() + "/" + folder.getContainer() + "?format=json&delimiter=/&prefix=" + URL.encodeQueryString(subdir) + "&t=" + System.currentTimeMillis(); + String path = getApiPath() + folder.getOwner() + "/" + folder.getContainer() + "?format=json&delimiter=/&prefix=" + URL.encodeQueryString(subdir) + "&t=" + System.currentTimeMillis(); RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, path); builder.setHeader("X-Auth-Token", getToken()); try { @@ -924,6 +924,18 @@ public class Pithos implements EntryPoint, ResizeHandler { } } else { + if (folder.isContainer()) { + updateFolder(folder, true, new Command() { + + @Override + public void execute() { + updateStatistics(); + if (callback != null) + callback.execute(); + } + }, false); + return; + } String path = folder.getUri(); DeleteRequest deleteFolder = new DeleteRequest(getApiPath(), getUsername(), URL.encode(path)) { @Override diff --git a/src/gr/grnet/pithos/web/client/animation/FadeIn.java b/src/gr/grnet/pithos/web/client/animation/FadeIn.java index 8acab08..9967260 100644 --- a/src/gr/grnet/pithos/web/client/animation/FadeIn.java +++ b/src/gr/grnet/pithos/web/client/animation/FadeIn.java @@ -54,10 +54,6 @@ public class FadeIn extends Animation { double progress1 = 1.0 - progress; currOpacity = initialOpacity * progress1; DOM.setStyleAttribute(widget.getElement(), "opacity", ""+new Double(1d - currOpacity / 100d)); - //required for ie to work - //Disabled because IE has bugs rendering non-opaque objects - //int opacityToSet = new Double(currOpacity).intValue(); - //DOM.setStyleAttribute(widget.getElement(), "filter", "alpha(opacity=" + (initialOpacity - opacityToSet) + ")"); } } diff --git a/src/gr/grnet/pithos/web/client/animation/FadeOut.java b/src/gr/grnet/pithos/web/client/animation/FadeOut.java index 6c87ec4..474de0a 100644 --- a/src/gr/grnet/pithos/web/client/animation/FadeOut.java +++ b/src/gr/grnet/pithos/web/client/animation/FadeOut.java @@ -55,10 +55,6 @@ public class FadeOut extends Animation { double progress1 = 1.0 - progress; currOpacity = initialOpacity*progress1; DOM.setStyleAttribute(widget.getElement(), "opacity", ""+new Double(currOpacity/100d)); - //required for ie to work - //Disabled because IE has bugs rendering non-opaque objects - //int opacityToSet = new Double(currOpacity).intValue(); - //DOM.setStyleAttribute(widget.getElement(), "filter", "alpha(opacity="+currOpacity+")"); } } diff --git a/src/gr/grnet/pithos/web/client/commands/EmptyTrashCommand.java b/src/gr/grnet/pithos/web/client/commands/EmptyTrashCommand.java index 88d7dbe..f0e5f7a 100644 --- a/src/gr/grnet/pithos/web/client/commands/EmptyTrashCommand.java +++ b/src/gr/grnet/pithos/web/client/commands/EmptyTrashCommand.java @@ -72,27 +72,7 @@ public class EmptyTrashCommand implements Command{ final Folder trash = app.getAccount().getTrash(); if (trash != null) { - Iterator iter = trash.getFiles().iterator(); - deleteFile(iter, new Command() { - - @Override - public void execute() { - Iterator iter2 = trash.getSubfolders().iterator(); - deleteSubfolder(iter2, new Command() { - - @Override - public void execute() { - app.updateTrash(true, new Command() { - - @Override - public void execute() { - app.updateStatistics(); - } - }); - } - }); - } - }); + app.deleteFolder(trash, null); //deleteFolder will not delete the folder itself if it is a container } } diff --git a/src/gr/grnet/pithos/web/client/commands/ResreshOthersSharesCommand.java b/src/gr/grnet/pithos/web/client/commands/ResreshOthersSharesCommand.java deleted file mode 100644 index 41428e9..0000000 --- a/src/gr/grnet/pithos/web/client/commands/ResreshOthersSharesCommand.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 - * 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.commands; - -import com.google.gwt.user.client.Command; -import com.google.gwt.user.client.ui.PopupPanel; - - -public class ResreshOthersSharesCommand implements Command{ - private PopupPanel containerPanel; - - public ResreshOthersSharesCommand(PopupPanel _containerPanel){ - containerPanel = _containerPanel; - } - - @Override - public void execute() { - containerPanel.hide(); - //TODO:CELLTREE - //app.getFolders().update( app.getFolders().getCurrent()); - } - -} diff --git a/src/gr/grnet/pithos/web/client/foldertree/FolderTreeViewModel.java b/src/gr/grnet/pithos/web/client/foldertree/FolderTreeViewModel.java index 1a57aab..bee1042 100644 --- a/src/gr/grnet/pithos/web/client/foldertree/FolderTreeViewModel.java +++ b/src/gr/grnet/pithos/web/client/foldertree/FolderTreeViewModel.java @@ -130,8 +130,6 @@ public class FolderTreeViewModel implements TreeViewModel { } final ListDataProvider dataProvider = dataProviderMap.get(f); //This prevents the loading indicator -// dataProvider.getList().clear(); -// dataProvider.getList().addAll(f.getSubfolders()); fetchFolder(f, dataProvider, false, null); return new DefaultNodeInfo(dataProvider, folderCell, selectionModel, null); } diff --git a/src/gr/grnet/pithos/web/client/grouptree/GroupTreeView.java b/src/gr/grnet/pithos/web/client/grouptree/GroupTreeView.java index b0d3bd7..79626cd 100644 --- a/src/gr/grnet/pithos/web/client/grouptree/GroupTreeView.java +++ b/src/gr/grnet/pithos/web/client/grouptree/GroupTreeView.java @@ -174,7 +174,6 @@ public class GroupTreeView extends Composite implements TreeView { @Override public Folder getSelection() { - // TODO Auto-generated method stub return null; } diff --git a/src/gr/grnet/pithos/web/client/tagtree/Tag.java b/src/gr/grnet/pithos/web/client/tagtree/Tag.java index 7386965..42640dd 100644 --- a/src/gr/grnet/pithos/web/client/tagtree/Tag.java +++ b/src/gr/grnet/pithos/web/client/tagtree/Tag.java @@ -60,76 +60,6 @@ public class Tag extends Resource { return name; } -// public void populate(Response response) { -// String header = response.getHeader("Last-Modified"); -// if (header != null) -// lastModified = DateTimeFormat.getFormat(PredefinedFormat.RFC_2822).parse(header); -// -// header = response.getHeader("X-Container-Bytes-Used"); -// if (header != null) -// bytesUsed = Long.valueOf(header); -// -// subfolders.clear(); //This is necessary in case we update a pre-existing Tag so that stale subfolders won't show up -// files.clear(); -// JSONValue json = JSONParser.parseStrict(response.getText()); -// JSONArray array = json.isArray(); -// if (array != null) { -// for (int i=0; i(tagDataProvider, tagCell, selectionModel, null); } else -- 1.7.10.4