@FXML void chooseFile(ActionEvent event) { FileChooser openFileDialog = new FileChooser(); openFileDialog.setTitle(CurlyApp.getMessage(CHOOSE_TEXT_OR_EXCEL)); File selected = openFileDialog.showOpenDialog(null); if (selected != null && selected.exists() && selected.isFile()) { openFile(selected); } }
@FXML // This method is called by the FXMLLoader when initialization is complete void initialize() { assert currentFileName != null : "fx:id=\"currentFileName\" was not injected: check your FXML file 'DataImporter.fxml'."; assert worksheetSelector != null : "fx:id=\"worksheetSelector\" was not injected: check your FXML file 'DataImporter.fxml'."; assert contentTable != null : "fx:id=\"contentTable\" was not injected: check your FXML file 'DataImporter.fxml'."; assert skipFirstSelection != null : "fx:id=\"skipFirstSelection\" was not injected: check your FXML file 'DataImporter.fxml'."; worksheetSelector.getSelectionModel().selectedItemProperty().addListener(this::changeSheet); List<Integer> zeroThroughTen = IntStream.range(0, 10).boxed().collect(Collectors.toList()); skipFirstSelection.setItems(new ObservableListWrapper<>(zeroThroughTen)); Platform.runLater(() -> skipFirstSelection.getSelectionModel().selectFirst()); contentTable.setPlaceholder(new Label(CurlyApp.getMessage(NO_DATA_LOADED))); }