fixing 'All tags' display version 2 - add a new css class named 'gss-tag'
[pithos] / src / gr / ebs / gss / client / AbstractPropertiesDialog.java
index df33037..2f00992 100644 (file)
@@ -21,7 +21,6 @@ package gr.ebs.gss.client;
 import gr.ebs.gss.client.rest.GetCommand;\r
 import gr.ebs.gss.client.rest.resource.TagsResource;\r
 \r
-import java.util.Iterator;\r
 import java.util.List;\r
 \r
 import com.google.gwt.core.client.GWT;\r
@@ -31,9 +30,9 @@ import com.google.gwt.event.dom.client.ClickHandler;
 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.Button;\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.HTML;\r
 import com.google.gwt.user.client.ui.TabPanel;\r
 import com.google.gwt.user.client.ui.TextBox;\r
 \r
@@ -73,7 +72,6 @@ public abstract class AbstractPropertiesDialog extends DialogBox {
                setAnimationEnabled(true);\r
 \r
        }\r
-\r
        /**\r
         * Retrieves all user tags from the server and updates the FlowPanel\r
         *\r
@@ -87,22 +85,26 @@ public abstract class AbstractPropertiesDialog extends DialogBox {
                                allTagsContent.clear();\r
                                TagsResource tagr = getResult();\r
                                List<String> userTags = tagr.getTags();\r
-                               Iterator t = userTags.iterator();\r
-                               while (t.hasNext()) {\r
-                                       final Button tag = new Button((String) t.next(), new ClickHandler() {\r
-\r
+                               HTML tag = null;\r
+                               for(String usrTag : userTags){\r
+                                       tag = new HTML(usrTag.toString()+"&nbsp", true);\r
+                                       tag.addStyleName("gss-tag");\r
+                                       allTagsContent.add(tag);\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 = ((Button) event.getSource()).getText().trim();\r
+                                                       String newTag = ((HTML) 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() + (existing.length() > 0 ? ", " : "") + newTag);\r
+                                                       if (existing.indexOf(newTag) == -1 && !existing.trim().endsWith(newTag))\r
+                                                               tags.setText(existing.trim()\r
+                                                                                       + (existing.length() > 0 ? ", " : "")\r
+                                                                                       + newTag);\r
                                                }\r
                                        });\r
-                                       allTagsContent.add(tag);\r
                                }\r
                        }\r
 \r