Examples of Keys


Examples of org.zanata.webtrans.client.keys.Keys

                keyShortcutCaptor.capture());
        List<KeyShortcut> shortcuts = keyShortcutCaptor.getAllValues();

        // test keys
        KeyShortcut prevKey = shortcuts.get(0);
        assertThat(prevKey.getAllKeys(), Matchers.equalTo(Keys.setOf(new Keys(
                Keys.ALT_KEY, KeyCodes.KEY_UP), new Keys(Keys.ALT_KEY, 'J'))));
        assertThat(prevKey.getDescription(), Matchers.equalTo("previous row"));
        assertThat(prevKey.getContext(),
                Matchers.equalTo(ShortcutContext.Navigation));
        assertThat(prevKey.getKeyEvent(),
                Matchers.equalTo(KeyShortcut.KeyEvent.KEY_DOWN));

        KeyShortcut nextKey = shortcuts.get(1);
        assertThat(nextKey.getAllKeys(), Matchers.equalTo(Keys.setOf(new Keys(
                Keys.ALT_KEY, KeyCodes.KEY_DOWN), new Keys(Keys.ALT_KEY, 'K'))));
        assertThat(nextKey.getDescription(), Matchers.equalTo("next row"));
        assertThat(nextKey.getContext(),
                Matchers.equalTo(ShortcutContext.Navigation));
        assertThat(nextKey.getKeyEvent(),
                Matchers.equalTo(KeyShortcut.KeyEvent.KEY_DOWN));

        KeyShortcut enterKey = shortcuts.get(2);
        assertThat(enterKey.getAllKeys(), Matchers.contains(new Keys(
                Keys.NO_MODIFIER, KeyCodes.KEY_ENTER)));
        assertThat(enterKey.getDescription(), Matchers.equalTo("open editor"));
        assertThat(enterKey.getContext(),
                Matchers.equalTo(ShortcutContext.Navigation));
        assertThat(enterKey.getKeyEvent(),
View Full Code Here

Examples of org.zanata.webtrans.client.keys.Keys

        spyPresenter.onBind();

        verify(keyShortcutPresenter).register(keyShortcutCaptor.capture());
        KeyShortcut keyShortcut = keyShortcutCaptor.getValue();
        assertThat(keyShortcut.getAllKeys(),
                Matchers.containsInAnyOrder(new Keys(Keys.NO_MODIFIER,
                        KeyCodes.KEY_ENTER)));
        assertThat(keyShortcut.getContext(),
                Matchers.equalTo(ShortcutContext.Glossary));
        assertThat(keyShortcut.getDescription(),
                Matchers.equalTo("search glossary"));
View Full Code Here

Examples of pl.edu.pw.elka.mmarkiew.controller.queueevents.ViewKeyPress.Keys

    final boolean xVelocity = (player.getXVelocity() != 0);
    final boolean yVelocity = (player.getYVelocity() != 0);
   
    if (event instanceof ViewKeyPress)
    {
      final Keys code = ((ViewKeyPress) event).getKey();
      final boolean pressed = ((ViewKeyPress) event).isPress();
     
      switch (code)
      {        //set velocity only if it's needed to set it, and reset it the same
        case UP:  if (pressed && !yVelocity)
              {
                player.setYVelocity(-player.getMaxVelocity());
              }
              else if (!pressed && yVelocity)
              {
                player.setYVelocity(0);
              }
              break;
        case DOWN:  if (pressed && !yVelocity)
              {
                player.setYVelocity(player.getMaxVelocity());
              }
              else if (!pressed && yVelocity)
              {
                player.setYVelocity(0);
              }
              break;
        case LEFT:  if (pressed && !xVelocity)
              {
                player.setXVelocity(-player.getMaxVelocity());
              }
              else if (!pressed && xVelocity)
              {
                player.setXVelocity(0);
              }
              break;
        case RIGHT:  if (pressed && !xVelocity)
              {
                player.setXVelocity(player.getMaxVelocity());
              }
              else if (!pressed && xVelocity)
              {
                player.setXVelocity(0);
              }
              break;
        case PLANT:  if (pressed)
              {
                model.plantBomb();
              }
              break;
        case TIMER_1:
        case TIMER_2:
        case TIMER_3:  if (pressed)
                {
                  // depends on the number of timer enum, sets appropriate number of seconds
                  player.setBombTimer( (code.ordinal() - Keys.TIMER_1.ordinal() + 1) * 1000 );
                }
                break;
        case PAUSE:  if (pressed)
              {
                model.switchPause();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.