Fix of Revision: ec7b8d0b2c after code review. Added a check condition before remov...
[pithos] / src / gr / ebs / gss / client / FilePropertiesDialog.java
index edd6191..ea09bc4 100644 (file)
@@ -1,5 +1,5 @@
 /*\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
@@ -31,6 +31,8 @@ import java.util.Set;
 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.KeyDownEvent;\r
+import com.google.gwt.event.dom.client.KeyDownHandler;\r
 import com.google.gwt.i18n.client.DateTimeFormat;\r
 import com.google.gwt.json.client.JSONArray;\r
 import com.google.gwt.json.client.JSONBoolean;\r
@@ -96,6 +98,8 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog {
 \r
        final FileResource file;\r
 \r
+       private String userFullName;\r
+\r
        /**\r
         * The widget's constructor.\r
         *\r
@@ -103,14 +107,16 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog {
         * @param groups\r
         * @param bodies\r
         */\r
-       public FilePropertiesDialog(final Images images, final List<GroupResource> groups, List<FileResource> bodies) {\r
+       public FilePropertiesDialog(final Images images, final List<GroupResource> groups, List<FileResource> bodies, String _userFullName) {\r
 \r
                // Set the dialog's caption.\r
                setText("File properties");\r
 \r
                file = (FileResource) GSS.get().getCurrentSelection();\r
+               userFullName = _userFullName;\r
                permList = new PermissionsList(images, file.getPermissions(), file.getOwner());\r
 \r
+\r
                // Outer contains inner and buttons.\r
                final VerticalPanel outer = new VerticalPanel();\r
                final FocusPanel focusPanel = new FocusPanel(outer);\r
@@ -133,19 +139,35 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog {
                inner.add(verPanel, "Versions");\r
                inner.selectTab(0);\r
 \r
+               final Label fileNameNote = new Label("Please note that slashes ('/') are not allowed in file names.", true);\r
+               fileNameNote.setVisible(false);\r
+               fileNameNote.setStylePrimaryName("gss-readForAllNote");\r
+\r
                final FlexTable generalTable = new FlexTable();\r
                generalTable.setText(0, 0, "Name");\r
                generalTable.setText(1, 0, "Folder");\r
                generalTable.setText(2, 0, "Owner");\r
                generalTable.setText(3, 0, "Last modified");\r
                generalTable.setText(4, 0, "Tags");\r
+               name.setWidth("100%");\r
                name.setText(file.getName());\r
                generalTable.setWidget(0, 1, name);\r
+               name.addKeyDownHandler(new KeyDownHandler() {\r
+\r
+                       @Override\r
+                       public void onKeyDown(KeyDownEvent event) {\r
+                               fileNameNote.setVisible(true);\r
+\r
+                       }\r
+               });\r
+\r
                if(file.getFolderName() != null)\r
                        generalTable.setText(1, 1, file.getFolderName());\r
                else\r
                        generalTable.setText(1, 1, "-");\r
-               generalTable.setText(2, 1, file.getOwner());\r
+               generalTable.setWidget(0, 2, fileNameNote);\r
+               generalTable.setText(2, 1,userFullName);\r
+\r
                final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a");\r
                generalTable.setText(3, 1, formatter.format(file.getModificationDate()));\r
                // Get the tags.\r
@@ -158,6 +180,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog {
                if (tagsBuffer.length() > 1)\r
                        tagsBuffer.delete(tagsBuffer.length() - 2, tagsBuffer.length() - 1);\r
                initialTagText = tagsBuffer.toString();\r
+               tags.setWidth("100%");\r
                tags.setText(initialTagText);\r
                generalTable.setWidget(4, 1, tags);\r
                generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels");\r
@@ -209,6 +232,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog {
 \r
                DisclosurePanel allTags = new DisclosurePanel("All tags");\r
                allTagsContent = new FlowPanel();\r
+               allTagsContent.setWidth("100%");\r
                allTags.setContent(allTagsContent);\r
                generalPanel.add(allTags);\r
                generalPanel.setSpacing(4);\r
@@ -257,7 +281,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog {
                permPanel.add(permButtons);\r
                // Only show the read for all permission if the user is the owner.\r
                if (file.getOwner().equals(GSS.get().getCurrentUserResource().getUsername())) {\r
-                       permForAll.add(new Label("Make Public"));\r
+                       permForAll.add(new Label("Public"));\r
                        permForAll.add(readForAll);\r
                        permForAll.setSpacing(8);\r
                        permForAll.addStyleName("gss-TabPanelBottom");\r
@@ -491,5 +515,4 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog {
                DeferredCommand.addCommand(cf);\r
        }\r
 \r
-\r
 }\r