/*\r
- * Copyright 2011 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
*\r
* Redistribution and use in source and binary forms, with or\r
* without modification, are permitted provided that the following\r
\r
import gr.grnet.pithos.web.client.foldertree.File;\r
import gr.grnet.pithos.web.client.foldertree.FileVersions;\r
-import gr.grnet.pithos.web.client.foldertree.Resource;\r
import gr.grnet.pithos.web.client.foldertree.Version;\r
import gr.grnet.pithos.web.client.rest.GetRequest;\r
-import gr.grnet.pithos.web.client.rest.PostRequest;\r
-import gr.grnet.pithos.web.client.rest.PutRequest;\r
import gr.grnet.pithos.web.client.rest.RestException;\r
\r
-import java.util.HashMap;\r
import java.util.List;\r
-import java.util.Map;\r
\r
import com.google.gwt.core.client.GWT;\r
import com.google.gwt.core.client.Scheduler;\r
import com.google.gwt.event.dom.client.ClickEvent;\r
import com.google.gwt.event.dom.client.ClickHandler;\r
import com.google.gwt.http.client.Response;\r
-import com.google.gwt.http.client.URL;\r
import com.google.gwt.resources.client.ImageResource;\r
import com.google.gwt.user.client.Command;\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.CheckBox;\r
-import com.google.gwt.user.client.ui.DecoratedTabPanel;\r
import com.google.gwt.user.client.ui.FocusPanel;\r
import com.google.gwt.user.client.ui.HasHorizontalAlignment;\r
-import com.google.gwt.user.client.ui.TextBox;\r
import com.google.gwt.user.client.ui.VerticalPanel;\r
\r
/**\r
*/\r
public class FileVersionsDialog extends AbstractPropertiesDialog {\r
\r
- protected PermissionsList permList;\r
-\r
- protected CheckBox readForAll;\r
-\r
/**\r
* An image bundle for this widgets images.\r
*/\r
super(_app);\r
file = _file;\r
\r
- Anchor close = new Anchor();\r
+ Anchor close = new Anchor("close");\r
close.addStyleName("close");\r
close.addClickHandler(new ClickHandler() {\r
\r
@Override\r
- public void onClick(@SuppressWarnings("unused") ClickEvent event) {\r
+ public void onClick(ClickEvent event) {\r
hide();\r
}\r
});\r
inner = new VerticalPanel();\r
inner.addStyleName("inner");\r
\r
- fetchVersions();\r
- \r
- outer.add(inner);\r
+ outer.add(inner);\r
\r
// Create the 'OK' button, along with a listener that hides the dialog\r
// when the button is clicked.\r
final Button ok = new Button("OK", new ClickHandler() {\r
@Override\r
- public void onClick(@SuppressWarnings("unused") ClickEvent event) {\r
+ public void onClick(ClickEvent event) {\r
accept();\r
closeDialog();\r
}\r
setWidget(outer);\r
}\r
\r
+ void doCenter() {\r
+ super.center();\r
+ }\r
+ \r
+ @Override\r
+ public void center() {\r
+ fetchVersions();\r
+ }\r
+\r
protected void fetchVersions() {\r
String path = file.getUri() + "?format=json&version=list";\r
GetRequest<FileVersions> getVersions = new GetRequest<FileVersions>(FileVersions.class, app.getApiPath(), file.getOwner(), path) {\r
@Override\r
public void onSuccess(FileVersions _result) {\r
inner.add(createVersionPanel(_result.getVersions()));\r
+ doCenter();\r
}\r
\r
@Override\r
}\r
\r
@Override\r
- protected void onUnauthorized(@SuppressWarnings("unused") Response response) {\r
+ protected void onUnauthorized(Response response) {\r
app.sessionExpired();\r
}\r
};\r
\r
/**\r
* Accepts any change and updates the file\r
+ * @return \r
*\r
*/\r
@Override\r
- protected void accept() {\r
- updateMetaData(app.getApiPath(), app.getUsername(), file.getUri() + "?update=");\r
- }\r
-\r
- protected void updateMetaData(String api, String owner, String path) {\r
+ protected boolean accept() {\r
app.updateFolder(file.getParent(), true, new Command() {\r
\r
@Override\r
public void execute() {\r
- if (file.isShared())\r
+ if (file.isSharedOrPublished())\r
app.updateMySharedRoot();\r
}\r
- });\r
- }\r
+ }, true);\r
+ \r
+ return true;\r
+ }\r
}\r