import com.google.gwt.event.dom.client.ClickEvent;\r
import com.google.gwt.event.dom.client.ClickHandler;\r
import com.google.gwt.event.dom.client.KeyCodes;\r
+import com.google.gwt.http.client.Response;\r
+import com.google.gwt.user.client.Command;\r
import com.google.gwt.user.client.Event.NativePreviewEvent;\r
import com.google.gwt.user.client.ui.AbstractImagePrototype;\r
+import com.google.gwt.user.client.ui.Anchor;\r
import com.google.gwt.user.client.ui.Button;\r
import com.google.gwt.user.client.ui.DialogBox;\r
import com.google.gwt.user.client.ui.HTML;\r
public DeleteFileDialog(Pithos _app, Images images, List<File> _files) {\r
app = _app;\r
files = _files;\r
+ Anchor close = new Anchor();\r
+ close.addStyleName("close");\r
+ close.addClickHandler(new ClickHandler() {\r
+ \r
+ @Override\r
+ public void onClick(ClickEvent event) {\r
+ hide();\r
+ }\r
+ });\r
// Set the dialog's caption.\r
setText("Confirmation");\r
setAnimationEnabled(true);\r
+ setGlassEnabled(true);\r
+ setStyleName("pithos-DialogBox");\r
// Create a VerticalPanel to contain the label and the buttons.\r
VerticalPanel outer = new VerticalPanel();\r
- HorizontalPanel buttons = new HorizontalPanel();\r
+ outer.add(close);\r
+ \r
+ VerticalPanel inner = new VerticalPanel();\r
+ inner.addStyleName("inner");\r
\r
HTML text;\r
if (files.size() == 1)\r
else\r
text = new HTML("<table><tr><td>" + AbstractImagePrototype.create(images.warn()).getHTML() + "</td><td>" + "Are you sure you want to <b>permanently</b> delete the selected files?</td></tr></table>");\r
text.setStyleName("pithos-warnMessage");\r
- outer.add(text);\r
+ inner.add(text);\r
\r
// Create the 'Delete' button, along with a listener that hides the dialog\r
// when the button is clicked and deletes the file.\r
hide();\r
}\r
});\r
- ok.getElement().setId("confirmation.ok");\r
- buttons.add(ok);\r
- buttons.setCellHorizontalAlignment(ok, 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 ClickHandler() {\r
- @Override\r
- public void onClick(@SuppressWarnings("unused") ClickEvent event) {\r
- hide();\r
- }\r
- });\r
- cancel.getElement().setId("confirmation.cancel");\r
- buttons.add(cancel);\r
- buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);\r
- buttons.setSpacing(8);\r
- buttons.setStyleName("pithos-warnMessage");\r
- outer.setStyleName("pithos-warnMessage");\r
- outer.add(buttons);\r
- outer.setCellHorizontalAlignment(text, HasHorizontalAlignment.ALIGN_CENTER);\r
- outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);\r
+ ok.addStyleName("button");\r
+ inner.add(ok);\r
+ inner.setCellHorizontalAlignment(text, HasHorizontalAlignment.ALIGN_CENTER);\r
+ outer.add(inner);\r
+ outer.setCellHorizontalAlignment(inner, HasHorizontalAlignment.ALIGN_CENTER);\r
setWidget(outer);\r
}\r
\r
if (iter.hasNext()) {\r
File f = iter.next();\r
String path = f.getUri();\r
- DeleteRequest deleteFile = new DeleteRequest(app.getApiPath(), app.getUsername(), path) {\r
+ DeleteRequest deleteFile = new DeleteRequest(app.getApiPath(), f.getOwner(), path) {\r
@Override\r
public void onSuccess(@SuppressWarnings("unused") Resource result) {\r
deleteFile(iter);\r
else\r
app.displayError("System error unable to delete file: "+t.getMessage());\r
}\r
+\r
+ @Override\r
+ protected void onUnauthorized(Response response) {\r
+ app.sessionExpired();\r
+ }\r
};\r
deleteFile.setHeader("X-Auth-Token", app.getToken());\r
Scheduler.get().scheduleDeferred(deleteFile);\r
}\r
else {\r
- app.updateFolder(files.get(0).getParent(), true, null);\r
+ app.updateFolder(files.get(0).getParent(), true, new Command() {\r
+ \r
+ @Override\r
+ public void execute() {\r
+ app.updateStatistics();\r
+ }\r
+ });\r
}\r
}\r
\r