/*\r
- * Copyright 2007, 2008, 2009 Electronic Business Systems Ltd.\r
+ * Copyright 2007, 2008, 2009, 2010 Electronic Business Systems Ltd.\r
*\r
* This file is part of GSS.\r
*\r
package gr.ebs.gss.client;\r
\r
import gr.ebs.gss.client.FilePropertiesDialog.Images;\r
-import gr.ebs.gss.client.dnd.DnDTreeItem;\r
import gr.ebs.gss.client.rest.PostCommand;\r
import gr.ebs.gss.client.rest.RestException;\r
import gr.ebs.gss.client.rest.resource.FolderResource;\r
import gr.ebs.gss.client.rest.resource.GroupResource;\r
import gr.ebs.gss.client.rest.resource.PermissionHolder;\r
+import gr.ebs.gss.client.rest.resource.RestResource;\r
+import gr.ebs.gss.client.rest.resource.RestResourceWrapper;\r
\r
import java.util.List;\r
import java.util.Set;\r
\r
import com.google.gwt.core.client.GWT;\r
import com.google.gwt.dom.client.NativeEvent;\r
+import com.google.gwt.event.dom.client.ChangeEvent;\r
+import com.google.gwt.event.dom.client.ChangeHandler;\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.KeyCodes;\r
-import com.google.gwt.event.dom.client.KeyDownEvent;\r
-import com.google.gwt.event.dom.client.KeyDownHandler;\r
import com.google.gwt.http.client.URL;\r
import com.google.gwt.i18n.client.DateTimeFormat;\r
import com.google.gwt.json.client.JSONArray;\r
GSS.enableIESelection();\r
\r
create = _create;\r
- DnDTreeItem folderItem = (DnDTreeItem)GSS.get().getFolders().getCurrent();\r
- folder = folderItem.getFolderResource();\r
+ \r
+ folder = ((RestResourceWrapper) GSS.get().getTreeView().getSelection()).getResource();\r
permList = new PermissionsList(images, folder.getPermissions(), folder.getOwner());\r
groups = _groups;\r
\r
inner.add(permPanel, "Sharing");\r
inner.selectTab(0);\r
\r
- final Label folderNameNote = new Label("Please note that slashes ('/') are not allowed in foldernames.", true);\r
+ final Label folderNameNote = new Label("Please note that slashes ('/') are not allowed in folder names.", true);\r
folderNameNote.setVisible(false);\r
folderNameNote.setStylePrimaryName("gss-readForAllNote");\r
\r
generalTable.setText(2, 0, "Creator");\r
generalTable.setText(3, 0, "Last modified");\r
folderName.setText(create ? "" : folder.getName());\r
+ folderName.getElement().setId("folderPropertiesDialog.textBox.name");\r
generalTable.setWidget(0, 1, folderName);\r
- folderName.addKeyDownHandler(new KeyDownHandler() {\r
-\r
+ folderName.addChangeHandler(new ChangeHandler() {\r
+ \r
@Override\r
- public void onKeyDown(KeyDownEvent event) {\r
- folderNameNote.setVisible(true);\r
-\r
+ public void onChange(ChangeEvent event) {\r
+ if(folderName.getText().contains("/"))\r
+ folderNameNote.setVisible(true);\r
+ else\r
+ folderNameNote.setVisible(false); \r
+ \r
}\r
});\r
\r
- if (create){\r
+\r
+ if (create)\r
generalTable.setText(1, 1, folder.getName());\r
- generalTable.setWidget(0, 2, folderNameNote);\r
- }\r
else if(folder.getParentName() == null)\r
generalTable.setText(1, 1, "-");\r
else\r
generalTable.setText(1, 1, folder.getParentName());\r
+ generalTable.setWidget(0, 2, folderNameNote);\r
generalTable.setText(2, 1, folder.getOwner());\r
DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a");\r
if(folder.getModificationDate() != null)\r
okLabel = "Update";\r
Button ok = new Button(okLabel, new ClickHandler() {\r
@Override\r
- public void onClick(ClickEvent event) {\r
-\r
- createOrUpdateFolder();\r
+ public void onClick(ClickEvent event) { \r
+ if(folderName.getText().contains("/"))\r
+ folderNameNote.setVisible(true);\r
+ else {\r
+ folderNameNote.setVisible(false);\r
+ createOrUpdateFolder();\r
+ closeDialog();\r
+ }\r
\r
- closeDialog();\r
}\r
});\r
+ ok.getElement().setId("folderPropertiesDialog.button.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
closeDialog();\r
}\r
});\r
+ cancel.getElement().setId("folderPropertiesDialog.button.cancel");\r
buttons.add(cancel);\r
buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);\r
buttons.setSpacing(8);\r
dlg.center();\r
}\r
});\r
+ add.getElement().setId("folderPropertiesDialog.button.addGroup");\r
permButtons.add(add);\r
permButtons.setCellHorizontalAlignment(add, HasHorizontalAlignment.ALIGN_CENTER);\r
\r
dlg.center();\r
}\r
});\r
+ addUser.getElement().setId("folderPropertiesDialog.button.addUser");\r
permButtons.add(addUser);\r
permButtons.setCellHorizontalAlignment(addUser, HasHorizontalAlignment.ALIGN_CENTER);\r
\r
readForAllNote.setStylePrimaryName("gss-readForAllNote");\r
\r
readForAll = new CheckBox();\r
+ readForAll.getElement().setId("folderPropertiesDialog.checkBox.public");\r
readForAll.setValue(folder.isReadForAll());\r
readForAll.addClickHandler(new ClickHandler() {\r
@Override\r
permPanel.add(permForAll);\r
}\r
TextBox path = new TextBox();\r
+ path.getElement().setId("folderPropertiesDialog.textBox.link");\r
path.setWidth("100%");\r
path.addClickHandler(new ClickHandler() {\r
@Override\r
\r
@Override\r
public void onComplete() {\r
- GSS.get().getFolders().updateFolder((DnDTreeItem) GSS.get().getFolders().getCurrent());\r
+ //TODO:CELLTREE\r
+ GSS.get().getTreeView().updateNodeChildren((RestResourceWrapper) GSS.get().getTreeView().getSelection());\r
+ //GSS.get().getFolders().updateFolder((DnDTreeItem) GSS.get().getFolders().getCurrent());\r
}\r
\r
@Override\r
\r
@Override\r
public void onComplete() {\r
+ //TODO:CELLTREE\r
+ \r
if(getPostBody() != null && !"".equals(getPostBody().trim())){\r
- DnDTreeItem folderItem = (DnDTreeItem) GSS.get().getFolders().getCurrent();\r
- FolderResource fres = folderItem.getFolderResource();\r
+ \r
+ \r
+ FolderResource fres = ((RestResourceWrapper) GSS.get().getTreeView().getSelection()).getResource();\r
String initialPath = fres.getUri();\r
String newPath = getPostBody().trim();\r
fres.setUri(newPath);\r
-\r
+ ((RestResourceWrapper) GSS.get().getTreeView().getSelection()).getResource().setUri(newPath);\r
+ ((RestResourceWrapper) GSS.get().getTreeView().getSelection()).setUri(newPath);\r
+ GSS.get().getTreeView().updateNodeChildren(fres.getParentURI());\r
+ if (permList.hasChanges()) {\r
+ GSS.get().getTreeView().updateMySharedNode();\r
+ }\r
+ /*\r
if(folderItem.getParentItem() != null && ((DnDTreeItem)folderItem.getParentItem()).getFolderResource() != null){\r
((DnDTreeItem)folderItem.getParentItem()).getFolderResource().removeSubfolderPath(initialPath);\r
((DnDTreeItem)folderItem.getParentItem()).getFolderResource().getSubfolderPaths().add(newPath);\r
- }\r
+ }*/\r
}\r
- GSS.get().getFolders().updateFolder( (DnDTreeItem) GSS.get().getFolders().getCurrent());\r
+ //GSS.get().getFolders().updateFolder( (DnDTreeItem) GSS.get().getFolders().getCurrent());\r
+ \r
GSS.get().showFileList(true);\r
}\r
\r
}\r
else\r
GSS.get().displayError("System error moifying file: "+t.getMessage());\r
- GSS.get().getFolders().updateFolder( (DnDTreeItem) GSS.get().getFolders().getCurrent());\r
+ //TODO:CELLTREE\r
+ //GSS.get().getFolders().updateFolder( (DnDTreeItem) GSS.get().getFolders().getCurrent());\r
}\r
};\r
DeferredCommand.addCommand(ep);\r