<?xml version="1.0" encoding="utf-8" ?>
-<project name="gss" default="gwt-compile" basedir=".">
- <description>The GSS project build file</description>
+<project name="pithos" default="gwt-compile" basedir=".">
+ <description>The Pithos web client project build file</description>
<property file="build.properties"/>
<property name="deps.dir" value="dependencies"/>
<property name="gwtquery-droppable-plugin.filename" value="droppable-plugin-1.0.2.jar"/>
<property name="gwtquery-droppable-plugin.download.url" value="http://gss.googlecode.com/hg/lib/${gwtquery-droppable-plugin.filename}?r=c8bca56a1c4ab780ac0d0cc72a2b40b60d7ca4f7"/>
- <property name="root.context" value="gss" />
- <property name="gwt.module.class" value="GSS" />
+ <property name="gwt.module.class" value="Pithos" />
<property name="gwt.root.package" value="gr.grnet.pithos.web" />
<property name="gwt.root.path" value="gr/grnet/pithos/web" />
<property name="gwt.module" value="${gwt.root.package}.${gwt.module.class}" />
<arg value="${gwt.www.dir}/${gwt.module}"/>
<arg value="-noserver"/>
<arg value="-startupUrl"/>
- <arg value="http://127.0.0.1:8080/client/GSS.html"/>
+ <arg value="http://127.0.0.1:8080/client/pithos.html"/>
<arg value="${gwt.module}"/>
</java>
</target>
<inherits name="com.google.gwt.json.JSON"/>
<inherits name="gwtquery.plugins.droppable.Droppable"/>
- <entry-point class='gr.grnet.pithos.web.client.GSS' />
+ <entry-point class='gr.grnet.pithos.web.client.Pithos' />
<stylesheet src='gss.css' />
<!-- Rebind the file upload dialog if Gears is installed -->
public AbstractPropertiesDialog() {\r
\r
// Enable IE selection for the dialog (must disable it upon closing it)\r
- GSS.enableIESelection();\r
+ Pithos.enableIESelection();\r
\r
setAnimationEnabled(true);\r
\r
* @param userId\r
*/\r
protected void updateTags() {\r
- GetCommand<TagsResource> tc = new GetCommand<TagsResource>(TagsResource.class, GSS.get().getCurrentUserResource().getTagsPath(),null) {\r
+ GetCommand<TagsResource> tc = new GetCommand<TagsResource>(TagsResource.class, Pithos.get().getCurrentUserResource().getTagsPath(),null) {\r
\r
@Override\r
public void onComplete() {\r
@Override\r
public void onError(Throwable t) {\r
GWT.log("", t);\r
- GSS.get().displayError("Unable to fetch user tags");\r
+ Pithos.get().displayError("Unable to fetch user tags");\r
}\r
};\r
DeferredCommand.addCommand(tc);\r
* (we disable the prevention on creation of the dialog)\r
*/\r
public void closeDialog() {\r
- GSS.preventIESelection();\r
+ Pithos.preventIESelection();\r
hide();\r
}\r
}\r
public void onSelectionChange(com.google.gwt.view.client.SelectionChangeEvent event) {
NodeInfo<RestResource> nodeInfo = (NodeInfo<RestResource>) getModel().getNodeInfo(selectionModel.getSelectedObject());
if(nodeInfo==null || nodeInfo.getValueUpdater()==null){
- GSS.get().showFileList(getSelection());
+ Pithos.get().showFileList(getSelection());
}
else
nodeInfo.getValueUpdater().update(selectionModel.getSelectedObject());
- GSS.get().setCurrentSelection(selectionModel.getSelectedObject());
+ Pithos.get().setCurrentSelection(selectionModel.getSelectedObject());
}
}
private boolean init=false;
public boolean fetchRootFolders() {
- UserResource userResource = GSS.get().getCurrentUserResource();
+ UserResource userResource = Pithos.get().getCurrentUserResource();
if (userResource == null)
return !DONE;
if(!init){
@Override
public void onError(Throwable t) {
GWT.log("Error fetching root folder", t);
- GSS.get().displayError("Unable to fetch root folder");
+ Pithos.get().displayError("Unable to fetch root folder");
}
};
DeferredCommand.addCommand(gf);
- DeferredCommand.addCommand(new GetCommand<TrashResource>(TrashResource.class, GSS.get().getCurrentUserResource().getTrashPath(), null) {
+ DeferredCommand.addCommand(new GetCommand<TrashResource>(TrashResource.class, Pithos.get().getCurrentUserResource().getTrashPath(), null) {
@Override
public void onComplete() {
trash = getResult();
int statusCode = ((RestException)t).getHttpStatusCode();
// On IE status code 1223 may be returned instead of 204.
if(statusCode == 204 || statusCode == 1223){
- trash = new TrashResource(GSS.get().getCurrentUserResource().getTrashPath());
+ trash = new TrashResource(Pithos.get().getCurrentUserResource().getTrashPath());
}
else{
GWT.log("", t);
- GSS.get().displayError("Unable to fetch trash folder:"+t.getMessage());
- trash = new TrashResource(GSS.get().getCurrentUserResource().getTrashPath());
+ Pithos.get().displayError("Unable to fetch trash folder:"+t.getMessage());
+ trash = new TrashResource(Pithos.get().getCurrentUserResource().getTrashPath());
}
}
}
@Override
public void onError(Throwable t) {
GWT.log("Error fetching Shared Root folder", t);
- GSS.get().displayError("Unable to fetch Shared Root folder");
+ Pithos.get().displayError("Unable to fetch Shared Root folder");
}
};
DeferredCommand.addCommand(gs);
@Override
public void onError(Throwable t) {
GWT.log("Error fetching Others Root folder", t);
- GSS.get().displayError("Unable to fetch Others Root folder");
+ Pithos.get().displayError("Unable to fetch Others Root folder");
}
};
DeferredCommand.addCommand(go);
public void updateTrashNode(){
- DeferredCommand.addCommand(new GetCommand<TrashResource>(TrashResource.class, GSS.get().getCurrentUserResource().getTrashPath(), null) {
+ DeferredCommand.addCommand(new GetCommand<TrashResource>(TrashResource.class, Pithos.get().getCurrentUserResource().getTrashPath(), null) {
@Override
public void onComplete() {
trash = getResult();
int statusCode = ((RestException)t).getHttpStatusCode();
// On IE status code 1223 may be returned instead of 204.
if(statusCode == 204 || statusCode == 1223){
- trash = new TrashResource(GSS.get().getCurrentUserResource().getTrashPath());
+ trash = new TrashResource(Pithos.get().getCurrentUserResource().getTrashPath());
model.getRootNodes().getList().set(1, trash);
//model.getRootNodes().refresh();
}
else{
GWT.log("", t);
- GSS.get().displayError("Unable to fetch trash folder:"+t.getMessage());
- trash = new TrashResource(GSS.get().getCurrentUserResource().getTrashPath());
+ Pithos.get().displayError("Unable to fetch trash folder:"+t.getMessage());
+ trash = new TrashResource(Pithos.get().getCurrentUserResource().getTrashPath());
model.getRootNodes().getList().set(1, trash);
//model.getRootNodes().refresh();
}
}
public void updateRootNode(){
- final String path = GSS.get().getCurrentUserResource().getFilesPath();
+ final String path = Pithos.get().getCurrentUserResource().getFilesPath();
GetCommand<FolderResource> gf = new GetCommand<FolderResource>(FolderResource.class, path, null) {
@Override
@Override
public void onError(Throwable t) {
GWT.log("Error fetching root folder", t);
- GSS.get().displayError("Unable to fetch root folder");
+ Pithos.get().displayError("Unable to fetch root folder");
}
};
}
public void updateMySharedNode(){
- GetCommand<SharedResource> gs = new GetCommand<SharedResource>(SharedResource.class, GSS.get().getCurrentUserResource().getSharedPath(), null) {
+ GetCommand<SharedResource> gs = new GetCommand<SharedResource>(SharedResource.class, Pithos.get().getCurrentUserResource().getSharedPath(), null) {
@Override
public void onComplete() {
@Override
public void onError(Throwable t) {
GWT.log("Error fetching Shared Root folder", t);
- GSS.get().displayError("Unable to fetch Shared Root folder");
+ Pithos.get().displayError("Unable to fetch Shared Root folder");
}
};
DeferredCommand.addCommand(gs);
public void updateOtherNode(){
GetCommand<OthersResource> go = new GetCommand<OthersResource>(OthersResource.class,
- GSS.get().getCurrentUserResource().getOthersPath(), null) {
+ Pithos.get().getCurrentUserResource().getOthersPath(), null) {
@Override
public void onComplete() {
@Override
public void onError(Throwable t) {
GWT.log("Error fetching Others Root folder", t);
- GSS.get().displayError("Unable to fetch Others Root folder");
+ Pithos.get().displayError("Unable to fetch Others Root folder");
}
};
DeferredCommand.addCommand(go);
}
public void clearSelection(){
- if(GSS.get().getCurrentSelection().equals(getSelection()))
- GSS.get().setCurrentSelection(null);
+ if(Pithos.get().getCurrentSelection().equals(getSelection()))
+ Pithos.get().setCurrentSelection(null);
selectionModel.setSelected(getSelection(), false);
}
public void refreshCurrentNode(boolean clearSelection){
NodeInfo<RestResource> nodeInfo = (NodeInfo<RestResource>) getModel().getNodeInfo(selectionModel.getSelectedObject());
if(nodeInfo==null || nodeInfo.getValueUpdater()==null){
- GSS.get().showFileList(getSelection(),clearSelection);
+ Pithos.get().showFileList(getSelection(),clearSelection);
}
else{
if(!clearSelection)
import gwtquery.plugins.droppable.client.gwt.DragAndDropNodeInfo;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public void onBrowserEvent(Cell.Context context, com.google.gwt.dom.client.Element parent, RestResource value, com.google.gwt.dom.client.NativeEvent event, com.google.gwt.cell.client.ValueUpdater<RestResource> valueUpdater) {
if(event.getType().equals("contextmenu")){
selectionModel.setSelected(value, true);
- GSS.get().setCurrentSelection(value);
- GSS.get().getTreeView().showPopup(event.getClientX(), event.getClientY());
+ Pithos.get().setCurrentSelection(value);
+ Pithos.get().getTreeView().showPopup(event.getClientX(), event.getClientY());
}
};
// Second level.
ListDataProvider<RestResource> trashProvider = new ListDataProvider<RestResource>();
List<RestResource> r = new ArrayList<RestResource>();
- for(FolderResource f : GSS.get().getTreeView().getTrash().getFolders()){
+ for(FolderResource f : Pithos.get().getTreeView().getTrash().getFolders()){
r.add(new TrashFolderResource(f));
}
trashProvider.setList(r);
public void f(final DragAndDropContext context) {
if(context.getDroppableData()!=null && context.getDroppableData() instanceof RestResource){
- GSS.get().getTreeView().getUtils().openNodeContainingResource((RestResource) context.getDroppableData(), new RefreshHandler() {
+ Pithos.get().getTreeView().getUtils().openNodeContainingResource((RestResource) context.getDroppableData(), new RefreshHandler() {
@Override
public void onRefresh() {
FolderResource rootResource = getResult();
//((MyFolderResource)value).getResource().setFiles(rootResource.getFiles());
((MyFolderResource)value).setResource(rootResource);
- if(GSS.get().getTreeView().getSelection().getUri().equals(value.getUri()))
+ if(Pithos.get().getTreeView().getSelection().getUri().equals(value.getUri()))
selectionModel.setSelected(value, true);
- GSS.get().onResourceUpdate(value,clearSelection);
+ Pithos.get().onResourceUpdate(value,clearSelection);
}
@Override
public void onError(Throwable t) {
GWT.log("Error fetching root folder", t);
- GSS.get().displayError("Unable to fetch root folder");
+ Pithos.get().displayError("Unable to fetch root folder");
}
};
DeferredCommand.addCommand(gf);
}
else if(value instanceof TrashResource){
- DeferredCommand.addCommand(new GetCommand<TrashResource>(TrashResource.class, GSS.get().getCurrentUserResource().getTrashPath(), null) {
+ DeferredCommand.addCommand(new GetCommand<TrashResource>(TrashResource.class, Pithos.get().getCurrentUserResource().getTrashPath(), null) {
@Override
public void onComplete() {
//trash = getResult();
((TrashResource)value).setFiles(getResult().getFiles());
for(RestResource r : getRootNodes().getList()){
if(r instanceof TrashResource)
- getRootNodes().getList().set(getRootNodes().getList().indexOf(r),GSS.get().getTreeView().getTrash());
+ getRootNodes().getList().set(getRootNodes().getList().indexOf(r), Pithos.get().getTreeView().getTrash());
}
- GSS.get().getTreeView().updateNodeChildren(GSS.get().getTreeView().getTrash());
- //GSS.get().showFileList(true);
- GSS.get().onResourceUpdate(value,clearSelection);
+ Pithos.get().getTreeView().updateNodeChildren(Pithos.get().getTreeView().getTrash());
+ //Pithos.get().showFileList(true);
+ Pithos.get().onResourceUpdate(value,clearSelection);
}
@Override
}
else{
GWT.log("", t);
- GSS.get().displayError("Unable to fetch trash folder:"+t.getMessage());
- //GSS.get().getTreeView().getTrash() = new TrashResource(GSS.get().getCurrentUserResource().getTrashPath());
+ Pithos.get().displayError("Unable to fetch trash folder:"+t.getMessage());
+ //Pithos.get().getTreeView().getTrash() = new TrashResource(Pithos.get().getCurrentUserResource().getTrashPath());
}
}
}
FolderResource rootResource = getResult();
//((MyFolderResource)value).getResource().setFiles(rootResource.getFiles());
((OthersFolderResource)value).setResource(rootResource);
- if(GSS.get().getTreeView().getSelection().getUri().equals(value.getUri()))
+ if(Pithos.get().getTreeView().getSelection().getUri().equals(value.getUri()))
selectionModel.setSelected(value, true);
- GSS.get().onResourceUpdate(value,clearSelection);
+ Pithos.get().onResourceUpdate(value,clearSelection);
}
@Override
public void onError(Throwable t) {
GWT.log("Error fetching root folder", t);
- GSS.get().displayError("Unable to fetch root folder");
+ Pithos.get().displayError("Unable to fetch root folder");
}
};
FolderResource rootResource = getResult();
//((MyFolderResource)value).getResource().setFiles(rootResource.getFiles());
((SharedFolderResource)value).setResource(rootResource);
- if(GSS.get().getTreeView().getSelection().getUri().equals(value.getUri()))
+ if(Pithos.get().getTreeView().getSelection().getUri().equals(value.getUri()))
selectionModel.setSelected(value, true);
- GSS.get().onResourceUpdate(value,clearSelection);
+ Pithos.get().onResourceUpdate(value,clearSelection);
}
@Override
public void onError(Throwable t) {
GWT.log("Error fetching root folder", t);
- GSS.get().displayError("Unable to fetch root folder");
+ Pithos.get().displayError("Unable to fetch root folder");
}
};
((SharedResource)value).setFolders(getResult().getFolders());
((SharedResource)value).setFiles(getResult().getFiles());
- if(GSS.get().getTreeView().getSelection().getUri().equals(value.getUri()))
+ if(Pithos.get().getTreeView().getSelection().getUri().equals(value.getUri()))
selectionModel.setSelected(value, true);
- GSS.get().onResourceUpdate(value,clearSelection);
+ Pithos.get().onResourceUpdate(value,clearSelection);
}
@Override
public void onError(Throwable t) {
GWT.log("Error fetching root folder", t);
- GSS.get().displayError("Unable to fetch root folder");
+ Pithos.get().displayError("Unable to fetch root folder");
}
};
((OtherUserResource)value).setFolders(getResult().getFolders());
((OtherUserResource)value).setFiles(getResult().getFiles());
- if(GSS.get().getTreeView().getSelection().getUri().equals(value.getUri()))
+ if(Pithos.get().getTreeView().getSelection().getUri().equals(value.getUri()))
selectionModel.setSelected(value, true);
- GSS.get().onResourceUpdate(value,clearSelection);
+ Pithos.get().onResourceUpdate(value,clearSelection);
}
@Override
public void onError(Throwable t) {
GWT.log("Error fetching root folder", t);
- GSS.get().displayError("Unable to fetch root folder");
+ Pithos.get().displayError("Unable to fetch root folder");
}
};
@Override
public void onError(Throwable t) {
- GSS.get().displayError("Unable to fetch subfolders");
+ Pithos.get().displayError("Unable to fetch subfolders");
GWT.log("Unable to fetch subfolders", t);
}
public void onError(Throwable t) {
GWT.log("Error fetching root folder", t);
- GSS.get().displayError("Unable to fetch root folder");
+ Pithos.get().displayError("Unable to fetch root folder");
}
};
@Override
public void onError(Throwable t) {
GWT.log("Error fetching Others Root folder", t);
- GSS.get().displayError("Unable to fetch Others Root folder");
+ Pithos.get().displayError("Unable to fetch Others Root folder");
}
@Override
@Override
public void onError(Throwable t) {
GWT.log("Error fetching Others Root folder", t);
- GSS.get().displayError("Unable to fetch Others Root folder");
+ Pithos.get().displayError("Unable to fetch Others Root folder");
}
};
DeferredCommand.addCommand(go);
/**
* @return the name of the service
*/
- @DefaultStringValue("GSS")
+ @DefaultStringValue("pithos")
String serviceName();
/**
*/
package gr.grnet.pithos.web.client;
-import com.google.gwt.user.client.Window;
import gr.grnet.pithos.web.client.rest.PostCommand;
import gr.grnet.pithos.web.client.rest.RestException;
Button ok = new Button("Yes", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- resetPassword(GSS.get().getCurrentUserResource().getUri());
+ resetPassword(Pithos.get().getCurrentUserResource().getUri());
hide();
}
});
Button confirm = new Button("Proceed", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- GSS.get().authenticateUser();
+ Pithos.get().authenticateUser();
hide();
}
});
// either enter or escape is pressed.
switch (evt.getKeyCode()) {
case KeyCodes.KEY_ENTER:
- GSS.get().authenticateUser();
+ Pithos.get().authenticateUser();
hide();
break;
case KeyCodes.KEY_ESCAPE:
table.setText(0, 0, "Username");
table.setText(1, 0, "Token");
TextBox username = new TextBox();
- final GSS app = GSS.get();
+ final Pithos app = Pithos.get();
username.setText(app.getCurrentUserResource().getUsername());
username.setReadOnly(true);
username.setWidth(WIDTH_FIELD);
username.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- GSS.enableIESelection();
+ Pithos.enableIESelection();
((TextBox) event.getSource()).selectAll();
- GSS.preventIESelection();
+ Pithos.preventIESelection();
}
});
tokenBox.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- GSS.enableIESelection();
+ Pithos.enableIESelection();
((TextBox) event.getSource()).selectAll();
- GSS.preventIESelection();
+ Pithos.preventIESelection();
}
});
private void resetPassword(String userUri) {
if (userUri == null || userUri.length() == 0) {
- GSS.get().displayError("Empty user Uri!");
+ Pithos.get().displayError("Empty user Uri!");
return;
}
GWT.log("resetPassword(" + userUri + ")", null);
if(t instanceof RestException){
int statusCode = ((RestException)t).getHttpStatusCode();
if(statusCode == 405)
- GSS.get().displayError("You don't have the necessary" +
+ Pithos.get().displayError("You don't have the necessary" +
" permissions");
else if(statusCode == 404)
- GSS.get().displayError("Resource does not exist");
+ Pithos.get().displayError("Resource does not exist");
else
- GSS.get().displayError("Unable to reset password:" +
+ Pithos.get().displayError("Unable to reset password:" +
((RestException)t).getHttpStatusText());
}
else
- GSS.get().displayError("System error resetting password:" +
+ Pithos.get().displayError("System error resetting password:" +
t.getMessage());
}
};
import gr.grnet.pithos.web.client.MessagePanel.Images;\r
import gr.grnet.pithos.web.client.foldertree.File;\r
import gr.grnet.pithos.web.client.foldertree.Resource;\r
-import gr.grnet.pithos.web.client.rest.DeleteCommand;\r
import gr.grnet.pithos.web.client.rest.DeleteRequest;\r
-import gr.grnet.pithos.web.client.rest.MultipleDeleteCommand;\r
import gr.grnet.pithos.web.client.rest.RestException;\r
-import gr.grnet.pithos.web.client.rest.resource.FileResource;\r
\r
-import java.util.ArrayList;\r
import java.util.Iterator;\r
import java.util.List;\r
\r
import com.google.gwt.event.dom.client.ClickEvent;\r
import com.google.gwt.event.dom.client.ClickHandler;\r
import com.google.gwt.event.dom.client.KeyCodes;\r
-import com.google.gwt.user.client.DeferredCommand;\r
import com.google.gwt.user.client.Event.NativePreviewEvent;\r
import com.google.gwt.user.client.ui.AbstractImagePrototype;\r
import com.google.gwt.user.client.ui.Button;\r
private void deleteFile(final Iterator<File> iter) {\r
if (iter.hasNext()) {\r
File f = iter.next();\r
- String path = GSS.get().getApiPath() + GSS.get().getUsername() + f.getUri();\r
+ String path = Pithos.get().getApiPath() + Pithos.get().getUsername() + f.getUri();\r
DeleteRequest deleteFile = new DeleteRequest(path) {\r
@Override\r
public void onSuccess(Resource result) {\r
public void onError(Throwable t) {\r
GWT.log("", t);\r
if (t instanceof RestException) {\r
- GSS.get().displayError("Unable to delete file: " + ((RestException) t).getHttpStatusText());\r
+ Pithos.get().displayError("Unable to delete file: " + ((RestException) t).getHttpStatusText());\r
}\r
else\r
- GSS.get().displayError("System error unable to delete file: "+t.getMessage());\r
+ Pithos.get().displayError("System error unable to delete file: "+t.getMessage());\r
}\r
};\r
- deleteFile.setHeader("X-Auth-Token", GSS.get().getToken());\r
+ deleteFile.setHeader("X-Auth-Token", Pithos.get().getToken());\r
Scheduler.get().scheduleDeferred(deleteFile);\r
}\r
else {\r
- GSS.get().updateFolder(files.get(0).getParent());\r
+ Pithos.get().updateFolder(files.get(0).getParent());\r
}\r
}\r
\r
*/\r
package gr.grnet.pithos.web.client;\r
\r
-import com.google.gwt.core.client.Scheduler;\r
import com.google.gwt.event.dom.client.KeyDownEvent;\r
-import com.google.gwt.http.client.Request;\r
-import com.google.gwt.http.client.RequestBuilder;\r
-import com.google.gwt.http.client.RequestCallback;\r
-import com.google.gwt.http.client.RequestException;\r
-import com.google.gwt.http.client.Response;\r
-import com.google.gwt.json.client.JSONArray;\r
-import com.google.gwt.json.client.JSONObject;\r
-import com.google.gwt.json.client.JSONParser;\r
-import com.google.gwt.json.client.JSONString;\r
-import com.google.gwt.json.client.JSONValue;\r
-import com.google.gwt.user.client.Event;\r
import gr.grnet.pithos.web.client.MessagePanel.Images;\r
-import gr.grnet.pithos.web.client.foldertree.File;\r
import gr.grnet.pithos.web.client.foldertree.Folder;\r
-import gr.grnet.pithos.web.client.foldertree.Resource;\r
-import gr.grnet.pithos.web.client.rest.DeleteCommand;\r
-import gr.grnet.pithos.web.client.rest.DeleteRequest;\r
-import gr.grnet.pithos.web.client.rest.GetRequest;\r
-import gr.grnet.pithos.web.client.rest.RestException;\r
-import gr.grnet.pithos.web.client.rest.RestRequestCallback;\r
-import gr.grnet.pithos.web.client.rest.resource.FolderResource;\r
-import gr.grnet.pithos.web.client.rest.resource.RestResource;\r
-import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;\r
-import gr.grnet.pithos.web.client.rest.resource.TrashFolderResource;\r
\r
-import com.google.gwt.core.client.GWT;\r
import com.google.gwt.dom.client.NativeEvent;\r
import com.google.gwt.event.dom.client.ClickEvent;\r
import com.google.gwt.event.dom.client.ClickHandler;\r
import com.google.gwt.event.dom.client.KeyCodes;\r
-import com.google.gwt.user.client.DeferredCommand;\r
import com.google.gwt.user.client.Event.NativePreviewEvent;\r
import com.google.gwt.user.client.ui.AbstractImagePrototype;\r
import com.google.gwt.user.client.ui.Button;\r
import com.google.gwt.user.client.ui.HasHorizontalAlignment;\r
import com.google.gwt.user.client.ui.HorizontalPanel;\r
import com.google.gwt.user.client.ui.VerticalPanel;\r
-import java.util.Iterator;\r
-import java.util.List;\r
\r
/**\r
* The 'delete folder' dialog box.\r
*/\r
public class DeleteFolderDialog extends DialogBox {\r
\r
- private GSS app;\r
+ private Pithos app;\r
private Folder folder;\r
\r
/**\r
* The widget's constructor.\r
* @param images the supplied images\r
*/\r
- public DeleteFolderDialog(GSS _app, Images images, Folder _folder) {\r
+ public DeleteFolderDialog(Pithos _app, Images images, Folder _folder) {\r
this.app = _app;\r
this.folder = _folder;\r
// Set the dialog's caption.\r
import gr.grnet.pithos.web.client.rest.MultiplePostCommand;
import gr.grnet.pithos.web.client.rest.PostCommand;
import gr.grnet.pithos.web.client.rest.RestException;
-import gr.grnet.pithos.web.client.rest.resource.FileResource;
import gr.grnet.pithos.web.client.rest.resource.FolderResource;
import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
import java.util.List;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
};
final MenuBar contextMenu = new MenuBar(true);
- final CellTreeView folders = GSS.get().getTreeView();
+ final CellTreeView folders = Pithos.get().getTreeView();
contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Move</span>", true, new Command() {
moveFolder(target, (Folder) toCopy);
}
else if (toCopy instanceof List) {
- List<File> files = GSS.get().getFileList().getSelectedFiles();
+ List<File> files = Pithos.get().getFileList().getSelectedFiles();
moveFiles(target, files);
}
hide();
if (toCopy instanceof Folder)
copyFolder(target, (Folder) toCopy);
else if (toCopy instanceof List) {
- List<File> files = GSS.get().getFileList().getSelectedFiles();
+ List<File> files = Pithos.get().getFileList().getSelectedFiles();
copyFiles(target, files);
}
hide();
trashFolder(((RestResourceWrapper) toCopy).getResource());
}
else if (toCopy instanceof List) {
- List<File> files = GSS.get().getFileList().getSelectedFiles();
+ List<File> files = Pithos.get().getFileList().getSelectedFiles();
trashFiles(files);
}
hide();
//
// @Override
// public void onComplete() {
-// GSS.get().getTreeView().updateNodeChildren(new RestResourceWrapper(target));
-// GSS.get().getStatusPanel().updateStats();
+// Pithos.get().getTreeView().updateNodeChildren(new RestResourceWrapper(target));
+// Pithos.get().getStatusPanel().updateStats();
// }
//
// @Override
// if (t instanceof RestException) {
// int statusCode = ((RestException) t).getHttpStatusCode();
// if (statusCode == 405)
-// GSS.get().displayError("You don't have the necessary permissions");
+// Pithos.get().displayError("You don't have the necessary permissions");
//
// else if (statusCode == 409)
-// GSS.get().displayError("A folder with the same name already exists");
+// Pithos.get().displayError("A folder with the same name already exists");
// else if (statusCode == 413)
-// GSS.get().displayError("Your quota has been exceeded");
+// Pithos.get().displayError("Your quota has been exceeded");
// else
-// GSS.get().displayError("Unable to copy folder:" + ((RestException) t).getHttpStatusText());
+// Pithos.get().displayError("Unable to copy folder:" + ((RestException) t).getHttpStatusText());
// }
// else
-// GSS.get().displayError("System error copying folder:" + t.getMessage());
+// Pithos.get().displayError("System error copying folder:" + t.getMessage());
// }
// };
// DeferredCommand.addCommand(cf);
// @Override
// public void onComplete() {
// GWT.log("[MOVE]" + target.getUri() + " " + toCopy.getParentURI());
-// GSS.get().getTreeView().updateNodeChildren(new RestResourceWrapper(target));
-// GSS.get().getTreeView().updateNodeChildrenForRemove(toCopy.getParentURI());
-// GSS.get().getStatusPanel().updateStats();
+// Pithos.get().getTreeView().updateNodeChildren(new RestResourceWrapper(target));
+// Pithos.get().getTreeView().updateNodeChildrenForRemove(toCopy.getParentURI());
+// Pithos.get().getStatusPanel().updateStats();
// }
//
// @Override
// if (t instanceof RestException) {
// int statusCode = ((RestException) t).getHttpStatusCode();
// if (statusCode == 405)
-// GSS.get().displayError("You don't have the necessary permissions");
+// Pithos.get().displayError("You don't have the necessary permissions");
//
// else if (statusCode == 409)
-// GSS.get().displayError("A folder with the same name already exists");
+// Pithos.get().displayError("A folder with the same name already exists");
// else if (statusCode == 413)
-// GSS.get().displayError("Your quota has been exceeded");
+// Pithos.get().displayError("Your quota has been exceeded");
// else
-// GSS.get().displayError("Unable to copy folder:" + ((RestException) t).getHttpStatusText());
+// Pithos.get().displayError("Unable to copy folder:" + ((RestException) t).getHttpStatusText());
// }
// else
-// GSS.get().displayError("System error copying folder:" + t.getMessage());
+// Pithos.get().displayError("System error copying folder:" + t.getMessage());
// }
// };
// DeferredCommand.addCommand(cf);
@Override
public void onComplete() {
- GSS.get().getTreeView().updateNodeChildrenForRemove(folder.getParentURI());
- GSS.get().getTreeView().updateTrashNode();
+ Pithos.get().getTreeView().updateNodeChildrenForRemove(folder.getParentURI());
+ Pithos.get().getTreeView().updateTrashNode();
/*for(TreeItem item : items)
- GSS.get().getFolders().updateFolder((DnDTreeItem) item);
- GSS.get().getFolders().update(GSS.get().getFolders().getTrashItem());
+ Pithos.get().getFolders().updateFolder((DnDTreeItem) item);
+ Pithos.get().getFolders().update(Pithos.get().getFolders().getTrashItem());
- GSS.get().showFileList(true);
+ Pithos.get().showFileList(true);
*/
}
if (t instanceof RestException) {
int statusCode = ((RestException) t).getHttpStatusCode();
if (statusCode == 405)
- GSS.get().displayError("You don't have the necessary permissions");
+ Pithos.get().displayError("You don't have the necessary permissions");
else if (statusCode == 404)
- GSS.get().displayError("Folder does not exist");
+ Pithos.get().displayError("Folder does not exist");
else
- GSS.get().displayError("Unable to trash folder:" + ((RestException) t).getHttpStatusText());
+ Pithos.get().displayError("Unable to trash folder:" + ((RestException) t).getHttpStatusText());
}
else
- GSS.get().displayError("System error trashing folder:" + t.getMessage());
+ Pithos.get().displayError("System error trashing folder:" + t.getMessage());
}
};
DeferredCommand.addCommand(tot);
@Override
public void onComplete() {
- GSS.get().showFileList(true);
+ Pithos.get().showFileList(true);
}
@Override
if (t instanceof RestException) {
int statusCode = ((RestException) t).getHttpStatusCode();
if (statusCode == 405)
- GSS.get().displayError("You don't have the necessary permissions");
+ Pithos.get().displayError("You don't have the necessary permissions");
else if (statusCode == 404)
- GSS.get().displayError("File does not exist");
+ Pithos.get().displayError("File does not exist");
else
- GSS.get().displayError("Unable to trash file:" + ((RestException) t).getHttpStatusText());
+ Pithos.get().displayError("Unable to trash file:" + ((RestException) t).getHttpStatusText());
}
else
- GSS.get().displayError("System error trashing file:" + t.getMessage());
+ Pithos.get().displayError("System error trashing file:" + t.getMessage());
}
};
DeferredCommand.addCommand(tot);
private void executeCopyOrMoveFiles(final int index, final List<String> paths) {
if (index >= paths.size()) {
- GSS.get().showFileList(true);
- GSS.get().getStatusPanel().updateStats();
+ Pithos.get().showFileList(true);
+ Pithos.get().getStatusPanel().updateStats();
return;
}
PostCommand cf = new PostCommand(paths.get(index), "", 200) {
if (t instanceof RestException) {
int statusCode = ((RestException) t).getHttpStatusCode();
if (statusCode == 405)
- GSS.get().displayError("You don't have the necessary permissions");
+ Pithos.get().displayError("You don't have the necessary permissions");
else if (statusCode == 404)
- GSS.get().displayError("File not found");
+ Pithos.get().displayError("File not found");
else if (statusCode == 409)
- GSS.get().displayError("A file with the same name already exists");
+ Pithos.get().displayError("A file with the same name already exists");
else if (statusCode == 413)
- GSS.get().displayError("Your quota has been exceeded");
+ Pithos.get().displayError("Your quota has been exceeded");
else
- GSS.get().displayError("Unable to copy file:" + ((RestException) t).getHttpStatusText());
+ Pithos.get().displayError("Unable to copy file:" + ((RestException) t).getHttpStatusText());
}
else
- GSS.get().displayError("System error copying file:" + t.getMessage());
+ Pithos.get().displayError("System error copying file:" + t.getMessage());
}
};
DeferredCommand.addCommand(cf);
import gr.grnet.pithos.web.client.commands.ToTrashCommand;
import gr.grnet.pithos.web.client.foldertree.File;
import gr.grnet.pithos.web.client.foldertree.Folder;
-import gr.grnet.pithos.web.client.rest.resource.FileResource;
-
-import gr.grnet.pithos.web.client.rest.resource.GroupUserResource;
-import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
import java.util.List;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
-import com.google.gwt.user.client.ui.PopupPanel;
/**
* The 'Edit' menu implementation.
*
* @param newImages the image bundle passed on by the parent object
*/
- public EditMenu(final GSS _app, final Images newImages) {
+ public EditMenu(final Pithos _app, final Images newImages) {
super(true);
setAnimationEnabled(true);
images = newImages;
import gr.grnet.pithos.web.client.commands.DeleteCommand;
import gr.grnet.pithos.web.client.commands.PasteCommand;
import gr.grnet.pithos.web.client.commands.PropertiesCommand;
-import gr.grnet.pithos.web.client.commands.RefreshCommand;
-import gr.grnet.pithos.web.client.commands.RestoreTrashCommand;
import gr.grnet.pithos.web.client.commands.ToTrashCommand;
import gr.grnet.pithos.web.client.commands.UploadFileCommand;
import gr.grnet.pithos.web.client.foldertree.File;
import gr.grnet.pithos.web.client.foldertree.Folder;
-import gr.grnet.pithos.web.client.rest.resource.FileResource;
-import gr.grnet.pithos.web.client.rest.resource.FolderResource;
-import gr.grnet.pithos.web.client.rest.resource.RestResource;
-import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
-import gr.grnet.pithos.web.client.rest.resource.TrashFolderResource;
import java.util.List;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.ContextMenuEvent;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
// The popup's constructor's argument is a boolean specifying that it
// auto-close itself when the user clicks outside of it.
super(true);
- GSS gss = GSS.get();
+ Pithos gss = Pithos.get();
setAnimationEnabled(true);
images = newImages;
MenuBar contextMenu = new MenuBar(true);
- if (GSS.get().getClipboard().hasFiles()) {
- pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.paste()).getHTML() + " Paste</span>", true, new PasteCommand(GSS.get(), this, selectedFolder));
+ if (Pithos.get().getClipboard().hasFiles()) {
+ pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.paste()).getHTML() + " Paste</span>", true, new PasteCommand(Pithos.get(), this, selectedFolder));
contextMenu.addItem(pasteItem);
}
// MenuItem delete = new MenuItem("<span>" + AbstractImagePrototype.create(images.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, null, images));
// contextMenu.addItem(delete);
// } else {
- cutItem = new MenuItem("<span id='fileContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(GSS.get(), this, selectedFiles));
+ cutItem = new MenuItem("<span id='fileContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(Pithos.get(), this, selectedFiles));
contextMenu.addItem(cutItem);
- copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(GSS.get(), this, selectedFiles));
+ copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(Pithos.get(), this, selectedFiles));
contextMenu.addItem(copyItem);
- trashItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + " Move to Trash</span>", true, new ToTrashCommand(GSS.get(), this, selectedFiles));
+ trashItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + " Move to Trash</span>", true, new ToTrashCommand(Pithos.get(), this, selectedFiles));
contextMenu.addItem(trashItem);
deleteItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, selectedFiles, images));
// sharingItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + " Sharing</span>", true, new PropertiesCommand(this, images, 1));
// contextMenu.addItem(sharingItem);
- contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(GSS.get(), this, selectedFiles, images, 0)));
+ contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(Pithos.get(), this, selectedFiles, images, 0)));
- contextMenu.addItem(new MenuItem("<span><a class='hidden-link' href='" + GSS.get().getApiPath() + GSS.get().getUsername() + selectedFiles.get(0).getUri() + "?X-Auth-Token=" + GSS.get().getToken() + "' target='_blank'>" + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download</a></span>", true, (Command) null));
+ if (!selectedFiles.isEmpty())
+ contextMenu.addItem(new MenuItem("<span><a class='hidden-link' href='" + Pithos.get().getApiPath() + Pithos.get().getUsername() + selectedFiles.get(0).getUri() + "?X-Auth-Token=" + Pithos.get().getToken() + "' target='_blank'>" + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download</a></span>", true, (Command) null));
MenuItem unSelect = new MenuItem("<span>" + AbstractImagePrototype.create(images.unselectAll()).getHTML() + " Unselect</span>", true, new Command() {
@Override
public void execute() {
hide();
- GSS.get().getFileList().clearSelectedRows();
+ Pithos.get().getFileList().clearSelectedRows();
}
});
contextMenu.addItem(unSelect);
}
};
- celltable = new DragAndDropCellTable<File>(GSS.VISIBLE_FILE_COUNT, resources, keyProvider);
+ celltable = new DragAndDropCellTable<File>(Pithos.VISIBLE_FILE_COUNT, resources, keyProvider);
celltable.setWidth("100%");
celltable.setStyleName("pithos-List");
vp.addHandler(new ContextMenuHandler() {
@Override
public void onContextMenu(ContextMenuEvent event) {
- FileContextMenu contextMenu = new FileContextMenu(images, treeView.getSelection(), getSelectedFiles(), false);
- int x = event.getNativeEvent().getClientX();
- int y = event.getNativeEvent().getClientY();
- contextMenu.setPopupPosition(x, y);
- contextMenu.show();
+ Folder selectedFolder = treeView.getSelection();
+ if (!selectedFolder.isTrash()) {
+ FileContextMenu contextMenu = new FileContextMenu(images, selectedFolder, getSelectedFiles(), false);
+ int x = event.getNativeEvent().getClientX();
+ int y = event.getNativeEvent().getClientY();
+ contextMenu.setPopupPosition(x, y);
+ contextMenu.show();
+ }
}
}, ContextMenuEvent.getType());
initWidget(vp);
@Override
public void onSelectionChange(SelectionChangeEvent event) {
if(getSelectedFiles().size() == 1)
- GSS.get().setCurrentSelection(getSelectedFiles().get(0));
+ Pithos.get().setCurrentSelection(getSelectedFiles().get(0));
else
- GSS.get().setCurrentSelection(getSelectedFiles());
+ Pithos.get().setCurrentSelection(getSelectedFiles());
}
};
selectionModel.addSelectionChangeHandler(selectionHandler);
celltable.setSelectionModel(selectionModel, GSSSelectionEventManager.<File> createDefaultManager());
- celltable.setPageSize(GSS.VISIBLE_FILE_COUNT);
+ celltable.setPageSize(Pithos.VISIBLE_FILE_COUNT);
sinkEvents(Event.ONCONTEXTMENU);
// sinkEvents(Event.ONMOUSEUP);
// sinkEvents(Event.ONCLICK);
// sinkEvents(Event.ONKEYDOWN);
// sinkEvents(Event.ONDBLCLICK);
- GSS.preventIESelection();
+ Pithos.preventIESelection();
}
public List<File> getSelectedFiles() {
// event.preventDefault();
// } else if (DOM.eventGetType(event) == Event.ONDBLCLICK)
// if (getSelectedFiles().size() == 1) {
-// GSS app = GSS.get();
+// Pithos app = Pithos.get();
// File file = getSelectedFiles().get(0);
// Window.open(file.getUri(), "_blank", "");
// event.preventDefault();
*/
void update(boolean sort) {
int count = folderFileCount;
- int max = startIndex + GSS.VISIBLE_FILE_COUNT;
+ int max = startIndex + Pithos.VISIBLE_FILE_COUNT;
if (max > count)
max = count;
folderTotalSize = 0;
}
if (folderFileCount == 0) {
showingStats = "no files";
- } else if (folderFileCount < GSS.VISIBLE_FILE_COUNT) {
+ } else if (folderFileCount < Pithos.VISIBLE_FILE_COUNT) {
if (folderFileCount == 1)
showingStats = "1 file";
else
* Update status panel with currently showing file stats.
*/
public void updateCurrentlyShowingStats() {
- GSS.get().getStatusPanel().updateCurrentlyShowing(showingStats);
+ Pithos.get().getStatusPanel().updateCurrentlyShowing(showingStats);
}
/**
}
}
- if(files.size() > GSS.VISIBLE_FILE_COUNT){
+ if(files.size() > Pithos.VISIBLE_FILE_COUNT){
pagerBottom.setVisible(true);
pagerTop.setVisible(true);
}
* Shows the files in the cellTable
*/
private void showCellTable(){
- if(files.size()>GSS.VISIBLE_FILE_COUNT){
+ if(files.size()> Pithos.VISIBLE_FILE_COUNT){
pagerBottom.setVisible(true);
pagerTop.setVisible(true);
}
//celltable.redraw();
celltable.redrawHeaders();
}
+
+ public void showTrash() {
+ uploadButtonBottom.setVisible(false);
+ uploadButtonTop.setVisible(false);
+ }
+
+ public void showFiles() {
+ uploadButtonBottom.setVisible(true);
+ uploadButtonTop.setVisible(true);
+ }
}
*/
package gr.grnet.pithos.web.client;
-import gr.grnet.pithos.web.client.commands.EmptyTrashCommand;
import gr.grnet.pithos.web.client.commands.NewFolderCommand;
import gr.grnet.pithos.web.client.commands.PropertiesCommand;
-import gr.grnet.pithos.web.client.commands.RefreshCommand;
import gr.grnet.pithos.web.client.commands.UploadFileCommand;
import gr.grnet.pithos.web.client.foldertree.File;
import gr.grnet.pithos.web.client.foldertree.Folder;
-import gr.grnet.pithos.web.client.rest.resource.FileResource;
import java.util.List;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.Command;
*
* @param _images the image bundle passed on by the parent object
*/
- public FileMenu(GSS _app, final Images _images) {
+ public FileMenu(Pithos _app, final Images _images) {
super(true);
setAnimationEnabled(true);
images = _images;
addItem(uploadItem);
}
if (selectedFiles.size() == 1) {
- addItem(new MenuItem("<span><a class='hidden-link' href='" + GSS.get().getApiPath() + GSS.get().getUsername() + selectedFiles.get(0).getUri() + "?X-Auth-Token=" + GSS.get().getToken() + "' target='_blank'>" + AbstractImagePrototype.create(images.download()).getHTML() + " Download</a></span>", true, (Command) null));
+ addItem(new MenuItem("<span><a class='hidden-link' href='" + Pithos.get().getApiPath() + Pithos.get().getUsername() + selectedFiles.get(0).getUri() + "?X-Auth-Token=" + Pithos.get().getToken() + "' target='_blank'>" + AbstractImagePrototype.create(images.download()).getHTML() + " Download</a></span>", true, (Command) null));
}
// MenuItem emptyTrashItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.emptyTrash()).getHTML() + " Empty Trash</span>", true, new EmptyTrashCommand(this));
// .setVisible(propertiesVisible);
//
if (selectedFiles.size() > 0 || selectedFolder != null) {
- MenuItem propertiesItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(GSS.get(), null, selectedFiles.size() > 0 ? selectedFiles : selectedFolder, images, 0));
+ MenuItem propertiesItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(Pithos.get(), null, selectedFiles.size() > 0 ? selectedFiles : selectedFolder, images, 0));
addItem(propertiesItem);
}
}
import gr.grnet.pithos.web.client.foldertree.File;\r
import gr.grnet.pithos.web.client.foldertree.Resource;\r
import gr.grnet.pithos.web.client.rest.PostCommand;\r
-import gr.grnet.pithos.web.client.rest.PostRequest;\r
import gr.grnet.pithos.web.client.rest.PutRequest;\r
import gr.grnet.pithos.web.client.rest.RestException;\r
-import gr.grnet.pithos.web.client.rest.resource.FileResource;\r
-import gr.grnet.pithos.web.client.rest.resource.GroupResource;\r
-import gr.grnet.pithos.web.client.rest.resource.PermissionHolder;\r
-\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Set;\r
\r
import com.google.gwt.core.client.GWT;\r
-import com.google.gwt.event.dom.client.ChangeEvent;\r
-import com.google.gwt.event.dom.client.ChangeHandler;\r
import com.google.gwt.event.dom.client.ClickEvent;\r
import com.google.gwt.event.dom.client.ClickHandler;\r
import com.google.gwt.i18n.client.DateTimeFormat;\r
-import com.google.gwt.json.client.JSONArray;\r
import com.google.gwt.json.client.JSONBoolean;\r
import com.google.gwt.json.client.JSONObject;\r
-import com.google.gwt.json.client.JSONString;\r
import com.google.gwt.resources.client.ClientBundle;\r
import com.google.gwt.resources.client.ImageResource;\r
import com.google.gwt.user.client.Command;\r
import com.google.gwt.user.client.DeferredCommand;\r
-import com.google.gwt.user.client.ui.AbstractImagePrototype;\r
import com.google.gwt.user.client.ui.Button;\r
import com.google.gwt.user.client.ui.CheckBox;\r
import com.google.gwt.user.client.ui.DecoratedTabPanel;\r
import com.google.gwt.user.client.ui.FlexTable;\r
import com.google.gwt.user.client.ui.FlowPanel;\r
import com.google.gwt.user.client.ui.FocusPanel;\r
-import com.google.gwt.user.client.ui.HTML;\r
import com.google.gwt.user.client.ui.HasHorizontalAlignment;\r
import com.google.gwt.user.client.ui.HorizontalPanel;\r
-import com.google.gwt.user.client.ui.Label;\r
import com.google.gwt.user.client.ui.TextBox;\r
import com.google.gwt.user.client.ui.VerticalPanel;\r
\r
\r
private String userFullName;\r
\r
- private GSS app;\r
+ private Pithos app;\r
\r
/**\r
* The widget's constructor.\r
*/\r
- public FilePropertiesDialog(GSS _app, File _file) {\r
+ public FilePropertiesDialog(Pithos _app, File _file) {\r
app = _app;\r
file = _file;\r
\r
// path.addClickHandler(new ClickHandler() {\r
// @Override\r
// public void onClick(ClickEvent event) {\r
-// GSS.enableIESelection();\r
+// Pithos.enableIESelection();\r
// ((TextBox) event.getSource()).selectAll();\r
-// GSS.preventIESelection();\r
+// Pithos.preventIESelection();\r
// }\r
// });\r
// path.setText(file.getUri());\r
// json.put("versioned", JSONBoolean.getInstance(versioned.getValue()));\r
//only update the read for all perm if the user is the owner\r
// if (readForAll.getValue() != file.isReadForAll())\r
-// if (file.getOwner().equals(GSS.get().getCurrentUserResource().getUsername()))\r
+// if (file.getOwner().equals(Pithos.get().getCurrentUserResource().getUsername()))\r
// json.put("readForAll", JSONBoolean.getInstance(readForAll.getValue()));\r
// int i = 0;\r
// if (permList.hasChanges()) {\r
if (t instanceof RestException) {\r
int statusCode = ((RestException) t).getHttpStatusCode();\r
if (statusCode == 405)\r
- GSS.get().displayError("You don't have the necessary permissions");\r
+ Pithos.get().displayError("You don't have the necessary permissions");\r
else if (statusCode == 404)\r
- GSS.get().displayError("User in permissions does not exist");\r
+ Pithos.get().displayError("User in permissions does not exist");\r
else if (statusCode == 409)\r
- GSS.get().displayError("A folder with the same name already exists");\r
+ Pithos.get().displayError("A folder with the same name already exists");\r
else if (statusCode == 413)\r
- GSS.get().displayError("Your quota has been exceeded");\r
+ Pithos.get().displayError("Your quota has been exceeded");\r
else\r
- GSS.get().displayError("Unable to modify file:" + ((RestException) t).getHttpStatusText());\r
+ Pithos.get().displayError("Unable to modify file:" + ((RestException) t).getHttpStatusText());\r
} else\r
- GSS.get().displayError("System error moifying file:" + t.getMessage());\r
+ Pithos.get().displayError("System error moifying file:" + t.getMessage());\r
}\r
};\r
DeferredCommand.addCommand(cf);\r
\r
@Override\r
public void onComplete() {\r
- GSS.get().getTreeView().refreshCurrentNode(false);\r
+ Pithos.get().getTreeView().refreshCurrentNode(false);\r
}\r
\r
@Override\r
if (t instanceof RestException) {\r
int statusCode = ((RestException) t).getHttpStatusCode();\r
if (statusCode == 405)\r
- GSS.get().displayError("You don't have the necessary permissions");\r
+ Pithos.get().displayError("You don't have the necessary permissions");\r
else if (statusCode == 404)\r
- GSS.get().displayError("User in permissions does not exist");\r
+ Pithos.get().displayError("User in permissions does not exist");\r
else if (statusCode == 409)\r
- GSS.get().displayError("A folder with the same name already exists");\r
+ Pithos.get().displayError("A folder with the same name already exists");\r
else if (statusCode == 413)\r
- GSS.get().displayError("Your quota has been exceeded");\r
+ Pithos.get().displayError("Your quota has been exceeded");\r
else\r
- GSS.get().displayError("Unable to modify file:" + ((RestException) t).getHttpStatusText());\r
+ Pithos.get().displayError("Unable to modify file:" + ((RestException) t).getHttpStatusText());\r
} else\r
- GSS.get().displayError("System error moifying file:" + t.getMessage());\r
+ Pithos.get().displayError("System error moifying file:" + t.getMessage());\r
}\r
};\r
DeferredCommand.addCommand(cf);\r
*/
package gr.grnet.pithos.web.client;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.http.client.Response;
import gr.grnet.pithos.web.client.foldertree.File;
import gr.grnet.pithos.web.client.foldertree.Folder;
-import gr.grnet.pithos.web.client.foldertree.Resource;
-import gr.grnet.pithos.web.client.rest.GetCommand;
-import gr.grnet.pithos.web.client.rest.PostCommand;
-import gr.grnet.pithos.web.client.rest.PutRequest;
-import gr.grnet.pithos.web.client.rest.RestCommand;
-import gr.grnet.pithos.web.client.rest.RestException;
-import gr.grnet.pithos.web.client.rest.resource.FileResource;
-import gr.grnet.pithos.web.client.rest.resource.FolderResource;
-import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
-import gr.grnet.pithos.web.client.rest.resource.UploadStatusResource;
-
-import java.util.ArrayList;
-import java.util.List;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.http.client.URL;
-import com.google.gwt.json.client.JSONObject;
-import com.google.gwt.json.client.JSONString;
-import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.Event.NativePreviewEvent;
-import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.FileUpload;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
-import javax.xml.transform.Templates;
/**
* The 'File upload' dialog box implementation.
protected Folder folder;
- protected GSS app;
+ protected Pithos app;
/**
* The widget's constructor.
return null;
}
- public void setApp(GSS app) {
+ public void setApp(Pithos app) {
this.app = app;
}
import gr.grnet.pithos.web.client.rest.PostCommand;
import gr.grnet.pithos.web.client.rest.RestCommand;
import gr.grnet.pithos.web.client.rest.RestException;
-import gr.grnet.pithos.web.client.rest.resource.FileResource;
import java.util.ArrayList;
import java.util.Arrays;
/**
* The widget's constructor.
*/
- public FileUploadGearsDialog(GSS _app, Folder _folder) {
+ public FileUploadGearsDialog(Pithos _app, Folder _folder) {
this.folder = _folder;
this.app = _app;
// Set the dialog's caption.
info.addStyleName("pithos-uploadNote");
panel.add(info);
// Add an informative label with the folder name.
- Object selection = GSS.get().getTreeView().getSelection();
+ Object selection = Pithos.get().getTreeView().getSelection();
browse = new Button("Browse...");
public void onClick(ClickEvent event) {
canContinue = false;
cancelUpload();
- GSS.get().showFileList(true);
+ Pithos.get().showFileList(true);
}
});
buttons.add(cancel);
@Override
public void prepareAndSubmit() {
- GSS app = GSS.get();
+ Pithos app = Pithos.get();
if (selectedFiles.size() == 0) {
app.displayError("You must select a file!");
hide();
@Override
public void onError(Throwable t) {
- GSS app = GSS.get();
+ Pithos app = Pithos.get();
GWT.log("", t);
if (t instanceof RestException) {
int statusCode = ((RestException) t).getHttpStatusCode();
* Perform the HTTP request to upload the specified file.
*/
protected void doSend(final List<File> filesRemaining) {
- final GSS app = GSS.get();
+ final Pithos app = Pithos.get();
HttpRequest request = factory.createHttpRequest();
requests.add(request);
String method = "PUT";
String date = RestCommand.getDate();
String sig = RestCommand.calculateSig(method, date, resource, RestCommand.base64decode(token));
request.open(method, path);
- request.setRequestHeader("X-GSS-Date", date);
request.setRequestHeader("Authorization", app.getCurrentUserResource().getUsername() + " " + sig);
request.setRequestHeader("Accept", "application/json; charset=utf-8");
request.setCallback(new RequestCallback() {
*/
protected void finish() {
hide();
- //GSS.get().showFileList(true);
- GSS.get().getTreeView().updateNode(GSS.get().getTreeView().getSelection());//showFileList(true);
- GSS.get().getStatusPanel().updateStats();
+ //Pithos.get().showFileList(true);
+ Pithos.get().getTreeView().updateNode(Pithos.get().getTreeView().getSelection());//showFileList(true);
+ Pithos.get().getStatusPanel().updateStats();
}
/**
*/
@Override
protected void doSend(final List<File> filesRemaining) {
- final GSS app = GSS.get();
+ final Pithos app = Pithos.get();
HttpRequest request = factory.createHttpRequest();
requests.add(request);
String method = "POST";
String date = RestCommand.getDate();
String sig = RestCommand.calculateSig(method, date, resource, RestCommand.base64decode(token));
request.open(method, path);
- request.setRequestHeader("X-GSS-Date", date);
request.setRequestHeader("Authorization", app.getCurrentUserResource().getUsername() + " " + sig);
request.setRequestHeader("Accept", "application/json; charset=utf-8");
request.setCallback(new RequestCallback() {
*/\r
package gr.grnet.pithos.web.client;\r
\r
-import gr.grnet.pithos.web.client.components.TristateCheckBox;\r
import gr.grnet.pithos.web.client.foldertree.File;\r
import gr.grnet.pithos.web.client.foldertree.Folder;\r
-import gr.grnet.pithos.web.client.rest.MultiplePostCommand;\r
-import gr.grnet.pithos.web.client.rest.RestException;\r
-import gr.grnet.pithos.web.client.rest.resource.FileResource;\r
\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
import java.util.List;\r
\r
-import com.google.gwt.core.client.GWT;\r
import com.google.gwt.event.dom.client.ClickEvent;\r
import com.google.gwt.event.dom.client.ClickHandler;\r
-import com.google.gwt.event.dom.client.FocusEvent;\r
-import com.google.gwt.event.dom.client.FocusHandler;\r
-import com.google.gwt.json.client.JSONArray;\r
-import com.google.gwt.json.client.JSONBoolean;\r
-import com.google.gwt.json.client.JSONObject;\r
-import com.google.gwt.json.client.JSONString;\r
-import com.google.gwt.user.client.Command;\r
-import com.google.gwt.user.client.DeferredCommand;\r
import com.google.gwt.user.client.ui.Button;\r
import com.google.gwt.user.client.ui.DecoratedTabPanel;\r
import com.google.gwt.user.client.ui.DisclosurePanel;\r
import com.google.gwt.user.client.ui.FocusPanel;\r
import com.google.gwt.user.client.ui.HasHorizontalAlignment;\r
import com.google.gwt.user.client.ui.HorizontalPanel;\r
-import com.google.gwt.user.client.ui.Label;\r
import com.google.gwt.user.client.ui.VerticalPanel;\r
\r
/**\r
*\r
* @param _files\r
*/\r
- public FilesPropertiesDialog(GSS _app, final List<File> _files) {\r
+ public FilesPropertiesDialog(Pithos _app, final List<File> _files) {\r
super();\r
\r
files = _files;\r
//\r
// @Override\r
// public void onComplete() {\r
-// GSS.get().getTreeView().refreshCurrentNode(false);\r
+// Pithos.get().getTreeView().refreshCurrentNode(false);\r
// }\r
//\r
// @Override\r
// if(t instanceof RestException){\r
// int statusCode = ((RestException)t).getHttpStatusCode();\r
// if(statusCode == 405)\r
-// GSS.get().displayError("You don't have the necessary permissions");\r
+// Pithos.get().displayError("You don't have the necessary permissions");\r
// else if(statusCode == 404)\r
-// GSS.get().displayError("File does not exist");\r
+// Pithos.get().displayError("File does not exist");\r
// else if(statusCode == 409)\r
-// GSS.get().displayError("A file with the same name already exists");\r
+// Pithos.get().displayError("A file with the same name already exists");\r
// else if(statusCode == 413)\r
-// GSS.get().displayError("Your quota has been exceeded");\r
+// Pithos.get().displayError("Your quota has been exceeded");\r
// else\r
-// GSS.get().displayError("Unable to modify file::"+((RestException)t).getHttpStatusText());\r
+// Pithos.get().displayError("Unable to modify file::"+((RestException)t).getHttpStatusText());\r
// }\r
// else\r
-// GSS.get().displayError("System error modifying file:"+t.getMessage());\r
+// Pithos.get().displayError("System error modifying file:"+t.getMessage());\r
// }\r
// };\r
// DeferredCommand.addCommand(rt);\r
import gr.grnet.pithos.web.client.commands.CopyCommand;
import gr.grnet.pithos.web.client.commands.CutCommand;
import gr.grnet.pithos.web.client.commands.DeleteCommand;
-import gr.grnet.pithos.web.client.commands.EmptyTrashCommand;
import gr.grnet.pithos.web.client.commands.NewFolderCommand;
import gr.grnet.pithos.web.client.commands.PasteCommand;
import gr.grnet.pithos.web.client.commands.PropertiesCommand;
-import gr.grnet.pithos.web.client.commands.RefreshCommand;
-import gr.grnet.pithos.web.client.commands.RestoreTrashCommand;
import gr.grnet.pithos.web.client.commands.ToTrashCommand;
-import gr.grnet.pithos.web.client.commands.UploadFileCommand;
import gr.grnet.pithos.web.client.foldertree.Folder;
-import gr.grnet.pithos.web.client.foldertree.FolderTreeView;
-import gr.grnet.pithos.web.client.rest.resource.MyFolderResource;
-import gr.grnet.pithos.web.client.rest.resource.OtherUserResource;
-import gr.grnet.pithos.web.client.rest.resource.OthersFolderResource;
-import gr.grnet.pithos.web.client.rest.resource.OthersResource;
-import gr.grnet.pithos.web.client.rest.resource.RestResource;
-import gr.grnet.pithos.web.client.rest.resource.SharedFolderResource;
-import gr.grnet.pithos.web.client.rest.resource.SharedResource;
-import gr.grnet.pithos.web.client.rest.resource.TrashFolderResource;
-import gr.grnet.pithos.web.client.rest.resource.TrashResource;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
contextMenu.addItem(newFolder);
if (!folder.isContainer()) {
- MenuItem cut = new MenuItem("<span id = 'folderContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(GSS.get(), this, folder));
+ MenuItem cut = new MenuItem("<span id = 'folderContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(Pithos.get(), this, folder));
contextMenu.addItem(cut);
}
- MenuItem copy = new MenuItem("<span id = 'folderContextMenu.copy'>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(GSS.get(), this, folder));
+ MenuItem copy = new MenuItem("<span id = 'folderContextMenu.copy'>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(Pithos.get(), this, folder));
contextMenu.addItem(copy);
- if (!GSS.get().getClipboard().isEmpty()) {
- pasteItem = new MenuItem("<span id = 'folderContextMenu.paste'>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + " Paste</span>", true, new PasteCommand(GSS.get(), this, folder));
+ if (!Pithos.get().getClipboard().isEmpty()) {
+ pasteItem = new MenuItem("<span id = 'folderContextMenu.paste'>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + " Paste</span>", true, new PasteCommand(Pithos.get(), this, folder));
contextMenu.addItem(pasteItem);
}
if (!folder.isContainer()) {
- MenuItem moveToTrash = new MenuItem("<span id = 'folderContextMenu.moveToTrash'>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + " Move to Trash</span>", true, new ToTrashCommand(GSS.get(), this, folder));
+ MenuItem moveToTrash = new MenuItem("<span id = 'folderContextMenu.moveToTrash'>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + " Move to Trash</span>", true, new ToTrashCommand(Pithos.get(), this, folder));
contextMenu.addItem(moveToTrash);
MenuItem delete = new MenuItem("<span id = 'folderContextMenu.delete'>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, folder, newImages));
// MenuItem sharing = new MenuItem("<span id = 'folderContextMenu.sharing'>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + " Sharing</span>", true, new PropertiesCommand(this, newImages, 1));
// contextMenu.addItem(sharing);
- MenuItem properties = new MenuItem("<span id = 'folderContextMenu.properties'>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(GSS.get(), this, folder, newImages, 0));
+ MenuItem properties = new MenuItem("<span id = 'folderContextMenu.properties'>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(Pithos.get(), this, folder, newImages, 0));
contextMenu.addItem(properties);
add(contextMenu);
import com.google.gwt.core.client.Scheduler;\r
import com.google.gwt.event.dom.client.KeyDownEvent;\r
import com.google.gwt.user.client.Command;\r
-import com.google.gwt.user.client.Event;\r
import gr.grnet.pithos.web.client.foldertree.File;\r
import gr.grnet.pithos.web.client.foldertree.Folder;\r
import gr.grnet.pithos.web.client.foldertree.Resource;\r
-import gr.grnet.pithos.web.client.rest.PostCommand;\r
import gr.grnet.pithos.web.client.rest.PutRequest;\r
import gr.grnet.pithos.web.client.rest.RestException;\r
-import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;\r
\r
import com.google.gwt.core.client.GWT;\r
import com.google.gwt.dom.client.NativeEvent;\r
import com.google.gwt.event.dom.client.ClickEvent;\r
import com.google.gwt.event.dom.client.ClickHandler;\r
import com.google.gwt.event.dom.client.KeyCodes;\r
-import com.google.gwt.http.client.URL;\r
import com.google.gwt.i18n.client.DateTimeFormat;\r
-import com.google.gwt.user.client.DeferredCommand;\r
import com.google.gwt.user.client.Event.NativePreviewEvent;\r
import com.google.gwt.user.client.ui.Button;\r
import com.google.gwt.user.client.ui.CheckBox;\r
import com.google.gwt.user.client.ui.FlexTable;\r
import com.google.gwt.user.client.ui.HasHorizontalAlignment;\r
import com.google.gwt.user.client.ui.HorizontalPanel;\r
-import com.google.gwt.user.client.ui.Label;\r
import com.google.gwt.user.client.ui.TabPanel;\r
import com.google.gwt.user.client.ui.TextBox;\r
import com.google.gwt.user.client.ui.VerticalPanel;\r
*/\r
public class FolderPropertiesDialog extends DialogBox {\r
\r
- private GSS app;\r
+ private Pithos app;\r
\r
private CheckBox readForAll;\r
\r
/**\r
* The widget's constructor.\r
*/\r
- public FolderPropertiesDialog(GSS app, boolean _create, Folder selected) {\r
+ public FolderPropertiesDialog(Pithos app, boolean _create, Folder selected) {\r
this.app = app;\r
setAnimationEnabled(true);\r
\r
selectedUser = suggestBox.getText();
for(PermissionHolder p : permList.permissions)
if (selectedUser.equals(p.getUser())){
- GSS.get().displayError("User already has access to the resource");
+ Pithos.get().displayError("User already has access to the resource");
return;
}
perm.setUser(selectedUser);
return;
for(PermissionHolder p : permList.permissions)
if (selected.getName().equals(p.getGroup())){
- GSS.get().displayError("Group already has access to the resource");
+ Pithos.get().displayError("Group already has access to the resource");
return;
}
perm.setGroup(selected.getName());
* Update the list of suggestions.
*/
protected void updateSuggestions() {
- final GSS app = GSS.get();
+ final Pithos app = Pithos.get();
String query = selectedUser.substring(0, selectedUser.length()-1);
GWT.log("Searching for " + query, null);
/**
* Examines whether or not the user's full name exists in the
- * userFullNameMap in the GSS.java for every element of the input list.
+ * userFullNameMap in the Pithos.java for every element of the input list.
* If the user's full name does not exist in the map then a request is being made
* for the specific username.
*
aPermissions.remove(dto);
handleFullNames(aPermissions);
}
- }else if(GSS.get().findUserFullName(dto.getUser()) != null){
+ }else if(Pithos.get().findUserFullName(dto.getUser()) != null){
if(aPermissions.size() >= 1){
aPermissions.remove(dto);
handleFullNames(aPermissions);
permTable.setHTML(i, 0, "<span id=permissionList.Owner>" + AbstractImagePrototype.create(images.permUser()).getHTML() + " Owner</span>");
removeButton.setVisible(false);
}else{
- permTable.setHTML(i, 0, "<span id=permissionList."+GSS.get().findUserFullName(dto.getUser())+">"+ AbstractImagePrototype.create(images.permUser()).getHTML() + " "+ GSS.get().findUserFullName(dto.getUser()) + "</span>");
+ permTable.setHTML(i, 0, "<span id=permissionList."+ Pithos.get().findUserFullName(dto.getUser())+">"+ AbstractImagePrototype.create(images.permUser()).getHTML() + " "+ Pithos.get().findUserFullName(dto.getUser()) + "</span>");
}
}else if(dto.getGroup() != null){
permTable.setHTML(i, 0, "<span id=permissionList."+dto.getGroup()+">" + AbstractImagePrototype.create(images.permGroup()).getHTML() + " "+ dto.getGroup() + "</span>");
private void findFullNameAndUpdate(final Set<PermissionHolder> aPermissions){
final PermissionHolder dto = aPermissions.iterator().next();
- String path = GSS.get().getApiPath() + "users/" + dto.getUser();
+ String path = Pithos.get().getApiPath() + "users/" + dto.getUser();
GetCommand<UserSearchResource> gg = new GetCommand<UserSearchResource>(UserSearchResource.class, path, false,null) {
@Override
for (UserResource user : result.getUsers()){
String username = user.getUsername();
String userFullName = user.getName();
- GSS.get().putUserToMap(username, userFullName);
+ Pithos.get().putUserToMap(username, userFullName);
if(aPermissions.size() >= 1){
aPermissions.remove(dto);
if(aPermissions.isEmpty()){
}
@Override
public void onError(Throwable t) {
- GSS.get().displayError("Unable to fetch user's full name from the given username " + dto.getUser());
+ Pithos.get().displayError("Unable to fetch user's full name from the given username " + dto.getUser());
if(aPermissions.size() >= 1){
aPermissions.remove(dto);
if(aPermissions.isEmpty()){
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.Command;
import com.google.gwt.view.client.SelectionChangeEvent;
+import com.google.gwt.view.client.SelectionChangeEvent.Handler;
import com.google.gwt.view.client.SingleSelectionModel;
import gr.grnet.pithos.web.client.commands.GetUserCommand;
import gr.grnet.pithos.web.client.foldertree.AccountResource;
import gr.grnet.pithos.web.client.rest.resource.TrashResource;
import gr.grnet.pithos.web.client.rest.resource.UserResource;
+import gr.grnet.pithos.web.client.tagtree.Tag;
+import gr.grnet.pithos.web.client.tagtree.TagTreeView;
+import gr.grnet.pithos.web.client.tagtree.TagTreeViewModel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
-public class GSS implements EntryPoint, ResizeHandler {
+public class Pithos implements EntryPoint, ResizeHandler {
/**
* A constant that denotes the completion of an IncrementalCommand.
folderTreeView.updateFolder(f);
}
+ public void updateTag(Tag t) {
+ tagTreeView.updateTag(t);
+ }
+
+ public void updateTags() {
+ tagTreeViewModel.initialize(account);
+ }
+
/**
* An aggregate image bundle that pulls together all the images for this
* application into a single bundle.
}
/**
- * The single GSS instance.
+ * The single Pithos instance.
*/
- private static GSS singleton;
+ private static Pithos singleton;
/**
- * Gets the singleton GSS instance.
+ * Gets the singleton Pithos instance.
*
- * @return the GSS object
+ * @return the Pithos object
*/
- public static GSS get() {
- if (GSS.singleton == null)
- GSS.singleton = new GSS();
- return GSS.singleton;
+ public static Pithos get() {
+ if (Pithos.singleton == null)
+ Pithos.singleton = new Pithos();
+ return Pithos.singleton;
}
/**
/**
* The panel that contains the various system messages.
*/
- private MessagePanel messagePanel = new MessagePanel(GSS.images);
+ private MessagePanel messagePanel = new MessagePanel(Pithos.images);
/**
* The bottom panel that contains the status bar.
private FolderTreeViewModel folderTreeViewModel;
private FolderTreeView folderTreeView;
+ private SingleSelectionModel<Tag> tagTreeSelectionModel;
+ private TagTreeViewModel tagTreeViewModel;
+ private TagTreeView tagTreeView;
+
private AccountResource account;
@Override
public void onModuleLoad() {
// Initialize the singleton before calling the constructors of the
- // various widgets that might call GSS.get().
+ // various widgets that might call Pithos.get().
singleton = this;
if (parseUserCredentials())
initialize();
}
private void initialize() {
- topPanel = new TopPanel(GSS.images);
+ topPanel = new TopPanel(Pithos.images);
topPanel.setWidth("100%");
messagePanel.setWidth("100%");
fileList = new FileList(images, folderTreeView);
inner.add(fileList, createHeaderHTML(AbstractImagePrototype.create(images.folders()), "Files"), true);
+ tagTreeSelectionModel = new SingleSelectionModel<Tag>();
+ tagTreeSelectionModel.addSelectionChangeHandler(new Handler() {
+ @Override
+ public void onSelectionChange(SelectionChangeEvent event) {
+ Tag t = tagTreeSelectionModel.getSelectedObject();
+ updateTag(t);
+ }
+ });
+ tagTreeViewModel = new TagTreeViewModel(tagTreeSelectionModel);
+ tagTreeView = new TagTreeView(tagTreeViewModel);
+
+ VerticalPanel trees = new VerticalPanel();
+ trees.add(folderTreeView);
+ trees.add(tagTreeView);
// Add the left and right panels to the split panel.
- splitPanel.setLeftWidget(folderTreeView);
+ splitPanel.setLeftWidget(trees);
splitPanel.setRightWidget(inner);
splitPanel.setSplitPosition("25%");
splitPanel.setSize("100%", "100%");
outer.add(topPanel);
outer.add(messagePanel);
outer.add(splitPanel);
- statusPanel = new StatusPanel(GSS.images);
+ statusPanel = new StatusPanel(Pithos.images);
outer.add(statusPanel);
outer.setWidth("100%");
outer.setCellHorizontalAlignment(messagePanel, HasHorizontalAlignment.ALIGN_CENTER);
public void showFiles(Folder f) {
inner.selectTab(0);
+ if (f.isTrash()) {
+ fileList.showTrash();
+ }
+ else
+ fileList.showFiles();
Set<File> files = f.getFiles();
Iterator<File> iter = files.iterator();
fetchFile(iter, files);
public void onError(Throwable t) {
GWT.log("Error getting file", t);
if (t instanceof RestException)
- GSS.get().displayError("Error getting file: " + ((RestException) t).getHttpStatusText());
+ Pithos.get().displayError("Error getting file: " + ((RestException) t).getHttpStatusText());
else
- GSS.get().displayError("System error fetching file: " + t.getMessage());
+ Pithos.get().displayError("System error fetching file: " + t.getMessage());
}
};
getFile.setHeader("X-Auth-Token", "0000");
// Window.Location.assign(GWT.getModuleBaseURL() + conf.loginUrl() + "?next=" + Window.Location.getHref());
Cookies.setCookie(conf.authCookie(), "test" + conf.cookieSeparator() + "0000");
- Window.Location.assign(GWT.getModuleBaseURL() + "GSS.html");
+ Window.Location.assign(GWT.getModuleBaseURL() + "Pithos.html");
}
private void fetchAccount() {
public void onError(Throwable t) {
GWT.log("Error getting account", t);
if (t instanceof RestException)
- GSS.get().displayError("Error getting account: " + ((RestException) t).getHttpStatusText());
+ Pithos.get().displayError("Error getting account: " + ((RestException) t).getHttpStatusText());
else
- GSS.get().displayError("System error fetching user data: " + t.getMessage());
+ Pithos.get().displayError("System error fetching user data: " + t.getMessage());
}
};
getAccount.setHeader("X-Auth-Token", token);
}
public String getUserFullName(String _userName) {
- if (GSS.get().findUserFullName(_userName) == null)
+ if (Pithos.get().findUserFullName(_userName) == null)
//if there is no userFullName found then the map fills with the given _userName,
//so userFullName = _userName
- GSS.get().putUserToMap(_userName, _userName);
- else if(GSS.get().findUserFullName(_userName).indexOf('@') != -1){
+ Pithos.get().putUserToMap(_userName, _userName);
+ else if(Pithos.get().findUserFullName(_userName).indexOf('@') != -1){
//if the userFullName = _userName the GetUserCommand updates the userFullName in the map
GetUserCommand guc = new GetUserCommand(_userName);
guc.execute();
}
- return GSS.get().findUserFullName(_userName);
+ return Pithos.get().findUserFullName(_userName);
}
/**
* Retrieve the treeView.
@Override
public void onError(Request request, Throwable exception) {
- GSS.get().displayError("System error unable to delete folder: " + exception.getMessage());
+ Pithos.get().displayError("System error unable to delete folder: " + exception.getMessage());
}
});
}
@Override
public void onError(Throwable t) {
GWT.log("", t);
- GSS.get().displayError("System error unable to delete folder: " + t.getMessage());
+ Pithos.get().displayError("System error unable to delete folder: " + t.getMessage());
}
};
delete.setHeader("X-Auth-Token", getToken());
@Override
public void onError(Request request, Throwable exception) {
- GSS.get().displayError("System error unable to delete folder: " + exception.getMessage());
+ Pithos.get().displayError("System error unable to delete folder: " + exception.getMessage());
}
});
}
displayError("Unable to delete folder: "+((RestException) t).getHttpStatusText());
}
else
- GSS.get().displayError("System error unable to delete folder: " + t.getMessage());
+ Pithos.get().displayError("System error unable to delete folder: " + t.getMessage());
}
};
deleteFolder.setHeader("X-Auth-Token", getToken());
public void onError(Throwable t) {
GWT.log("", t);
if (t instanceof RestException) {
- GSS.get().displayError("Unable to copy file: " + ((RestException) t).getHttpStatusText());
+ Pithos.get().displayError("Unable to copy file: " + ((RestException) t).getHttpStatusText());
}
else
- GSS.get().displayError("System error unable to copy file: "+t.getMessage());
+ Pithos.get().displayError("System error unable to copy file: "+t.getMessage());
}
};
copyFile.setHeader("X-Auth-Token", getToken());
@Override\r
public void onClick(ClickEvent event) {\r
hide();\r
- GSS.get().logout();\r
+ Pithos.get().logout();\r
}\r
});\r
buttons.add(quit);\r
switch (evt.getKeyCode()) {\r
case KeyCodes.KEY_ENTER:\r
hide();\r
- GSS.get().logout();\r
+ Pithos.get().logout();\r
break;\r
case KeyCodes.KEY_ESCAPE:\r
hide();\r
Button confirm = new Button("Proceed", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- GSS.get().authenticateUser();
+ Pithos.get().authenticateUser();
hide();
}
});
// enter or escape is pressed.
switch (evt.getKeyCode()) {
case KeyCodes.KEY_ENTER:
- GSS.get().authenticateUser();
+ Pithos.get().authenticateUser();
hide();
break;
case KeyCodes.KEY_ESCAPE:
package gr.grnet.pithos.web.client;
import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import gr.grnet.pithos.web.client.foldertree.AccountResource;
-import gr.grnet.pithos.web.client.rest.GetCommand;
import gr.grnet.pithos.web.client.rest.GetRequest;
import gr.grnet.pithos.web.client.rest.RestException;
-import gr.grnet.pithos.web.client.rest.resource.QuotaHolder;
-import gr.grnet.pithos.web.client.rest.resource.UserResource;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
*/
//TODO: This should not be done here
public void updateStats() {
- final GSS app = GSS.get();
+ final Pithos app = Pithos.get();
String path = app.getApiPath() + app.getUsername();
GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(AccountResource.class, path) {
@Override
*/
package gr.grnet.pithos.web.client;
-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.user.client.Command;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
AbstractImagePrototype.create(images.folder()).getHTML() + "</td><td>File</td></tr></table>", true, new MenuBar(true)){
@Override
public MenuBar getSubMenu() {
- return new FileMenu(GSS.get(), images);
+ return new FileMenu(Pithos.get(), images);
}
};
AbstractImagePrototype.create(images.edit()).getHTML() + "</td><td>Edit</td></tr></table>", true, new MenuBar(true)){
@Override
public MenuBar getSubMenu() {
- return new EditMenu(GSS.get(), images);
+ return new EditMenu(Pithos.get(), images);
}
};
import gr.grnet.pithos.web.client.rest.resource.UserResource;
-import com.google.gwt.user.client.DeferredCommand;
-import com.google.gwt.user.client.IncrementalCommand;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
* @return true if the work has been carried out successfully
*/
protected boolean displayUserInfo() {
- UserResource user = GSS.get().getCurrentUserResource();
+ UserResource user = Pithos.get().getCurrentUserResource();
if (user == null)
return !DONE;
userInfoLabel.setHTML("<b>" + user.getName() + " \u0387 " + user.getUsername() + "</b>");
- GSS.get().putUserToMap(user.getUsername(), user.getName());
+ Pithos.get().putUserToMap(user.getUsername(), user.getName());
return DONE;
}
});
permTable.setHTML(i, 0, "<span>" + dto.getVersion() + "</span>");
- permTable.setHTML(i, 1, "<span>" + formatDate(dto.getCreationDate()) + " by " + GSS.get().findUserFullName(dto.getCreatedBy()) + "</span>");
- permTable.setHTML(i, 2, "<span>" + formatDate(dto.getModificationDate()) + " by " + GSS.get().findUserFullName(dto.getModifiedBy()) + "</span>");
+ permTable.setHTML(i, 1, "<span>" + formatDate(dto.getCreationDate()) + " by " + Pithos.get().findUserFullName(dto.getCreatedBy()) + "</span>");
+ permTable.setHTML(i, 2, "<span>" + formatDate(dto.getModificationDate()) + " by " + Pithos.get().findUserFullName(dto.getModifiedBy()) + "</span>");
permTable.setHTML(i, 3, "<span>" + dto.getFileSizeAsString() + "</span>");
HTML downloadHtml = new HTML("<a class='hidden-link info' href='#'><span>"+AbstractImagePrototype.create(images.download()).getHTML()+"</span><div>View this Version</div></a>");
downloadHtml.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- GSS app = GSS.get();
+ Pithos app = Pithos.get();
String dateString = RestCommand.getDate();
String resource = dto.getUri().substring(app.getApiPath().length()-1, dto.getUri().length());
String sig = app.getCurrentUserResource().getUsername()+" "+RestCommand.calculateSig("GET", dateString, resource, RestCommand.base64decode(app.getToken()));
public void onComplete() {
toRemove = version;
updateTable();
- GSS.get().getTreeView().refreshCurrentNode(false);
+ Pithos.get().getTreeView().refreshCurrentNode(false);
}
@Override
if(t instanceof RestException){
int statusCode = ((RestException)t).getHttpStatusCode();
if(statusCode == 405)
- GSS.get().displayError("You don't have the necessary permissions");
+ Pithos.get().displayError("You don't have the necessary permissions");
else if(statusCode == 404)
- GSS.get().displayError("Versions does not exist");
+ Pithos.get().displayError("Versions does not exist");
else
- GSS.get().displayError("Unable to remove version:"+((RestException)t).getHttpStatusText());
+ Pithos.get().displayError("Unable to remove version:"+((RestException)t).getHttpStatusText());
}
else
- GSS.get().displayError("System error removing version:"+t.getMessage());
+ Pithos.get().displayError("System error removing version:"+t.getMessage());
}
};
DeferredCommand.addCommand(df);
}
void restoreVersion(final FileResource version) {
- FileResource selectedFile = (FileResource) GSS.get().getCurrentSelection();
+ FileResource selectedFile = (FileResource) Pithos.get().getCurrentSelection();
PostCommand ep = new PostCommand(selectedFile.getUri()+"?restoreVersion="+version.getVersion(),"",200){
@Override
public void onComplete() {
container.hide();
- GSS.get().getTreeView().refreshCurrentNode(false);
+ Pithos.get().getTreeView().refreshCurrentNode(false);
}
@Override
public void onError(Throwable t) {
GWT.log("", t);
if(t instanceof RestException)
- GSS.get().displayError("Unable to restore version:"+((RestException)t).getHttpStatusText());
+ Pithos.get().displayError("Unable to restore version:"+((RestException)t).getHttpStatusText());
else
- GSS.get().displayError("System error restoring version:"+t.getMessage());
+ Pithos.get().displayError("System error restoring version:"+t.getMessage());
}
};
/**
* Examines whether or not the user's full name exists in the
- * userFullNameMap in the GSS.java for every element of the input list.
+ * userFullNameMap in the Pithos.java for every element of the input list.
* If the user's full name does not exist in the map then a request is being made
* for the specific username.
*
return;
}
- if(GSS.get().findUserFullName(input.get(0).getOwner()) == null){
+ if(Pithos.get().findUserFullName(input.get(0).getOwner()) == null){
findFullNameAndUpdate(input);
return;
}
private void findFullNameAndUpdate(final List<FileResource> input){
final String aUserName = input.get(0).getOwner();
- String path = GSS.get().getApiPath() + "users/" + aUserName;
+ String path = Pithos.get().getApiPath() + "users/" + aUserName;
GetCommand<UserSearchResource> gg = new GetCommand<UserSearchResource>(UserSearchResource.class, path, false,null) {
@Override
for (UserResource user : result.getUsers()){
String username = user.getUsername();
String userFullName = user.getName();
- GSS.get().putUserToMap(username, userFullName);
+ Pithos.get().putUserToMap(username, userFullName);
if(input.size() >= 1){
input.remove(input.get(0));
if(input.isEmpty()){
}
@Override
public void onError(Throwable t) {
- GSS.get().displayError("Unable to fetch user's full name from the given username " + aUserName);
+ Pithos.get().displayError("Unable to fetch user's full name from the given username " + aUserName);
if(input.size() >= 1){
input.remove(input.get(0));
handleFullNames(input);
package gr.grnet.pithos.web.client.commands;
import gr.grnet.pithos.web.client.Clipboard;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.foldertree.File;
import gr.grnet.pithos.web.client.foldertree.Folder;
import com.google.gwt.user.client.ui.PopupPanel;
/**
*
- * Command for copying a file, folder or user to GSS Clipboard
+ * Command for copying a file, folder or user to Pithos Clipboard
*
*/
public class CopyCommand implements Command{
- private GSS app;
+ private Pithos app;
private PopupPanel containerPanel;
private Object resource;
- public CopyCommand(GSS _app, PopupPanel _containerPanel, Object _resource){
+ public CopyCommand(Pithos _app, PopupPanel _containerPanel, Object _resource){
app = _app;
containerPanel = _containerPanel;
resource = _resource;
package gr.grnet.pithos.web.client.commands;
import gr.grnet.pithos.web.client.Clipboard;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.foldertree.File;
import gr.grnet.pithos.web.client.foldertree.Folder;
import com.google.gwt.user.client.ui.PopupPanel;
/**
- * Command for cutting a file, folder or user to GSS Clipboard
+ * Command for cutting a file, folder or user to Pithos Clipboard
*
*/
public class CutCommand implements Command {
- private GSS app;
+ private Pithos app;
private PopupPanel containerPanel;
private Object resource;
- public CutCommand(GSS _app, PopupPanel _containerPanel, Object _resource){
+ public CutCommand(Pithos _app, PopupPanel _containerPanel, Object _resource){
app = _app;
containerPanel = _containerPanel;
resource = _resource;
import gr.grnet.pithos.web.client.DeleteFileDialog;
import gr.grnet.pithos.web.client.DeleteFolderDialog;
import gr.grnet.pithos.web.client.EditMenu.Images;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.foldertree.File;
import gr.grnet.pithos.web.client.foldertree.Folder;
-import gr.grnet.pithos.web.client.foldertree.Resource;
-import gr.grnet.pithos.web.client.rest.resource.FileResource;
-import gr.grnet.pithos.web.client.rest.resource.GroupUserResource;
-import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
import java.util.List;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.PopupPanel;
containerPanel.hide();
if (resource instanceof Folder) {
- DeleteFolderDialog dlg = new DeleteFolderDialog(GSS.get(), newImages, (Folder) resource);
+ DeleteFolderDialog dlg = new DeleteFolderDialog(Pithos.get(), newImages, (Folder) resource);
dlg.center();
} else if (resource instanceof List) {
DeleteFileDialog dlg = new DeleteFileDialog(newImages, (List<File>) resource);
*/
package gr.grnet.pithos.web.client.commands;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.rest.DeleteCommand;
import gr.grnet.pithos.web.client.rest.RestException;
@Override
public void execute() {
containerPanel.hide();
- DeleteCommand df = new DeleteCommand(GSS.get().getTreeView().getTrash().getUri()){
+ DeleteCommand df = new DeleteCommand(Pithos.get().getTreeView().getTrash().getUri()){
@Override
public void onComplete() {
- GSS.get().getTreeView().updateTrashNode();
- GSS.get().showFileList(true);
+ Pithos.get().getTreeView().updateTrashNode();
+ Pithos.get().showFileList(true);
}
@Override
if(t instanceof RestException){
int statusCode = ((RestException)t).getHttpStatusCode();
if(statusCode == 405)
- GSS.get().displayError("You don't have the necessary permissions");
+ Pithos.get().displayError("You don't have the necessary permissions");
else if(statusCode == 404)
- GSS.get().displayError("Resource does not exist");
+ Pithos.get().displayError("Resource does not exist");
else
- GSS.get().displayError("Unable to empty trash:"+((RestException)t).getHttpStatusText());
+ Pithos.get().displayError("Unable to empty trash:"+((RestException)t).getHttpStatusText());
}
else
- GSS.get().displayError("System error emptying trash:"+t.getMessage());
+ Pithos.get().displayError("System error emptying trash:"+t.getMessage());
}
};
DeferredCommand.addCommand(df);
*/
package gr.grnet.pithos.web.client.commands;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.rest.GetCommand;
import gr.grnet.pithos.web.client.rest.resource.UserResource;
import gr.grnet.pithos.web.client.rest.resource.UserSearchResource;
/**
* This command manages usernames and the corresponding user's Full Name
- * along with the HashMap collection in the GSS.java class
+ * along with the HashMap collection in the Pithos.java class
*
*
*/
@Override
public void execute() {
- String path = GSS.get().getApiPath() + "users/" + userName;
+ String path = Pithos.get().getApiPath() + "users/" + userName;
GetCommand<UserSearchResource> gg = new GetCommand<UserSearchResource>(UserSearchResource.class,
path, false ,null) {
@Override
for (UserResource user : result.getUsers()){
String username = user.getUsername();
String _userFullName = user.getName();
- GSS.get().putUserToMap(username, _userFullName);
+ Pithos.get().putUserToMap(username, _userFullName);
}
}
@Override
public void onError(Throwable t) {
GWT.log("", t);
- GSS.get().displayError("Unable to fetch user's full name from the given username " + userName);
+ Pithos.get().displayError("Unable to fetch user's full name from the given username " + userName);
}
};
DeferredCommand.addCommand(gg);
*/
package gr.grnet.pithos.web.client.commands;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
import gr.grnet.pithos.web.client.FileMenu.Images;
import gr.grnet.pithos.web.client.FolderPropertiesDialog;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.foldertree.Folder;
-import gr.grnet.pithos.web.client.foldertree.FolderTreeView;
-import gr.grnet.pithos.web.client.rest.GetCommand;
-import gr.grnet.pithos.web.client.rest.MultipleGetCommand;
import gr.grnet.pithos.web.client.rest.resource.GroupResource;
-import gr.grnet.pithos.web.client.rest.resource.GroupsResource;
-import gr.grnet.pithos.web.client.rest.resource.RestResource;
-import java.util.ArrayList;
import java.util.List;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.DeferredCommand;
-import com.google.gwt.user.client.IncrementalCommand;
import com.google.gwt.user.client.ui.PopupPanel;
/**
void displayNewFolderDialog() {
if (folder != null) {
- FolderPropertiesDialog dlg = new FolderPropertiesDialog(GSS.get(), true, folder);
+ FolderPropertiesDialog dlg = new FolderPropertiesDialog(Pithos.get(), true, folder);
dlg.center();
}
}
import com.google.gwt.core.client.Scheduler;
import gr.grnet.pithos.web.client.Clipboard;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.foldertree.File;
import gr.grnet.pithos.web.client.foldertree.Folder;
import gr.grnet.pithos.web.client.foldertree.Resource;
public class PasteCommand implements Command {
- private GSS app;
+ private Pithos app;
private PopupPanel containerPanel;
private Folder folder;
- public PasteCommand(GSS _app, PopupPanel _containerPanel, Folder _folder) {
+ public PasteCommand(Pithos _app, PopupPanel _containerPanel, Folder _folder) {
app = _app;
containerPanel = _containerPanel;
folder = _folder;
public void onError(Throwable t) {
GWT.log("", t);
if (t instanceof RestException) {
- GSS.get().displayError("Unable to copy file: " + ((RestException) t).getHttpStatusText());
+ Pithos.get().displayError("Unable to copy file: " + ((RestException) t).getHttpStatusText());
}
else
- GSS.get().displayError("System error unable to copy file: "+t.getMessage());
+ Pithos.get().displayError("System error unable to copy file: "+t.getMessage());
}
};
copyFile.setHeader("X-Auth-Token", app.getToken());
import gr.grnet.pithos.web.client.FilePropertiesDialog;
import gr.grnet.pithos.web.client.FilesPropertiesDialog;
import gr.grnet.pithos.web.client.FolderPropertiesDialog;
-import gr.grnet.pithos.web.client.GSS;
-import gr.grnet.pithos.web.client.FileMenu.Images;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.foldertree.File;
import gr.grnet.pithos.web.client.foldertree.Folder;
-import gr.grnet.pithos.web.client.rest.GetCommand;
-import gr.grnet.pithos.web.client.rest.HeadCommand;
-import gr.grnet.pithos.web.client.rest.MultipleGetCommand;
-import gr.grnet.pithos.web.client.rest.MultipleHeadCommand;
-import gr.grnet.pithos.web.client.rest.RestException;
-import gr.grnet.pithos.web.client.rest.MultipleGetCommand.Cached;
import gr.grnet.pithos.web.client.rest.resource.FileResource;
-import gr.grnet.pithos.web.client.rest.resource.FolderResource;
import gr.grnet.pithos.web.client.rest.resource.GroupResource;
-import gr.grnet.pithos.web.client.rest.resource.GroupsResource;
-import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
-import java.util.ArrayList;
import java.util.List;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.DeferredCommand;
-import com.google.gwt.user.client.IncrementalCommand;
import com.google.gwt.user.client.ui.PopupPanel;
-import org.w3c.css.sac.ElementSelector;
/**
* The command that displays the appropriate Properties dialog, according to the
private Object resource;
- private GSS app;
+ private Pithos app;
/**
* @param _containerPanel
* @param _newImages the images of all the possible delete dialogs
* @param _tab the tab to switch to
*/
- public PropertiesCommand(GSS _app, PopupPanel _containerPanel, Object _resource, final FileMenu.Images _newImages, int _tab) {
+ public PropertiesCommand(Pithos _app, PopupPanel _containerPanel, Object _resource, final FileMenu.Images _newImages, int _tab) {
containerPanel = _containerPanel;
newImages = _newImages;
tabToShow = _tab;
package gr.grnet.pithos.web.client.commands;
import gr.grnet.pithos.web.client.FileMenu;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.rest.resource.FileResource;
import gr.grnet.pithos.web.client.rest.resource.GroupUserResource;
@Override
public void execute() {
containerPanel.hide();
- if (GSS.get().getCurrentSelection() instanceof FileResource || GSS.get().getCurrentSelection() instanceof List)
- GSS.get().showFileList(true);
- else if (GSS.get().getCurrentSelection() instanceof GroupUserResource)
+ if (Pithos.get().getCurrentSelection() instanceof FileResource || Pithos.get().getCurrentSelection() instanceof List)
+ Pithos.get().showFileList(true);
+ else if (Pithos.get().getCurrentSelection() instanceof GroupUserResource)
return;
else{
//TODO:CELLTREE
- //DnDTreeItem selectedTreeItem = (DnDTreeItem) GSS.get().getFolders().getCurrent();
+ //DnDTreeItem selectedTreeItem = (DnDTreeItem) Pithos.get().getFolders().getCurrent();
//if(selectedTreeItem != null){
- //GSS.get().getFolders().updateFolder(selectedTreeItem);
- GSS.get().getTreeView().updateNode(GSS.get().getTreeView().getSelection());
- GSS.get().showFileList(true);
+ //Pithos.get().getFolders().updateFolder(selectedTreeItem);
+ Pithos.get().getTreeView().updateNode(Pithos.get().getTreeView().getSelection());
+ Pithos.get().showFileList(true);
//}
}
}
public void execute() {
containerPanel.hide();
//TODO:CELLTREE
- //GSS.get().getFolders().update( GSS.get().getFolders().getCurrent());
+ //Pithos.get().getFolders().update( Pithos.get().getFolders().getCurrent());
}
}
*/
package gr.grnet.pithos.web.client.commands;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.rest.MultiplePostCommand;
import gr.grnet.pithos.web.client.rest.PostCommand;
import gr.grnet.pithos.web.client.rest.RestException;
@Override
public void execute() {
containerPanel.hide();
- Object selection = GSS.get().getCurrentSelection();
+ Object selection = Pithos.get().getCurrentSelection();
if (selection == null){
// Check to see if Trash Node is selected.
List folderList = new ArrayList();
- TrashResource trashItem = GSS.get().getTreeView().getTrash();
+ TrashResource trashItem = Pithos.get().getTreeView().getTrash();
for(int i=0 ; i < trashItem.getFolders().size() ; i++)
folderList.add(trashItem.getFolders().get(i));
return;
@Override
public void onComplete() {
//TODO:CELLTREE
- //GSS.get().getFolders().update(GSS.get().getFolders().getTrashItem());
+ //Pithos.get().getFolders().update(Pithos.get().getFolders().getTrashItem());
- GSS.get().showFileList(true);
+ Pithos.get().showFileList(true);
}
@Override
if(t instanceof RestException){
int statusCode = ((RestException)t).getHttpStatusCode();
if(statusCode == 405)
- GSS.get().displayError("You don't have the necessary permissions");
+ Pithos.get().displayError("You don't have the necessary permissions");
else if(statusCode == 404)
- GSS.get().displayError("File does not exist");
+ Pithos.get().displayError("File does not exist");
else if(statusCode == 409)
- GSS.get().displayError("A file with the same name already exists");
+ Pithos.get().displayError("A file with the same name already exists");
else if(statusCode == 413)
- GSS.get().displayError("Your quota has been exceeded");
+ Pithos.get().displayError("Your quota has been exceeded");
else
- GSS.get().displayError("Unable to restore file:"+((RestException)t).getHttpStatusText());
+ Pithos.get().displayError("Unable to restore file:"+((RestException)t).getHttpStatusText());
}
else
- GSS.get().displayError("System error restoring file:"+t.getMessage());
+ Pithos.get().displayError("System error restoring file:"+t.getMessage());
}
};
DeferredCommand.addCommand(rt);
@Override
public void onComplete() {
//TODO:CELLTREE
- //GSS.get().getFolders().update(GSS.get().getFolders().getTrashItem());
- GSS.get().showFileList(true);
+ //Pithos.get().getFolders().update(Pithos.get().getFolders().getTrashItem());
+ Pithos.get().showFileList(true);
}
@Override
if(t instanceof RestException){
int statusCode = ((RestException)t).getHttpStatusCode();
if(statusCode == 405)
- GSS.get().displayError("You don't have the necessary permissions");
+ Pithos.get().displayError("You don't have the necessary permissions");
else if(statusCode == 404)
- GSS.get().displayError("File does not exist");
+ Pithos.get().displayError("File does not exist");
else if(statusCode == 409)
- GSS.get().displayError("A file with the same name already exists");
+ Pithos.get().displayError("A file with the same name already exists");
else if(statusCode == 413)
- GSS.get().displayError("Your quota has been exceeded");
+ Pithos.get().displayError("Your quota has been exceeded");
else
- GSS.get().displayError("Unable to restore file::"+((RestException)t).getHttpStatusText());
+ Pithos.get().displayError("Unable to restore file::"+((RestException)t).getHttpStatusText());
}
else
- GSS.get().displayError("System error restoring file:"+t.getMessage());
+ Pithos.get().displayError("System error restoring file:"+t.getMessage());
}
};
DeferredCommand.addCommand(rt);
public void onComplete() {
//TODO:CELLTREE
/*
- GSS.get().getFolders().updateFolder((DnDTreeItem) GSS.get().getFolders().getRootItem());
+ Pithos.get().getFolders().updateFolder((DnDTreeItem) Pithos.get().getFolders().getRootItem());
- GSS.get().getFolders().update(GSS.get().getFolders().getTrashItem());
+ Pithos.get().getFolders().update(Pithos.get().getFolders().getTrashItem());
*/
- GSS.get().getTreeView().updateTrashNode();
- GSS.get().getTreeView().updateRootNode();
+ Pithos.get().getTreeView().updateTrashNode();
+ Pithos.get().getTreeView().updateRootNode();
}
@Override
if(t instanceof RestException){
int statusCode = ((RestException)t).getHttpStatusCode();
if(statusCode == 405)
- GSS.get().displayError("You don't have the necessary permissions");
+ Pithos.get().displayError("You don't have the necessary permissions");
else if(statusCode == 404)
- GSS.get().displayError("Folder does not exist");
+ Pithos.get().displayError("Folder does not exist");
else if(statusCode == 409)
- GSS.get().displayError("A folder with the same name already exists");
+ Pithos.get().displayError("A folder with the same name already exists");
else if(statusCode == 413)
- GSS.get().displayError("Your quota has been exceeded");
+ Pithos.get().displayError("Your quota has been exceeded");
else
- GSS.get().displayError("Unable to restore folder::"+((RestException)t).getHttpStatusText());
+ Pithos.get().displayError("Unable to restore folder::"+((RestException)t).getHttpStatusText());
}
else
- GSS.get().displayError("System error restoring folder:"+t.getMessage());
+ Pithos.get().displayError("System error restoring folder:"+t.getMessage());
}
};
DeferredCommand.addCommand(rt);
package gr.grnet.pithos.web.client.commands;
import com.google.gwt.core.client.Scheduler;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.foldertree.File;
import gr.grnet.pithos.web.client.foldertree.Folder;
import gr.grnet.pithos.web.client.foldertree.Resource;
-import gr.grnet.pithos.web.client.rest.MultiplePostCommand;
-import gr.grnet.pithos.web.client.rest.PostCommand;
import gr.grnet.pithos.web.client.rest.PostRequest;
-import gr.grnet.pithos.web.client.rest.PutRequest;
import gr.grnet.pithos.web.client.rest.RestException;
-import gr.grnet.pithos.web.client.rest.resource.FileResource;
-import gr.grnet.pithos.web.client.rest.resource.FolderResource;
-import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
-import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.ui.PopupPanel;
/**
*/
public class ToTrashCommand implements Command{
private PopupPanel containerPanel;
- private GSS app;
+ private Pithos app;
private Object resource;
- public ToTrashCommand(GSS _app, PopupPanel _containerPanel, Object _resource){
+ public ToTrashCommand(Pithos _app, PopupPanel _containerPanel, Object _resource){
containerPanel = _containerPanel;
app = _app;
resource = _resource;
public void onError(Throwable t) {
GWT.log("", t);
if (t instanceof RestException) {
- GSS.get().displayError("Unable to copy file: " + ((RestException) t).getHttpStatusText());
+ Pithos.get().displayError("Unable to copy file: " + ((RestException) t).getHttpStatusText());
}
else
- GSS.get().displayError("System error unable to copy file: "+t.getMessage());
+ Pithos.get().displayError("System error unable to copy file: "+t.getMessage());
}
};
trashFile.setHeader("X-Auth-Token", app.getToken());
package gr.grnet.pithos.web.client.commands;
import gr.grnet.pithos.web.client.FileUploadDialog;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.foldertree.Folder;
-import gr.grnet.pithos.web.client.rest.GetCommand;
-import gr.grnet.pithos.web.client.rest.resource.FileResource;
-import gr.grnet.pithos.web.client.rest.resource.FolderResource;
-import gr.grnet.pithos.web.client.rest.resource.RestResource;
-import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
-
-import java.util.ArrayList;
-import java.util.List;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.DeferredCommand;
-import com.google.gwt.user.client.IncrementalCommand;
import com.google.gwt.user.client.ui.PopupPanel;
/**
*/
private void displayNewFile() {
FileUploadDialog dlg = GWT.create(FileUploadDialog.class);
- dlg.setApp(GSS.get());
+ dlg.setApp(Pithos.get());
dlg.setFolder(folder);
dlg.center();
}
private boolean inTrash = false;
+ /*
+ * Flag that indicates that this folder is the Trash
+ */
+ private boolean trash = false;
+
+ private Set<String> tags = new LinkedHashSet<String>();
+
public Folder() {};
public Folder(String name) {
if (header != null && header.equals("true"))
inTrash = true;
+ header = response.getHeader("X-Container-Object-Meta");
+ if (header != null) {
+ tags.add("tag1");
+ tags.add("tag2");
+ }
+
subfolders.clear(); //This is necessary in case we update a pre-existing Folder so that stale subfolders won't show up
files.clear();
JSONValue json = JSONParser.parseStrict(response.getText());
public boolean isContainer() {
return parent == null;
}
+
+ public boolean isTrash() {
+ return trash;
+ }
+
+ public void setTrash(boolean trash) {
+ this.trash = trash;
+ }
+
+ public void setContainer(String container) {
+ this.container = container;
+ }
+
+ public Set<String> getTags() {
+ return tags;
+ }
}
static interface BasicResources extends CellTree.Resources {
@ImageOptions(flipRtl = true)
- @Source("cellTreeClosedItem.gif")
+ @Source("gr/grnet/pithos/web/client/cellTreeClosedItem.gif")
ImageResource cellTreeClosedItem();
@ImageOptions(flipRtl = true)
- @Source("cellTreeLoadingBasic.gif")
+ @Source("gr/grnet/pithos/web/client/cellTreeLoadingBasic.gif")
ImageResource cellTreeLoading();
@ImageOptions(flipRtl = true)
- @Source("cellTreeOpenItem.gif")
+ @Source("gr/grnet/pithos/web/client/cellTreeOpenItem.gif")
ImageResource cellTreeOpenItem();
- @Source({"GssCellTreeBasic.css"})
+ @Source({"gr/grnet/pithos/web/client/GssCellTreeBasic.css"})
CellTree.Style cellTreeStyle();
}
import com.google.gwt.view.client.SingleSelectionModel;
import com.google.gwt.view.client.TreeViewModel;
import gr.grnet.pithos.web.client.FolderContextMenu;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.foldertree.FolderTreeView.Templates;
import gr.grnet.pithos.web.client.rest.GetRequest;
import gr.grnet.pithos.web.client.rest.RestException;
@Override
public void render(Context context, Folder folder, SafeHtmlBuilder safeHtmlBuilder) {
- String html = AbstractImagePrototype.create(FolderTreeView.images.folderYellow()).getHTML();
+ String html;
+ if (folder.isTrash())
+ html = AbstractImagePrototype.create(FolderTreeView.images.emptyTrash()).getHTML();
+ else
+ html = AbstractImagePrototype.create(FolderTreeView.images.folderYellow()).getHTML();
safeHtmlBuilder.appendHtmlConstant(html);
safeHtmlBuilder.append(Templates.INSTANCE.nameSpan(folder.getName()));
}
public void onBrowserEvent(Cell.Context context, com.google.gwt.dom.client.Element parent, Folder folder, com.google.gwt.dom.client.NativeEvent event, com.google.gwt.cell.client.ValueUpdater<Folder> valueUpdater) {
if (event.getType().equals(ContextMenuEvent.getType().getName())) {
FolderTreeViewModel.this.selectionModel.setSelected(folder, true);
- FolderContextMenu menu = new FolderContextMenu(FolderTreeView.images, folder);
- menu.setPopupPosition(event.getClientX(), event.getClientY());
- menu.show();
+ if (!folder.isTrash()) {
+ FolderContextMenu menu = new FolderContextMenu(FolderTreeView.images, folder);
+ menu.setPopupPosition(event.getClientX(), event.getClientY());
+ menu.show();
+ }
}
}
};
}
private void fetchFolder(final Iterator<Folder> iter, final ListDataProvider<Folder> dataProvider, final Set<Folder> folders) {
- final GSS app = GSS.get();
+ final Pithos app = Pithos.get();
if (iter.hasNext()) {
final Folder f = iter.next();
public void onError(Throwable t) {
GWT.log("Error getting folder", t);
if (t instanceof RestException)
- GSS.get().displayError("Error getting folder: " + ((RestException) t).getHttpStatusText());
+ Pithos.get().displayError("Error getting folder: " + ((RestException) t).getHttpStatusText());
else
- GSS.get().displayError("System error fetching folder: " + t.getMessage());
+ Pithos.get().displayError("System error fetching folder: " + t.getMessage());
}
};
getFolder.setHeader("X-Auth-Token", app.getToken());
else {
dataProvider.getList().clear();
dataProvider.getList().addAll(folders);
- if (dataProvider.equals(rootDataProvider))
+ if (dataProvider.equals(rootDataProvider)) {
selectionModel.setSelected(dataProvider.getList().get(0), true);
+ Folder f = new Folder("Trash");
+ f.setTrash(true);
+ f.setContainer("trash");
+ dataProvider.getList().add(f);
+ Pithos.get().updateTags();
+ }
}
}
dataProviderMap.put(folder, new ListDataProvider<Folder>());
}
final ListDataProvider<Folder> dataProvider = dataProviderMap.get(folder);
- fetchFolder(folder, dataProvider);
+ if (!folder.isTrash())
+ fetchFolder(folder, dataProvider);
+ else
+ Pithos.get().showFiles(folder);
}
public void fetchFolder(final Folder f, final ListDataProvider<Folder> dataProvider) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
- final GSS app = GSS.get();
+ final Pithos app = Pithos.get();
String path = app.getApiPath() + app.getUsername() + "/" + f.getContainer() + "?format=json&delimiter=/&prefix=" + f.getPrefix();
GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, path, f) {
@Override
public void onError(Throwable t) {
GWT.log("Error getting folder", t);
if (t instanceof RestException)
- GSS.get().displayError("Error getting folder: " + ((RestException) t).getHttpStatusText());
+ Pithos.get().displayError("Error getting folder: " + ((RestException) t).getHttpStatusText());
else
- GSS.get().displayError("System error fetching folder: " + t.getMessage());
+ Pithos.get().displayError("System error fetching folder: " + t.getMessage());
}
};
getFolder.setHeader("X-Auth-Token", app.getToken());
+++ /dev/null
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-/* Incremental changes from CellTable.css */
-.cellTableFooter {
- padding: 3px 9px;
-}
-
-.cellTableHeader {
- /*padding: 3px 9px;*/
- border:none;
- background-color: #E0EDFE;
- font-weight: bold;
- cursor: pointer;
-}
-
-.cellTableCell {
- padding: 4px 9px;
- border-width: 0;
-}
-
-.cellTableFirstColumn {
- padding: 0px;
-}
-
-.cellTableLastColumn {
- padding: 0px;
-}
-
-.cellTableFirstColumnFooter {
- border: 0px;
- padding: 0px;
-}
-
-.cellTableFirstColumnHeader {
- border: 0px;
- padding: 0px;
-}
-
-.cellTableLastColumnFooter {
- border: 0px;
- padding: 0px;
-}
-
-.cellTableLastColumnHeader {
- border: 0px;
- padding: 0px;
-}
-
-.cellTableEvenRow {
- cursor: hand;
- cursor: pointer;
-}
-
-.cellTableOddRow {
- cursor: hand;
- cursor: pointer;
-}
-
-.cellTableSelectedRow {
- background: #628cd5;
- color: white;
- height: auto;
- overflow: auto;
-}
-
- .cellTableHoveredRow {
-
- /*background-color: #E0EDFE;
- color: white;
- height: auto;
- overflow: auto;*/
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-.cellTreeWidget {
-
-}
-
-.cellTreeEmptyMessage {
- padding-left: 16px;
- font-style: italic;
-}
-
-.cellTreeItem {
- padding-top: 4px;
- padding-bottom: 4px;
- cursor: hand;
- cursor: pointer;
- zoom: 1;
-}
-
-.cellTreeItemImage {
-
-}
-
-.cellTreeItemImageValue {
- zoom: 1;
-}
-
-.cellTreeItemValue {
- padding-left: 3px;
- padding-right: 3px;
- outline: none;
-}
-
-.cellTreeOpenItem {
-
-}
-
-.cellTreeTopItem {
-
-}
-
-.cellTreeTopItemImage {
-
-}
-
-.cellTreeTopItemImageValue {
-
-}
-
-.cellTreeKeyboardSelectedItem {
- background-color: #ffc;
- outline: none;
-}
-
-.cellTreeSelectedItem {
- background-color: #628cd5;
- color: white;
- height: auto;
- overflow: visible;
-}
-
-.cellTreeShowMoreButton {
- padding-left: 16px;
- outline: none;
-}
\ No newline at end of file
*/
package gr.grnet.pithos.web.client.rest;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.InsufficientPermissionsException;
import com.google.gwt.http.client.Request;
public DeleteCommand(String pathToDelete, boolean showLoading){
setShowLoadingIndicator(showLoading);
if(isShowLoadingIndicator())
- GSS.get().showLoadingIndicator("Deleting ",pathToDelete);
+ Pithos.get().showLoadingIndicator("Deleting ",pathToDelete);
final String path;
if(pathToDelete.endsWith("/"))
path = pathToDelete;
boolean com = isComplete();
if(com){
if(isShowLoadingIndicator())
- GSS.get().hideLoadingIndicator();
+ Pithos.get().hideLoadingIndicator();
return false;
}
return true;
*/
package gr.grnet.pithos.web.client.rest;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.rest.resource.FileResource;
import gr.grnet.pithos.web.client.rest.resource.FolderResource;
import gr.grnet.pithos.web.client.rest.resource.GroupResource;
public GetCommand(Class<T> theclass, String pathToGet, boolean showLoading, T theCached){
setShowLoadingIndicator(showLoading);
if(isShowLoadingIndicator())
- GSS.get().showLoadingIndicator("Getting ",pathToGet);
+ Pithos.get().showLoadingIndicator("Getting ",pathToGet);
this.aclass = theclass;
if(pathToGet.indexOf("?") != -1)
path = pathToGet;
public GetCommand(Class<T> theclass, String aUsername , String pathToGet, boolean showLoading, T theCached){
setShowLoadingIndicator(showLoading);
if(isShowLoadingIndicator())
- GSS.get().showLoadingIndicator("Getting ",pathToGet);
+ Pithos.get().showLoadingIndicator("Getting ",pathToGet);
this.aclass = theclass;
path = fixPath(pathToGet);
this.username = aUsername;
else {
// Use cache data
if(isShowLoadingIndicator())
- GSS.get().hideLoadingIndicator();
+ Pithos.get().hideLoadingIndicator();
if (resp.result instanceof Throwable) {
// Error to be handled
Throwable ex = (Throwable) resp.result;
if(com){
if(isShowLoadingIndicator())
- GSS.get().hideLoadingIndicator();
+ Pithos.get().hideLoadingIndicator();
if(getResult() != null) {
// Add to cache
cache.put(key, new ResponseData(System.currentTimeMillis(), getResult()));
}
else if(aclass.equals(FileResource.class)){
result1 = new FileResource(aPath);
- result1.createFromJSON(response.getHeader("X-GSS-Metadata"));
+ result1.createFromJSON(response.getHeader("X-Pithos-Metadata"));
}
else if(aclass.equals(GroupsResource.class)){
result1 = new GroupsResource(aPath);
*/
package gr.grnet.pithos.web.client.rest;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.ObjectNotFoundException;
import gr.grnet.pithos.web.client.rest.resource.FileResource;
import gr.grnet.pithos.web.client.rest.resource.FolderResource;
setShowLoadingIndicator(showLoading);
this.aclass = theClass;
if(isShowLoadingIndicator())
- GSS.get().showLoadingIndicator("Getting ",pathToGet);
+ Pithos.get().showLoadingIndicator("Getting ",pathToGet);
if(theClass.equals(FileResource.class))
path = pathToGet;
boolean com = isComplete();
if(com){
if(isShowLoadingIndicator())
- GSS.get().hideLoadingIndicator();
+ Pithos.get().hideLoadingIndicator();
if(getResult() != null)
onComplete();
else
}
else if(aclass.equals(FileResource.class)){
result1 = new FileResource(aPath);
- result1.createFromJSON(response.getHeader("X-GSS-Metadata"));
+ result1.createFromJSON(response.getHeader("X-Pithos-Metadata"));
}
else if(aclass.equals(GroupsResource.class)){
result1 = new GroupsResource(aPath);
*/
package gr.grnet.pithos.web.client.rest;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.InsufficientPermissionsException;
import java.util.ArrayList;
public MultipleDeleteCommand(String[] pathToDelete, boolean showLoading){
setShowLoadingIndicator(showLoading);
if(isShowLoadingIndicator())
- GSS.get().showLoadingIndicator("Deleting "+pathToDelete.length+" items",null);
+ Pithos.get().showLoadingIndicator("Deleting "+pathToDelete.length+" items",null);
paths = pathToDelete;
for (final String pathg : pathToDelete) {
GWT.log("[DEL]"+pathg, null);
onError(p, errors.get(p));
onComplete();
if(isShowLoadingIndicator())
- GSS.get().hideLoadingIndicator();
+ Pithos.get().hideLoadingIndicator();
return false;
}
return true;
*/
package gr.grnet.pithos.web.client.rest;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.rest.resource.FileResource;
import gr.grnet.pithos.web.client.rest.resource.FolderResource;
import gr.grnet.pithos.web.client.rest.resource.GroupResource;
public MultipleGetCommand(Class<T> aNewClass, String[] pathToGet, boolean showLoading, Cached[] theCached) {
setShowLoadingIndicator(showLoading);
if (isShowLoadingIndicator())
- GSS.get().showLoadingIndicator("Getting "+pathToGet.length+" items", null);
+ Pithos.get().showLoadingIndicator("Getting "+pathToGet.length+" items", null);
aclass = aNewClass;
paths = pathToGet;
this.cached = theCached;
boolean com = isComplete();
if (com) {
if (isShowLoadingIndicator())
- GSS.get().hideLoadingIndicator();
+ Pithos.get().hideLoadingIndicator();
if (hasErrors())
for(String p : errors.keySet())
onError(p, errors.get(p));
}
else if (aclass.equals(FileResource.class)){
result1 = new FileResource(path);
- result1.createFromJSON(response.getHeader("X-GSS-Metadata"));
+ result1.createFromJSON(response.getHeader("X-Pithos-Metadata"));
}
else if (aclass.equals(GroupsResource.class)) {
result1 = new GroupsResource(path);
*/
package gr.grnet.pithos.web.client.rest;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.rest.MultipleGetCommand.Cached;
import gr.grnet.pithos.web.client.rest.resource.FileResource;
import gr.grnet.pithos.web.client.rest.resource.FolderResource;
public MultipleHeadCommand(Class<T> theClass, String[] pathToGet, boolean showLoading, Cached[] theCached) {
setShowLoadingIndicator(showLoading);
if(isShowLoadingIndicator())
- GSS.get().showLoadingIndicator("Getting "+pathToGet.length+" items", null);
+ Pithos.get().showLoadingIndicator("Getting "+pathToGet.length+" items", null);
paths = pathToGet;
this.aclass = theClass;
this.cached = theCached;
boolean com = isComplete();
if (com) {
if(isShowLoadingIndicator())
- GSS.get().hideLoadingIndicator();
+ Pithos.get().hideLoadingIndicator();
if(hasErrors())
for(String p : errors.keySet())
onError(p, errors.get(p));
result1.createFromJSON(response.getText());
} else if (aclass.equals(FileResource.class)) {
result1 = new FileResource(path);
- result1.createFromJSON(response.getHeader("X-GSS-Metadata"));
+ result1.createFromJSON(response.getHeader("X-Pithos-Metadata"));
} else if (aclass.equals(GroupsResource.class)) {
result1 = new GroupsResource(path);
result1.createFromJSON(response.getText());
*/
package gr.grnet.pithos.web.client.rest;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.InsufficientPermissionsException;
import java.util.ArrayList;
public MultiplePostCommand(String[] pathToDelete, String data, final int okStatusCode, boolean showLoading){
setShowLoadingIndicator(showLoading);
if(isShowLoadingIndicator())
- GSS.get().showLoadingIndicator("Updating "+pathToDelete.length+" items", null);
+ Pithos.get().showLoadingIndicator("Updating "+pathToDelete.length+" items", null);
paths = pathToDelete;
for (final String pathg : pathToDelete) {
GWT.log("[DEL]"+pathg, null);
onError(p, errors.get(p));
onComplete();
if(isShowLoadingIndicator())
- GSS.get().hideLoadingIndicator();
+ Pithos.get().hideLoadingIndicator();
return false;
}
return true;
*/
package gr.grnet.pithos.web.client.rest;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.Response;
-
public abstract class PostCommand extends RestCommand{
boolean complete = false;
String postBody=null;
public PostCommand(final String path, String data, final int okStatusCode, boolean showLoading) {
setShowLoadingIndicator(showLoading);
if(isShowLoadingIndicator())
- GSS.get().showLoadingIndicator("Updating ",path);
+ Pithos.get().showLoadingIndicator("Updating ",path);
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, path);
boolean com = isComplete();
if (com) {
if (isShowLoadingIndicator())
- GSS.get().hideLoadingIndicator();
+ Pithos.get().hideLoadingIndicator();
return false;
}
return true;
*/
package gr.grnet.pithos.web.client.rest;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.SessionExpiredDialog;
import com.google.gwt.http.client.RequestBuilder;
protected void handleHeaders(String username, RequestBuilder requestBuilder, String path) {
String date = getDate();
- requestBuilder.setHeader("X-GSS-Date", date);
+ requestBuilder.setHeader("X-Pithos-Date", date);
- GSS app = GSS.get();
+ Pithos app = Pithos.get();
String token = app.getToken();
if (token == null)
token = "aa";
}
protected void handleHeaders(RequestBuilder requestBuilder, String path) {
- if (GSS.get().getCurrentUserResource() != null) {
- String username = GSS.get().getCurrentUserResource().getUsername();
+ if (Pithos.get().getCurrentUserResource() != null) {
+ String username = Pithos.get().getCurrentUserResource().getUsername();
handleHeaders(username, requestBuilder, path);
} else
- GSS.get().displayError("no username");
+ Pithos.get().displayError("no username");
}
public static native String getDate()/*-{
package gr.grnet.pithos.web.client.rest.resource;
import gr.grnet.pithos.web.client.DisplayHelper;
-import gr.grnet.pithos.web.client.GSS;
+import gr.grnet.pithos.web.client.Pithos;
import gr.grnet.pithos.web.client.rest.MultipleGetCommand;
import gr.grnet.pithos.web.client.rest.MultipleGetCommand.Cached;
else if(treeItem.getParentItem() == null){
//this is the case when the user uses the browser's forward arrow to navigate through other's
//shared folders and item.getParentItem is null only inside other's shared folder
- String apiPath = GSS.get().getApiPath();
+ String apiPath = Pithos.get().getApiPath();
String newPath = getParentURI().substring(apiPath.lastIndexOf("/"));
constructedUri = constructedUri + "Files"+ newPath + getName();
return constructedUri;
--- /dev/null
+/*
+ * 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.tagtree;
+
+import com.google.gwt.http.client.Response;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
+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.File;
+import gr.grnet.pithos.web.client.foldertree.Resource;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+public class Tag extends Resource {
+ /*
+ * The name of the tag.
+ */
+ private String name = null;
+
+ private Set<File> files = new LinkedHashSet<File>();
+
+ public Tag() {};
+
+ public Tag(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ 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);
+//
+// header = response.getHeader("X-Object-Meta-Trash");
+// if (header != null && header.equals("true"))
+// inTrash = true;
+//
+// 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<array.size(); i++) {
+// JSONObject o = array.get(i).isObject();
+// if (o != null) {
+// String contentType = unmarshallString(o, "content_type");
+// if (o.containsKey("subdir") || (contentType != null && (contentType.startsWith("application/directory") || contentType.startsWith("application/folder")))) {
+// Tag f = new Tag();
+// f.populate(this, o, container);
+// subfolders.add(f);
+// }
+// else if (!(o.containsKey("x_object_meta_trash") && o.get("x_object_meta_trash").isString().stringValue().equals("true"))) {
+// File file = new File();
+// file.populate(this, o, container);
+// files.add(file);
+// }
+// }
+// }
+// //This step is necessary to remove the trashed folders. Trashed folders are added initially because we need to
+// //avoid having in the list the virtual folders of the form {"subdir":"folder1"} which have no indication of thrash
+// Iterator<Tag> iter = subfolders.iterator();
+// while (iter.hasNext()) {
+// Tag f = iter.next();
+// if (f.isInTrash())
+// iter.remove();
+// }
+// }
+// }
+//
+// public void populate(Tag parent, JSONObject o, String aContainer) {
+// this.parent = parent;
+// String path = null;
+// if (o.containsKey("subdir")) {
+// path = unmarshallString(o, "subdir");
+// }
+// else {
+// path = unmarshallString(o, "name");
+// lastModified = unmarshallDate(o, "last_modified");
+// }
+// if (path.endsWith("/"))
+// path = path.substring(0, path.length() - 1);
+// if (path.contains("/"))
+// name = path.substring(path.lastIndexOf("/") + 1, path.length()); //strip the prefix
+// else
+// name = path;
+// if (aContainer != null) {
+// container = aContainer;
+// prefix = path;
+// }
+// else {
+// container = name;
+// prefix = "";
+// }
+// if (o.containsKey("x_object_meta_trash") && o.get("x_object_meta_trash").isString().stringValue().equals("true"))
+// inTrash = true;
+// }
+//
+// public static Tag createFromResponse(Response response, Tag result) {
+// Tag f = null;
+// if (result == null)
+// f = new Tag();
+// else
+// f = result;
+//
+// f.populate(response);
+// return f;
+// }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other instanceof Tag) {
+ Tag o = (Tag) other;
+ return name.equals(o.getName());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ public Set<File> getFiles() {
+ return files;
+ }
+}
--- /dev/null
+/*
+ * 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.tagtree;
+
+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.client.ui.Composite;
+import com.google.gwt.user.client.ui.Tree;
+import gr.grnet.pithos.web.client.FolderContextMenu;
+
+public class TagTreeView extends Composite {
+
+ 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();
+ }
+
+ static interface Images extends ClientBundle,Tree.Resources, FolderContextMenu.Images {
+
+ @Source("gr/grnet/pithos/resources/folder_home.png")
+ ImageResource home();
+
+ @Source("gr/grnet/pithos/resources/info.png")
+ public ImageResource tag();
+ }
+
+ 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 TagTreeViewModel model;
+
+ public TagTreeView(TagTreeViewModel 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 Tag getSelection() {
+ return model.getSelection();
+ }
+
+ public void updateTag(Tag tag) {
+ model.updateTag(tag);
+ }
+}
--- /dev/null
+/*
+ * 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.tagtree;
+
+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.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.ui.AbstractImagePrototype;
+import com.google.gwt.view.client.ListDataProvider;
+import com.google.gwt.view.client.SingleSelectionModel;
+import com.google.gwt.view.client.TreeViewModel;
+import gr.grnet.pithos.web.client.Pithos;
+import gr.grnet.pithos.web.client.foldertree.AccountResource;
+import gr.grnet.pithos.web.client.foldertree.Folder;
+import gr.grnet.pithos.web.client.tagtree.TagTreeView.Templates;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+public class TagTreeViewModel implements TreeViewModel {
+
+ private Cell<Tag> tagCell = new AbstractCell<Tag>(ContextMenuEvent.getType().getName()) {
+
+ @Override
+ public void render(Context context, Tag tag, SafeHtmlBuilder safeHtmlBuilder) {
+ String html = AbstractImagePrototype.create(TagTreeView.images.tag()).getHTML();
+ safeHtmlBuilder.appendHtmlConstant(html);
+ safeHtmlBuilder.append(Templates.INSTANCE.nameSpan(tag.getName()));
+ }
+
+ @Override
+ public void onBrowserEvent(Context context, com.google.gwt.dom.client.Element parent, Tag tag, com.google.gwt.dom.client.NativeEvent event, com.google.gwt.cell.client.ValueUpdater<Tag> valueUpdater) {
+ if (event.getType().equals(com.google.gwt.event.dom.client.ContextMenuEvent.getType().getName())) {
+ TagTreeViewModel.this.selectionModel.setSelected(tag, true);
+ }
+ }
+ };
+
+ private ListDataProvider<String> rootDataProvider = new ListDataProvider<String>();
+ private ListDataProvider<Tag> tagDataProvider = new ListDataProvider<Tag>();
+
+ private SingleSelectionModel<Tag> selectionModel;
+
+ public TagTreeViewModel(SingleSelectionModel<Tag> selectionModel) {
+ this.selectionModel = selectionModel;
+ }
+
+ @Override
+ public <T> NodeInfo<?> getNodeInfo(T value) {
+ if (value == null) {
+// rootDataProvider.getList().add("Tags");
+ 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(TagTreeView.images.tag()).getHTML();
+ builder.appendHtmlConstant(html);
+ builder.append(Templates.INSTANCE.nameSpan(object));
+ }
+ }), new SingleSelectionModel<String>(), null);
+ }
+ else if (value instanceof String) {
+ //fetchAllTags();
+ return new DefaultNodeInfo<Tag>(tagDataProvider, tagCell, selectionModel, null);
+ }
+ else
+ return null;
+ }
+
+ @Override
+ public boolean isLeaf(Object o) {
+ if (o == null)
+ return false;
+ if (o instanceof String)
+ return tagDataProvider.getList().isEmpty();
+ else
+ return true;
+ }
+
+ private void fetchTags(final Iterator<Folder> iter) {
+ final Pithos app = Pithos.get();
+ if (iter.hasNext()) {
+ final Folder f = iter.next();
+
+ String path = app.getApiPath() + app.getUsername() + "/" + f.getUri() + "?format=json&delimiter=/&prefix=" + f.getPrefix();
+// GetRequest<Tag> getFolder = new GetRequest<Tag>(Tag.class, path, f) {
+// @Override
+// public void onSuccess(Tag result) {
+// fetchFolder(iter, dataProvider, tags);
+// }
+//
+// @Override
+// public void onError(Throwable t) {
+// GWT.log("Error getting folder", t);
+// if (t instanceof RestException)
+// Pithos.get().displayError("Error getting folder: " + ((RestException) t).getHttpStatusText());
+// else
+// Pithos.get().displayError("System error fetching folder: " + t.getMessage());
+// }
+// };
+// getFolder.setHeader("X-Auth-Token", app.getToken());
+// Scheduler.get().scheduleDeferred(getFolder);
+ }
+ }
+//
+// public void initialize(AccountResource account) {
+// Iterator<Tag> iter = account.getContainers().iterator();
+// fetchFolder(iter, rootDataProvider, account.getContainers());
+// }
+//
+ public Tag getSelection() {
+ return selectionModel.getSelectedObject();
+ }
+
+ public void updateTag(Tag tag) {
+// if (dataProviderMap.get(tag) == null) {
+// dataProviderMap.put(tag, new ListDataProvider<Tag>());
+// }
+// final ListDataProvider<Tag> dataProvider = dataProviderMap.get(tag);
+// if (!tag.isTrash())
+// fetchFolder(tag, dataProvider);
+// else
+// Pithos.get().showFiles(tag);
+ }
+
+// public void fetchFolder(final Tag f, final ListDataProvider<Tag> dataProvider) {
+// dataProvider.flush();
+// Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+// @Override
+// public void execute() {
+// final Pithos app = Pithos.get();
+// String path = app.getApiPath() + app.getUsername() + "/" + f.getContainer() + "?format=json&delimiter=/&prefix=" + f.getPrefix();
+// GetRequest<Tag> getFolder = new GetRequest<Tag>(Tag.class, path, f) {
+// @Override
+// public void onSuccess(Tag result) {
+// app.showFiles(result);
+// Iterator<Tag> iter = result.getSubfolders().iterator();
+// fetchFolder(iter, dataProvider, result.getSubfolders());
+// }
+//
+// @Override
+// public void onError(Throwable t) {
+// GWT.log("Error getting folder", t);
+// if (t instanceof RestException)
+// Pithos.get().displayError("Error getting folder: " + ((RestException) t).getHttpStatusText());
+// else
+// Pithos.get().displayError("System error fetching folder: " + t.getMessage());
+// }
+// };
+// getFolder.setHeader("X-Auth-Token", app.getToken());
+// Scheduler.get().scheduleDeferred(getFolder);
+// }
+// });
+// }
+
+ public void initialize(AccountResource account) {
+ List<Tag> tagList = tagDataProvider.getList();
+ for (Folder f : account.getContainers()) {
+ for (String t : f.getTags())
+ tagList.add(new Tag(t));
+ }
+ rootDataProvider.getList().add("Tags");
+ }
+}
<head>
<title>Pithos</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <script language='javascript' src='gr.grnet.pithos.web.GSS.nocache.js'></script>
+ <script language='javascript' src='gr.grnet.pithos.web.Pithos.nocache.js'></script>
<script type="text/javascript">
document.oncontextmenu = function() {
return false;