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.FolderResource;
import gr.ebs.gss.client.rest.resource.OtherUserResource;
+import gr.ebs.gss.client.rest.resource.RestResource;
+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;
* The image bundle for this widget's images that reuses images defined in
* other menus.
*/
- public interface Images extends FileMenu.Images, EditMenu.Images {
+ public interface Images extends ClientBundle,FileMenu.Images, EditMenu.Images {
}
private MenuItem pasteItem;
setAnimationEnabled(true);
images = newImages;
- pasteItem = new MenuItem("<span>" + newImages.paste().getHTML() + " Paste</span>", true, new PasteCommand(this));
+ pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + " Paste</span>", true, new PasteCommand(this));
MenuBar contextMenu = new MenuBar(true);
- 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>" + newImages.delete().getHTML() + " Empty Trash</span>", true, new EmptyTrashCommand(this));
- contextMenu.addItem("<span>" + images.refresh().getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
- }
- else {
- contextMenu.addItem("<span>" + newImages.viewText().getHTML() + " Restore folder and contents</span>", true, new RestoreTrashCommand(this));
- contextMenu.addItem("<span>" + newImages.delete().getHTML() + " Delete</span>", true, new DeleteCommand(this, newImages));
- contextMenu.addItem("<span>" + images.refresh().getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
- }
- }
- else if(folders.isFileItem(selectedItem)){
- contextMenu.addItem("<span>" + newImages.folderNew().getHTML() + " New Folder</span>", true, new NewFolderCommand(this, images));
- contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this));
- boolean notRootFolder = !folders.getRootItem().equals(selectedItem);
+ if(selectedItem instanceof FolderResource){
+ 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 = !GSS.get().getTreeView().getMyFolders().equals(selectedItem);
if (notRootFolder) {
// do not show the copy & cut option for the user's root folder
- contextMenu.addItem("<span>" + newImages.cut().getHTML() + " Cut</span>", true, new CutCommand(this));
- contextMenu.addItem("<span>" + newImages.copy().getHTML() + " Copy</span>", true, new CopyCommand(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);
if (notRootFolder) {
// do not show delete options for the user's root folder
- contextMenu.addItem("<span>" + newImages.emptyTrash().getHTML() + " Move to Trash</span>", true, new ToTrashCommand(this));
- contextMenu.addItem("<span>" + newImages.delete().getHTML() + " Delete</span>", true, new DeleteCommand(this, newImages));
+ 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>" + images.refresh().getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
- contextMenu.addItem("<span>" + newImages.sharing().getHTML() + " Sharing</span>", true, new PropertiesCommand(this, newImages, 1));
- contextMenu.addItem("<span>" + newImages.viewText().getHTML() + " Properties</span>", true, new PropertiesCommand(this, newImages, 0));
+ 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(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>" + newImages.folderNew().getHTML() + " New Folder</span>", true, new NewFolderCommand(this, images));
- contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this));
- contextMenu.addItem("<span>" + newImages.cut().getHTML() + " Cut</span>", true, new CutCommand(this));
- contextMenu.addItem("<span>" + newImages.copy().getHTML() + " Copy</span>", true, new CopyCommand(this));
+ 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>" + newImages.emptyTrash().getHTML() + " Move to Trash</span>", true, new ToTrashCommand(this));
- contextMenu.addItem("<span>" + newImages.delete().getHTML() + " Delete</span>", true, new DeleteCommand(this, newImages));
- contextMenu.addItem("<span>" + images.refresh().getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
- contextMenu.addItem("<span>" + newImages.viewText().getHTML() + " Properties</span>", true, new PropertiesCommand(this, newImages, 0));
+ 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));
}
else if(!folders.isOthersShared(selectedItem) && folders.isOthersSharedItem(selectedItem) && !(GSS.get().getCurrentSelection() instanceof OtherUserResource)){
- contextMenu.addItem("<span>" + newImages.folderNew().getHTML() + " New Folder</span>", true, new NewFolderCommand(this, images));
- contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this));
- contextMenu.addItem("<span>" + newImages.copy().getHTML() + " Copy</span>", true, new CopyCommand(this));
+ 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>" + images.refresh().getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
- contextMenu.addItem("<span>" + newImages.viewText().getHTML() + " Properties</span>", true, new PropertiesCommand(this, newImages, 0));
+ 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));
} else if(!selectedItem.equals(folders.getSharesItem()))
- contextMenu.addItem("<span>" + images.refresh().getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ 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);