Automated merge with https://gss.googlecode.com/hg/
[pithos] / src / gr / ebs / gss / client / FileMenu.java
index cf4b927..1ed1f0d 100644 (file)
@@ -38,6 +38,7 @@ 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;
 import com.google.gwt.user.client.ui.TreeItem;
 
@@ -175,22 +176,46 @@ public class FileMenu extends PopupPanel implements ClickHandler {
                boolean propertiesVisible = true;//!(selectedItem != null && (folders.isTrash(selectedItem) || folders.isMyShares(selectedItem) || folders.isOthersShared(selectedItem) || selectedItem.getUserObject() instanceof GroupUserResource || GSS.get().getCurrentSelection() instanceof List));
                boolean newFolderVisible = true;//!(selectedItem != null && (folders.isTrash(selectedItem) || folders.isTrashItem(selectedItem) || folders.isMyShares(selectedItem)|| folders.isOthersShared(selectedItem)));
                boolean uploadVisible = true;//!(selectedItem != null && (folders.isTrash(selectedItem) || folders.isTrashItem(selectedItem)|| folders.isMyShares(selectedItem)|| folders.isOthersShared(selectedItem)));
-               if(newFolderVisible)
-                       contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.folderNew()).getHTML() + "&nbsp;New Folder</span>", true, new NewFolderCommand(this, images));
-               if(uploadVisible)
-                       contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.fileUpdate()).getHTML() + "&nbsp;Upload</span>", true, new UploadFileCommand(this));
+               if(newFolderVisible){
+                       MenuItem newFolderItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.folderNew()).getHTML() + "&nbsp;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() + "&nbsp;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() + "&nbsp;Download" + link[1] + "</span>", true, downloadCmd);
+                       
+                       MenuItem downloadItem = new MenuItem("<span>" + link[0] + AbstractImagePrototype.create(images.download()).getHTML() + "&nbsp;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() + "&nbsp;Save As" + link[1] + "</span>", true, downloadCmd);
+                       
+                       MenuItem saveAsItem = new MenuItem("<span>" + link[0] + AbstractImagePrototype.create(images.download()).getHTML() + "&nbsp;Save As" + link[1] + "</span>", true, downloadCmd);
+                       saveAsItem.getElement().setId("topMenu.file.saveAs");
+                       contextMenu.addItem(saveAsItem);
                }
-               contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.emptyTrash()).getHTML() + "&nbsp;Empty Trash</span>", true, new EmptyTrashCommand(this));
-               contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + "&nbsp;Refresh</span>", true, new RefreshCommand(this, images));
-               contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.sharing()).getHTML() + "&nbsp;Sharing</span>", true, new PropertiesCommand(this, images, 1))
+               MenuItem emptyTrashItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.emptyTrash()).getHTML() + "&nbsp;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() + "&nbsp;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() + "&nbsp;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() + "&nbsp;Properties</span>", true, new PropertiesCommand(this, images, 0))
+               
+               MenuItem propertiesItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.viewText()).getHTML() + "&nbsp;Properties</span>", true, new PropertiesCommand(this, images, 0));
+               propertiesItem.getElement().setId("topMenu.file.properties");
+               contextMenu.addItem(propertiesItem)
                                        .setVisible(propertiesVisible);
                return contextMenu;
        }