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.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
*
* @param newImages the image bundle passed on by the parent object
*/
- public FileContextMenu(final Pithos app, Images newImages, TreeView selectedTree, Folder selectedFolder, List<File> selectedFiles) {
+ public FileContextMenu(final Pithos app, Images newImages, TreeView selectedTree, Folder selectedFolder, final List<File> selectedFiles) {
// The popup's constructor's argument is a boolean specifying that it
// auto-close itself when the user clicks outside of it.
super(true);
contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(app, this, selectedFiles, images, 0)));
}
- if (selectedFiles.size() == 1)
- contextMenu.addItem(new MenuItem("<span><a class='hidden-link' href='" + app.getApiPath() + selectedFiles.get(0).getOwner() + selectedFiles.get(0).getUri() + "?X-Auth-Token=" + app.getToken() + "' target='_blank'>" + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download</a></span>", true, (Command) null));
+ contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download</span>", true, new Command() {
+
+ @Override
+ public void execute() {
+ for (File f : selectedFiles)
+ Window.open(app.getApiPath() + f.getOwner() + f.getUri() + "?X-Auth-Token=" + app.getToken(), "_blank", "");
+ }
+ }));
add(contextMenu);
}
import java.util.List;
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.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
*
* @param newImages the image bundle passed on by the parent object
*/
- public ToolsMenu(Pithos app, Images newImages, TreeView selectedTree, Folder folder, List<File> files) {
+ public ToolsMenu(final Pithos app, Images newImages, TreeView selectedTree, Folder folder, final List<File> files) {
// The popup's constructor's argument is a boolean specifying that it
// auto-close itself when the user clicks outside of it.
super(true);
if (properties != null)
contextMenu.addItem(properties);
}
- if (files != null && files.size() == 1)
- contextMenu.addItem(new MenuItem("<span><a class='hidden-link' href='" + app.getApiPath() + files.get(0).getOwner() + files.get(0).getUri() + "?X-Auth-Token=" + app.getToken() + "' target='_blank'>" + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download</a></span>", true, (Command) null));
+ if (files != null) {
+ contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download</span>", true, new Command() {
+
+ @Override
+ public void execute() {
+ for (File f: files)
+ Window.open(app.getApiPath() + files.get(0).getOwner() + files.get(0).getUri() + "?X-Auth-Token=" + app.getToken(), "_blank", "");
+ }
+ }));
+ }
}
}
else {