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());
  }
Пример #2
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();
  }
Пример #3
0
 @Override
 public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
   return peer.addHandler(handler, KeyUpEvent.getType());
 }
Пример #4
0
  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());
  }
Пример #5
0
  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);
    }
  }
Пример #6
0
 @Override
 public HandlerRegistration addKeyUpHandler(final KeyUpHandler handler) {
   return handlers.addHandler(KeyUpEvent.getType(), handler);
 }
Пример #7
0
 public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
   return addDomHandler(handler, KeyUpEvent.getType());
 }