// Create a panel to hold all of the form widgets.\r
VerticalPanel panel = new VerticalPanel();\r
form.setWidget(panel);\r
- final HTML info = new HTML("Select a single file to upload. Install" +\r
- " <a href='http://gears.google.com/'>Google Gears</a><br> " +\r
- "for uploading multiple files at once.");\r
+ final HTML info = new HTML("You may select a file to upload. Install" +\r
+ " <a href='http://gears.google.com/' target='_blank'>Google " +\r
+ "Gears</a><br> for uploading multiple files simultaneously.");\r
info.addStyleName("gss-uploadNote");\r
panel.add(info);\r
final Hidden date = new Hidden("Date", "");\r
GSS.get().displayError(results);\r
}\r
progressBar.setProgress(100);\r
- repeater.finish();\r
- hide();\r
+ cancelUpload();\r
GSS.get().showFileList(true);\r
GSS.get().getStatusPanel().updateStats();\r
}\r
prepareAndSubmit();\r
break;\r
case KeyboardListener.KEY_ESCAPE:\r
- repeater.finish();\r
- hide();\r
+ cancelUpload();\r
break;\r
}\r
\r
return true;\r
}\r
\r
+ /**\r
+ * Cancels the file upload.\r
+ */\r
+ private void cancelUpload() {\r
+ repeater.finish();\r
+ hide();\r
+ }\r
+\r
+ /**\r
+ * Make any last minute checks and start the upload.\r
+ */\r
public void prepareAndSubmit() {\r
final String fname = getFilename(upload.getFilename());\r
if (getFileForName(fname) == null) {\r
return filename + " " + i;\r
}\r
\r
+ /**\r
+ * Rename the conflicting trashed file with the supplied new name.\r
+ */\r
private void updateTrashedFile(String newName, FileResource trashedFile) {\r
JSONObject json = new JSONObject();\r
json.put("name", new JSONString(newName));\r
\r
@Override\r
public void onError(Throwable t) {\r
+ GSS app = GSS.get();\r
GWT.log("", t);\r
if (t instanceof RestException) {\r
int statusCode = ((RestException) t).getHttpStatusCode();\r
if (statusCode == 405)\r
- GSS.get().displayError("You don't have the necessary permissions");\r
+ app.displayError("You don't have the necessary permissions");\r
else if (statusCode == 404)\r
- GSS.get().displayError("User in permissions does not exist");\r
+ app.displayError("User in permissions does not exist");\r
else if (statusCode == 409)\r
- GSS.get().displayError("A file with the same name already exists");\r
+ app.displayError("A file with the same name already exists");\r
else if (statusCode == 413)\r
- GSS.get().displayError("Your quota has been exceeded");\r
+ app.displayError("Your quota has been exceeded");\r
else\r
- GSS.get().displayError("Unable to modify file:" +((RestException)t).getHttpStatusText());\r
+ app.displayError("Unable to modify file:" + ((RestException) t).getHttpStatusText());\r
} else\r
- GSS.get().displayError("System error modifying file:" + t.getMessage());\r
+ app.displayError("System error modifying file:" + t.getMessage());\r
}\r
\r
};\r
* Same as URL.encodeComponent, but also\r
* encode apostrophe since browsers aren't consistent about it\r
* (FF encodes, IE does not).\r
- *\r
- * @param decodedURLComponent\r
- * @return\r
*/\r
- protected String encodeComponent(String decodedURLComponent) {\r
+ private String encodeComponent(String decodedURLComponent) {\r
String retv = URL.encodeComponent(decodedURLComponent);\r
retv = retv.replaceAll("'", "%27");\r
return retv;\r