X-Git-Url: https://code.grnet.gr/git/pithos/blobdiff_plain/54834916bcc42ffa2bbcf248a7227b607bf8b733..06b485635358b64000d78d92a238724250809175:/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 d40b14a..df33037 100644 --- a/src/gr/ebs/gss/client/AbstractPropertiesDialog.java +++ b/src/gr/ebs/gss/client/AbstractPropertiesDialog.java @@ -25,15 +25,17 @@ import java.util.Iterator; import java.util.List; import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.NativeEvent; +import com.google.gwt.event.dom.client.ClickEvent; +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.ClickListener; import com.google.gwt.user.client.ui.DialogBox; import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.KeyboardListener; import com.google.gwt.user.client.ui.TabPanel; import com.google.gwt.user.client.ui.TextBox; -import com.google.gwt.user.client.ui.Widget; /** * Abstract class, parent of all 'File properties' dialog boxes. @@ -78,7 +80,7 @@ public abstract class AbstractPropertiesDialog extends DialogBox { * @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() { @@ -87,12 +89,13 @@ public abstract class AbstractPropertiesDialog extends DialogBox { List userTags = tagr.getTags(); Iterator t = userTags.iterator(); while (t.hasNext()) { - final Button tag = new Button((String) t.next(), new ClickListener() { + final Button tag = new Button((String) t.next(), new ClickHandler() { - public void onClick(Widget sender) { + @Override + public void onClick(ClickEvent event) { String existing = tags.getText(); if (MULTIPLE_VALUES_TEXT.equals(existing)) existing = ""; - String newTag = ((Button) sender).getText().trim(); + String newTag = ((Button) 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)) @@ -121,19 +124,22 @@ public abstract class AbstractPropertiesDialog extends DialogBox { @Override @SuppressWarnings("fallthrough") - public boolean onKeyDownPreview(char key, int modifiers) { - // Use the popup's key preview hooks to close the dialog when either - // enter or escape is pressed. - switch (key) { - case KeyboardListener.KEY_ENTER: - accept(); - case KeyboardListener.KEY_ESCAPE: - closeDialog(); - break; - } - - return true; - } + protected void onPreviewNativeEvent(NativePreviewEvent preview) { + super.onPreviewNativeEvent(preview); + + NativeEvent evt = preview.getNativeEvent(); + if (evt.getType().equals("keydown")) + // Use the popup's key preview hooks to close the dialog when either + // enter or escape is pressed. + switch (evt.getKeyCode()) { + case KeyCodes.KEY_ENTER: + accept(); + case KeyCodes.KEY_ESCAPE: + closeDialog(); + break; + } + } + public void selectTab(int _tab) {