import gr.ebs.gss.client.commands.RestoreTrashCommand;
import gr.ebs.gss.client.commands.ToTrashCommand;
import gr.ebs.gss.client.commands.UploadFileCommand;
+import gr.ebs.gss.client.rest.resource.MyFolderResource;
import gr.ebs.gss.client.rest.resource.OtherUserResource;
+import gr.ebs.gss.client.rest.resource.OthersFolderResource;
+import gr.ebs.gss.client.rest.resource.OthersResource;
+import gr.ebs.gss.client.rest.resource.RestResource;
+import gr.ebs.gss.client.rest.resource.SharedFolderResource;
+import gr.ebs.gss.client.rest.resource.SharedResource;
+import gr.ebs.gss.client.rest.resource.TrashFolderResource;
+import gr.ebs.gss.client.rest.resource.TrashResource;
import com.google.gwt.resources.client.ClientBundle;
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;
-import com.google.gwt.user.client.ui.TreeItem;
/**
* The 'Folder Context' menu implementation.
pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + " Paste</span>", true, new PasteCommand(this));
MenuBar contextMenu = new MenuBar(true);
- //TODO:CELLTREE
- /*
- Folders folders = GSS.get().getFolders();
- TreeItem selectedItem = folders.getCurrent();
+
+
+
+ RestResource selectedItem = GSS.get().getTreeView().getSelection();
if(selectedItem != null)
- if(folders.isTrashItem(selectedItem)){
- if (folders.isTrash(selectedItem)){
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Empty Trash</span>", true, new EmptyTrashCommand(this));
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
- }
- else {
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Restore folder and contents</span>", true, new RestoreTrashCommand(this));
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, newImages));
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
- }
- }
- else if(folders.isFileItem(selectedItem)){
+ if(selectedItem instanceof MyFolderResource){
contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.folderNew()).getHTML() + " New Folder</span>", true, new NewFolderCommand(this, images));
contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
- boolean notRootFolder = !folders.getRootItem().equals(selectedItem);
+ boolean notRootFolder = !GSS.get().getTreeView().getMyFolders().equals(selectedItem);
if (notRootFolder) {
// do not show the copy & cut option for the user's root folder
contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(this));
contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + " Sharing</span>", true, new PropertiesCommand(this, newImages, 1));
contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(this, newImages, 0));
}
+ if(selectedItem instanceof SharedFolderResource){
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.folderNew()).getHTML() + " New Folder</span>", true, new NewFolderCommand(this, images));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(this));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(this));
+ contextMenu.addItem(pasteItem);
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + " Move to Trash</span>", true, new ToTrashCommand(this));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, newImages));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + " Sharing</span>", true, new PropertiesCommand(this, newImages, 1));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(this, newImages, 0));
+ }
+ if(selectedItem instanceof TrashFolderResource){
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Restore folder and contents</span>", true, new RestoreTrashCommand(this));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, newImages));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ }
+ if(selectedItem instanceof OthersFolderResource){
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.folderNew()).getHTML() + " New Folder</span>", true, new NewFolderCommand(this, images));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(this));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(this));
+ contextMenu.addItem(pasteItem);
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + " Move to Trash</span>", true, new ToTrashCommand(this));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, newImages));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + " Sharing</span>", true, new PropertiesCommand(this, newImages, 1));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(this, newImages, 0));
+ }
+ if(selectedItem instanceof TrashResource){
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Restore Trash</span>", true, new RestoreTrashCommand(this));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Empty Trash</span>", true, new EmptyTrashCommand(this));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ }
+ if(selectedItem instanceof SharedResource || selectedItem instanceof OthersResource || selectedItem instanceof OtherUserResource){
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ }
+
+ /*
+ if(folders.isTrashItem(selectedItem)){
+ if (folders.isTrash(selectedItem)){
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Empty Trash</span>", true, new EmptyTrashCommand(this));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ }
+ else {
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Restore folder and contents</span>", true, new RestoreTrashCommand(this));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, newImages));
+ contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ }
+ }
+ else if(folders.isFileItem(selectedItem)){
+
+ }
else if(!folders.isMyShares(selectedItem) && folders.isMySharedItem(selectedItem)){
contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.folderNew()).getHTML() + " New Folder</span>", true, new NewFolderCommand(this, images));
contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(this, newImages, 0));
} else if(!selectedItem.equals(folders.getSharesItem()))
contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
- */
+ */
+
add(contextMenu);
if (GSS.get().getClipboard().hasFolderOrFileItem())
pasteItem.setVisible(true);