Fixed various warnings
[pithos-web-client] / src / gr / grnet / pithos / web / client / AbstractPropertiesDialog.java
index b63350a..82237d4 100644 (file)
  */\r
 package gr.grnet.pithos.web.client;\r
 \r
-import gr.grnet.pithos.web.client.rest.GetCommand;\r
-import gr.grnet.pithos.web.client.rest.resource.TagsResource;\r
-\r
-import java.util.List;\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.ClickEvent;\r
-import com.google.gwt.event.dom.client.ClickHandler;\r
 import com.google.gwt.event.dom.client.KeyCodes;\r
-import com.google.gwt.user.client.DeferredCommand;\r
 import com.google.gwt.user.client.Event.NativePreviewEvent;\r
-import com.google.gwt.user.client.ui.Anchor;\r
 import com.google.gwt.user.client.ui.DialogBox;\r
-import com.google.gwt.user.client.ui.FlowPanel;\r
-import com.google.gwt.user.client.ui.Label;\r
-import com.google.gwt.user.client.ui.TabPanel;\r
-import com.google.gwt.user.client.ui.TextBox;\r
+import com.google.gwt.user.client.ui.VerticalPanel;\r
 \r
 /**\r
  * Abstract class, parent of all 'File properties' dialog boxes.\r
@@ -61,79 +48,22 @@ public abstract class AbstractPropertiesDialog extends DialogBox {
 \r
        protected static final String MULTIPLE_VALUES_TEXT = "(Multiple values)";\r
 \r
-       /**\r
-        * Text box with the tags associated with the file\r
-        */\r
-       protected TextBox tags = new TextBox();\r
+       protected VerticalPanel inner = null;\r
 \r
-       protected String initialTagText;\r
-\r
-       /**\r
-        * A FlowPanel with all user tags\r
-        */\r
-       protected FlowPanel allTagsContent;\r
-\r
-\r
-       protected TabPanel inner = null;\r
+    protected Pithos app;\r
 \r
        /**\r
         * The widget's constructor.\r
         *\r
         */\r
-       public AbstractPropertiesDialog() {\r
-\r
+       public AbstractPropertiesDialog(Pithos _app) {\r
+        app = _app;\r
                // Enable IE selection for the dialog (must disable it upon closing it)\r
                Pithos.enableIESelection();\r
 \r
                setAnimationEnabled(true);\r
 \r
        }\r
-       /**\r
-        * Retrieves all user tags from the server and updates the FlowPanel\r
-        */\r
-       protected void updateTags() {\r
-               GetCommand<TagsResource> tc = new GetCommand<TagsResource>(TagsResource.class, Pithos.get().getCurrentUserResource().getTagsPath(),null) {\r
-\r
-                       @Override\r
-                       public void onComplete() {\r
-                               allTagsContent.clear();\r
-                               TagsResource tagr = getResult();\r
-                               List<String> userTags = tagr.getTags();\r
-                               Anchor tag = null;\r
-                               for(String usrTag : userTags){\r
-                                       tag = new Anchor(usrTag.toString(), false);\r
-                                       tag.addStyleName("pithos-tag");\r
-                                       allTagsContent.add(tag);\r
-                                       Label separator = new Label(", ");\r
-                                       separator.addStyleName("pithos-tag");\r
-                                       allTagsContent.add(separator);\r
-                                       tag.addClickHandler( new ClickHandler() {\r
-\r
-                                               @Override\r
-                                               public void onClick(ClickEvent event) {\r
-                                                       String existing = tags.getText();\r
-                                                       if (MULTIPLE_VALUES_TEXT.equals(existing)) existing = "";\r
-                                                       String newTag = ((Anchor) event.getSource()).getText().trim();\r
-                                                       // insert the new tag only if it is not in the list\r
-                                                       // already\r
-                                                       if (existing.indexOf(newTag) == -1 && !existing.trim().endsWith(newTag))\r
-                                                               tags.setText(existing.trim()\r
-                                                                                       + (existing.length() > 0 ? ", " : "")\r
-                                                                                       + newTag);\r
-                                               }\r
-                                       });\r
-                               }\r
-                       }\r
-\r
-                       @Override\r
-                       public void onError(Throwable t) {\r
-                               GWT.log("", t);\r
-                               Pithos.get().displayError("Unable to fetch user tags");\r
-                       }\r
-               };\r
-               DeferredCommand.addCommand(tc);\r
-\r
-       }\r
 \r
        /**\r
         * Accepts any change and updates the file\r
@@ -142,7 +72,6 @@ public abstract class AbstractPropertiesDialog extends DialogBox {
        protected abstract void accept();\r
 \r
        @Override\r
-       @SuppressWarnings("fallthrough")\r
        protected void onPreviewNativeEvent(NativePreviewEvent preview) {\r
            super.onPreviewNativeEvent(preview);\r
 \r
@@ -153,19 +82,13 @@ public abstract class AbstractPropertiesDialog extends DialogBox {
                          switch (evt.getKeyCode()) {\r
                            case KeyCodes.KEY_ENTER:\r
                                accept();\r
-                           case KeyCodes.KEY_ESCAPE:\r
-                             closeDialog();\r
-                             break;\r
+                           //$FALL-THROUGH$\r
+                       case KeyCodes.KEY_ESCAPE:\r
+                               closeDialog();\r
+                               break;\r
                          }\r
          }\r
 \r
-\r
-\r
-       public void selectTab(int _tab) {\r
-               inner.selectTab(_tab);\r
-       }\r
-\r
-\r
        /**\r
         * Enables IE selection prevention and hides the dialog\r
         * (we disable the prevention on creation of the dialog)\r