For anybody trying to do something similar, my working code (using
event.preventDefault, and using DeferredCommand did the trick):

  //
  // Preview events-- look for shift-clicks on paper/author links, and
pops up
  // edit dialog boxes:
  //
  public void onPreviewNativeEvent(Event.NativePreviewEvent pe) {
    NativeEvent e = pe.getNativeEvent();
    if (Event.getTypeInt(e.getType())  != Event.ONCLICK) { return; }
    if (!e.getShiftKey()) { return; }

    EventTarget target  = e.getEventTarget();
    if (!Element.is(target)) { return; }
    Element elt = Element.as(target);
    String href = elt.getAttribute("href");
    if (href == null || href.length() == 0){ return; }

    if (href.contains("/paper/")) {
      e.preventDefault();
      final String paperPID = InterfaceUtils.getPIDFromLinkString
(href, "paper/");
      DeferredCommand.addCommand(new Command() {
        public void execute() { fetchPaperInfoThenEdit(paperPID); }
      });

    }
    else if (href.contains("/author/")) {
      e.preventDefault();
      final String authorPID = InterfaceUtils.getPIDFromLinkString
(href, "author/");
      Map<String,String> params = InterfaceUtils.parseURLParams(href);
      final String fromPaperPID = params.get("fromPaper");
      DeferredCommand.addCommand(new Command() {
        public void execute() { fetchAuthorInfoThenEdit(authorPID,
fromPaperPID); }
      });
    }
  }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to