예제 #1
2
 @Override
 public void handle(MouseEvent t) {
   // move circle back to origin
   TranslateTransition move =
       new TranslateTransition(new Duration(200), (Circle) (t.getSource()));
   move.setToX(translateX);
   move.setToY(translateY);
   move.playFromStart();
 }
 @FXML
 void onMouseClickGameStatus(MouseEvent mouseEvent) {
   GameStatus gameStatus = playerInfoBean.getGameStatus();
   if (gameStatus == GameStatus.NONE) {
     return;
   }
   if (mouseEvent.getButton() == MouseButton.PRIMARY && mouseEvent.getClickCount() == 2) {
     int uid = playerInfoBean.getGameUid();
     if (gameStatus == GameStatus.LOBBY || gameStatus == GameStatus.HOST) {
       GameInfoBean gameInfoBean = gameService.getByUid(uid);
       gamesController.onJoinGame(
           gameInfoBean, null, mouseEvent.getScreenX(), mouseEvent.getScreenY());
     } else if (gameStatus == GameStatus.PLAYING) {
       try {
         replayService.runLiveReplay(uid, playerInfoBean.getUsername());
       } catch (IOException e) {
         notificationService.addNotification(
             new ImmediateNotification(
                 i18n.get("errorTitle"),
                 i18n.get("replayCouldNotBeStarted.text"),
                 Severity.ERROR,
                 e,
                 singletonList(new ReportAction(i18n, reportingService, e))));
       }
     }
   }
 }
예제 #3
0
 private void kochPanelMouseDragged(MouseEvent event) {
   zoomTranslateX = zoomTranslateX + event.getX() - lastDragX;
   zoomTranslateY = zoomTranslateY + event.getY() - lastDragY;
   lastDragX = event.getX();
   lastDragY = event.getY();
   kochManager.drawEdges();
 }
예제 #4
0
 @Override
 public void handle(MouseEvent t) {
   // set origin coordinates
   originX = t.getSceneX();
   originY = t.getSceneY();
   translateX = ((Circle) (t.getSource())).getTranslateX();
   translateY = ((Circle) (t.getSource())).getTranslateY();
 }
예제 #5
0
 @Override
 protected void handleClick(MouseEvent e) {
   double worldX = getViewModel().screenToWorldX(e.getX());
   double worldY = getViewModel().screenToWorldY(e.getY());
   double worldZ = getViewModel().getCurrentZLevel();
   getUserInputHandler().worldPointClicked(worldX, worldY, worldZ, e);
   e.consume();
 }
예제 #6
0
 @FXML
 private void evtMouseClick(MouseEvent evt) throws Exception {
   if (evt.getButton() == MouseButton.SECONDARY) {
     showContextMenu(evt.getX(), evt.getY());
     evt.consume();
   } else if (contextMenu != null) {
     contextMenu.hide();
   }
 }
 /**
  * Returns <code>true</code> if the specified mouse event has modifier keys that match this
  * handler.
  *
  * @param e the mouse event (<code>null</code> not permitted).
  * @return A boolean.
  */
 @Override
 public boolean hasMatchingModifiers(MouseEvent e) {
   boolean b = true;
   b = b && (this.altKey == e.isAltDown());
   b = b && (this.ctrlKey == e.isControlDown());
   b = b && (this.metaKey == e.isMetaDown());
   b = b && (this.shiftKey == e.isShiftDown());
   return b;
 }
예제 #8
0
  /**
   * 处理鼠标移动和退出事件
   *
   * @param event
   */
  protected void preMouseEvent(Event event) {
    if (!(event instanceof MouseEvent)) return;

    MouseEvent me = (MouseEvent) event;
    if (event.getEventType() == MouseEvent.MOUSE_MOVED) {
      mouse = new Point((int) me.getX(), (int) me.getY());
    } else if (event.getEventType() == MouseEvent.MOUSE_EXITED) {
      mouse = null;
    }
  }
예제 #9
0
 @Override
 public void handle(MouseEvent t) {
   // calculate offset
   double offsetX = t.getSceneX() - originX;
   double offsetY = t.getSceneY() - originY;
   double newTranslateX = translateX + offsetX;
   double newTranslateY = translateY + offsetY;
   // follow mouse
   ((Circle) (t.getSource())).setTranslateX(newTranslateX);
   ((Circle) (t.getSource())).setTranslateY(newTranslateY);
 }
 /*     */ public void handle(MouseEvent paramAnonymousMouseEvent) {
   /* 307 */ Rectangle localRectangle = (Rectangle) paramAnonymousMouseEvent.getSource();
   /* 308 */ TableColumn localTableColumn =
       (TableColumn) localRectangle.getProperties().get("TableColumn");
   /* 309 */ NestedTableColumnHeader localNestedTableColumnHeader =
       (NestedTableColumnHeader) localRectangle.getProperties().get("TableColumnHeader");
   /*     */
   /* 311 */ if (!localNestedTableColumnHeader.isColumnResizingEnabled()) return;
   /*     */
   /* 313 */ localNestedTableColumnHeader.columnResizingComplete(
       localTableColumn, paramAnonymousMouseEvent);
   /* 314 */ paramAnonymousMouseEvent.consume();
   /*     */ }
예제 #11
0
 public void treeViewClicked(MouseEvent ev) {
   if (ev.getClickCount() == 2) {
     // don't process click on triangle
     EventTarget target = ev.getTarget();
     if (target instanceof Node && !"arrow".equals(((Node) target).getStyleClass())) {
       TreeItem<DbTreeValue> selectedItem = treeView.getSelectionModel().getSelectedItem();
       if (selectedItem != null
           && selectedItem.getValue().getValueType() == TreeValueType.COLLECTION) {
         mainFrameController.openTab();
         ev.consume();
       }
     }
   }
 }
  @Override
  public void drag(MouseEvent e, Dimension delta) {
    IVisualPart<Node, ? extends Node> anchorage =
        getHost().getAnchorages().keySet().iterator().next();
    FXConnection connection = (FXConnection) anchorage.getVisual();

    List<Point> before = new ArrayList<Point>(connection.getWayPoints());

    getBendPolicy(anchorage).moveSelectedSegmentPoint(new Point(e.getSceneX(), e.getSceneY()));

    List<Point> after = new ArrayList<Point>(connection.getWayPoints());

    adjustHandles(before, after);
  }
예제 #13
0
 @FXML
 private void gotoNP(MouseEvent event) {
   if (event.getButton() == MouseButton.PRIMARY) {
     if (go == false) {
       npView.setVisible(true);
       mView.toBack();
       timeProgress.setTextFill(Color.WHITE);
       Stage stage = (Stage) root.getScene().getWindow();
       stage.setResizable(true);
       btnPaFull.setImage(new Image("icon/Full_button/full.png"));
       go = true;
     } else {
       if (play == true) {
         Stage stage = (Stage) root.getScene().getWindow();
         if (full == false) {
           stage.setFullScreen(true);
           btnPaFull.setImage(new Image("icon/Full_button/full_off.png"));
           full = true;
         } else {
           stage.setFullScreen(false);
           btnPaFull.setImage(new Image("icon/Full_button/full.png"));
           full = false;
         }
       }
     }
   }
 }
예제 #14
0
 @Override
 public void handle(MouseEvent event) {
   // TODO Auto-generated method stub
   if (event.getClickCount() == 2) {
     subirElementos();
   }
 }
예제 #15
0
  @FXML
  private void Play(MouseEvent event) {
    if (event.getButton() == MouseButton.PRIMARY) {
      if (j == 0) {
        listView.getSelectionModel().select(j);
        listView.getFocusModel().focus(j);
      }

      if (mp != null) {
        MediaPlayer.Status status = mp.getStatus();
        if (status == MediaPlayer.Status.UNKNOWN || status == MediaPlayer.Status.HALTED) {
          return;
        }
        if (status == MediaPlayer.Status.PAUSED
            || status == MediaPlayer.Status.READY
            || status == MediaPlayer.Status.STOPPED) {
          if (atEndOfMedia) {
            atEndOfMedia = false;
          }
          onPlay();
          mp.play();
          statusDisplay.toBack();
          play = true;

        } else {
          mp.pause();
          statusDisplay.toFront();
          play = false;
        }
      }
    }
  }
예제 #16
0
 @FXML
 private void evtMouseEnter(MouseEvent evt) throws Exception {
   if (cfg.autoHideProperty().get()) {
     hideDock(false);
     evt.consume();
   }
 }
  @Override
  public void press(MouseEvent e) {
    createdSegmentIndex = -1;
    FXCircleSegmentHandlePart hp = getHost();
    IVisualPart<Node, ? extends Node> anchorage =
        getHost().getAnchorages().keySet().iterator().next();

    disableRefreshVisuals(anchorage);
    init(getBendPolicy(anchorage));

    if (hp.getSegmentParameter() == 0.5) {
      // create new way point
      getBendPolicy(anchorage)
          .createAndSelectSegmentPoint(
              hp.getSegmentIndex(), new Point(e.getSceneX(), e.getSceneY()));

      // find other segment handle parts
      List<FXCircleSegmentHandlePart> parts =
          PartUtils.filterParts(
              PartUtils.getAnchoreds(getHost().getAnchorages().keySet()),
              FXCircleSegmentHandlePart.class);

      // sort parts by segment index and parameter
      Collections.<FXCircleSegmentHandlePart>sort(parts);

      // increment segment index of succeeding parts
      for (FXCircleSegmentHandlePart p : parts) {
        if (p.getSegmentIndex() > hp.getSegmentIndex()
            || (p.getSegmentIndex() == hp.getSegmentIndex() && p.getSegmentParameter() == 1)) {
          p.setSegmentIndex(p.getSegmentIndex() + 1);
        }
      }

      // adjust index and parameter of this segment handle part
      hp.setSegmentIndex(hp.getSegmentIndex() + 1);
      hp.setSegmentParameter(0);
      createdSegmentIndex = hp.getSegmentIndex();
    } else {
      // select existing way point
      getBendPolicy(anchorage)
          .selectSegmentPoint(
              hp.getSegmentIndex(),
              hp.getSegmentParameter(),
              new Point(e.getSceneX(), e.getSceneY()));
    }
  }
예제 #18
0
 @Override
 public void handle(MouseEvent event) {
   EventType<? extends Event> type = event.getEventType();
   if (type.equals(MouseEvent.MOUSE_ENTERED) || type.equals(MouseEvent.MOUSE_EXITED)) {
     refreshVisual();
   } else if (type.equals(MouseEvent.MOUSE_MOVED) || type.equals(MouseEvent.MOUSE_DRAGGED)) {
     if (originalBounds != null) {
       if (!originalBounds.contains(event.getSceneX(), event.getSceneY())) {
         // unhover the visual by making it mouse transparent
         getVisual().setMouseTransparent(true);
         // this will result in a MOUSE_EXITED event being fired,
         // which will lead to a refreshVisual() call, which will
         // update the visualization
       }
     }
   }
 }
  /**
   * Click and Hold to make window draggable
   *
   * @param event
   */
  public void handleAppMouseClick_Hold(MouseEvent event) {

    Stage stage = OnlineQuizzingApp.getInstance().getStage();

    xOffset = event.getSceneX();
    yOffset = event.getSceneY();

    if (event.getButton().equals(MouseButton.PRIMARY)) {
      if (event.getClickCount() == 2) {
        if (stage.isFullScreen()) {
          stage.setFullScreen(false);
        } else {
          stage.setFullScreen(true);
        }
      }
    }
  }
 @Override
 public void press(MouseEvent e) {
   targetParts = getTargetParts();
   if (targetParts.size() < 2 || e.isControlDown()) {
     invalidGesture = true;
     return;
   }
   // init resize context vars
   initialMouseLocation = new Point(e.getSceneX(), e.getSceneY());
   selectionBounds = getSelectionBounds(targetParts);
   relX1 = new HashMap<>();
   relY1 = new HashMap<>();
   relX2 = new HashMap<>();
   relY2 = new HashMap<>();
   // init scale relocate policies
   for (IContentPart<Node, ? extends Node> targetPart : targetParts) {
     FXTransformPolicy transformPolicy = getTransformPolicy(targetPart);
     if (transformPolicy != null) {
       storeAndDisableRefreshVisuals(targetPart);
       computeRelatives(targetPart);
       init(transformPolicy);
       // transform scale pivot to parent coordinates
       Point pivotInScene = getVisualBounds(targetPart).getTopLeft();
       Point pivotInParent =
           FX2Geometry.toPoint(
               getHost().getVisual().getParent().sceneToLocal(pivotInScene.x, pivotInScene.y));
       // create transformations for scaling around pivot
       int translateToOriginIndex = transformPolicy.createPostTransform();
       int scaleIndex = transformPolicy.createPostTransform();
       int translateBackIndex = transformPolicy.createPostTransform();
       // set translation transforms for scaling
       transformPolicy.setPostTranslate(
           translateToOriginIndex, -pivotInParent.x, -pivotInParent.y);
       transformPolicy.setPostTranslate(translateBackIndex, pivotInParent.x, pivotInParent.y);
       // save rotation index for later adjustments
       scaleIndices.put(targetPart, scaleIndex);
       // create transform for translation of the target part
       translateIndices.put(targetPart, transformPolicy.createPostTransform());
       // initialize resize policy if available
       FXResizePolicy resizePolicy = getResizePolicy(targetPart);
       if (resizePolicy != null) {
         init(resizePolicy);
       }
     }
   }
 }
예제 #21
0
  /*
   *
   *   Listener dell'immagine con la lente d'ingrandimento , serve a mostrare le informazioni complete relative
   *   a quell'offerta
   * */
  public void visualizzaOffertePernotto(MouseEvent event) {

    ImageView o = (ImageView) event.getSource();

    //
    // accessoCatalogoView.mostraOfferta(accessoCatalogoModel.findOff(o.getId(),TipoOfferta.OffertaPernotto));
    accessoCatalogoView.mostraOfferta(
        DAOFactory.getDAOFactory(TipoOfferta.OffertaPernotto).getOffertaDAO().findOff(o.getId()));
  }
예제 #22
0
 @FXML
 void seek(MouseEvent evt) {
   if (player != null) {
     Duration d = player.getMedia().getDuration();
     double millis = (evt.getX() / loadProgressBar.getWidth()) * d.toMillis();
     Duration s = new Duration(millis);
     player.seek(s);
   }
 }
예제 #23
0
 @FXML
 private void handleProgress(MouseEvent event) {
   if (event.getButton() == MouseButton.PRIMARY) {
     if (play = true) {
       mp.seek(
           Duration.seconds((mp.getTotalDuration().toSeconds() * timeSlider.getValue() / 100)));
     }
   }
 }
예제 #24
0
  private void mouseDragged(MouseEvent ev) {
    if (this.mouseDragging && this.getSelectionModel().getSelectedItem() != null) {

      double currentMouseX = ev.getX();
      double currentMouseY = ev.getY();
      double mouseMoveX = currentMouseX - this.mousePressX;
      double mouseMoveY = currentMouseY - this.mousePressY;

      // Yの移動量が一定量以下の時は、タブの順番を変えるだけ
      if (mouseMoveY < 30 && mouseMoveY > -30) {
        if (ev.getPickResult().getIntersectedNode() instanceof LabeledText) {

          // マウスの下にあるタブのラベルを取得
          LabeledText label = (LabeledText) ev.getPickResult().getIntersectedNode();
          DockableTab currentTab = (DockableTab) this.getSelectionModel().getSelectedItem();

          // 自分のタブの上でない場合
          if (!label.getText().equals(this.getSelectionModel().getSelectedItem().getText())) {

            Tab overTab;
            if (mouseMoveX > 0) {
              overTab =
                  this.findAfterTab(label.getText(), this.getSelectionModel().getSelectedIndex());
            } else {
              overTab =
                  this.findBeforeTab(label.getText(), this.getSelectionModel().getSelectedIndex());
            }
            int overTabIndex = this.getTabs().indexOf(overTab);
            if (overTabIndex >= 0) {
              this.cutTab();
              this.insertTab(overTabIndex, currentTab);
              this.getSelectionModel().select(currentTab);
              this.mousePressX = ev.getX();
            }
          }
        }
      }

      // ドッキングを試みる
      else {
        this.parent.startShowDockingBorder(ev);
      }
    }
  }
  public void playerTurn(MouseEvent event) {
    int spot = -1;
    String playerMarker = player.getPlayerMarker();
    if (event.getSource().equals(lblSpot1)) {
      lblSpot1.setText(playerMarker);
      spot = 0;
      lblSpot1.setDisable(true);
    } else if (event.getSource() == lblSpot2) {
      lblSpot2.setText(playerMarker);
      spot = 1;
      lblSpot2.setDisable(true);
    } else if (event.getSource() == lblSpot3) {
      lblSpot3.setText(playerMarker);
      spot = 2;
      lblSpot3.setDisable(true);
    } else if (event.getSource() == lblSpot4) {
      lblSpot4.setText(playerMarker);
      spot = 3;
      lblSpot4.setDisable(true);
    } else if (event.getSource() == lblSpot5) {
      lblSpot5.setText(playerMarker);
      spot = 4;
      lblSpot5.setDisable(true);
    } else if (event.getSource() == lblSpot6) {
      lblSpot6.setText(playerMarker);
      spot = 5;
      lblSpot6.setDisable(true);
    } else if (event.getSource() == lblSpot7) {
      lblSpot7.setText(playerMarker);
      spot = 6;
      lblSpot7.setDisable(true);
    } else if (event.getSource() == lblSpot8) {
      lblSpot8.setText(playerMarker);
      spot = 7;
      lblSpot8.setDisable(true);
    } else if (event.getSource() == lblSpot9) {
      lblSpot9.setText(playerMarker);
      spot = 8;
      lblSpot9.setDisable(true);
    }
    playboard.placeMarker(spot, playerInternalMarker);
    playboard.showBoardStatus();

    if (playboard.checkForWin(playerInternalMarker)) {
      endGame("Human");
    } else {
      computerMove(false);
    }
  }
예제 #26
0
  private void handleMouseEvent(MouseEvent me) {
    // Handle cursor
    final Scene scene = getScene();

    if (scene == null) {
      return;
    }

    // When another window is focused (just like the preview window),
    // we use default cursor
    if (scene.getWindow() != null && !scene.getWindow().isFocused()) {
      setCursor(Cursor.DEFAULT);
      return;
    }

    final LibraryListItem listItem = getItem();
    ILibraryItem item = null;

    if (listItem != null) {
      item = listItem.getLibItem();
    }

    boolean isSection = false;
    if (listItem != null && listItem.getSectionName() != null) {
      isSection = true;
    }

    if (me.getEventType() == MouseEvent.MOUSE_ENTERED) {
      if (isEmpty() || isSection) {
        setCursor(Cursor.DEFAULT);
      } else {
        setCursor(Cursor.OPEN_HAND);
      }
    } else if (me.getEventType() == MouseEvent.MOUSE_PRESSED) {
      if (isEmpty() || isSection) {
        setCursor(Cursor.DEFAULT);
      } else {
        setCursor(Cursor.CLOSED_HAND);
      }
    } else if (me.getEventType() == MouseEvent.MOUSE_RELEASED) {
      if (isEmpty() || isSection) {
        setCursor(Cursor.DEFAULT);
      } else {
        setCursor(Cursor.OPEN_HAND);
      }
    } else if (me.getEventType() == MouseEvent.MOUSE_EXITED) {
      setCursor(Cursor.DEFAULT);
    } else if (me.getEventType() == MouseEvent.MOUSE_CLICKED) {
      // On double click ask for addition of the drag able item on Content
      if (me.getClickCount() == 2 && me.getButton() == MouseButton.PRIMARY) {
        if (!isEmpty() && !isSection && item != null) {
          if (editorController.canPerformInsert(item)) {
            editorController.performInsert(item);
          }
        }
      }
    }
  }
 @Override
 public void handle(MouseEvent event) {
   // TODO Auto-generated method stub
   if (event.getEventType().equals(MouseEvent.MOUSE_CLICKED)) {
     if (parent != null) {
       kioskMain.setMode(dispMode.MODE_BUS);
       parent.getScene().setRoot(kioskMain);
     }
   }
 }
예제 #28
0
 @FXML
 private void evtMouseExit(MouseEvent evt) throws Exception {
   stopDockRevealerTimer();
   if (cfg.autoHideProperty().get()
       && !arePopupsOpen()
       && (contextMenu == null || !contextMenu.isShowing())) {
     maybeHideDock();
     evt.consume();
   }
 }
예제 #29
0
 @Override
 public void handle(MouseEvent event) {
   txt = (Text) event.getTarget();
   if (event.getEventType() == MouseEvent.MOUSE_ENTERED) {
     actualWindow.setCursor(actualWindow.cursorHover);
     actualWindow.getMenuPanel().getModuleMenu().drawHover(txt);
   }
   if (event.getEventType() == MouseEvent.MOUSE_EXITED) {
     actualWindow.setCursor(actualWindow.cursor);
     actualWindow.getMenuPanel().getModuleMenu().unHover(txt);
   }
   if (event.getEventType() == MouseEvent.MOUSE_CLICKED) {
     if (txt != null && txt.getId() == "newPart") {
       actualModel.getMusic().getMusicMenu().stop();
       actualModel.nouvellePartie();
       actualWindow.switchPanel(actualWindow.getGamePanel());
       actualModel.getMusic().playLoop();
     }
   }
 }
예제 #30
0
 @FXML
 private void Stop(MouseEvent event) {
   if (event.getButton() == MouseButton.PRIMARY) {
     if (mp != null) {
       mp.stop();
       playButton.setImage(new Image("icon/PlayPause_button/play.png"));
       mp.seek(mp.getStartTime());
       play = false;
     }
   }
 }