@Override
  public final void onKeyUp(KeyUpEvent event) {
    if (event.getNativeKeyCode() != KeyCodes.KEY_TAB) {
      updateValue(event.getSource());

      validate();

      if (getState() != State.Initial) {
        setState(validate() ? State.Valid : State.Invalid);
      }
    }
  }
 @Override
 public void onKeyUp(KeyUpEvent event) {
   if (event.getSource().equals(txtBuscar.textBox)) {
     grid.getDataProvider().setFilter(txtBuscar.getText());
     grid.getDataProvider().refresh();
   } else if (event.getSource().equals(grid)) {
     if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER
         || event.getNativeEvent().getKeyCode() == KeyCodes.KEY_SPACE) {
       itemSelected();
     }
   }
 }
  @Override
  public void onKeyUp(KeyUpEvent event) {
    switch (event.getNativeEvent().getKeyCode()) {
      case 38: /*up*/
      case 87: /*W*/
        this.moveForward = false;
        break;

      case 37: /*left*/
      case 65: /*A*/
        this.moveLeft = false;
        break;

      case 40: /*down*/
      case 83: /*S*/
        this.moveBackward = false;
        break;

      case 39: /*right*/
      case 68: /*D*/
        this.moveRight = false;
        break;

      case 82: /*R*/
        this.moveUp = false;
        break;
      case 70: /*F*/
        this.moveDown = false;
        break;
    }
  }
 @UiHandler("projectDescription")
 void onProjectDescriptionChanged(KeyUpEvent event) {
   if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
     return;
   }
   delegate.projectDescriptionChanged(projectDescription.getValue());
 }
 public void onKeyUp(KeyUpEvent e) {
   // stopping propagation may be needed in strange browsers
   // this also makes sure no top-level action is done on keyUp
   // but the default action of the event should have already been
   // expired
   e.stopPropagation();
 }
 @UiHandler({"fuf0", "fuf1", "fuf2", "fuf3", "fuf4"})
 void onFormKeyUp(KeyUpEvent event) {
   if ((event.getNativeKeyCode() == KeyCodes.KEY_BACKSPACE)
       || (event.getNativeKeyCode() == KeyCodes.KEY_DELETE)) {
     TextField tf = (TextField) event.getSource();
     for (IPCFileUploadField fuf : fufList) {
       String value = fuf.getValue();
       String currentValue = tf.getCurrentValue();
       if (value.equalsIgnoreCase(currentValue)) {
         fuf.clear();
         fuf.validate(true);
         break;
       }
     }
   }
 }
 @Override
 public void onKeyUp(KeyUpEvent event) {
   TextBox textBox = (TextBox) event.getSource();
   String input = textBox.getText();
   if (!input.matches("[0-9]*")) {
     textBox.setText("");
   }
 }
Exemple #8
0
 @UiHandler("filter")
 public void onFilterSelected(KeyUpEvent event) {
   if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER
       || filter.getTextBox().getText().isEmpty()) {
     // variables list has changed so update all
     getUiHandlers().filterVariables(filter.getTextBox().getText());
   }
 }
 @Override
 public void onKeyUp(KeyUpEvent event) {
   ignoreNextKeyPress = false;
   cancelNextKeyPress = false;
   Event nativeEvent = (Event) event.getNativeEvent();
   if (!nativeEvent.isCancelled()) {
     handleKeyRelease(nativeEvent);
   }
 }
Exemple #10
0
    @Override
    public void onKeyUp(KeyUpEvent event) {
      if (isReadOnly() || !isEnabled()) {
        return;
      }

      if (processKeyCode(event.getNativeEvent().getKeyCode())) {
        cancelKey();
      }
    }
  private void arrowKeyUp(KeyUpEvent event) {
    if (!diagramPane.getPopupMenu().isShowing()) {
      int x = 0;
      int y = 0;

      if (event.isLeftArrow()) {
        x = Parameters.MOVEX;
      } else if (event.isRightArrow()) {
        x = -Parameters.MOVEX;
      } else if (event.isUpArrow()) {
        y = Parameters.MOVEY;
      } else if (event.isDownArrow()) {
        y = -Parameters.MOVEY;
      }

      diagramPane.translate(x, y);
      diagramPane.update();
    }
  }
  /*
   * auto-insert degree symbol when appropriate
   */
  public void onKeyUp(KeyUpEvent e) {

    // return unless digit typed (instead of !Character.isDigit)
    if (e.getNativeKeyCode() < 48
        || (e.getNativeKeyCode() > 57 && e.getNativeKeyCode() < 96)
        || e.getNativeKeyCode() > 105) return;

    AutoCompleteTextFieldW tc = inputPanel.getTextComponent();
    String text = tc.getText();

    // if text already contains degree symbol or variable
    for (int i = 0; i < text.length(); i++) {
      if (!StringUtil.isDigit(text.charAt(i))) return;
    }

    int caretPos = tc.getCaretPosition();

    tc.setText(tc.getText() + Unicode.degree);

    tc.setCaretPosition(caretPos);
  }
  @UiHandler("projectName")
  void onProjectNameChanged(KeyUpEvent event) {
    String projectNameValue = projectName.getValue();

    if (projectNameValue != null && projectNameValue.contains(" ")) {
      projectNameValue = projectNameValue.replace(" ", "-");
      projectName.setValue(projectNameValue);
    }

    if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
      return;
    }

    delegate.projectNameChanged(projectName.getValue());
  }
  public FirstPersonControls(Object3D object, Widget widget) {
    super(object, widget);

    this.viewHalfX = widget.getOffsetWidth() / 2;
    this.viewHalfY = widget.getOffsetHeight() / 2;

    if (getWidget().getClass() != RootPanel.class)
      getWidget().getElement().setAttribute("tabindex", "-1");

    this.target = new Vector3();

    getWidget().addDomHandler(this, ContextMenuEvent.getType());

    getWidget().addDomHandler(this, MouseMoveEvent.getType());
    getWidget().addDomHandler(this, MouseDownEvent.getType());
    getWidget().addDomHandler(this, MouseUpEvent.getType());
    RootPanel.get().addDomHandler(this, KeyDownEvent.getType());
    RootPanel.get().addDomHandler(this, KeyUpEvent.getType());
  }
 @Override
 public void onKeyUp(KeyUpEvent event) {
   if (isValidate) {
     if (txtConfirmAction.getText().trim().equalsIgnoreCase(deleteCode)
         && isUserCheckedAllOptions()) {
       btnPositive.getElement().removeClassName("disabled");
       btnPositive.setEnabled(true);
       if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
         if (lblRemoving.getText() != null && !lblRemoving.getText().equalsIgnoreCase("")) {
           setButtonVisibility(false);
           showIsRemoving();
         }
         onClickPositiveButton(null);
       }
     } else {
       setPositiveBtnStatus(false);
     }
   }
 }
Exemple #16
0
  private void initComponents() {
    pnlHeader = new FlexTable();
    txtBuscar = new MSearchBox();
    txtBuscar.setPlaceHolder("Buscar");
    form = new UIFormMantenimiento();
    header = new HeaderMenu();
    lblCenter = new Label("SELECCIONAR EQUIPOS");
    btnBack = new PushButton(new Image(MyResource.INSTANCE.getImgBack32()));
    btnBack.setTitle("Volver Atras");
    header.setLeftWidget(btnBack);
    header.setCenterWidget(lblCenter);
    grid = new GridItemPlan();
    // grid.setAlwaysShowScrollBars(true);
    // grid.setMinimumTableWidth(1024, Style.Unit.PX);
    pnlOperacion = new FlowPanel();
    btnOperacion = new Button("Agregar");
    pnlOperacion.add(btnOperacion);
    btnOperacion.setConfirm(true);
    form.getPnlTabla().add(grid);
    form.getPnlTabla().add(grid.getPager());
    form.getPnlTabla().add(pnlOperacion);

    pnlHeader.setWidget(0, 0, header);
    pnlHeader.setWidget(1, 0, txtBuscar);
    form.getPnlBusqueda().add(pnlHeader);
    form.getPnlBotones().setVisible(false);
    grid.addHandler(this, KeyUpEvent.getType());
    grid.getSelectionModel()
        .addSelectionChangeHandler(
            new SelectionChangeEvent.Handler() {
              @Override
              public void onSelectionChange(SelectionChangeEvent event) {}
            });
    this.add(form);
    this.setGlassEnabled(true);
    this.setAnimationEnabled(true);
    this.setModal(true);
    this.setAutoHideEnabled(true);
    this.setSize("700px", "540px");
    this.center();
  }
 @Override
 public void onKeyUp(KeyUpEvent event) {
   if (event.getNativeKeyCode() == KeyCodes.KEY_DOWN) {
     iCourses.setSelectedRow(iCourses.getSelectedRow() + 1);
     scrollToSelectedRow();
     updateCourseDetails();
   } else if (event.getNativeKeyCode() == KeyCodes.KEY_UP) {
     iCourses.setSelectedRow(
         iCourses.getSelectedRow() == 0
             ? iCourses.getRowsCount() - 1
             : iCourses.getSelectedRow() - 1);
     scrollToSelectedRow();
     updateCourseDetails();
   } else if (event.isControlKeyDown() || event.isAltKeyDown()) {
     for (Map.Entry<Character, Integer> entry : iTabAccessKeys.entrySet())
       if (event.getNativeKeyCode() == Character.toLowerCase(entry.getKey())
           || event.getNativeKeyCode() == Character.toUpperCase(entry.getKey())) {
         iCourseDetailsTabPanel.selectTab(entry.getValue());
         event.preventDefault();
         event.stopPropagation();
       }
   }
 }
Exemple #18
0
 /**
  * Aliases typing Enter in the name box to the same as pressing the "Go" button.
  *
  * @param event The key event. The value {@code event.getNativeKeyCode()} is compared against
  *     {@code KeyCodes.KEY_ENTER}.
  */
 @UiHandler("nameBox")
 void onNameBoxKeypress(KeyUpEvent event) {
   if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
     onGoButtonClick(null);
   }
 }
 /** Fired when the user types in the nameField. */
 public void onKeyUp(KeyUpEvent event) {
   if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
     sendNameToServer();
   }
 }
 @Override
 public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
   return peer.addHandler(handler, KeyUpEvent.getType());
 }
  public TextEditor(TextEntry1Space parentWidget, int userNo, int nbTextEntry) {
    super();
    parent = parentWidget;
    logVector = new Vector<String>();
    this.userNo = userNo;
    this.nbTextEntry = nbTextEntry;
    if (parentWidget instanceof AbsolutePanel) isAPanel = true;

    if (nbTextEntry == 1) // if it's training
    {
      wordlist = traininglist;
    }

    text = new Label(wordlist[0]);
    text.getElement().getStyle().setColor("#fff");
    text.getElement().getStyle().setFontSize(20, Unit.PT);
    text.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hPanel.setWidth("100%");
    hPanel.add(text);
    this.add(hPanel);

    MultiFocus.setVisible(true);
    MultiFocus.setWidth("100%");
    MultiFocus.setHeight("100px");
    MultiFocus.setWidth("250px");

    MultiFocus.getElement().getStyle().setBackgroundColor("#fff");

    // this.add(ta);
    this.add(MultiFocus);
    this.setBorderWidth(1);

    MultiFocus.addDomHandler(
        new KeyPressHandler() { // Listen for KeyPress events on MultiFocusTextBox
          @Override
          public void onKeyPress(KeyPressEvent event) {

            if (!isStarted) {
              startTime = System.currentTimeMillis();

              if (!isSetStarted) {
                setStartTime = startTime; // set experiment start time
                isSetStarted = true;
              }

              isStarted = true;
            }
            typedText = typedText + event.getCharCode();
          }
        },
        KeyPressEvent.getType());

    MultiFocus.addDomHandler(
        new KeyUpHandler() {

          @Override
          public void onKeyUp(KeyUpEvent event) {

            if (event.getNativeEvent().getKeyCode() == 13) {

              if (isSetFinished && !isLast) { // for the second set

                log(typedText, ta.getText());
                parent.setLoggedData(logVector, false, true); // done with experiment

                iteration++;
                text.setText(secondwordlist[iteration]);

                typedText = "";
                isStarted = false;
              }

              if (isLast) {
                log(typedText, ta.getText());
                parent.setLoggedData(logVector, true, true); // done with experiment

                text.setText(secondwordlist[0]);
                typedText = "";
                isStarted = false;

                iteration = 0;
                isLast = false;
              }

              if (!isSetFinished) {

                if (!isLast) {
                  iteration++;
                  text.setText(wordlist[iteration]);

                  log(typedText, ta.getText()); // log for wordlist[iteration-1]
                  typedText = "";
                  isStarted = false;

                  if ((iteration == (wordlist.length - 1))) { // last element
                    isSetFinished = true;
                    isLast = true;
                  }
                }
              }
            }

            if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_BACKSPACE) {

              typedText = typedText + "~";
            }
          }
        },
        KeyUpEvent.getType());
  }
Exemple #22
0
 @Override
 public void onKeyUp(KeyUpEvent event) {
   if (isClosable() && event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
     onCloseClick();
   }
 }
Exemple #23
0
 /** When the user input ENTER key, the query starts */
 @UiHandler("queryTextBox")
 void onKeyEnterRunQuery(KeyUpEvent event) {
   if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
     runQuery();
   }
 }
Exemple #24
0
 public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
   return addDomHandler(handler, KeyUpEvent.getType());
 }
  public void updateActionPanel() {
    rightButtonPanel.clear();
    boolean exam = app.isExam();
    setStyleName("examToolbar", exam);
    if (exam) {
      // We directly read the parameters to show the intention.
      // It may be possible that 3D is not supported from technical
      // reasons (e.g. the graphics card is problematic), but in such
      // cases we don't want to show that here.

      if (!app.getExam().isCASAllowed()) {
        Label nocas = new Label("CAS");
        nocas.getElement().getStyle().setTextDecoration(TextDecoration.LINE_THROUGH);
        nocas.getElement().setClassName("timer");
        rightButtonPanel.add(nocas);
      }
      if (!app.getExam().is3DAllowed()) {
        Label no3d = new Label("3D");
        no3d.getElement().getStyle().setTextDecoration(TextDecoration.LINE_THROUGH);
        no3d.getElement().setClassName("timer");
        rightButtonPanel.add(no3d);
      }
      rightButtonPanel.add(getTimer());
    }

    if (app.getLAF().undoRedoSupported()) {
      addUndoPanel();
    }
    if (app.getArticleElement().getDataParamShowMenuBar(false)
        || app.getArticleElement().getDataParamApp()) {
      PerspectiveResources pr =
          ((ImageFactory) GWT.create(ImageFactory.class)).getPerspectiveResources();
      this.menuBarShowing = true;
      // openMenuButton = new StandardButton(pr.button_open_menu(), null,
      // 32);
      //
      // openMenuButton.addFastClickHandler(new FastClickHandler() {
      // @Override
      // public void onClick(Widget source) {
      // app.hideKeyboard();
      // app.closePopups();
      // GGWToolBar.this.app.toggleMenu();
      // }

      openMenuButton = new StandardButton(pr.menu_header_open_menu(), null, 32);

      openMenuButton.getUpHoveringFace().setImage(getImage(pr.menu_header_open_menu_hover(), 32));

      openMenuButton.addFastClickHandler(
          new FastClickHandler() {
            @Override
            public void onClick(Widget source) {
              app.hideKeyboard();
              app.closePopups();
              GGWToolBar.this.app.toggleMenu();
            }
          });

      openMenuButton.addDomHandler(
          new KeyUpHandler() {
            public void onKeyUp(KeyUpEvent event) {
              if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                GGWToolBar.this.app.toggleMenu();
              }
              if (event.getNativeKeyCode() == KeyCodes.KEY_LEFT) {
                GGWToolBar.this.selectMenuButton(0);
              }
              if (event.getNativeKeyCode() == KeyCodes.KEY_RIGHT) {
                GGWToolBar.this.toolBar.selectMenu(0);
              }
            }
          },
          KeyUpEvent.getType());

      if (!exam && app.enableFileFeatures()) {
        // openSearchButton = new
        // StandardButton(pr.button_open_search(),
        // null, 32);
        // openSearchButton.addFastClickHandler(new FastClickHandler() {
        // @Override
        // public void onClick(Widget source) {
        // app.openSearch(null);
        // }
        // });

        openSearchButton = new StandardButton(pr.menu_header_open_search(), null, 32);
        openSearchButton.getUpFace().setImage(getImage(pr.menu_header_open_search(), 32));
        openSearchButton
            .getUpHoveringFace()
            .setImage(getImage(pr.menu_header_open_search_hover(), 32));

        openSearchButton.addFastClickHandler(
            new FastClickHandler() {
              @Override
              public void onClick(Widget source) {
                app.openSearch(null);
              }
            });

        openSearchButton.addDomHandler(
            new KeyUpHandler() {
              public void onKeyUp(KeyUpEvent event) {
                if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                  app.openSearch(null);
                }
                if (event.getNativeKeyCode() == KeyCodes.KEY_RIGHT) {
                  GGWToolBar.this.selectMenuButton(1);
                }
                if (event.getNativeKeyCode() == KeyCodes.KEY_LEFT) {
                  GGWToolBar.this.toolBar.selectMenu(-1);
                }
              }
            },
            KeyUpEvent.getType());

        this.rightButtonPanel.add(openSearchButton);
      }
      this.rightButtonPanel.add(openMenuButton);
    }
  }
Exemple #26
0
 @Override
 public HandlerRegistration addKeyUpHandler(final KeyUpHandler handler) {
   return handlers.addHandler(KeyUpEvent.getType(), handler);
 }