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
final Button ok = new Button("OK", new ClickHandler() {\r
@Override\r
public void onClick(ClickEvent event) {\r
- accept();\r
- closeDialog();\r
+ if (accept())\r
+ closeDialog();\r
}\r
});\r
ok.addStyleName("button");\r
meta.addStyleName("pithos-metaTitle");\r
metaTitlePanel.add(meta);\r
\r
- Image plus = new Image();\r
- plus.addStyleName("pithos-addMetaImg");\r
+ Anchor plus = new Anchor("add");\r
+ plus.addStyleName(Pithos.resources.pithosCss().commandAnchor());\r
metaTitlePanel.add(plus);\r
\r
generalPanel.add(metaTitlePanel);\r
table.setWidget(row, 1, valueBox);\r
table.getFlexCellFormatter().setStyleName(1, 1, "props-values");\r
\r
- Image delete = new Image();\r
- delete.addStyleName("pithos-metaDeleteImg");\r
+ Anchor delete = new Anchor("remove");\r
+ delete.addStyleName(Pithos.resources.pithosCss().commandAnchor());\r
delete.addClickHandler(new ClickHandler() {\r
\r
@Override\r
*\r
*/\r
@Override\r
- protected void accept() {\r
+ protected boolean accept() {\r
String newFilename = null;\r
\r
if (!name.getText().trim().equals(file.getName())) {\r
newFilename = name.getText().trim();\r
+ if (newFilename.length() == 0)\r
+ newFilename = null;\r
}\r
+ \r
\r
final Map<String, String> newMeta = new HashMap<String, String>();\r
for (int row = 1; row < metaTable.getRowCount(); row++) {\r
String value = ((TextBox) metaTable.getWidget(row, 1)).getText().trim();\r
if (key.length() > 0 && value.length() > 0)\r
newMeta.put(key, value);\r
+ else if ((key.length() > 0 && value.length() == 0) || (key.length() == 0 && value.length() > 0)) {\r
+ app.displayError("You have empty keys or values");\r
+ return false;\r
+ }\r
}\r
\r
if (newFilename != null) {\r
}\r
else\r
updateMetaData(app.getApiPath(), app.getUsername(), file.getUri() + "?update=", newMeta);\r
+ return true;\r
}\r
\r
protected void updateMetaData(String api, String owner, String path, Map<String, String> newMeta) {\r
PostRequest updateFile = new PostRequest(api, owner, path) {\r
@Override\r
public void onSuccess(Resource result) {\r
- app.updateFolder(file.getParent(), true, new Command() {\r
- \r
- @Override\r
- public void execute() {\r
- app.updateMySharedRoot();\r
- }\r
- }, true);\r
+ if (!app.isMySharedSelected())\r
+ app.updateFolder(file.getParent(), true, new Command() {\r
+ \r
+ @Override\r
+ public void execute() {\r
+ app.updateMySharedRoot();\r
+ }\r
+ }, true);\r
+ else\r
+ app.updateSharedFolder(file.getParent(), true);\r
}\r
\r
@Override\r
\r
Scheduler.get().scheduleDeferred(updateFile);\r
}\r
- else\r
+ else if (!app.isMySharedSelected())\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
}, true);\r
+ else\r
+ app.updateSharedFolder(file.getParent(), true);\r
}\r
}\r