<attribute name="javadoc_location" value="http://commons.apache.org/configuration/apidocs/"/>
</attributes>
</classpathentry>
+ <classpathentry kind="lib" path="lib/gwt-gears.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<pathelement location="${ear.lib.dir}/commons-lang.jar"/>
<pathelement location="${junit.path}/junit.jar"/>
<pathelement location="${basedir}/lib/gwt-dnd-2.5.6.jar"/>
+ <pathelement location="${basedir}/lib/gwt-gears.jar"/>
</path>
<target name="install" description="Installs the configuration files of the application server">
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
+ <!-- Inherit the default GWT style sheet -->
+ <!-- inherits name="com.google.gwt.user.theme.standard.Standard"/-->
+ <inherits name="com.google.gwt.gears.Gears"/>
<inherits name='com.allen_sauer.gwt.dnd.gwt-dnd' />
<inherits name="com.google.gwt.http.HTTP"/>
<inherits name="com.google.gwt.json.JSON"/>
<entry-point class='gr.ebs.gss.client.GSS' />
<stylesheet src='gss.css' />
<!-- <set-property name="user.agent" value="gecko" /> -->
-
+ <!-- Rebind the file upload dialog if Gears is installed -->
+ <replace-with class="gr.ebs.gss.client.FileUploadGearsDialog">
+ <when-type-is class="gr.ebs.gss.client.FileUploadDialog"/>
+ <when-property-is name="gears.installed" value="true"/>
+ </replace-with>
</module>
*/
package gr.ebs.gss.client;
-import gr.ebs.gss.client.MessagePanel.Images;
-
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
/**
* The widget's constructor.
*
- * @param images the supplied images
* @param message the message to display
* @param buttonLabel the label of the confirmation button
*/
- public ConfirmationDialog(Images images, String message, String buttonLabel) {
+ public ConfirmationDialog(String message, String buttonLabel) {
// Set the dialog's caption.
setText("Confirmation");
setAnimationEnabled(true);
VerticalPanel outer = new VerticalPanel();
HorizontalPanel buttons = new HorizontalPanel();
- HTML text = new HTML("<table><tr><td rowspan='2'>" + images.warn().getHTML() +
+ HTML text = new HTML("<table><tr><td rowspan='2'>" + MessagePanel.images.warn().getHTML() +
"</td><td>" + message + "</td></tr></table>");
text.setStyleName("gss-warnMessage");
outer.add(text);
contextMenu.addItem(pasteItem);
if (GSS.get().getFolders().getCurrent() != null)
if (GSS.get().getFolders().isFileItem(GSS.get().getFolders().getCurrent()))
- contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this, images));
+ contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this));
else if (GSS.get().getFolders().isMySharedItem(GSS.get().getFolders().getCurrent()) || GSS .get()
.getFolders()
.isOthersSharedItem(GSS .get()
.getFolders()
.getCurrent()))
if(GSS.get().getFolders().getCurrent().getUserObject() instanceof FolderResource)
- contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this, images));
+ contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this));
contextMenu.addItem("<span>" + images.refresh().getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
} else if (isTrash) {
contextMenu.addItem("<span>" + newImages.versions().getHTML() + " Restore</span>", true, new RestoreTrashCommand(this));
cutItem = new MenuItem("<span>" + newImages.cut().getHTML() + " Cut</span>", true, new CutCommand(this));
copyItem = new MenuItem("<span>" + newImages.copy().getHTML() + " Copy</span>", true, new CopyCommand(this));
- updateItem = new MenuItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this, images));
+ updateItem = new MenuItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this));
trashItem = new MenuItem("<span>" + newImages.emptyTrash().getHTML() + " Move to Trash</span>", true, new ToTrashCommand(this));
deleteItem = new MenuItem("<span>" + newImages.delete().getHTML() + " Delete</span>", true, new DeleteCommand(this, images));
boolean downloadVisible = GSS.get().getCurrentSelection() != null && GSS.get().getCurrentSelection() instanceof FileResource;\r
boolean propertiesNotVisible = selectedItem != null && (folders.isTrash(selectedItem) || folders.isMyShares(selectedItem) || folders.isOthersShared(selectedItem) || selectedItem.getUserObject() instanceof GroupUserResource);\r
contextMenu.addItem("<span>" + images.folderNew().getHTML() + " New Folder</span>", true, new NewFolderCommand(this, images));\r
- contextMenu.addItem("<span>" + images.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this, images));\r
+ contextMenu.addItem("<span>" + images.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this));\r
if (downloadVisible) {\r
String[] link = {"", ""};\r
createDownloadLink(link);\r
Button removeVersionsButton = new Button(images.delete().getHTML(), new ClickListener() {\r
\r
public void onClick(Widget sender) {\r
- ConfirmationDialog confirm = new ConfirmationDialog(images,"Really remove all previous versions?","Remove"){\r
+ ConfirmationDialog confirm = new ConfirmationDialog("Really " +\r
+ "remove all previous versions?", "Remove") {\r
\r
+ @Override\r
public void cancel() {\r
}\r
\r
-\r
+ @Override\r
public void confirm() {\r
FilePropertiesDialog.this.closeDialog();\r
removeAllOldVersions();\r
private void updateTags() {\r
GetCommand<TagsResource> tc = new GetCommand<TagsResource>(TagsResource.class, GSS.get().getCurrentUserResource().getTagsPath()) {\r
\r
+ @Override\r
public void onComplete() {\r
allTagsContent.clear();\r
TagsResource tagr = getResult();\r
}\r
PostCommand cf = new PostCommand(file.getUri() + "?update=", jsonString, 200) {\r
\r
+ @Override\r
public void onComplete() {\r
GSS.get().getFileList().updateFileCache(true, false /* do not clear selected file*/);\r
}\r
\r
+ @Override\r
public void onError(Throwable t) {\r
GWT.log("", t);\r
if (t instanceof RestException) {\r
GWT.log(json.toString(), null);\r
PostCommand cf = new PostCommand(file.getUri() + "?update=", json.toString(), 200) {\r
\r
+ @Override\r
public void onComplete() {\r
toggleVersioned(true);\r
}\r
\r
+ @Override\r
public void onError(Throwable t) {\r
GWT.log("", t);\r
if (t instanceof RestException) {\r
GWT.log(json.toString(), null);\r
PostCommand cf = new PostCommand(file.getUri() + "?update=", json.toString(), 200) {\r
\r
+ @Override\r
public void onComplete() {\r
GSS.get().getFileList().updateFileCache(true, false /* do not clear selected file*/);\r
}\r
\r
+ @Override\r
public void onError(Throwable t) {\r
GWT.log("", t);\r
if (t instanceof RestException) {\r
*/\r
package gr.ebs.gss.client;\r
\r
-import gr.ebs.gss.client.FileMenu.Images;\r
import gr.ebs.gss.client.rest.GetCommand;\r
import gr.ebs.gss.client.rest.PostCommand;\r
import gr.ebs.gss.client.rest.RestCommand;\r
*/\r
public class FileUploadDialog extends DialogBox implements Updateable {\r
\r
- private int prgBarInterval = 1500;\r
+ protected int prgBarInterval = 1500;\r
\r
- private ProgressBar progressBar;\r
+ protected ProgressBar progressBar;\r
\r
- private RepeatingTimer repeater = new RepeatingTimer(this, prgBarInterval);\r
+ protected RepeatingTimer repeater = new RepeatingTimer(this, prgBarInterval);\r
\r
public static final boolean DONE = true;\r
\r
/**\r
* The Form element that performs the file upload.\r
*/\r
- final FormPanel form = new FormPanel();\r
+ private final FormPanel form = new FormPanel();\r
\r
- final FileUpload upload = new FileUpload();\r
+ private final FileUpload upload = new FileUpload();\r
\r
- final Label filenameLabel = new Label("");\r
+ protected final Label filenameLabel = new Label("");\r
\r
- private List<FileResource> files;\r
+ protected List<FileResource> files;\r
\r
- boolean cancelEvent = false;\r
+ protected boolean cancelEvent = false;\r
\r
- private String fileNameToUse;\r
+ protected String fileNameToUse;\r
\r
- final FolderResource folder;\r
- final Images images;\r
+ protected FolderResource folder;\r
\r
/**\r
* The widget's constructor.\r
- * @param _images\r
- * @param _files\r
*/\r
- public FileUploadDialog(final Images _images, List<FileResource> _files) {\r
- images = _images;\r
- files = _files;\r
+ public FileUploadDialog() {\r
// Set the dialog's caption.\r
setText("File upload");\r
setAnimationEnabled(true);\r
else {\r
final FileResource sameFile = same;\r
GWT.log("Same deleted file", null);\r
- ConfirmationDialog confirm = new ConfirmationDialog(images, "A file with " +\r
+ ConfirmationDialog confirm = new ConfirmationDialog("A file with " +\r
"the same name exists in the trash. If you continue,<br/>the trashed " +\r
- "file '" + fname + "' will be renamed automatically for you.", "Continue"){\r
+ "file '" + fname + "' will be renamed automatically for you.", "Continue") {\r
\r
@Override\r
public void cancel() {\r
}\r
else {\r
// We are going to update an existing file, so show a confirmation dialog.\r
- ConfirmationDialog confirm = new ConfirmationDialog(images, "Are you sure " +\r
- "you want to update " + fname + "?", "Update"){\r
+ ConfirmationDialog confirm = new ConfirmationDialog("Are you sure " +\r
+ "you want to update " + fname + "?", "Update") {\r
\r
@Override\r
public void cancel() {\r
* @param name the potentially full path name of a file\r
* @return the file name without extra path information\r
*/\r
- private String getFilename(String name) {\r
+ protected String getFilename(String name) {\r
int pathSepIndex = name.lastIndexOf("\\");\r
if (pathSepIndex == -1) {\r
pathSepIndex = name.lastIndexOf("/");\r
@Override\r
public void onError(Throwable t) {\r
GWT.log("", t);\r
-\r
}\r
\r
};\r
DeferredCommand.addCommand(eg);\r
}\r
\r
- private String getBackupFilename(String filename) {\r
+ protected String getBackupFilename(String filename) {\r
List<FileResource> filesInSameFolder = new ArrayList<FileResource>();\r
for (FileResource deleted : folder.getFiles())\r
if (deleted.isDeleted())\r
return filename + " " + i;\r
}\r
\r
- private void updateTrashedFile(String newName, FileResource trashedFile) {\r
+ protected void updateTrashedFile(String newName, FileResource trashedFile) {\r
JSONObject json = new JSONObject();\r
json.put("name", new JSONString(newName));\r
PostCommand cf = new PostCommand(trashedFile.getUri() + "?update=", json.toString(), 200) {\r
DeferredCommand.addCommand(cf);\r
}\r
\r
- private FileResource getFileForName(String name){\r
+ protected FileResource getFileForName(String name){\r
for (FileResource f : folder.getFiles())\r
if (!f.isDeleted() && f.getName().equals(name))\r
return f;\r
* @param decodedURLComponent\r
* @return\r
*/\r
- private String encodeComponent(String decodedURLComponent) {\r
+ protected String encodeComponent(String decodedURLComponent) {\r
String retv = URL.encodeComponent(decodedURLComponent);\r
retv = retv.replaceAll("'", "%27");\r
return retv;\r
}\r
+\r
+ /**\r
+ * Modify the files.\r
+ *\r
+ * @param newFiles the files to set\r
+ */\r
+ public void setFiles(List<FileResource> newFiles) {\r
+ files = newFiles;\r
+ }\r
}\r
--- /dev/null
+/*\r
+ * Copyright 2009 Electronic Business Systems Ltd.\r
+ *\r
+ * This file is part of GSS.\r
+ *\r
+ * GSS is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * GSS is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with GSS. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package gr.ebs.gss.client;\r
+\r
+import gr.ebs.gss.client.rest.RestCommand;\r
+import gr.ebs.gss.client.rest.resource.FileResource;\r
+import gr.ebs.gss.client.rest.resource.FolderResource;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
+import com.google.gwt.core.client.GWT;\r
+import com.google.gwt.gears.client.Factory;\r
+import com.google.gwt.gears.client.desktop.Desktop;\r
+import com.google.gwt.gears.client.desktop.File;\r
+import com.google.gwt.gears.client.desktop.OpenFilesHandler;\r
+import com.google.gwt.gears.client.httprequest.HttpRequest;\r
+import com.google.gwt.gears.client.httprequest.ProgressEvent;\r
+import com.google.gwt.gears.client.httprequest.ProgressHandler;\r
+import com.google.gwt.gears.client.httprequest.RequestCallback;\r
+import com.google.gwt.user.client.Command;\r
+import com.google.gwt.user.client.DeferredCommand;\r
+import com.google.gwt.user.client.ui.Button;\r
+import com.google.gwt.user.client.ui.ClickListener;\r
+import com.google.gwt.user.client.ui.Grid;\r
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;\r
+import com.google.gwt.user.client.ui.HorizontalPanel;\r
+import com.google.gwt.user.client.ui.TextBox;\r
+import com.google.gwt.user.client.ui.VerticalPanel;\r
+import com.google.gwt.user.client.ui.Widget;\r
+\r
+/**\r
+ * The 'File upload' dialog box implementation with Google Gears support.\r
+ */\r
+public class FileUploadGearsDialog extends FileUploadDialog implements Updateable {\r
+\r
+ private final Factory factory = Factory.getInstance();\r
+\r
+ private List<File> selectedFiles = new ArrayList<File>();\r
+\r
+ private TextBox selected;\r
+\r
+ /**\r
+ * The widget's constructor.\r
+ */\r
+ public FileUploadGearsDialog() {\r
+ // Set the dialog's caption.\r
+ setText("File upload");\r
+ setAnimationEnabled(true);\r
+ // Create a panel to hold all of the dialog widgets.\r
+ VerticalPanel panel = new VerticalPanel();\r
+ // Add an informative label with the folder name.\r
+ Object selection = GSS.get().getFolders().getCurrent().getUserObject();\r
+ folder = (FolderResource) selection;\r
+ filenameLabel.setText("");\r
+ filenameLabel.setVisible(false);\r
+ filenameLabel.setStyleName("props-labels");\r
+\r
+ final Button browse = new Button("Browse...");\r
+\r
+ selected = new TextBox();\r
+ selected.setEnabled(false);\r
+\r
+ HorizontalPanel fileUploadPanel = new HorizontalPanel();\r
+ fileUploadPanel.add(filenameLabel);\r
+ fileUploadPanel.add(selected);\r
+ fileUploadPanel.add(browse);\r
+\r
+ Grid generalTable = new Grid(2, 2);\r
+ generalTable.setText(0, 0, "Folder");\r
+ generalTable.setText(1, 0, "File");\r
+ generalTable.setText(0, 1, folder.getName());\r
+ generalTable.setWidget(1, 1, fileUploadPanel);\r
+ generalTable.getCellFormatter().setStyleName(0, 0, "props-labels");\r
+ generalTable.getCellFormatter().setStyleName(1, 0, "props-labels");\r
+ generalTable.getCellFormatter().setStyleName(0, 1, "props-values");\r
+ generalTable.getCellFormatter().setStyleName(1, 1, "props-values");\r
+ generalTable.setCellSpacing(4);\r
+\r
+ panel.add(generalTable);\r
+\r
+ // Create a panel to hold the buttons.\r
+ HorizontalPanel buttons = new HorizontalPanel();\r
+\r
+ // Create the 'upload' button, along with a listener that submits the\r
+ // form.\r
+ final Button submit = new Button("Upload");\r
+ submit.addClickListener(new ClickListener() {\r
+\r
+ public void onClick(Widget sender) {\r
+ GSS app = GSS.get();\r
+ if (selectedFiles.size() == 0) {\r
+ app.displayError("You must select a file!");\r
+ hide();\r
+ return;\r
+ }\r
+ for(File file: selectedFiles)\r
+ if (!canContinue(file)) {\r
+ app.displayError("The specified file name already exists in this folder");\r
+ hide();\r
+ return;\r
+ }\r
+ submit.setEnabled(false);\r
+ browse.setVisible(false);\r
+ prepareAndSubmit();\r
+ }\r
+ });\r
+ submit.setEnabled(false);\r
+ buttons.add(submit);\r
+ buttons.setCellHorizontalAlignment(submit, HasHorizontalAlignment.ALIGN_CENTER);\r
+ // Create the 'Cancel' button, along with a listener that hides the\r
+ // dialog when the button is clicked.\r
+ Button cancel = new Button("Cancel", new ClickListener() {\r
+\r
+ public void onClick(Widget sender) {\r
+ hide();\r
+ }\r
+ });\r
+ buttons.add(cancel);\r
+ buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);\r
+ buttons.setSpacing(8);\r
+ buttons.addStyleName("gss-DialogBox");\r
+\r
+ browse.addClickListener(new ClickListener() {\r
+ public void onClick(Widget sender) {\r
+ Desktop desktop = factory.createDesktop();\r
+ desktop.openFiles(new OpenFilesHandler() {\r
+\r
+ public void onOpenFiles(OpenFilesEvent event) {\r
+ selectedFiles.addAll(Arrays.asList(event.getFiles()));\r
+ selected.setText(selectedFiles.get(0).getName());\r
+ submit.setEnabled(true);\r
+ }\r
+ });\r
+ }\r
+ });\r
+\r
+ panel.add(buttons);\r
+ progressBar = new ProgressBar(50, ProgressBar.SHOW_TIME_REMAINING);\r
+ panel.add(progressBar);\r
+ progressBar.setVisible(false);\r
+ panel.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);\r
+ panel.setCellHorizontalAlignment(progressBar, HasHorizontalAlignment.ALIGN_CENTER);\r
+ panel.addStyleName("gss-DialogBox");\r
+ addStyleName("gss-DialogBox");\r
+ setWidget(panel);\r
+ }\r
+\r
+ /**\r
+ * Check whether the specified file name exists in the selected folder.\r
+ */\r
+ private boolean canContinue(File file) {\r
+ String fileName = getFilename(file.getName());\r
+ if (getFileForName(fileName) == null)\r
+ // For file creation, check to see if the file already exists.\r
+ for (FileResource fileRes : files)\r
+ if (!fileRes.isDeleted() && fileRes.getName().equals(fileName))\r
+ return false;\r
+ return true;\r
+ }\r
+\r
+ @Override\r
+ public void prepareAndSubmit(){\r
+ final String fname = getFilename(selectedFiles.get(0).getName());\r
+ if (getFileForName(fname) == null) {\r
+ // We are going to create a file, so we check to see if there is a\r
+ // trashed file with the same name.\r
+ FileResource same = null;\r
+ for (FileResource fres : folder.getFiles())\r
+ if (fres.isDeleted() && fres.getName().equals(fname))\r
+ same = fres;\r
+ if (same == null)\r
+ uploadFiles();\r
+ else {\r
+ final FileResource sameFile = same;\r
+ GWT.log("Same deleted file", null);\r
+ ConfirmationDialog confirm = new ConfirmationDialog("A file " +\r
+ "with the same name exists in the trash. If you " +\r
+ "continue,<br/>the trashed file '" + fname +\r
+ "' will be renamed automatically for you.", "Continue") {\r
+\r
+ @Override\r
+ public void cancel() {\r
+ FileUploadGearsDialog.this.hide();\r
+ }\r
+\r
+ @Override\r
+ public void confirm() {\r
+ updateTrashedFile(getBackupFilename(fname), sameFile);\r
+ }\r
+\r
+ };\r
+ confirm.center();\r
+ }\r
+ }\r
+ else {\r
+ // We are going to update an existing file, so show a confirmation dialog.\r
+ ConfirmationDialog confirm = new ConfirmationDialog("Are you sure " +\r
+ "you want to update " + fname + "?", "Update"){\r
+\r
+ @Override\r
+ public void cancel() {\r
+ FileUploadGearsDialog.this.hide();\r
+ }\r
+\r
+ @Override\r
+ public void confirm() {\r
+ uploadFiles();\r
+ }\r
+\r
+ };\r
+ confirm.center();\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Schedule the PUT requests to upload the files.\r
+ */\r
+ private void uploadFiles() {\r
+ for (final File file: selectedFiles)\r
+ DeferredCommand.addCommand(new Command() {\r
+ public void execute() {\r
+ doPut(file);\r
+ }\r
+ });\r
+ }\r
+\r
+ /**\r
+ * Perform the HTTP PUT requests to upload the specified file.\r
+ */\r
+ protected void doPut(final File file) {\r
+ GSS app = GSS.get();\r
+ HttpRequest request = factory.createHttpRequest();\r
+ String method = "PUT";\r
+\r
+ fileNameToUse = getFilename(file.getName());\r
+ selected.setVisible(false);\r
+ filenameLabel.setText(fileNameToUse);\r
+ filenameLabel.setVisible(true);\r
+ progressBar.setVisible(true);\r
+\r
+ String path;\r
+ FileResource selectedResource = getFileForName(fileNameToUse);\r
+ if (selectedResource == null ) {\r
+ // We are going to create a file.\r
+ path = folder.getUri();\r
+ if (!path.endsWith("/"))\r
+ path = path + "/";\r
+ path = path + encodeComponent(fileNameToUse);\r
+ } else\r
+ path = selectedResource.getUri();\r
+\r
+ String token = app.getToken();\r
+ String resource = path.substring(app.getApiPath().length()-1, path.length());\r
+ String date = RestCommand.getDate();\r
+ String sig = RestCommand.calculateSig(method, date, resource, RestCommand.base64decode(token));\r
+ request.open(method, path);\r
+ request.setRequestHeader("X-GSS-Date", date);\r
+ request.setRequestHeader("Authorization", app.getCurrentUserResource().getUsername() + " " + sig);\r
+ request.setRequestHeader("Accept", "application/json; charset=utf-8");\r
+ request.setCallback(new RequestCallback() {\r
+ public void onResponseReceived(HttpRequest req) {\r
+ switch(req.getStatus()) {\r
+ case 201: // Created falls through to updated.\r
+ case 204:\r
+ selectedFiles.remove(file);\r
+ finish();\r
+ break;\r
+ case 403:\r
+ SessionExpiredDialog dlg = new SessionExpiredDialog();\r
+ dlg.center();\r
+ break;\r
+ default:\r
+ DisplayHelper.log(req.getStatus() + ":" + req.getStatusText());\r
+ }\r
+ }\r
+ });\r
+ request.getUpload().setProgressHandler(new ProgressHandler() {\r
+ public void onProgress(ProgressEvent event) {\r
+ double pcnt = (double) event.getLoaded() / event.getTotal();\r
+ progressBar.setProgress((int) Math.floor(pcnt * 100));\r
+ }\r
+ });\r
+ request.send(file.getBlob());\r
+ }\r
+\r
+ /**\r
+ * Perform the final actions after the files are uploaded.\r
+ */\r
+ private void finish() {\r
+ if (!selectedFiles.isEmpty()) return;\r
+ hide();\r
+ GSS.get().showFileList(true);\r
+ GSS.get().getStatusPanel().updateStats();\r
+ }\r
+}\r
}
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, images));
+ contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this));
boolean notRootFolder = !folders.getRootItem().equals(selectedItem);
if (notRootFolder) {
// do not show the copy & cut option for the user's root folder
}
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, 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(pasteItem);
}
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, 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(pasteItem);
contextMenu.addItem("<span>" + images.refresh().getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
/**\r
* The widget's images.\r
*/\r
- private Images images;\r
+ public static Images images;\r
\r
/**\r
* The system message to be displayed.\r
import gr.ebs.gss.client.FileUploadDialog;
import gr.ebs.gss.client.GSS;
-import gr.ebs.gss.client.FileMenu.Images;
import gr.ebs.gss.client.rest.GetCommand;
import gr.ebs.gss.client.rest.resource.FileResource;
import gr.ebs.gss.client.rest.resource.FolderResource;
import java.util.ArrayList;
import java.util.List;
+import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.IncrementalCommand;
public class UploadFileCommand implements Command {
private PopupPanel containerPanel;
- final Images newImages;
- List<FileResource> files;
- boolean monitorCall = false;
+ private List<FileResource> files;
- public UploadFileCommand(PopupPanel _containerPanel, final Images images) {
- newImages = images;
+ public UploadFileCommand(PopupPanel _containerPanel) {
containerPanel = _containerPanel;
}
/**
* Display the 'new file' dialog for uploading a new file to the system.
*/
- void displayNewFile() {
+ private void displayNewFile() {
TreeItem currentFolder = GSS.get().getFolders().getCurrent();
if (currentFolder == null) {
GSS.get().displayError("You have to select the parent folder first");
public boolean execute() {
boolean res = canContinue();
if (res) {
- FileUploadDialog dlg = new FileUploadDialog(newImages, files);
+ FileUploadDialog dlg = GWT.create(FileUploadDialog.class);
+ dlg.setFiles(files);
dlg.center();
return false;
}