Package org.waveprotocol.wave.client.common.util

Examples of org.waveprotocol.wave.client.common.util.KeyCombo


  }

  /** Ensure correct action after a combination is registered. */

  public void testAddKeyCombo() {
    KeyCombo combo = KeyCombo.CTRL_A;
    EditorActionTracker action = new EditorActionTracker();

    KeyBindingRegistry registry = new KeyBindingRegistry();
    registry.registerAction(combo, action);

View Full Code Here


  }

  /** Ensure that getting an unknown combination produces null actions. */

  public void testUnknownComboAndRemove() {
    KeyCombo combo = KeyCombo.CTRL_ENTER;
    KeyBindingRegistry registry = new KeyBindingRegistry();

    assertFalse(registry.hasAction(combo));
    assertFalse(registry.getBoundKeyCombos().contains(combo));
    assertNull(registry.getAction(combo));
View Full Code Here

  }

  /** Ensure that reassigning a combination means that new calls are to the new action. */

  public void testReregisterOverwrites() {
    KeyCombo combo = KeyCombo.BACKSPACE;
    KeyBindingRegistry registry = new KeyBindingRegistry();

    EditorActionTracker action1 = new EditorActionTracker();
    EditorActionTracker action2 = new EditorActionTracker();

View Full Code Here

    action2.assertExecuteCount(1);
  }

  /** Make sure that clearing combos actually deregisters them. */
  public void testClearRegistry() {
    KeyCombo combo = KeyCombo.BACKSPACE;
    KeyBindingRegistry registry = new KeyBindingRegistry();
    EditorActionTracker action = new EditorActionTracker();

    registry.registerAction(combo, action);
    assertTrue(registry.hasAction(combo));
View Full Code Here

    @Override
    public boolean handleRangeKeyCombo(EditorEvent event, ContentRange selection) {
      assert !selection.isCollapsed();

      KeyCombo combo = EventWrapper.getKeyCombo(event.asEvent());

      // TODO(patcoleman): separate collapsed and normal, maybe also incorporate handled flag.
      if (keyBindings.hasAction(combo)) {
        keyBindings.getAction(combo).execute(EditorImpl.this);
        return true;
View Full Code Here

    @Override
    public boolean handleCollapsedKeyCombo(EditorEvent event, Point<ContentNode> caret) {
      // Handle events with carets
      // TODO(user): handle lots more events here
      KeyCombo combo = EventWrapper.getKeyCombo(event.asEvent());

      // TODO(patcoleman): separate collapsed and normal, maybe also incorporate handled flag.
      if (keyBindings.hasAction(combo)) {
        keyBindings.getAction(combo).execute(EditorImpl.this);
        return true;
View Full Code Here

        editorUndoManager.redo();

        return true;
      }

      KeyCombo combo = new EventWrapper(event.asEvent()).getKeyCombo();
      switch (combo) {
        // TODO(user): deprecate CTRL_ALT_D in favour of CTRL_ALT_G, ctrl alt d
        // is a bad combo for linux as it minimizes the window in many
        // window managers.
        case CTRL_ALT_D:
View Full Code Here

   *
   * @return true if it is safe to ignore, or false which will result in further
   *         handling.
   */
  private boolean isWhiteListedCombo(SignalEvent signal) {
    KeyCombo keyCombo = EventWrapper.getKeyCombo(signal);
    switch (keyCombo) {
      // Edit actions:
      // Allow cut/copy/paste combos and handle the actual clipboard events
      // later.
      case ORDER_C: // copy
View Full Code Here

    return false;
  }

  private boolean isBlackListedCombo(SignalEvent event) {
    KeyCombo keyCombo = EventWrapper.getKeyCombo(event);
    switch (keyCombo) {
      // Disallow undo
      case ORDER_Z:
        return true;
    }
View Full Code Here

    endSession();
  }

  @Override
  public boolean onKeySignal(Widget sender, SignalEvent signal) {
    KeyCombo key = EventWrapper.getKeyCombo(signal);
    switch (key) {
      case SHIFT_ENTER:
        endSession();
        return true;
      case ESC:
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.client.common.util.KeyCombo

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.