import gr.ebs.gss.client.rest.RestCommand;
import gr.ebs.gss.client.rest.resource.FileResource;
import gr.ebs.gss.client.rest.resource.GroupUserResource;
+import gr.ebs.gss.client.rest.resource.OtherUserResource;
+import gr.ebs.gss.client.rest.resource.OthersResource;
+import gr.ebs.gss.client.rest.resource.RestResource;
+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 java.util.List;
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;
import com.google.gwt.user.client.ui.TreeItem;
preDownloadCheck();
}
};
- Folders folders = GSS.get().getFolders();
- TreeItem selectedItem = folders.getCurrent();
+ //
+ RestResource selectedItem = GSS.get().getTreeView().getSelection();
boolean downloadVisible = GSS.get().getCurrentSelection() != null && GSS.get().getCurrentSelection() instanceof FileResource;
- boolean propertiesVisible = !(selectedItem != null && (folders.isTrash(selectedItem) || folders.isMyShares(selectedItem) || folders.isOthersShared(selectedItem) || selectedItem.getUserObject() instanceof GroupUserResource || GSS.get().getCurrentSelection() instanceof List));
- boolean newFolderVisible = !(selectedItem != null && (folders.isTrash(selectedItem) || folders.isTrashItem(selectedItem) || folders.isMyShares(selectedItem)|| folders.isOthersShared(selectedItem)));
- boolean uploadVisible = !(selectedItem != null && (folders.isTrash(selectedItem) || folders.isTrashItem(selectedItem)|| folders.isMyShares(selectedItem)|| folders.isOthersShared(selectedItem)));
- if(newFolderVisible)
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.folderNew()).getHTML() + " New Folder</span>", true, new NewFolderCommand(this, images));
- if(uploadVisible)
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
+ boolean propertiesVisible = !(selectedItem != null && (selectedItem instanceof TrashResource || selectedItem instanceof TrashFolderResource || selectedItem instanceof SharedResource || selectedItem instanceof OthersResource || selectedItem instanceof OtherUserResource
+ //|| folders.isOthersShared(selectedItem) || selectedItem.getUserObject() instanceof GroupUserResource
+ || GSS.get().getCurrentSelection() instanceof List));
+ boolean newFolderVisible = !(selectedItem != null && (selectedItem instanceof TrashResource || selectedItem instanceof TrashFolderResource || selectedItem instanceof SharedResource || selectedItem instanceof OthersResource || selectedItem instanceof OtherUserResource));
+ boolean uploadVisible = !(selectedItem != null && (selectedItem instanceof TrashResource || selectedItem instanceof TrashFolderResource || selectedItem instanceof SharedResource || selectedItem instanceof OthersResource || selectedItem instanceof OtherUserResource));
+ if(newFolderVisible){
+ MenuItem newFolderItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.folderNew()).getHTML() + " New Folder</span>", true, new NewFolderCommand(this, images));
+ newFolderItem.getElement().setId("topMenu.file.newFolder");
+ contextMenu.addItem(newFolderItem);
+ }
+ if(uploadVisible){
+ MenuItem uploadItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
+ uploadItem.getElement().setId("topMenu.file.upload");
+ contextMenu.addItem(uploadItem);
+ }
if (downloadVisible) {
String[] link = {"", ""};
createDownloadLink(link, false);
- contextMenu.addItem("<span>" + link[0] + AbstractImagePrototype.create(images.download()).getHTML() + " Download" + link[1] + "</span>", true, downloadCmd);
+
+ MenuItem downloadItem = new MenuItem("<span>" + link[0] + AbstractImagePrototype.create(images.download()).getHTML() + " Download" + link[1] + "</span>", true, downloadCmd);
+ contextMenu.addItem(downloadItem);
+ downloadItem.getElement().setId("topMenu.file.download");
+
createDownloadLink(link, true);
- contextMenu.addItem("<span>" + link[0] + AbstractImagePrototype.create(images.download()).getHTML() + " Save As" + link[1] + "</span>", true, downloadCmd);
+
+ MenuItem saveAsItem = new MenuItem("<span>" + link[0] + AbstractImagePrototype.create(images.download()).getHTML() + " Save As" + link[1] + "</span>", true, downloadCmd);
+ saveAsItem.getElement().setId("topMenu.file.saveAs");
+ contextMenu.addItem(saveAsItem);
}
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.emptyTrash()).getHTML() + " Empty Trash</span>", true, new EmptyTrashCommand(this));
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.sharing()).getHTML() + " Sharing</span>", true, new PropertiesCommand(this, images, 1))
+ MenuItem emptyTrashItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.emptyTrash()).getHTML() + " Empty Trash</span>", true, new EmptyTrashCommand(this));
+ emptyTrashItem.getElement().setId("topMenu.file.emptyTrash");
+ contextMenu.addItem(emptyTrashItem);
+
+ MenuItem refreshItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ refreshItem.getElement().setId("topMenu.file.refresh");
+ contextMenu.addItem(refreshItem);
+
+ MenuItem sharingItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.sharing()).getHTML() + " Sharing</span>", true, new PropertiesCommand(this, images, 1));
+ sharingItem.getElement().setId("topMenu.file.sharing");
+ contextMenu.addItem(sharingItem)
.setVisible(propertiesVisible);
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(this, images, 0))
+
+ MenuItem propertiesItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(this, images, 0));
+ propertiesItem.getElement().setId("topMenu.file.properties");
+ contextMenu.addItem(propertiesItem)
.setVisible(propertiesVisible);
return contextMenu;
}