Revision 0fc071d9 src/gr/ebs/gss/client/AbstractPropertiesDialog.java
b/src/gr/ebs/gss/client/AbstractPropertiesDialog.java | ||
---|---|---|
31 | 31 |
import com.google.gwt.event.dom.client.KeyCodes; |
32 | 32 |
import com.google.gwt.user.client.DeferredCommand; |
33 | 33 |
import com.google.gwt.user.client.Event.NativePreviewEvent; |
34 |
import com.google.gwt.user.client.ui.Button;
|
|
34 |
import com.google.gwt.user.client.ui.Anchor;
|
|
35 | 35 |
import com.google.gwt.user.client.ui.DialogBox; |
36 | 36 |
import com.google.gwt.user.client.ui.FlowPanel; |
37 | 37 |
import com.google.gwt.user.client.ui.TabPanel; |
... | ... | |
73 | 73 |
setAnimationEnabled(true); |
74 | 74 |
|
75 | 75 |
} |
76 |
|
|
77 | 76 |
/** |
78 | 77 |
* Retrieves all user tags from the server and updates the FlowPanel |
79 | 78 |
* |
... | ... | |
89 | 88 |
List<String> userTags = tagr.getTags(); |
90 | 89 |
Iterator t = userTags.iterator(); |
91 | 90 |
while (t.hasNext()) { |
92 |
final Button tag = new Button((String) t.next(), new ClickHandler() { |
|
91 |
final Anchor tag = new Anchor ((String) t.next() +" "); |
|
92 |
allTagsContent.add(tag); |
|
93 |
tag.addClickHandler( new ClickHandler() { |
|
93 | 94 |
|
94 | 95 |
@Override |
95 | 96 |
public void onClick(ClickEvent event) { |
96 | 97 |
String existing = tags.getText(); |
97 | 98 |
if (MULTIPLE_VALUES_TEXT.equals(existing)) existing = ""; |
98 |
String newTag = ((Button) event.getSource()).getText().trim();
|
|
99 |
String newTag = ((Anchor) event.getSource()).getText().trim();
|
|
99 | 100 |
// insert the new tag only if it is not in the list |
100 | 101 |
// already |
101 |
if (existing.indexOf(newTag + ",") == -1 && !existing.trim().endsWith(newTag)) |
|
102 |
tags.setText(existing.trim() + (existing.length() > 0 ? ", " : "") + newTag); |
|
102 |
if (existing.indexOf(newTag) == -1 && !existing.trim().endsWith(newTag)) |
|
103 |
tags.setText(existing.trim() |
|
104 |
+ (existing.length() > 0 ? ", " : "") |
|
105 |
+ newTag); |
|
103 | 106 |
} |
104 | 107 |
}); |
105 |
allTagsContent.add(tag); |
|
106 | 108 |
} |
107 | 109 |
} |
108 | 110 |
|
Also available in: Unified diff