Package com.google.gwtexpui.globalkey.client

Examples of com.google.gwtexpui.globalkey.client.KeyCommand


class JumpKeys {
  static void register(final Widget body) {
    final KeyCommandSet jumps = new KeyCommandSet();

    jumps.add(new KeyCommand(0, 'o', Gerrit.C.jumpAllOpen()) {
      @Override
      public void onKeyPress(final KeyPressEvent event) {
        Gerrit.display(PageLinks.toChangeQuery("status:open"));
      }
    });
    jumps.add(new KeyCommand(0, 'm', Gerrit.C.jumpAllMerged()) {
      @Override
      public void onKeyPress(final KeyPressEvent event) {
        Gerrit.display(PageLinks.toChangeQuery("status:merged"));
      }
    });
    jumps.add(new KeyCommand(0, 'a', Gerrit.C.jumpAllAbandoned()) {
      @Override
      public void onKeyPress(final KeyPressEvent event) {
        Gerrit.display(PageLinks.toChangeQuery("status:abandoned"));
      }
    });

    if (Gerrit.isSignedIn()) {
      jumps.add(new KeyCommand(0, 'i', Gerrit.C.jumpMine()) {
        @Override
        public void onKeyPress(final KeyPressEvent event) {
          Gerrit.display(PageLinks.MINE);
        }
      });
      jumps.add(new KeyCommand(0, 'd', Gerrit.C.jumpMineDrafts()) {
        @Override
        public void onKeyPress(final KeyPressEvent event) {
          Gerrit.display(PageLinks.toChangeQuery("is:draft"));
        }
      });
      jumps.add(new KeyCommand(0, 'c', Gerrit.C.jumpMineDraftComments()) {
        @Override
        public void onKeyPress(final KeyPressEvent event) {
          Gerrit.display(PageLinks.toChangeQuery("has:draft"));
        }
      });
      jumps.add(new KeyCommand(0, 'w', Gerrit.C.jumpMineWatched()) {
        @Override
        public void onKeyPress(final KeyPressEvent event) {
          Gerrit.display(PageLinks.toChangeQuery("is:watched status:open"));
        }
      });
      jumps.add(new KeyCommand(0, 's', Gerrit.C.jumpMineStarred()) {
        @Override
        public void onKeyPress(final KeyPressEvent event) {
          Gerrit.display(PageLinks.toChangeQuery("is:starred"));
        }
      });
View Full Code Here


  @Override
  protected void onLoad() {
    super.onLoad();
    if (regFocus == null) {
      regFocus =
          GlobalKey.addApplication(this, new KeyCommand(0, '/', Gerrit.C
              .keySearch()) {
            @Override
            public void onKeyPress(final KeyPressEvent event) {
              event.preventDefault();
              searchBox.setFocus(true);
View Full Code Here

      if (cmds[nav.cmd] != null) {
        keys.remove(cmds[nav.cmd]);
      }

      if (link != null) {
        cmds[nav.cmd] = new KeyCommand(0, nav.key, nav.help) {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            link.go();
          }
        };
View Full Code Here

    return Gerrit.isSignedIn() ? new Icon(source, starred) : null;
  }

  /** Make a key command that toggles the star for a change. */
  public static KeyCommand newKeyCommand(final Icon icon) {
    return new KeyCommand(0, 's', Util.C.changeTableStar()) {
      @Override
      public void onKeyPress(KeyPressEvent event) {
        icon.toggleStar();
      }
    };
View Full Code Here

TOP

Related Classes of com.google.gwtexpui.globalkey.client.KeyCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.