List of usage examples for javafx.event EventHandler EventHandler
EventHandler
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
private void onTrajectoryFileChoosed(File selectedFile) { textFileParserFrameController.setColumnAssignment(true); textFileParserFrameController.setColumnAssignmentValues("Ignore", "Easting", "Northing", "Elevation", "Time"); textFileParserFrameController.setColumnAssignmentDefaultSelectedIndex(0, 1); textFileParserFrameController.setColumnAssignmentDefaultSelectedIndex(1, 2); textFileParserFrameController.setColumnAssignmentDefaultSelectedIndex(2, 3); textFileParserFrameController.setColumnAssignmentDefaultSelectedIndex(3, 4); if (trajectoryFile != null) { textFileParserFrameController.setHeaderExtractionEnabled(trajectoryFile.containsHeader()); textFileParserFrameController.setSeparator(trajectoryFile.getColumnSeparator()); trajectoryFile.setColumnAssignment(trajectoryFile.getColumnAssignment()); } else {/*www . java 2 s. c o m*/ textFileParserFrameController.setHeaderExtractionEnabled(true); textFileParserFrameController.setSeparator(","); } try { textFileParserFrameController.setTextFile(selectedFile); } catch (IOException ex) { showErrorDialog(ex); return; } Stage textFileParserFrame = textFileParserFrameController.getStage(); textFileParserFrame.show(); textFileParserFrame.setOnHidden(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { trajectoryFile = new CSVFile(selectedFile.getAbsolutePath()); trajectoryFile.setColumnSeparator(textFileParserFrameController.getSeparator()); trajectoryFile.setColumnAssignment(textFileParserFrameController.getAssignedColumnsItemsMap()); trajectoryFile.setNbOfLinesToRead(textFileParserFrameController.getNumberOfLines()); trajectoryFile.setNbOfLinesToSkip(textFileParserFrameController.getSkipLinesNumber()); trajectoryFile.setContainsHeader(textFileParserFrameController.getHeaderIndex() != -1); trajectoryFile.setHeaderIndex(textFileParserFrameController.getHeaderIndex()); textFieldTrajectoryFileALS.setText(selectedFile.getAbsolutePath()); } }); }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
private void onInputFileTLSChoosed(File selectedFile) { String extension = FileManager.getExtension(selectedFile); switch (extension) { case ".rxp": textFieldInputFileTLS.setText(selectedFile.getAbsolutePath()); comboboxModeTLS.getSelectionModel().select(0); items = new ArrayList<>(); items.add(new LidarScan(selectedFile, MatrixUtility.convertMat4DToMatrix4d(Mat4D.identity()), selectedFile.getName())); listviewRxpScans.getItems().setAll(items); break;//from ww w .jav a2 s . c om case ".rsp": Rsp rsp = new Rsp(); try { rsp.read(selectedFile); comboboxModeTLS.getSelectionModel().select(1); textFieldInputFileTLS.setText(selectedFile.getAbsolutePath()); riscanProjectExtractor.init(rsp); riscanProjectExtractor.getFrame().show(); riscanProjectExtractor.getFrame().setOnHidden(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { final List<LidarScan> selectedScans = riscanProjectExtractor.getController() .getSelectedScans(); items = new ArrayList<>(); for (LidarScan scan : selectedScans) { scan.name = scan.file.getAbsolutePath(); items.add(scan); } popMatrix = new Matrix4d(rsp.getPopMatrix()); updateResultMatrix(); listviewRxpScans.getItems().setAll(items); } }); } catch (JDOMException | IOException ex) { showErrorDialog(ex); } break; case ".ptg": try { comboboxModeTLS.getSelectionModel().select(3); textFieldInputFileTLS.setText(selectedFile.getAbsolutePath()); ptgProjectExtractor.init(selectedFile); ptgProjectExtractor.getFrame().show(); ptgProjectExtractor.getFrame().setOnHidden(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { final List<LidarScan> selectedScans = ptgProjectExtractor.getController() .getSelectedScans(); items = new ArrayList<>(); for (LidarScan scan : selectedScans) { scan.name = scan.file.getAbsolutePath(); items.add(scan); } updateResultMatrix(); listviewRxpScans.getItems().setAll(items); } }); } catch (IOException ex) { showErrorDialog(ex); } catch (Exception ex) { showErrorDialog(ex); } break; case ".ptx": try { comboboxModeTLS.getSelectionModel().select(2); textFieldInputFileTLS.setText(selectedFile.getAbsolutePath()); ptxProjectExtractor.init(selectedFile); ptxProjectExtractor.getFrame().show(); ptxProjectExtractor.getFrame().setOnHidden(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { final List<LidarScan> selectedScans = ptxProjectExtractor.getController() .getSelectedScans(); items = new ArrayList<>(); for (LidarScan scan : selectedScans) { scan.name = ((PTXLidarScan) scan).toString(); items.add(scan); } updateResultMatrix(); listviewRxpScans.getItems().setAll(items); } }); } catch (IOException ex) { showErrorDialog(ex); } catch (Exception ex) { showErrorDialog(ex); } break; default: } }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
@FXML private void onActionButtonAddFilter(ActionEvent event) { filterFrame.show();// ww w. ja va2 s . c o m filterFrame.setOnHidden(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { if (filterFrameController.getFilter() != null) { listviewFilters.getItems().addAll(filterFrameController.getFilter()); } } }); }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
private PointCloudFilterPaneComponent addPointcloudFilterComponent() { final PointCloudFilterPaneComponent pcfpc = new PointCloudFilterPaneComponent(); pcfpc.getButtonRemovePointCloudFilter().setOnAction(new EventHandler<ActionEvent>() { @Override/* w w w . j a v a 2 s . co m*/ public void handle(ActionEvent event) { vBoxPointCloudFiltering.getChildren().remove(pcfpc); } }); pcfpc.getButtonOpenPointCloudFile().setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { if (lastFCOpenPointCloudFile != null) { fileChooserOpenPointCloudFile.setInitialDirectory(lastFCOpenPointCloudFile.getParentFile()); } File selectedFile = fileChooserOpenPointCloudFile.showOpenDialog(stage); if (selectedFile != null) { lastFCOpenPointCloudFile = selectedFile; textFileParserFrameController.setColumnAssignment(true); textFileParserFrameController.setColumnAssignmentValues("Ignore", "X", "Y", "Z"); textFileParserFrameController.setColumnAssignmentDefaultSelectedIndex(0, 1); textFileParserFrameController.setColumnAssignmentDefaultSelectedIndex(1, 2); textFileParserFrameController.setColumnAssignmentDefaultSelectedIndex(2, 3); textFileParserFrameController.setColumnAssignmentDefaultSelectedIndex(3, 4); textFileParserFrameController.setHeaderExtractionEnabled(true); textFileParserFrameController.setSeparator(","); try { textFileParserFrameController.setTextFile(selectedFile); } catch (IOException ex) { showErrorDialog(ex); return; } Stage textFileParserFrame = textFileParserFrameController.getStage(); textFileParserFrame.show(); textFileParserFrame.setOnHidden(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { CSVFile file = new CSVFile(selectedFile.getAbsolutePath()); file.setColumnSeparator(textFileParserFrameController.getSeparator()); file.setColumnAssignment(textFileParserFrameController.getAssignedColumnsItemsMap()); file.setNbOfLinesToRead(textFileParserFrameController.getNumberOfLines()); file.setNbOfLinesToSkip(textFileParserFrameController.getSkipLinesNumber()); file.setContainsHeader(textFileParserFrameController.getHeaderIndex() != -1); file.setHeaderIndex(textFileParserFrameController.getHeaderIndex()); pcfpc.setCSVFile(file); } }); } } }); pcfpc.disableContent(!checkboxUsePointcloudFilter.isSelected()); vBoxPointCloudFiltering.getChildren().add(pcfpc); return pcfpc; }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
private void exportDartPlots(final File voxelFile) { if (Util.checkIfVoxelFile(voxelFile)) { fileChooserSaveDartFile.setInitialFileName("plots.xml"); fileChooserSaveDartFile.setInitialDirectory(voxelFile.getParentFile()); final File plotFile = fileChooserSaveDartFile.showSaveDialog(stage); if (plotFile != null) { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle("Coordinate system"); alert.setContentText("Choose your coordinate system"); ButtonType buttonTypeGlobal = new ButtonType("Global"); ButtonType buttonTypeLocal = new ButtonType("Local"); alert.getButtonTypes().setAll(buttonTypeGlobal, buttonTypeLocal); Optional<ButtonType> result = alert.showAndWait(); final boolean global; if (result.get() == buttonTypeGlobal) { global = true;//from www . j av a 2 s . c o m } else if (result.get() == buttonTypeLocal) { global = false; } else { return; } final DartPlotsXMLWriter dartPlotsXML = new DartPlotsXMLWriter(); final Service service = new Service() { @Override protected Task createTask() { return new Task<Object>() { @Override protected Object call() throws Exception { dartPlotsXML.writeFromVoxelFile(voxelFile, plotFile, global); return null; } }; } }; ProgressDialog progressDialog = new ProgressDialog(service); progressDialog.show(); service.start(); Button buttonCancel = new Button("cancel"); progressDialog.setGraphic(buttonCancel); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { service.cancel(); dartPlotsXML.setCancelled(true); } }); } } else { logger.error("File is not a voxel file: " + voxelFile.getAbsolutePath()); Alert alert = new Alert(AlertType.CONFIRMATION); alert.setHeaderText("Incorrect file"); alert.setContentText("File is corrupted or cannot be read!\n" + "Do you want to keep it?"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.CANCEL) { listViewProductsFiles.getItems().remove(voxelFile); } } }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
@FXML private void onActionButtonAddPeriodToPeriodList(ActionEvent event) { dateChooserFrameController.reset();/* ww w . j a va2s . c om*/ dateChooserFrame.setOnHidden(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { if (dateChooserFrameController.isConfirmed()) { SimulationPeriod period = dateChooserFrameController.getDateRange(); if (period != null) { data.add(period); } } } }); dateChooserFrame.show(); }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
@FXML private void onActionButtonSetVOPMatrix(ActionEvent event) { transformationFrameController.reset(); transformationFrameController.fillMatrix(vopMatrix); transformationFrame.setOnHidden(new EventHandler<WindowEvent>() { @Override/*from w w w .j av a2 s.c o m*/ public void handle(WindowEvent event) { if (transformationFrameController.isConfirmed()) { vopMatrix = transformationFrameController.getMatrix(); if (vopMatrix == null) { vopMatrix = new Matrix4d(); vopMatrix.setIdentity(); } updateResultMatrix(); } } }); transformationFrame.show(); }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
@FXML private void onActionButtonSetupViewCap(ActionEvent event) { if (toggleButtonLAI2000Choice.isSelected()) { viewCapsSetupFrameController.setViewCapAngles(ViewCapsSetupFrameController.ViewCaps.LAI_2000); } else if (toggleButtonLAI2200Choice.isSelected()) { viewCapsSetupFrameController.setViewCapAngles(ViewCapsSetupFrameController.ViewCaps.LAI_2200); }/*from ww w . j a va 2s .c om*/ viewCapsSetupFrame.setOnHidden(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { if (viewCapsSetupFrameController.isConfirmed()) { textFieldViewCapAngleCanopyAnalyzer .setText(String.valueOf(viewCapsSetupFrameController.getAngle())); } } }); viewCapsSetupFrame.show(); }
From source file:org.simmi.GeneSetHead.java
License:asdf
public void fetchGenomes() { if (geneset.zippath == null) { newFile();/*w w w . jav a 2s . c o m*/ } VBox vbox = new VBox(); Stage stage = new Stage(); stage.setTitle("Fetch genomes"); stage.setScene(new Scene(vbox)); stage.initOwner(primaryStage); //frame.setSize(400, 600); try { Map<String, String> env = new HashMap<>(); env.put("create", "true"); //Path path = zipfile.toPath(); String uristr = "jar:" + geneset.zippath.toUri(); geneset.zipuri = URI.create(uristr /*.replace("file://", "file:")*/ ); geneset.zipfilesystem = FileSystems.newFileSystem(geneset.zipuri, env); final SerifyApplet sa = new SerifyApplet(geneset.zipfilesystem); sa.init(frame, vbox, geneset.user); for (Path root : geneset.zipfilesystem.getRootDirectories()) { Files.list(root).filter(t -> { String fname = t.getFileName().toString(); return /*fname.endsWith(".gbk") || */fname.endsWith(".fna") || fname.endsWith("fastg") || fname.endsWith(".fsa") || fname.endsWith(".fa") || fname.endsWith(".fasta") || fname.endsWith(".aa") || fname.endsWith(".nn") || fname.endsWith(".trna") || fname.endsWith(".rrna") || fname.endsWith(".ssu") || fname.endsWith(".lsu") || fname.endsWith(".tsu"); }).forEach(t -> { try { sa.addSequences(t.getFileName().toString(), t, null); } catch (URISyntaxException | IOException e) { e.printStackTrace(); } }); ; } } catch (IOException e1) { try { geneset.zipfilesystem.close(); } catch (IOException e2) { e2.printStackTrace(); } e1.printStackTrace(); } //BufferedWriter bw = Files.newBufferedWriter(nf, StandardOpenOption.CREATE); //InputStream is = new GZIPInputStream( new FileInputStream( fc.getSelectedFile() ) ); //uni2symbol(new InputStreamReader(is), bw, unimap); //bw.close(); //long bl = Files.copy( new ByteArrayInputStream( baos.toByteArray() ), nf, StandardCopyOption.REPLACE_EXISTING ); /*frame.addWindowListener( new WindowListener() { @Override public void windowOpened(WindowEvent e) {} @Override public void windowIconified(WindowEvent e) {} @Override public void windowDeiconified(WindowEvent e) {} @Override public void windowDeactivated(WindowEvent e) {} @Override public void windowClosing(WindowEvent e) {} @Override public void windowClosed(WindowEvent e) { try { geneset.zipfilesystem.close(); geneset.cleanUp(); importStuff(); } catch (IOException | UnavailableServiceException e1) { e1.printStackTrace(); } } @Override public void windowActivated(WindowEvent e) {} }); frame.setVisible( true );*/ stage.setOnCloseRequest(new EventHandler<WindowEvent>() { public void handle(WindowEvent event) { try { geneset.zipfilesystem.close(); geneset.cleanUp(); importStuff(); } catch (IOException | UnavailableServiceException e1) { e1.printStackTrace(); } } }); stage.show(); }
From source file:Pages.LandingPage.java
public void profilePicture(String picture, Stage theStage) { // <editor-fold defaultstate="collapsed" desc="Circle Image"> profile_pic = (new ImageView(new Image(picture))); Rectangle square = new Rectangle(); square.setWidth(150);/* w w w . jav a2 s .c om*/ square.setHeight(150); profile_pic.setClip(square); Circle clip = new Circle(); clip.setCenterX(75); clip.setCenterY(75); clip.setRadius(75); profile_pic.fitWidthProperty().bind(square.widthProperty()); profile_pic.fitHeightProperty().bind(square.heightProperty()); profile_pic.setClip(clip); profile_pic.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent arg0) { createProfilePicture(theStage); } }); userbox.getChildren().add(profile_pic); // </editor-fold> }