X-Git-Url: https://code.grnet.gr/git/pithos/blobdiff_plain/afd3a0ef323903ab769574e0871fc55e87df609f..ce98bfc619a13df1884b185f3c9eb066f7738c8f:/src/gr/ebs/gss/client/AbstractPropertiesDialog.java diff --git a/src/gr/ebs/gss/client/AbstractPropertiesDialog.java b/src/gr/ebs/gss/client/AbstractPropertiesDialog.java index 6316b91..2f00992 100644 --- a/src/gr/ebs/gss/client/AbstractPropertiesDialog.java +++ b/src/gr/ebs/gss/client/AbstractPropertiesDialog.java @@ -21,7 +21,6 @@ package gr.ebs.gss.client; import gr.ebs.gss.client.rest.GetCommand; import gr.ebs.gss.client.rest.resource.TagsResource; -import java.util.Iterator; import java.util.List; import com.google.gwt.core.client.GWT; @@ -31,9 +30,9 @@ import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.user.client.DeferredCommand; import com.google.gwt.user.client.Event.NativePreviewEvent; -import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.DialogBox; import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.TabPanel; import com.google.gwt.user.client.ui.TextBox; @@ -73,36 +72,39 @@ public abstract class AbstractPropertiesDialog extends DialogBox { setAnimationEnabled(true); } - /** * Retrieves all user tags from the server and updates the FlowPanel * * @param userId */ protected void updateTags() { - GetCommand tc = new GetCommand(TagsResource.class, GSS.get().getCurrentUserResource().getTagsPath()) { + GetCommand tc = new GetCommand(TagsResource.class, GSS.get().getCurrentUserResource().getTagsPath(),null) { @Override public void onComplete() { allTagsContent.clear(); TagsResource tagr = getResult(); List userTags = tagr.getTags(); - Iterator t = userTags.iterator(); - while (t.hasNext()) { - final Button tag = new Button((String) t.next(), new ClickHandler() { - + HTML tag = null; + for(String usrTag : userTags){ + tag = new HTML(usrTag.toString()+" ", true); + tag.addStyleName("gss-tag"); + allTagsContent.add(tag); + tag.addClickHandler( new ClickHandler() { + @Override public void onClick(ClickEvent event) { String existing = tags.getText(); if (MULTIPLE_VALUES_TEXT.equals(existing)) existing = ""; - String newTag = ((Button) event.getSource()).getText().trim(); + String newTag = ((HTML) event.getSource()).getText().trim(); // insert the new tag only if it is not in the list // already - if (existing.indexOf(newTag + ",") == -1 && !existing.trim().endsWith(newTag)) - tags.setText(existing.trim() + (existing.length() > 0 ? ", " : "") + newTag); + if (existing.indexOf(newTag) == -1 && !existing.trim().endsWith(newTag)) + tags.setText(existing.trim() + + (existing.length() > 0 ? ", " : "") + + newTag); } }); - allTagsContent.add(tag); } }