/*\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
package gr.grnet.pithos.web.client;\r
\r
-import gr.grnet.pithos.web.client.components.TristateCheckBox;\r
import gr.grnet.pithos.web.client.foldertree.File;\r
import gr.grnet.pithos.web.client.foldertree.Folder;\r
-import gr.grnet.pithos.web.client.rest.MultiplePostCommand;\r
-import gr.grnet.pithos.web.client.rest.RestException;\r
-import gr.grnet.pithos.web.client.rest.resource.FileResource;\r
\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
import java.util.List;\r
\r
-import com.google.gwt.core.client.GWT;\r
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.FocusEvent;\r
-import com.google.gwt.event.dom.client.FocusHandler;\r
-import com.google.gwt.json.client.JSONArray;\r
-import com.google.gwt.json.client.JSONBoolean;\r
-import com.google.gwt.json.client.JSONObject;\r
-import com.google.gwt.json.client.JSONString;\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.DecoratedTabPanel;\r
-import com.google.gwt.user.client.ui.DisclosurePanel;\r
import com.google.gwt.user.client.ui.FlexTable;\r
-import com.google.gwt.user.client.ui.FlowPanel;\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.HorizontalPanel;\r
-import com.google.gwt.user.client.ui.Label;\r
import com.google.gwt.user.client.ui.VerticalPanel;\r
\r
/**\r
*/\r
public class FilesPropertiesDialog extends AbstractPropertiesDialog {\r
\r
-// private final TristateCheckBox versionedCheck;\r
-\r
private final List<File> files;\r
\r
- private Boolean initialVersioned;\r
-\r
-\r
/**\r
* The widget's constructor.\r
*\r
* @param _files\r
*/\r
- public FilesPropertiesDialog(GSS _app, final List<File> _files) {\r
- super();\r
+ public FilesPropertiesDialog(Pithos _app, final List<File> _files) {\r
+ super(_app);\r
\r
files = _files;\r
-// int versionedNum = 0;\r
-// for (File fr : files)\r
-// if (fr.isVersioned()) versionedNum++;\r
-// Boolean versioned = null;\r
-// if (versionedNum == 0)\r
-// versioned = false;\r
-// if (versionedNum == files.size())\r
-// versioned = true;\r
-\r
-// initialVersioned = versioned;\r
-// versionedCheck = new TristateCheckBox(versioned);\r
\r
// Set the dialog's caption.\r
setText("Files properties");\r
final VerticalPanel outer = new VerticalPanel();\r
final FocusPanel focusPanel = new FocusPanel(outer);\r
// Inner contains generalPanel and permPanel.\r
- inner = new DecoratedTabPanel();\r
- inner.setAnimationEnabled(true);\r
+ inner = new VerticalPanel();\r
\r
- inner.add(createGeneralPanel(), "General");\r
+ inner.add(createGeneralPanel());\r
\r
- final VerticalPanel verPanel = new VerticalPanel();\r
-\r
-// final HorizontalPanel vPanel = new HorizontalPanel();\r
-// vPanel.setSpacing(8);\r
-// vPanel.addStyleName("pithos-TabPanelBottom");\r
-// vPanel.add(new Label("Versioned"));\r
-// vPanel.add(versionedCheck);\r
-//\r
-// verPanel.add(vPanel);\r
-\r
- inner.add(verPanel, "Versions");\r
- inner.selectTab(0);\r
outer.add(inner);\r
\r
final HorizontalPanel buttons = new HorizontalPanel();\r
else\r
generalTable.setText(1, 1, "-");\r
\r
- // Find if tags are identical\r
-// List<String> tagsList = files.get(0).getTags();\r
-// List<String> tagss;\r
-// for (int i=1; i<files.size(); i++) {\r
-// tagss = files.get(i).getTags();\r
-// if (tagsList.size() != tagss.size() || !tagsList.containsAll(tagss)) {\r
-// tagsList = null;\r
-// break;\r
-// }\r
-// }\r
-// // Get the tags.\r
-// StringBuffer tagsBuffer = new StringBuffer();\r
-// if (tagsList==null)\r
-// tagsBuffer.append(MULTIPLE_VALUES_TEXT);\r
-// else {\r
-// Iterator i = tagsList.iterator();\r
-// while (i.hasNext()) {\r
-// String tag = (String) i.next();\r
-// tagsBuffer.append(tag).append(", ");\r
-// }\r
-// if (tagsBuffer.length() > 1)\r
-// tagsBuffer.delete(tagsBuffer.length() - 2, tagsBuffer.length() - 1);\r
-// }\r
-// initialTagText = tagsBuffer.toString();\r
-// tags.setText(initialTagText);\r
-// tags.addFocusHandler(new FocusHandler() {\r
-// @Override\r
-// public void onFocus(FocusEvent event) {\r
-// if (MULTIPLE_VALUES_TEXT.equals(tags.getText()))\r
-// tags.setText("");\r
-// }\r
-// }\r
-// );\r
-//\r
-// generalTable.setWidget(2, 1, tags);\r
generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels");\r
generalTable.getFlexCellFormatter().setColSpan(0, 0, 2);\r
generalTable.getFlexCellFormatter().setStyleName(1, 0, "props-labels");\r
\r
generalPanel.add(generalTable);\r
\r
- // Asynchronously retrieve the tags defined by this user.\r
-// DeferredCommand.addCommand(new Command() {\r
-//\r
-// @Override\r
-// public void execute() {\r
-// updateTags();\r
-// }\r
-// });\r
-\r
- DisclosurePanel allTags = new DisclosurePanel("All tags");\r
- allTagsContent = new FlowPanel();\r
- allTags.setContent(allTagsContent);\r
- generalPanel.add(allTags);\r
- generalPanel.setSpacing(4);\r
-\r
return generalPanel;\r
}\r
\r
/**\r
* Accepts any change and updates the file\r
+ * @return \r
*\r
*/\r
@Override\r
- protected void accept() {\r
-// JSONObject json = new JSONObject();\r
-// if ( versionedCheck.getState()!=null && !versionedCheck.getState().equals(initialVersioned) )\r
-// json.put("versioned", JSONBoolean.getInstance(versionedCheck.getState()));\r
-//\r
-// JSONArray taga = new JSONArray();\r
-// int i = 0;\r
-// String tagText = tags.getText();\r
-// if (!MULTIPLE_VALUES_TEXT.equals(tagText) && !initialTagText.equals(tagText)) {\r
-// String[] tagset = tagText.split(",");\r
-// for (String t : tagset) {\r
-// JSONString to = new JSONString(t);\r
-// taga.set(i, to);\r
-// i++;\r
-// }\r
-// json.put("tags", taga);\r
-// }\r
-// String jsonString = json.toString();\r
-// if(jsonString.equals("{}")){\r
-// GWT.log("NO CHANGES", null);\r
-// return;\r
-// }\r
-// final List<String> fileIds = new ArrayList<String>();\r
-// for(FileResource f : files)\r
-// fileIds.add(f.getUri()+"?update=");\r
-// MultiplePostCommand rt = new MultiplePostCommand(fileIds.toArray(new String[0]), jsonString, 200){\r
-//\r
-// @Override\r
-// public void onComplete() {\r
-// GSS.get().getTreeView().refreshCurrentNode(false);\r
-// }\r
-//\r
-// @Override\r
-// public void onError(String p, Throwable t) {\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
-// else if(statusCode == 404)\r
-// GSS.get().displayError("File does not exist");\r
-// else if(statusCode == 409)\r
-// GSS.get().displayError("A file with the same name already exists");\r
-// else if(statusCode == 413)\r
-// GSS.get().displayError("Your quota has been exceeded");\r
-// else\r
-// GSS.get().displayError("Unable to modify file::"+((RestException)t).getHttpStatusText());\r
-// }\r
-// else\r
-// GSS.get().displayError("System error modifying file:"+t.getMessage());\r
-// }\r
-// };\r
-// DeferredCommand.addCommand(rt);\r
+ protected boolean accept() {\r
+ return true;\r
}\r
}\r