Example usage for javafx.scene.input MouseButton PRIMARY

List of usage examples for javafx.scene.input MouseButton PRIMARY

Introduction

In this page you can find the example usage for javafx.scene.input MouseButton PRIMARY.

Prototype

MouseButton PRIMARY

To view the source code for javafx.scene.input MouseButton PRIMARY.

Click Source Link

Document

Represents primary (button 1, usually the left) mouse button.

Usage

From source file:poe.trade.assist.SearchPane.java

private void setupTableClickListener() {
    searchTable.addEventFilter(MouseEvent.MOUSE_RELEASED, new EventHandler<MouseEvent>() {
        @Override//from  ww  w .j  a  va 2 s. co m
        public void handle(MouseEvent event) {
            if (event.getButton() == MouseButton.SECONDARY) {
                Search search = searchTable.getSelectionModel().getSelectedItem();
                if (search != null) {
                    search.markSeen();
                }
            }
        }
    });
    searchTable.addEventFilter(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            if (event.getClickCount() > 1 && event.getButton() == MouseButton.PRIMARY) {
                Search search = searchTable.getSelectionModel().getSelectedItem();
                if (search != null) {
                    SwingUtil.openUrlViaBrowser(search.getUrl());
                }
            }
        }
    });
}

From source file:net.rptools.tokentool.controller.ManageOverlays_Controller.java

private void loadImages(File dir) {
    // Clear Details panel
    clearDetails();/*from   ww w.  j  a v  a 2  s.  c  o  m*/

    currentDirectory = dir;
    File[] files = dir.listFiles(ImageUtil.SUPPORTED_FILENAME_FILTER);

    Task<Void> task = new Task<Void>() {
        @Override
        public Void call() {
            for (File file : files) {
                Path filePath = file.toPath();

                if (loadOverlaysThread.isInterrupted()) {
                    Platform.runLater(() -> overlayViewFlowPane.getChildren().clear());
                    break;
                }

                try {
                    ToggleButton overlayButton = new ToggleButton();
                    ImageView imageViewNode = ImageUtil.getOverlayThumb(new ImageView(), filePath);

                    overlayButton.getStyleClass().add("overlay-toggle-button");
                    overlayButton.setGraphic(imageViewNode);
                    overlayButton.setUserData(file);
                    overlayButton.setToggleGroup(overlayToggleGroup);

                    overlayButton.addEventHandler(ActionEvent.ACTION, event -> {
                        // No modifier keys used so add toggle group back to all buttons
                        resetToggleGroup();

                        // Also set button to selected due to resetting toggle groups & no unselecting needed, makes for better interface IMO
                        overlayButton.setSelected(true);

                        // Update the Details panel with the last selected overlay
                        File overlayFile = (File) overlayButton.getUserData();
                        updateDetails(overlayFile, (ImageView) overlayButton.getGraphic(),
                                overlayButton.isSelected());

                        // Consume the event, no more logic needed
                        event.consume();
                    });

                    overlayButton.setOnMouseClicked(new EventHandler<MouseEvent>() {
                        @Override
                        public void handle(MouseEvent event) {
                            // Allow multiple selections if shortcutKey+left_mouse is pressed
                            if (event.getButton().equals(MouseButton.PRIMARY) && event.isShortcutDown()) {
                                // Update the Details panel with the last selected overlay
                                File overlayFile = (File) overlayButton.getUserData();
                                updateDetails(overlayFile, (ImageView) overlayButton.getGraphic(), true);

                                // Remove the toggle group to allow multiple toggle button selection
                                overlayButton.setToggleGroup(null);

                                // Select the button
                                overlayButton.setSelected(true);

                                // Consume the event, no more logic needed
                                event.consume();
                            }
                        }
                    });

                    Platform.runLater(() -> overlayViewFlowPane.getChildren().add(overlayButton));
                } catch (IOException e) {
                    log.error("Loading image: " + filePath.getFileName(), e);
                }

            }

            return null;
        }
    };

    loadOverlaysThread.interrupt();
    executorService.execute(task);
}

From source file:de.pixida.logtest.designer.automaton.Graph.java

private void mouseClickedOnPane(final MouseEvent event) {
    this.contextMenu.hide();
    if (event.getButton() == MouseButton.PRIMARY) {
        if (this.connectorSourceNode != null) {
            Validate.notNull(this.connector);
            this.cancelDrawingConnector();
        } else {//from   w  w  w  .java 2s  .  com
            this.automatonEditor.showDefaultConfigFrame();
        }
    } else if (event.getButton() == MouseButton.SECONDARY) {
        this.contextMenu.show(this.pane, event.getScreenX(), event.getScreenY());
    }
}

From source file:mesclasses.view.TimetableController.java

private void handleClicks(Pane pane) {
    pane.setOnMouseClicked((MouseEvent mouseEvent) -> {
        if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
            if (mouseEvent.getClickCount() == 2) {
                Cours newCours = new Cours();
                newCours.setClasse(classes.get(0));
                newCours.setDay(paneMap.inverse().get(pane));
                newCours.setWeek(config.getProperty(Constants.CONF_WEEK_DEFAULT));
                newCours.setStartHour((int) (mouseEvent.getY()) / 60 + 7);
                newCours.setEndHour(newCours.getStartHour() + 1);
                createNewCours(newCours);
            }//www  .  java  2 s  .  c o m
        }
    });
}

From source file:open.dolphin.client.MainWindowController.java

/**
 * Initializes the controller class.//  ww  w  .ja  v a 2 s . c  om
 *
 * @param url
 * @param rb
 */
@Override
public void initialize(URL url, ResourceBundle rb) {

    //- Init TableView
    ReceptView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    PatientSearchView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    PatientFutureView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    LabRecieverView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    //        mainTab.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
    //            @Override
    //            public void changed(ObservableValue<? extends Number> ov, Number oldValue, Number newValue) {
    //                SingleSelectionModel<Tab> selectionModel = mainTab.getSelectionModel();
    //                if(mainTab.getTabs() != null){
    //                    if(selectionModel.isSelected(0)){
    //                        karteTabPane.getTabs().clear();
    //                    }
    //                }
    //            }
    //        }); 

    // ?????
    TableColumn colId = new TableColumn("ID");
    recept.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("recept"));
    visitTime.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("visitTime"));
    tableCellAlignRight(visitTime);
    clientId.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("clientId"));
    name.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("name"));
    sex.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("sex"));
    tableCellAlignCenter(sex);
    insurance.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("insurance"));
    birthDay.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("birthDay"));
    physicianInCharge.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("physicianInCharge"));
    clinicalDepartments
            .setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("clinicalDepartments"));
    reservation.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("reservation"));
    memo.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("memo"));
    status.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("status"));
    tableCellImageAlignCenter(status);
    // ????
    ReceptView.getItems().setAll(fetchDataFromServer());

    // ???(?)
    ReceptView.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent mouseEvent) {
            if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
                if (mouseEvent.getClickCount() == 2) {
                    System.out.println("Double clicked");
                    ReceptInfo selectedUser = ((TableView<ReceptInfo>) mouseEvent.getSource())
                            .getSelectionModel().getSelectedItem();
                    // ??????????
                    for (ReceptInfo info : receptList) {
                        if (info.getName().equals(selectedUser.getName())) {
                            return;
                        }
                    }
                    System.out.println(selectedUser.getClientId());
                    receptList.add(selectedUser);
                    // ??
                    final ContextMenu contextMenu = new ContextMenu();
                    MenuItem item1 = new MenuItem("?");
                    item1.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Reserve Karte?");
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item2 = new MenuItem("???");
                    item2.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab and Preservation???");
                            karteTabPane.getTabs().remove(karteTabPane.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item3 = new MenuItem("?");
                    item3.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab?");
                            karteTabPane.getTabs().remove(karteTabPane.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    contextMenu.getItems().addAll(item1, item2, item3);

                    Tab tab = new Tab(selectedUser.getName());
                    tab.setOnClosed(new EventHandler<Event>() {
                        @Override
                        public void handle(Event t) {
                            Tab tab = (Tab) t.getSource();
                            for (int i = 0; i < receptList.size(); i++) {
                                if (tab.getText().equals(receptList.get(i).getName())) {
                                    receptList.remove(i);
                                }
                            }
                            System.out.println("Closed!");
                        }
                    });
                    tab.setContextMenu(contextMenu); // Right-click mouse button menu
                    try {
                        // Loading content on demand
                        Parent root = (Parent) new FXMLLoader()
                                .load(this.getClass().getResource("/resources/fxml/Karte.fxml").openStream());
                        tab.setContent(root);
                        karteTabPane.getSelectionModel().select(tab);
                        karteTabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
                        karteTabPane.getTabs().add(tab);
                        karteTabPane.setPrefSize(kartePane.getPrefWidth(), kartePane.getPrefHeight());
                        kartePane.getChildren().retainAll();
                        kartePane.getChildren().add(karteTabPane);
                    } catch (IOException ex) {
                        Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex);
                    }

                }
            }
        }
    });

    // ????
    clientId1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("clientId1"));
    name1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("name1"));
    kana1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("kana1"));
    sex1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("sex1"));
    birthDay1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("birthDay1"));
    receiveDay1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("receiveDay1"));
    status1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("status1"));
    // dummy?
    PatientSearchView.getItems().setAll(fetchDataFromPatientInfo());

    // ??(?)
    PatientSearchView.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent mouseEvent) {
            if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
                if (mouseEvent.getClickCount() == 2) {
                    System.out.println("Double clicked");
                    PatientSearchInfo selectedUser = ((TableView<PatientSearchInfo>) mouseEvent.getSource())
                            .getSelectionModel().getSelectedItem();
                    // ??????????
                    for (PatientSearchInfo info : patientSearchList) {
                        if (info.getName1().equals(selectedUser.getName1())) {
                            return;
                        }
                    }
                    System.out.println(selectedUser.getKana1());
                    patientSearchList.add(selectedUser);
                    // ??
                    final ContextMenu contextMenu = new ContextMenu();
                    MenuItem item1 = new MenuItem("?");
                    item1.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Reserve Karte?");
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item2 = new MenuItem("???");
                    item2.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab and Preservation???");
                            karteTabPane1.getTabs().remove(karteTabPane1.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item3 = new MenuItem("?");
                    item3.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab?");
                            karteTabPane1.getTabs().remove(karteTabPane1.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    contextMenu.getItems().addAll(item1, item2, item3);

                    Tab tab = new Tab(selectedUser.getName1());
                    tab.setOnClosed(new EventHandler<Event>() {
                        @Override
                        public void handle(Event t) {
                            Tab tab = (Tab) t.getSource();
                            for (int i = 0; i < patientSearchList.size(); i++) {
                                if (tab.getText().equals(patientSearchList.get(i).getName1())) {
                                    patientSearchList.remove(i);
                                }
                            }
                            System.out.println("Closed!");
                        }
                    });
                    tab.setContextMenu(contextMenu); // Right-click mouse button menu
                    try {
                        // Loading content on demand
                        Parent root = (Parent) new FXMLLoader()
                                .load(this.getClass().getResource("/resources/fxml/Karte.fxml").openStream());
                        tab.setContent(root);
                        karteTabPane1.getSelectionModel().select(tab);
                        karteTabPane1.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
                        karteTabPane1.getTabs().add(tab);
                        karteTabPane1.setPrefSize(kartePane1.getPrefWidth(), kartePane1.getPrefHeight());
                        kartePane1.getChildren().retainAll();
                        kartePane1.getChildren().add(karteTabPane1);
                    } catch (IOException ex) {
                        Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }
        }
    });

    // ????
    clientId2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("clientId2"));
    name2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("name2"));
    kana2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("kana2"));
    insurance2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("insurance2"));
    sex2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("sex2"));
    birthDay2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("birthDay2"));
    physicianInCharge2
            .setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("physicianInCharge2"));
    clinicalDepartments2
            .setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("clinicalDepartments2"));
    karte2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("karte2"));
    // dummy?
    PatientFutureView.getItems().setAll(fetchDataFromPatientFutureInfo());

    // ??(?)
    PatientFutureView.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent mouseEvent) {
            if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
                if (mouseEvent.getClickCount() == 2) {
                    System.out.println("Double clicked");
                    PatientFutureInfo selectedUser = ((TableView<PatientFutureInfo>) mouseEvent.getSource())
                            .getSelectionModel().getSelectedItem();
                    System.out.println(selectedUser.getName2());
                    // ??
                    final ContextMenu contextMenu = new ContextMenu();
                    MenuItem item1 = new MenuItem("?");
                    item1.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Reserve Karte?");
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item2 = new MenuItem("???");
                    item2.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab and Preservation???");
                            karteTabPane2.getTabs().remove(karteTabPane2.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item3 = new MenuItem("?");
                    item3.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab?");
                            karteTabPane2.getTabs().remove(karteTabPane2.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    contextMenu.getItems().addAll(item1, item2, item3);

                    Tab tab = new Tab(selectedUser.getName2());
                    tab.setContextMenu(contextMenu); // Right-click mouse button menu
                    try {
                        // Loading content on demand
                        Parent root = (Parent) new FXMLLoader()
                                .load(this.getClass().getResource("/resources/fxml/Karte.fxml").openStream());
                        tab.setContent(root);
                        karteTabPane2.getSelectionModel().select(tab);
                        karteTabPane2.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
                        karteTabPane2.getTabs().add(tab);
                        karteTabPane2.setPrefSize(kartePane2.getPrefWidth(), kartePane2.getPrefHeight());
                        kartePane2.getChildren().retainAll();
                        kartePane2.getChildren().add(karteTabPane2);
                    } catch (IOException ex) {
                        Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex);
                    }

                }
            }
        }
    });

    // ?????
    lab3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("lab3"));
    clientId3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("clientId3"));
    kana3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("kana3"));
    karteKana3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("karteKana3"));
    sex3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("sex3"));
    karteSex3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("karteSex3"));
    sampleGetDay3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("sampleGetDay3"));
    register3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("register3"));
    status3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("status3"));
    // dummy?
    LabRecieverView.getItems().setAll(fetchDataFromLabRecieverInfo());

    // ???(?)
    LabRecieverView.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent mouseEvent) {
            if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
                if (mouseEvent.getClickCount() == 2) {
                    System.out.println("Double clicked");
                    LabReceiverInfo selectedUser = ((TableView<LabReceiverInfo>) mouseEvent.getSource())
                            .getSelectionModel().getSelectedItem();
                    System.out.println(selectedUser.getKana3());
                    // ??
                    final ContextMenu contextMenu = new ContextMenu();
                    MenuItem item1 = new MenuItem("?");
                    item1.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Reserve Karte?");
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item2 = new MenuItem("???");
                    item2.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab and Preservation???");
                            karteTabPane3.getTabs().remove(karteTabPane3.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item3 = new MenuItem("?");
                    item3.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab?");
                            karteTabPane3.getTabs().remove(karteTabPane3.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    contextMenu.getItems().addAll(item1, item2, item3);

                    Tab tab = new Tab(selectedUser.getKana3());
                    tab.setContextMenu(contextMenu); // Right-click mouse button menu
                    try {
                        // Loading content on demand
                        Parent root = (Parent) new FXMLLoader()
                                .load(this.getClass().getResource("/resources/fxml/Karte.fxml").openStream());
                        tab.setContent(root);
                        karteTabPane3.getSelectionModel().select(tab);
                        karteTabPane3.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
                        karteTabPane3.getTabs().add(tab);
                        karteTabPane3.setPrefSize(kartePane3.getPrefWidth(), kartePane3.getPrefHeight());
                        kartePane3.getChildren().retainAll();
                        kartePane3.getChildren().add(karteTabPane3);
                    } catch (IOException ex) {
                        Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex);
                    }

                }
            }
        }
    });

    // ??5??????
    Timer exeTimer = new Timer();
    Calendar cal = Calendar.getInstance();
    final int sec = cal.get(Calendar.SECOND);
    int delay = (60 - sec) * 1000;
    int interval = 5 * 1000;
    TimerTask task = new TimerTask() {
        @Override
        public void run() {
            if (!stopFlag) {
                System.out.println("this is called every 5 seconds on UI thread");
                receptUpdate();
            } else {
                this.cancel();
            }
        }
    };
    exeTimer.schedule(task, delay, interval);

}

From source file:be.makercafe.apps.makerbench.editors.JFXScadEditor.java

private void compile(String code) {

    csgObject = null;/*from  w w w .  j  ava  2 s  .c  om*/

    // clearLog();

    viewGroup.getChildren().clear();

    try {

        CompilerConfiguration cc = new CompilerConfiguration();

        cc.addCompilationCustomizers(
                new ImportCustomizer().addStarImports("eu.mihosoft.vrl.v3d", "eu.mihosoft.vrl.v3d.samples")
                        .addStaticStars("eu.mihosoft.vrl.v3d.Transform"));

        GroovyShell shell = new GroovyShell(getClass().getClassLoader(), new Binding(), cc);

        Script script = shell.parse(code);

        Object obj = script.run();

        if (obj instanceof CSG) {

            CSG csg = (CSG) obj;

            csgObject = csg;

            //Plane plane = new Plane();

            MeshContainer meshContainer = csg.toJavaFXMesh();

            final MeshView meshView = meshContainer.getAsMeshViews().get(0);

            setMeshScale(meshContainer, viewContainer.getBoundsInLocal(), meshView);

            PhongMaterial m = new PhongMaterial(Color.GREEN);

            meshView.setCullFace(CullFace.NONE);

            meshView.setMaterial(m);

            viewGroup.layoutXProperty().bind(viewContainer.widthProperty().divide(2));
            viewGroup.layoutYProperty().bind(viewContainer.heightProperty().divide(2));

            viewContainer.boundsInLocalProperty().addListener((ov, oldV, newV) -> {
                setMeshScale(meshContainer, newV, meshView);
            });

            VFX3DUtil.addMouseBehavior(meshView, viewContainer, MouseButton.PRIMARY);

            viewGroup.getChildren().add(meshView);

        } else {
            Logger.getLogger(this.getClass().getName()).log(Level.INFO, "No CSG object returned");
        }

    } catch (Throwable ex) {
        Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Unsuspected xception", ex);
    }
}

From source file:mesclasses.view.RootLayoutController.java

@Override
public void initialize(URL location, ResourceBundle resources) {
    name = "Root Layout Ctrl";
    super.initialize(location, resources);

    notificationPane.setManaged(false);//from w  w w.  java 2s  .  c o  m
    notificationPane.setVisible(false);
    notificationPane.setOnMouseClicked((MouseEvent mouseEvent) -> {
        if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
            closeNotif();
        }
    });
    screenMap = new HashMap<>();
    loadData(null);
}

From source file:be.makercafe.apps.makerbench.editors.GCodeEditor.java

private void compile(String code) {

    csgObject = null;/*  w  w w.  j a  va 2 s .c  om*/

    // clearLog();

    viewGroup.getChildren().clear();

    try {

        parseGCode(caCodeArea.getText(), viewGroup);

        viewGroup.layoutXProperty().bind(viewContainer.widthProperty().divide(2));
        viewGroup.layoutYProperty().bind(viewContainer.heightProperty().divide(2));

        //            viewContainer.boundsInLocalProperty().addListener(
        //                  (ov, oldV, newV) -> {
        //                     setMeshScale(meshContainer, newV, meshView);
        //                  });
        //
        VFX3DUtil.addMouseBehavior(viewGroup, viewContainer, MouseButton.PRIMARY);

    } catch (Throwable ex) {
        Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Unsuspected xception", ex);
    }
}

From source file:org.sleuthkit.autopsy.timeline.ui.AbstractVisualization.java

protected void setChartClickHandler() {
    chart.addEventHandler(MouseEvent.MOUSE_CLICKED, (MouseEvent event) -> {
        if (event.getButton() == MouseButton.PRIMARY && event.isStillSincePress()) {
            selectedNodes.clear();//from  w  ww  .  j  a v  a 2 s  . c  o m
        }
    });
}

From source file:acmi.l2.clientmod.l2smr.Controller.java

private void initializeUnr() {
    mapsDirProperty().addListener((observable, oldValue, newValue) -> {
        unrChooser.getSelectionModel().clearSelection();
        unrChooser.getItems().clear();/*from ww w. j a  v a 2  s .c  o m*/
        unrChooser.setDisable(true);

        if (newValue == null)
            return;

        unrChooser.getItems().addAll(Arrays.stream(newValue.listFiles(MAP_FILE_FILTER)).map(File::getName)
                .collect(Collectors.toList()));

        unrChooser.setDisable(false);

        AutoCompleteComboBox.autoCompleteComboBox(unrChooser, AutoCompleteComboBox.AutoCompleteMode.CONTAINING);
    });
    this.unrChooser.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        table.getSelectionModel().clearSelection();
        filterPane.setDisable(true);
        actors.set(null);
        actorStaticMeshChooser.getItems().clear();

        System.gc();

        if (newValue == null)
            return;

        try (UnrealPackage up = new UnrealPackage(new File(getMapsDir(), newValue), true)) {
            longTask(progress -> {
                List<UnrealPackage.ImportEntry> staticMeshes = up.getImportTable().parallelStream()
                        .filter(ie -> ie.getFullClassName().equalsIgnoreCase("Engine.StaticMesh"))
                        .sorted((ie1, ie2) -> String.CASE_INSENSITIVE_ORDER
                                .compare(ie1.getObjectInnerFullName(), ie2.getObjectInnerFullName()))
                        .collect(Collectors.toList());
                Platform.runLater(() -> {
                    actorStaticMeshChooser.getItems().setAll(staticMeshes);
                    AutoCompleteComboBox.autoCompleteComboBox(actorStaticMeshChooser,
                            AutoCompleteComboBox.AutoCompleteMode.CONTAINING);
                });

                List<Actor> actors = up
                        .getExportTable().parallelStream().filter(e -> UnrealPackage.ObjectFlag
                                .getFlags(e.getObjectFlags()).contains(UnrealPackage.ObjectFlag.HasStack))
                        .map(entry -> {
                            try {
                                return new Actor(entry.getIndex(), entry.getObjectInnerFullName(),
                                        entry.getObjectRawDataExternally(), up);
                            } catch (Throwable e) {
                                return null;
                            }
                        }).filter(Objects::nonNull)
                        .filter(actor -> actor.getStaticMeshRef() != 0 && actor.getOffsets().location != 0)
                        .collect(Collectors.toList());
                Platform.runLater(() -> Controller.this.actors.set(FXCollections.observableArrayList(actors)));
            }, e -> onException("Import failed", e));
        } catch (Exception e) {
            onException("Read failed", e);
        }

        resetFilter();
        filterPane.setDisable(false);
    });
    this.actorColumn.setCellValueFactory(actorStringCellDataFeatures -> new SimpleStringProperty(
            actorStringCellDataFeatures.getValue().getActorName()));
    this.staticMeshColumn.setCellValueFactory(actorStringCellDataFeatures -> new SimpleStringProperty(
            actorStringCellDataFeatures.getValue().getStaticMesh()));
    this.table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    this.table.getSelectionModel().selectedItemProperty().addListener((observable) -> updateSMAPane());

    this.table.setOnMouseClicked(event -> {
        if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2) {
            String obj = table.getSelectionModel().getSelectedItem().getStaticMesh();
            String file = obj.substring(0, obj.indexOf('.')) + ".usx";
            showUmodel(obj, file);
        }
    });
}