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.ui.Button;\r
-import com.google.gwt.user.client.ui.ClickListener;\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.KeyboardListener;\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.Widget;\r
\r
/**\r
* Abstract class, parent of all 'File properties' dialog boxes.\r
setAnimationEnabled(true);\r
\r
}\r
-\r
/**\r
* Retrieves all user tags from the server and updates the FlowPanel\r
*\r
* @param userId\r
*/\r
protected void updateTags() {\r
- GetCommand<TagsResource> tc = new GetCommand<TagsResource>(TagsResource.class, GSS.get().getCurrentUserResource().getTagsPath()) {\r
+ GetCommand<TagsResource> tc = new GetCommand<TagsResource>(TagsResource.class, GSS.get().getCurrentUserResource().getTagsPath(),null) {\r
\r
@Override\r
public void onComplete() {\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 ClickListener() {\r
+ final Anchor tag = new Anchor ((String) t.next() +" ");\r
+ allTagsContent.add(tag);\r
+ tag.addClickHandler( new ClickHandler() {\r
\r
- public void onClick(Widget sender) {\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) sender).getText().trim();\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() + (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
\r
@Override\r
@SuppressWarnings("fallthrough")\r
- public boolean onKeyDownPreview(char key, int modifiers) {\r
- // Use the popup's key preview hooks to close the dialog when either\r
- // enter or escape is pressed.\r
- switch (key) {\r
- case KeyboardListener.KEY_ENTER:\r
- accept();\r
- case KeyboardListener.KEY_ESCAPE:\r
- closeDialog();\r
- break;\r
- }\r
-\r
- return true;\r
- }\r
+ protected void onPreviewNativeEvent(NativePreviewEvent preview) {\r
+ super.onPreviewNativeEvent(preview);\r
+\r
+ NativeEvent evt = preview.getNativeEvent();\r
+ if (evt.getType().equals("keydown"))\r
+ // Use the popup's key preview hooks to close the dialog when either\r
+ // enter or escape is pressed.\r
+ switch (evt.getKeyCode()) {\r
+ case KeyCodes.KEY_ENTER:\r
+ accept();\r
+ case KeyCodes.KEY_ESCAPE:\r
+ closeDialog();\r
+ break;\r
+ }\r
+ }\r
+\r
\r
\r
public void selectTab(int _tab) {\r