X-Git-Url: https://code.grnet.gr/git/pithos/blobdiff_plain/9ab5db6dc5415e74cd4a3314ceba525b2b2c9e34..2390ae8e2972a614a0226903825a0f858f1440e0:/src/gr/ebs/gss/client/FilePropertiesDialog.java diff --git a/src/gr/ebs/gss/client/FilePropertiesDialog.java b/src/gr/ebs/gss/client/FilePropertiesDialog.java index 4b09700..1a47930 100644 --- a/src/gr/ebs/gss/client/FilePropertiesDialog.java +++ b/src/gr/ebs/gss/client/FilePropertiesDialog.java @@ -29,8 +29,12 @@ import java.util.List; import java.util.Set; import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ChangeEvent; +import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.KeyDownEvent; +import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.json.client.JSONArray; import com.google.gwt.json.client.JSONBoolean; @@ -111,8 +115,9 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { setText("File properties"); file = (FileResource) GSS.get().getCurrentSelection(); - permList = new PermissionsList(images, file.getPermissions(), file.getOwner()); userFullName = _userFullName; + permList = new PermissionsList(images, file.getPermissions(), file.getOwner()); + // Outer contains inner and buttons. final VerticalPanel outer = new VerticalPanel(); @@ -131,11 +136,16 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { final HorizontalPanel vPanel2 = new HorizontalPanel(); versioned.setValue(file.isVersioned()); + versioned.getElement().setId("filePropertiesDialog.chechBox.versioned"); inner.add(generalPanel, "General"); inner.add(permPanel, "Sharing"); inner.add(verPanel, "Versions"); inner.selectTab(0); + final Label fileNameNote = new Label("Please note that slashes ('/') are not allowed in file names.", true); + fileNameNote.setVisible(false); + fileNameNote.setStylePrimaryName("gss-readForAllNote"); + final FlexTable generalTable = new FlexTable(); generalTable.setText(0, 0, "Name"); generalTable.setText(1, 0, "Folder"); @@ -144,11 +154,25 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { generalTable.setText(4, 0, "Tags"); name.setWidth("100%"); name.setText(file.getName()); + name.getElement().setId("filePropertiesDialog.textBox.name"); generalTable.setWidget(0, 1, name); + name.addChangeHandler(new ChangeHandler() { + + @Override + public void onChange(ChangeEvent event) { + if(name.getText().contains("/")) + fileNameNote.setVisible(true); + else + fileNameNote.setVisible(false); + + } + }); + if(file.getFolderName() != null) generalTable.setText(1, 1, file.getFolderName()); else generalTable.setText(1, 1, "-"); + generalTable.setWidget(0, 2, fileNameNote); generalTable.setText(2, 1,userFullName); final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a"); @@ -164,6 +188,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { tagsBuffer.delete(tagsBuffer.length() - 2, tagsBuffer.length() - 1); initialTagText = tagsBuffer.toString(); tags.setWidth("100%"); + tags.getElement().setId("filePropertiesDialog.textBox.tags"); tags.setText(initialTagText); generalTable.setWidget(4, 1, tags); generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels"); @@ -183,10 +208,16 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { final Button ok = new Button("OK", new ClickHandler() { @Override public void onClick(ClickEvent event) { - accept(); - closeDialog(); + if(name.getText().contains("/")) + fileNameNote.setVisible(true); + else{ + fileNameNote.setVisible(true); + accept(); + closeDialog(); + } } }); + ok.getElement().setId("filePropertiesDialog.button.ok"); buttons.add(ok); buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER); // Create the 'Cancel' button, along with a listener that hides the @@ -197,6 +228,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { closeDialog(); } }); + cancel.getElement().setId("filePropertiesDialog.button.cancel"); buttons.add(cancel); buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); buttons.setSpacing(8); @@ -227,6 +259,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { dlg.center(); } }); + add.getElement().setId("filePropertiesDialog.button.addGroup"); permButtons.add(add); permButtons.setCellHorizontalAlignment(add, HasHorizontalAlignment.ALIGN_CENTER); @@ -237,6 +270,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { dlg.center(); } }); + add.getElement().setId("filePropertiesDialog.button.addUser"); permButtons.add(addUser); permButtons.setCellHorizontalAlignment(addUser, HasHorizontalAlignment.ALIGN_CENTER); @@ -251,6 +285,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { readForAllNote.setStylePrimaryName("gss-readForAllNote"); readForAll = new CheckBox(); + readForAll.getElement().setId("filePropertiesDialog.checkBox.public"); readForAll.setValue(file.isReadForAll()); readForAll.addClickHandler(new ClickHandler() { @Override @@ -284,6 +319,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { }); path.setText(file.getUri()); + path.getElement().setId("filePropertiesDialog.textBox.link"); path.setTitle("Use this link for sharing the file via e-mail, IM, etc. (crtl-C/cmd-C to copy to system clipboard)"); path.setWidth("100%"); path.setReadOnly(true); @@ -497,10 +533,5 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog { }; DeferredCommand.addCommand(cf); } - private boolean hasOwner(String _userName) { - if (GSS.get().findUserFullName(_userName) == null) - return false; - return true; - } }