List of usage examples for javafx.scene.control SelectionMode MULTIPLE
SelectionMode MULTIPLE
To view the source code for javafx.scene.control SelectionMode MULTIPLE.
Click Source Link
From source file:com.ggvaidya.scinames.ui.BulkChangeEditorController.java
private void setupChangesTableView() { changesTableView.setEditable(true);//from ww w . j av a 2 s . co m changesTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); changesTableView.getColumns().clear(); TableColumn<PotentialChange, ChangeType> colChangeType = new TableColumn<>("Type"); colChangeType.setCellFactory(ComboBoxTableCell.forTableColumn(new ChangeTypeStringConverter(), ChangeType.ADDITION, ChangeType.DELETION, ChangeType.RENAME, ChangeType.LUMP, ChangeType.SPLIT, ChangeType.ERROR)); colChangeType.setCellValueFactory(new PropertyValueFactory<>("type")); colChangeType.setPrefWidth(100.0); colChangeType.setEditable(true); changesTableView.getColumns().add(colChangeType); TableColumn<PotentialChange, ObservableSet<Name>> colChangeFrom = new TableColumn<>("From"); colChangeFrom.setCellFactory(TextFieldTableCell.forTableColumn(new NameSetStringConverter())); colChangeFrom.setCellValueFactory(new PropertyValueFactory<>("from")); colChangeFrom.setPrefWidth(200.0); colChangeFrom.setEditable(true); changesTableView.getColumns().add(colChangeFrom); TableColumn<PotentialChange, ObservableSet<Name>> colChangeTo = new TableColumn<>("To"); colChangeTo.setCellFactory(TextFieldTableCell.forTableColumn(new NameSetStringConverter())); colChangeTo.setCellValueFactory(new PropertyValueFactory<>("to")); colChangeTo.setPrefWidth(200.0); colChangeTo.setEditable(true); changesTableView.getColumns().add(colChangeTo); TableColumn<PotentialChange, String> colChangeDataset = new TableColumn<>("Dataset"); colChangeDataset.setCellValueFactory(new PropertyValueFactory<>("dataset")); colChangeDataset.setPrefWidth(100.0); changesTableView.getColumns().add(colChangeDataset); ChangeFilter cf = project.getChangeFilter(); TableColumn<PotentialChange, String> colFiltered = new TableColumn<>("Eliminated by filter?"); colFiltered.setCellValueFactory( (TableColumn.CellDataFeatures<PotentialChange, String> features) -> new ReadOnlyStringWrapper( cf.test(features.getValue()) ? "Allowed" : "Eliminated")); changesTableView.getColumns().add(colFiltered); TableColumn<PotentialChange, String> colNote = new TableColumn<>("Note"); colNote.setCellFactory(TextFieldTableCell.forTableColumn()); colNote.setCellValueFactory(new PropertyValueFactory<>("note")); colNote.setPrefWidth(100.0); colNote.setEditable(true); changesTableView.getColumns().add(colNote); TableColumn<PotentialChange, String> colProperties = new TableColumn<>("Properties"); colProperties.setCellValueFactory( (TableColumn.CellDataFeatures<PotentialChange, String> features) -> new ReadOnlyStringWrapper( features.getValue().getProperties().entrySet().stream() .map(entry -> entry.getKey() + ": " + entry.getValue()).sorted() .collect(Collectors.joining("; ")))); changesTableView.getColumns().add(colProperties); TableColumn<PotentialChange, String> colCitations = new TableColumn<>("Citations"); colCitations.setCellValueFactory( (TableColumn.CellDataFeatures<PotentialChange, String> features) -> new ReadOnlyStringWrapper( features.getValue().getCitationStream().map(citation -> citation.getCitation()).sorted() .collect(Collectors.joining("; ")))); changesTableView.getColumns().add(colCitations); TableColumn<PotentialChange, String> colGenera = new TableColumn<>("Genera"); colGenera.setCellValueFactory( (TableColumn.CellDataFeatures<PotentialChange, String> features) -> new ReadOnlyStringWrapper( String.join(", ", features.getValue().getAllNames().stream().map(n -> n.getGenus()) .distinct().sorted().collect(Collectors.toList())))); changesTableView.getColumns().add(colGenera); TableColumn<PotentialChange, String> colSpecificEpithet = new TableColumn<>("Specific epithet"); colSpecificEpithet.setCellValueFactory( (TableColumn.CellDataFeatures<PotentialChange, String> features) -> new ReadOnlyStringWrapper(String .join(", ", features.getValue().getAllNames().stream().map(n -> n.getSpecificEpithet()) .filter(s -> s != null).distinct().sorted().collect(Collectors.toList())))); changesTableView.getColumns().add(colSpecificEpithet); // TODO: if we can get an ObservableList over tp.getAllChanges(), then this table // will update dynamically as changes are made. Won't that be something. // Yes, we want to getAllChanges() so we can see which ones are filtered out. changesTableView.setItems(foundChanges); changesTableView.getSortOrder().add(colChangeType); }
From source file:de.perdoctus.ebikeconnect.gui.ActivitiesOverviewController.java
@FXML public void initialize() { logger.info("Init!"); NUMBER_FORMAT.setMaximumFractionDigits(2); webEngine = webView.getEngine();//from w w w . j ava2 s . com webEngine.load(getClass().getResource("/html/googleMap.html").toExternalForm()); // Activity Headers activityDaysHeaderService.setOnSucceeded(event -> { activitiesTable.setItems(FXCollections.observableArrayList(activityDaysHeaderService.getValue())); activitiesTable.getSortOrder().add(tcDate); tcDate.setSortable(true); }); activityDaysHeaderService.setOnFailed( event -> logger.error("Failed to obtain ActivityList!", activityDaysHeaderService.getException())); final ProgressDialog activityHeadersProgressDialog = new ProgressDialog(activityDaysHeaderService); activityHeadersProgressDialog.initModality(Modality.APPLICATION_MODAL); // Activity Details activityDetailsGroupService.setOnSucceeded( event -> this.currentActivityDetailsGroup.setValue(activityDetailsGroupService.getValue())); activityDetailsGroupService.setOnFailed(event -> logger.error("Failed to obtain ActivityDetails!", activityDaysHeaderService.getException())); final ProgressDialog activityDetailsProgressDialog = new ProgressDialog(activityDetailsGroupService); activityDetailsProgressDialog.initModality(Modality.APPLICATION_MODAL); // Gpx Export gpxExportService.setOnSucceeded(event -> gpxExportFinished()); gpxExportService .setOnFailed(event -> handleError("Failed to generate GPX File", gpxExportService.getException())); tcxExportService.setOnSucceeded(event -> gpxExportFinished()); tcxExportService .setOnFailed(event -> handleError("Failed to generate TCX File", tcxExportService.getException())); // ActivityTable tcDate.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getDate())); tcDate.setCellFactory(param -> new LocalDateCellFactory()); tcDate.setSortType(TableColumn.SortType.DESCENDING); tcDistance.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getDistance() / 1000)); tcDistance.setCellFactory(param -> new NumberCellFactory(1, "km")); tcDuration.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getDrivingTime())); tcDuration.setCellFactory(param -> new DurationCellFactory()); activitiesTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); activitiesTable.getSelectionModel().getSelectedItems() .addListener((ListChangeListener<ActivityHeaderGroup>) c -> { while (c.next()) { if (c.wasRemoved()) { for (ActivityHeaderGroup activityHeaderGroup : c.getRemoved()) { lstSegments.getItems().removeAll(activityHeaderGroup.getActivityHeaders()); } } if (c.wasAdded()) { for (ActivityHeaderGroup activityHeaderGroup : c.getAddedSubList()) { if (activityHeaderGroup != null) { // WTF? Why can this be null!? lstSegments.getItems().addAll(activityHeaderGroup.getActivityHeaders()); } } } } lstSegments.getItems().sort((o1, o2) -> o1.getStartTime().isAfter(o2.getStartTime()) ? 1 : 0); }); activitiesTable.setOnMouseClicked(event -> { if (event.getClickCount() == 2) { lstSegments.getCheckModel().checkAll(); openSelectedSections(); } }); // Segment List lstSegments .setCellFactory(listView -> new CheckBoxListCell<>(item -> lstSegments.getItemBooleanProperty(item), new StringConverter<ActivityHeader>() { @Override public ActivityHeader fromString(String arg0) { return null; } @Override public String toString(ActivityHeader activityHeader) { final String startTime = activityHeader.getStartTime().format(DATE_TIME_FORMATTER); final String endTime = activityHeader.getEndTime().format(TIME_FORMATTER); final double distance = activityHeader.getDistance() / 1000; return startTime + " - " + endTime + " (" + NUMBER_FORMAT.format(distance) + " km)"; } })); // -- Chart chartRangeSlider.setLowValue(0); chartRangeSlider.setHighValue(chartRangeSlider.getMax()); xAxis.setAutoRanging(false); xAxis.lowerBoundProperty().bind(chartRangeSlider.lowValueProperty()); xAxis.upperBoundProperty().bind(chartRangeSlider.highValueProperty()); xAxis.tickUnitProperty().bind( chartRangeSlider.highValueProperty().subtract(chartRangeSlider.lowValueProperty()).divide(20)); xAxis.setTickLabelFormatter(new StringConverter<Number>() { @Override public String toString(Number object) { final Duration duration = Duration.of(object.intValue(), ChronoUnit.SECONDS); return String.valueOf(DurationFormatter.formatHhMmSs(duration)); } @Override public Number fromString(String string) { return null; } }); chart.getChart().setOnScroll(event -> { final double scrollAmount = event.getDeltaY(); chartRangeSlider.setLowValue(chartRangeSlider.getLowValue() + scrollAmount); chartRangeSlider.setHighValue(chartRangeSlider.getHighValue() - scrollAmount); }); xAxis.setOnMouseMoved(event -> { if (getCurrentActivityDetailsGroup() == null) { return; } final Number valueForDisplay = xAxis.getValueForDisplay(event.getX()); final List<Coordinate> trackpoints = getCurrentActivityDetailsGroup().getJoinedTrackpoints(); final int index = valueForDisplay.intValue(); if (index >= 0 && index < trackpoints.size()) { final Coordinate coordinate = trackpoints.get(index); if (coordinate.isValid()) { final LatLng latLng = new LatLng(coordinate); try { webEngine.executeScript( "updateMarkerPosition(" + objectMapper.writeValueAsString(latLng) + ");"); } catch (JsonProcessingException e) { e.printStackTrace(); //TODO clean up ugly code!!!!-------------- } } } }); // -- Current ActivityDetails this.currentActivityDetailsGroup.addListener((observable, oldValue, newValue) -> { if (newValue != null) { activityGroupChanged(newValue); } }); }
From source file:com.exalttech.trex.ui.views.PacketTableView.java
/** * Build component UI//from ww w . j av a2 s. co m */ private void buildUI(boolean addExportToYamlBtn) { setTopAnchor(this, 0d); setLeftAnchor(this, 0d); setBottomAnchor(this, 0d); setRightAnchor(this, 0d); // build btn bar HBox buttonContainer = new HBox(); buttonContainer.setSpacing(5); addPacketBtn = new StreamTableButton(StreamTableAction.ADD); initializeStreamButtons(addPacketBtn, false); buttonContainer.getChildren().add(addPacketBtn); // add build stream btn buildPacketBtn = new StreamTableButton(StreamTableAction.BUILD); buildPacketBtn.setId("buildStreamBtn"); initializeStreamButtons(buildPacketBtn, false); buttonContainer.getChildren().add(buildPacketBtn); editPacketBtn = new StreamTableButton(StreamTableAction.EDIT); editPacketBtn.setId("editStreanBtn"); initializeStreamButtons(editPacketBtn, true); buttonContainer.getChildren().add(editPacketBtn); deleteButtonBtn = new StreamTableButton(StreamTableAction.DELETE); initializeStreamButtons(deleteButtonBtn, true); buttonContainer.getChildren().add(deleteButtonBtn); importPcapButton = new StreamTableButton(StreamTableAction.IMPORT_PCAP); initializeStreamButtons(importPcapButton, false); buttonContainer.getChildren().add(importPcapButton); exportPcapButton = new StreamTableButton(StreamTableAction.EXPORT_TO_PCAP); initializeStreamButtons(exportPcapButton, true); buttonContainer.getChildren().add(exportPcapButton); if (addExportToYamlBtn) { exportToYaml = new StreamTableButton(StreamTableAction.EXPORT_TO_YAML); initializeStreamButtons(exportToYaml, false); buttonContainer.getChildren().add(exportToYaml); } getChildren().add(buttonContainer); setTopAnchor(buttonContainer, 5d); rightClickMenu = new ContextMenu(); addMenuItem(StreamTableAction.EDIT); addMenuItem(StreamTableAction.DELETE); addMenuItem(StreamTableAction.EXPORT_TO_PCAP); addMenuItem(StreamTableAction.EXPORT_TO_YAML); // add table view streamPacketTableView = new TableView<>(); streamPacketTableView.setId("streamTableView"); streamPacketTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); streamPacketTableView.setFixedCellSize(32); streamPacketTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); streamPacketTableView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { handleTableRowClick(event); } }); streamPacketTableView.getSelectionModel().selectedItemProperty() .addListener((ObservableValue<? extends TableProfileStream> observable, TableProfileStream oldValue, TableProfileStream newValue) -> { boolean notSelected = !(newValue != null); exportPcapButton.setDisable(notSelected); editPacketBtn.setDisable(notSelected); deleteButtonBtn.setDisable(notSelected); }); streamPacketTableView.addEventFilter(KeyEvent.KEY_RELEASED, (KeyEvent event) -> { if (copyCombination.match(event)) { selectedProfile = tabledata.getProfiles() .get(streamPacketTableView.getSelectionModel().getSelectedIndex()); } else if (pasteCombination.match(event)) { handleDuplicateStream(); } else if (event.getCode() == KeyCode.DELETE) { handleDeletePacket(); } }); streamPacketTableView.setEditable(true); initializeTableColumn(); // disable table reordering streamPacketTableView.widthProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> source, Number oldWidth, Number newWidth) { TableHeaderRow header = (TableHeaderRow) streamPacketTableView.lookup("TableHeaderRow"); header.reorderingProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { header.setReordering(false); } }); } }); getChildren().add(streamPacketTableView); setTopAnchor(streamPacketTableView, 35d); setBottomAnchor(streamPacketTableView, 5d); setLeftAnchor(streamPacketTableView, 0d); setRightAnchor(streamPacketTableView, 0d); }
From source file:de.dkfz.roddy.client.fxuiclient.RoddyUIController.java
@Override public void initialize(URL url, ResourceBundle resourceBundle) { instance = this; txtDataSetFilter.textProperty().addListener((observableValue, s, s2) -> refillListOfDataSets()); comboBoxApplicationIniFiles.getSelectionModel().selectedItemProperty().addListener( (observableValue, old, newValue) -> selectedApplicationIniChanged(newValue.toString())); comboBoxApplicationIniFiles.getItems() .addAll(RoddyIOHelperMethods.readTextFile(getUiSettingsFileForIniFiles())); projectTree.setCellFactory(treeView -> new ProjectTreeItemCellImplementation(projectTree, instance)); projectTree.getSelectionModel().selectedItemProperty() .addListener((observableValue, oldValue, newValue) -> { TreeItem<FXICCWrapper> pWrapper = (TreeItem<FXICCWrapper>) projectTree.getSelectionModel() .getSelectedItem(); if (pWrapper == null) return; changeSelectedProject(pWrapper.getValue()); });/*from www .j av a 2 s .com*/ listViewDataSets.setCellFactory(listView -> new GenericListViewItemCellImplementation()); listViewDataSets.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); listViewDataSets.getSelectionModel().selectedItemProperty() .addListener((observableValue, old, newValue) -> selectedDataSetsChanged()); currentListOfDataSets.addListener((ListChangeListener<FXDataSetWrapper>) change -> refillListOfDataSets()); String txtAnalysisIDFilter = Roddy.getApplicationProperty(RunMode.UI, APP_PROPERTY_FILTER_ANALYSISID, StringConstants.EMPTY); String txtIDFilter = Roddy.getApplicationProperty(RunMode.UI, APP_PROPERTY_FILTER_PROJECTID, StringConstants.EMPTY); Boolean filterHideUnprocessable = Boolean.parseBoolean(Roddy.getApplicationProperty(RunMode.UI, APP_PROPERTY_FILTER_HIDE_UNPROCESSABLE, Boolean.FALSE.toString())); txtProjectFilterByAnalysis.setText(txtAnalysisIDFilter); txtProjectFilterByID.setText(txtIDFilter); txtProjectFilterByAnalysis.textProperty() .addListener((observableValue, oldValue, newValue) -> refreshProjectView(null)); txtProjectFilterByID.textProperty() .addListener((observableValue, oldValue, newValue) -> refreshProjectView(null)); cbProjectFilterHideUnprocessable.setSelected(filterHideUnprocessable); txtProjectFilterByAnalysis.textProperty().addListener((observableValue, oldValue, newValue) -> Roddy .setApplicationProperty(RunMode.UI, APP_PROPERTY_FILTER_ANALYSISID, newValue)); txtProjectFilterByID.textProperty().addListener((observableValue, oldValue, newValue) -> Roddy .setApplicationProperty(RunMode.UI, APP_PROPERTY_FILTER_ANALYSISID, newValue)); cbProjectFilterHideUnprocessable.selectedProperty() .addListener((observableValue, aBoolean, newValue) -> Roddy.setApplicationProperty(RunMode.UI, APP_PROPERTY_FILTER_HIDE_UNPROCESSABLE, newValue.toString())); setupTitlePaneExpansionProcessing(tpProjectFilterSettings, APP_PROPERTY_PROJECT_FILTER_SETTINGS_OPENED, Boolean.TRUE); setupTitlePaneExpansionProcessing(tpProjectSettings, APP_PROPERTY_PROJECT_SETTINGS_OPENED, Boolean.TRUE); setupTitlePaneExpansionProcessing(tpProjectDataSetFilter, APP_PROPERTY_PROJECT_DATASET_FILTER_OPENED, Boolean.TRUE); RoddyUITask.activeListOfTasksProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { RoddyUITask.invokeASAP(new Runnable() { @Override public void run() { listViewOfActiveUITasks.getItems().clear(); listViewOfActiveUITasks.getItems().addAll(RoddyUITask.activeListOfTasksProperty().values()); } }, "donttrack::Update tasklist", false); } }); startUIUpdateThread(); }
From source file:jobhunter.gui.FXMLController.java
@Override public void initialize(URL url, ResourceBundle rb) { this.bundle = rb; UpdateableListViewSkin<Subscription> skin = new UpdateableListViewSkin<>(this.subscriptionsList); this.subscriptionsList.setSkin(skin); feedErrorLabel.setText(getTranslation("message.feed.failed")); feedErrorLabel.getStyleClass().add("error-label"); developmentMenu.setVisible(ApplicationState.isDebug()); if (PreferencesController.isLastFilePathSet()) { final File fout = new File(PreferencesController.getLastFilePath()); ProfileRepository.load(fout);//from w ww . j a v a 2 s . co m SubscriptionRepository.load(fout); } else { ProfileRepository.getProfile(); } ProfileRepository.setListener(() -> { // Listen for change events in the repo and react refresh(); autosave(); }); subscriptionController.setOnUpdate(e -> { l.debug("Subscription Controller onUpdate"); JavaFXUtils.toast(statusLabel, getTranslation("message.all.feeds.updated")); UpdateableListViewSkin.cast(subscriptionsList.getSkin()).refresh(); autosave(); }); subscriptionController.setOnAdd(e -> { l.debug("Subscription Controller onAdd"); refresh(); autosave(); }); jobsList.setCellFactory(new JobCell.JobCellCallback()); subscriptionsList.setCellFactory(new SubscriptionListCell.CellCallback()); // Initialize the table dateColumn.setCellValueFactory(SubscriptionRow.DATE_VALUE); dateColumn.setCellFactory(SubscriptionRow::getCellFactory); positionColumn.setCellValueFactory(SubscriptionRow.POSITION_VALUE); subscriptionItemsTable.setRowFactory(SubscriptionRow::create); subscriptionItemsTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); this.webViewRenderer = new WebViewRenderer(mainWebView); WebViewOnClickListener.set(mainWebView); // Load Plugins loadPlugIns(null); refresh(); }
From source file:acmi.l2.clientmod.l2smr.Controller.java
private void initializeUnr() { mapsDirProperty().addListener((observable, oldValue, newValue) -> { unrChooser.getSelectionModel().clearSelection(); unrChooser.getItems().clear();//from www . j a v a 2 s. co 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); } }); }
From source file:com.github.drbookings.ui.controller.MainController.java
private void initTableView() { setTableColumns();/*from ww w .j ava 2 s .c o m*/ tableView.getSelectionModel().getSelectedCells() .addListener((final ListChangeListener.Change<? extends TablePosition> c) -> { rowsWithSelectedCells.clear(); final Set<Integer> rows = tableView.getSelectionModel().getSelectedCells().stream() .map(pos -> pos.getRow()).collect(Collectors.toSet()); rowsWithSelectedCells.addAll(rows); }); // tableView.setItems(dataModel.getData()); tableView.setItems(manager.getUIData()); tableView.getSelectionModel().setCellSelectionEnabled(true); tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); initTableViewContextMenus(); }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
private void initPostProcessTab() { //initialize voxel file merging panel listViewVoxMergingVoxelFiles.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); listViewVoxMergingVoxelFiles.setOnDragOver(DragAndDropHelper.dragOverEvent); listViewVoxMergingVoxelFiles.setOnDragDropped(new EventHandler<DragEvent>() { @Override/* www . j a v a 2s .c o m*/ public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles()) { success = true; for (File file : db.getFiles()) { addVoxelFileToMergingList(file); } } event.setDropCompleted(success); event.consume(); } }); fileChooserVoxMergingList = new FileChooserContext(); fileChooserOpenInputFileButterflyRemover = new FileChooserContext(); fileChooserOpenOutputFileButterflyRemover = new FileChooserContext(); fileChooserChooseOutputCfgFileButterflyRemover = new FileChooserContext(); }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
/** * Initializes the controller class.// w w w .ja v a 2 s . c o m */ @Override public void initialize(URL url, ResourceBundle rb) { this.resourceBundle = rb; viewer3DPanelController.setResourceBundle(rb); initStrings(rb); colorPickerSeries.valueProperty().addListener(new ChangeListener<javafx.scene.paint.Color>() { @Override public void changed(ObservableValue<? extends javafx.scene.paint.Color> observable, javafx.scene.paint.Color oldValue, javafx.scene.paint.Color newValue) { if (listViewVoxelsFilesChart.getSelectionModel().getSelectedItems().size() == 1) { listViewVoxelsFilesChart.getSelectionModel().getSelectedItem().getSeriesParameters() .setColor(new Color((float) newValue.getRed(), (float) newValue.getGreen(), (float) newValue.getBlue(), 1.0f)); } } }); comboboxScript.getItems().setAll("Daniel script"); vboxWeighting.disableProperty().bind(checkboxEnableWeighting.selectedProperty().not()); checkboxEnableWeighting.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue && textAreaWeighting.getText().isEmpty()) { int selectedVoxTab = tabPaneVoxelisation.getSelectionModel().getSelectedIndex(); if (selectedVoxTab == 0) { //ALS fillWeightingData(EchoesWeightParams.DEFAULT_ALS_WEIGHTING); } else if (selectedVoxTab == 1) { //TLS fillWeightingData(EchoesWeightParams.DEFAULT_TLS_WEIGHTING); } } } }); /*comboboxTransMode.getItems().setAll(1, 2, 3); comboboxTransMode.getSelectionModel().selectFirst(); comboboxPathLengthMode.getItems().setAll("A", "B"); comboboxPathLengthMode.getSelectionModel().selectFirst();*/ helpButtonNaNsCorrection.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { helpButtonNaNsCorrectionController.showHelpDialog(resourceBundle.getString("help_NaNs_correction")); } }); helpButtonAutoBBox.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { helpButtonAutoBBoxController.showHelpDialog(resourceBundle.getString("help_bbox")); } }); helpButtonHemiPhoto.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { helpButtonHemiPhotoController.showHelpDialog(resourceBundle.getString("help_hemiphoto")); } }); buttonHelpEmptyShotsFilter.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { buttonHelpEmptyShotsFilterController .showHelpDialog(resourceBundle.getString("help_empty_shots_filter")); } }); /*work around, the divider positions values are defined in the fxml, but when the window is initialized the values are lost*/ Platform.runLater(new Runnable() { @Override public void run() { splitPaneMain.setDividerPositions(0.75f); splitPaneVoxelization.setDividerPositions(0.45f); } }); initValidationSupport(); initPostProcessTab(); listViewTransmittanceMapSensorPositions.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); listViewTaskList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); MenuItem menuItemPadValue1m = new MenuItem("1m voxel size"); addMenuItemPadValue(menuItemPadValue1m, 3.536958f); MenuItem menuItemPadValue2m = new MenuItem("2m voxel size"); addMenuItemPadValue(menuItemPadValue2m, 2.262798f); MenuItem menuItemPadValue3m = new MenuItem("3m voxel size"); addMenuItemPadValue(menuItemPadValue3m, 1.749859f); MenuItem menuItemPadValue4m = new MenuItem("4m voxel size"); addMenuItemPadValue(menuItemPadValue4m, 1.3882959f); MenuItem menuItemPadValue5m = new MenuItem("5m voxel size"); addMenuItemPadValue(menuItemPadValue5m, 1.0848f); menuButtonAdvisablePADMaxValues.getItems().addAll(menuItemPadValue1m, menuItemPadValue2m, menuItemPadValue3m, menuItemPadValue4m, menuItemPadValue5m); fileChooserSaveCanopyAnalyserOutputFile = new FileChooserContext(); fileChooserSaveCanopyAnalyserCfgFile = new FileChooserContext(); fileChooserSaveTransmittanceSimCfgFile = new FileChooserContext(); fileChooserOpenCanopyAnalyserInputFile = new FileChooserContext(); listViewCanopyAnalyzerSensorPositions.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); ContextMenu contextMenuProductsList = new ContextMenu(); MenuItem openImageItem = new MenuItem(RS_STR_OPEN_IMAGE); openImageItem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedFile = listViewProductsFiles.getSelectionModel().getSelectedItem(); showImage(selectedFile); } }); Menu menuEdit = new Menu(RS_STR_EDIT); MenuItem menuItemEditVoxels = new MenuItem("Remove voxels (delete key)"); MenuItem menuItemFitToContent = new MenuItem("Fit to content"); MenuItem menuItemCrop = new MenuItem("Crop"); menuEdit.getItems().setAll(menuItemEditVoxels, menuItemFitToContent, menuItemCrop); menuItemFitToContent.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { fitVoxelSpaceToContent(selectedItem); } } }); menuItemEditVoxels.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { editVoxelSpace(selectedItem); } } }); menuItemCrop.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { try { voxelSpaceCroppingFrameController.setVoxelFile(selectedItem); voxelSpaceCroppingFrame.show(); } catch (Exception ex) { showErrorDialog(ex); } } } }); Menu menuExport = new Menu(RS_STR_EXPORT); MenuItem menuItemExportDartMaket = new MenuItem("Dart (maket.txt)"); MenuItem menuItemExportDartPlots = new MenuItem("Dart (plots.xml)"); MenuItem menuItemExportMeshObj = new MenuItem("Mesh (*.obj)"); menuItemExportDartMaket.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { exportDartMaket(selectedItem); } } }); menuItemExportDartPlots.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { exportDartPlots(selectedItem); } } }); menuItemExportMeshObj.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { exportMeshObj(selectedItem); } } }); menuExport.getItems().setAll(menuItemExportDartMaket, menuItemExportDartPlots, menuItemExportMeshObj); MenuItem menuItemInfo = new MenuItem(RS_STR_INFO); menuItemInfo.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Alert alert = new Alert(AlertType.INFORMATION); File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { VoxelFileReader reader; try { reader = new VoxelFileReader(selectedItem); VoxelSpaceInfos voxelSpaceInfos = reader.getVoxelSpaceInfos(); alert.setTitle("Information"); alert.setHeaderText("Voxel space informations"); alert.setContentText(voxelSpaceInfos.toString()); alert.show(); } catch (Exception ex) { showErrorDialog(ex); } } } }); final MenuItem menuItemOpenContainingFolder = new MenuItem(RS_STR_OPEN_CONTAINING_FOLDER); menuItemOpenContainingFolder.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { final File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { if (Desktop.isDesktopSupported()) { new Thread(() -> { try { Desktop.getDesktop().open(selectedItem.getParentFile()); } catch (IOException ex) { logger.error("Cannot open directory " + selectedItem); } }).start(); } } } }); listViewProductsFiles.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() { @Override public void handle(ContextMenuEvent event) { if (listViewProductsFiles.getSelectionModel().getSelectedIndices().size() == 1) { File selectedFile = listViewProductsFiles.getSelectionModel().getSelectedItem(); String extension = FileManager.getExtension(selectedFile); switch (extension) { case ".png": case ".bmp": case ".jpg": contextMenuProductsList.getItems().setAll(openImageItem, menuItemOpenContainingFolder); contextMenuProductsList.show(listViewProductsFiles, event.getScreenX(), event.getScreenY()); break; case ".vox": default: if (VoxelFileReader.isFileAVoxelFile(selectedFile)) { contextMenuProductsList.getItems().setAll(menuItemInfo, menuItemOpenContainingFolder, menuEdit, menuExport); contextMenuProductsList.show(listViewProductsFiles, event.getScreenX(), event.getScreenY()); } } } } }); ContextMenu contextMenuLidarScanEdit = new ContextMenu(); MenuItem editItem = new MenuItem("Edit"); editItem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { filterFrameController.setFilters("Reflectance", "Deviation", "Amplitude"); filterFrame.show(); filterFrame.setOnHidden(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { if (filterFrameController.getFilter() != null) { ObservableList<LidarScan> items = listViewHemiPhotoScans.getSelectionModel() .getSelectedItems(); for (LidarScan scan : items) { scan.filters.add(filterFrameController.getFilter()); } } } }); } }); contextMenuLidarScanEdit.getItems().add(editItem); listViewHemiPhotoScans.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); listViewHemiPhotoScans.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() { @Override public void handle(ContextMenuEvent event) { contextMenuLidarScanEdit.show(listViewHemiPhotoScans, event.getScreenX(), event.getScreenY()); } }); /**LAD tab initialization**/ comboboxLADChoice.getItems().addAll(LeafAngleDistribution.Type.UNIFORM, LeafAngleDistribution.Type.SPHERIC, LeafAngleDistribution.Type.ERECTOPHILE, LeafAngleDistribution.Type.PLANOPHILE, LeafAngleDistribution.Type.EXTREMOPHILE, LeafAngleDistribution.Type.PLAGIOPHILE, LeafAngleDistribution.Type.HORIZONTAL, LeafAngleDistribution.Type.VERTICAL, LeafAngleDistribution.Type.ELLIPSOIDAL, LeafAngleDistribution.Type.ELLIPTICAL, LeafAngleDistribution.Type.TWO_PARAMETER_BETA); comboboxLADChoice.getSelectionModel().select(LeafAngleDistribution.Type.SPHERIC); comboboxLADChoice.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<LeafAngleDistribution.Type>() { @Override public void changed(ObservableValue<? extends LeafAngleDistribution.Type> observable, LeafAngleDistribution.Type oldValue, LeafAngleDistribution.Type newValue) { if (newValue == LeafAngleDistribution.Type.TWO_PARAMETER_BETA || newValue == LeafAngleDistribution.Type.ELLIPSOIDAL) { hboxTwoBetaParameters.setVisible(true); if (newValue == LeafAngleDistribution.Type.ELLIPSOIDAL) { labelLADBeta.setVisible(false); } else { labelLADBeta.setVisible(true); } } else { hboxTwoBetaParameters.setVisible(false); } } }); ToggleGroup ladTypeGroup = new ToggleGroup(); radiobuttonLADHomogeneous.setToggleGroup(ladTypeGroup); radiobuttonLADLocalEstimation.setToggleGroup(ladTypeGroup); /**CHART panel initialization**/ ToggleGroup profileChartType = new ToggleGroup(); radiobuttonPreDefinedProfile.setToggleGroup(profileChartType); radiobuttonFromVariableProfile.setToggleGroup(profileChartType); ToggleGroup profileChartRelativeHeightType = new ToggleGroup(); radiobuttonHeightFromAboveGround.setToggleGroup(profileChartRelativeHeightType); radiobuttonHeightFromBelowCanopy.setToggleGroup(profileChartRelativeHeightType); comboboxFromVariableProfile.disableProperty().bind(radiobuttonPreDefinedProfile.selectedProperty()); comboboxPreDefinedProfile.disableProperty().bind(radiobuttonFromVariableProfile.selectedProperty()); hboxMaxPADVegetationProfile.visibleProperty().bind(radiobuttonPreDefinedProfile.selectedProperty()); listViewVoxelsFilesChart.getSelectionModel().selectedIndexProperty() .addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if (listViewVoxelsFilesChart.getSelectionModel().getSelectedItems().size() > 1) { colorPickerSeries.setDisable(true); } else if (listViewVoxelsFilesChart.getSelectionModel().getSelectedItems().size() == 1) { VoxelFileChart selectedItem = listViewVoxelsFilesChart.getSelectionModel() .getSelectedItem(); Color selectedItemColor = selectedItem.getSeriesParameters().getColor(); colorPickerSeries.setDisable(false); colorPickerSeries.setValue(new javafx.scene.paint.Color( selectedItemColor.getRed() / 255.0, selectedItemColor.getGreen() / 255.0, selectedItemColor.getBlue() / 255.0, 1.0)); if (newValue.intValue() >= 0) { textfieldLabelVoxelFileChart.setText( listViewVoxelsFilesChart.getItems().get(newValue.intValue()).label); } } } }); textfieldLabelVoxelFileChart.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (listViewVoxelsFilesChart.getSelectionModel().getSelectedIndex() >= 0) { listViewVoxelsFilesChart.getSelectionModel().getSelectedItem().label = newValue; } } }); listViewVoxelsFilesChart.getItems().addListener(new ListChangeListener<VoxelFileChart>() { @Override public void onChanged(ListChangeListener.Change<? extends VoxelFileChart> c) { while (c.next()) { } if (c.wasAdded() && c.getAddedSize() == c.getList().size()) { try { VoxelFileReader reader = new VoxelFileReader(c.getList().get(0).file); String[] columnNames = reader.getVoxelSpaceInfos().getColumnNames(); comboboxFromVariableProfile.getItems().clear(); comboboxFromVariableProfile.getItems().addAll(columnNames); comboboxFromVariableProfile.getSelectionModel().selectFirst(); } catch (Exception ex) { logger.error("Cannot read voxel file", ex); } } } }); anchorpaneQuadrats.disableProperty().bind(checkboxMakeQuadrats.selectedProperty().not()); comboboxSelectAxisForQuadrats.getItems().addAll("X", "Y", "Z"); comboboxSelectAxisForQuadrats.getSelectionModel().select(1); comboboxPreDefinedProfile.getItems().addAll("Vegetation (PAD)"); comboboxPreDefinedProfile.getSelectionModel().selectFirst(); radiobuttonSplitCountForQuadrats.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { textFieldSplitCountForQuadrats.setDisable(!newValue); textFieldLengthForQuadrats.setDisable(newValue); } }); ToggleGroup chartMakeQuadratsSplitType = new ToggleGroup(); radiobuttonLengthForQuadrats.setToggleGroup(chartMakeQuadratsSplitType); radiobuttonSplitCountForQuadrats.setToggleGroup(chartMakeQuadratsSplitType); /**Virtual measures panel initialization**/ comboboxHemiPhotoBitmapOutputMode.getItems().addAll("Pixel", "Color"); comboboxHemiPhotoBitmapOutputMode.getSelectionModel().selectFirst(); ToggleGroup virtualMeasuresChoiceGroup = new ToggleGroup(); toggleButtonLAI2000Choice.setToggleGroup(virtualMeasuresChoiceGroup); toggleButtonLAI2200Choice.setToggleGroup(virtualMeasuresChoiceGroup); comboboxChooseCanopyAnalyzerSampling.getItems().setAll(500, 4000, 10000); comboboxChooseCanopyAnalyzerSampling.getSelectionModel().selectFirst(); initEchoFiltering(); data = FXCollections.observableArrayList(); tableViewSimulationPeriods.setItems(data); tableViewSimulationPeriods.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); comboboxChooseDirectionsNumber.getItems().addAll(1, 6, 16, 46, 136, 406); comboboxChooseDirectionsNumber.getSelectionModel().select(4); ToggleGroup scannerPositionsMode = new ToggleGroup(); /*radiobuttonScannerPosSquaredArea.setToggleGroup(scannerPositionsMode); radiobuttonScannerPosFile.setToggleGroup(scannerPositionsMode);*/ tableColumnPeriod.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<SimulationPeriod, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call( TableColumn.CellDataFeatures<SimulationPeriod, String> param) { return new SimpleStringProperty(param.getValue().getPeriod().toString()); } }); tableColumnClearness.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<SimulationPeriod, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call( TableColumn.CellDataFeatures<SimulationPeriod, String> param) { return new SimpleStringProperty(String.valueOf(param.getValue().getClearnessCoefficient())); } }); checkboxMultiFiles.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { anchorpaneBoundingBoxParameters.setDisable(newValue); } }); hboxGenerateBitmapFiles.disableProperty().bind(checkboxGenerateBitmapFile.selectedProperty().not()); hboxGenerateTextFile.disableProperty().bind(checkboxGenerateTextFile.selectedProperty().not()); fileChooserOpenConfiguration = new FileChooser(); fileChooserOpenConfiguration.setTitle("Choose configuration file"); fileChooserSaveConfiguration = new FileChooserContext("cfg.xml"); fileChooserSaveConfiguration.fc.setTitle("Choose output file"); fileChooserOpenInputFileALS = new FileChooser(); fileChooserOpenInputFileALS.setTitle("Open input file"); fileChooserOpenInputFileALS.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Shot files", "*.sht"), new ExtensionFilter("Text Files", "*.txt"), new ExtensionFilter("Las Files", "*.las", "*.laz")); fileChooserOpenTrajectoryFileALS = new FileChooser(); fileChooserOpenTrajectoryFileALS.setTitle("Open trajectory file"); fileChooserOpenTrajectoryFileALS.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenOutputFileALS = new FileChooser(); fileChooserOpenOutputFileALS.setTitle("Choose output file"); fileChooserOpenInputFileTLS = new FileChooserContext(); fileChooserOpenInputFileTLS.fc.setTitle("Open input file"); fileChooserOpenInputFileTLS.fc.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt"), new ExtensionFilter("Rxp Files", "*.rxp"), new ExtensionFilter("Project Rsp Files", "*.rsp")); directoryChooserOpenOutputPathTLS = new DirectoryChooser(); directoryChooserOpenOutputPathTLS.setTitle("Choose output path"); directoryChooserOpenOutputPathALS = new DirectoryChooser(); directoryChooserOpenOutputPathALS.setTitle("Choose output path"); fileChooserSaveOutputFileTLS = new FileChooser(); fileChooserSaveOutputFileTLS.setTitle("Save voxel file"); fileChooserSaveTransmittanceTextFile = new FileChooser(); fileChooserSaveTransmittanceTextFile.setTitle("Save text file"); directoryChooserSaveTransmittanceBitmapFile = new DirectoryChooser(); directoryChooserSaveTransmittanceBitmapFile.setTitle("Choose output directory"); fileChooserSaveHemiPhotoOutputBitmapFile = new FileChooserContext("*.png"); fileChooserSaveHemiPhotoOutputBitmapFile.fc.setTitle("Save bitmap file"); directoryChooserSaveHemiPhotoOutputBitmapFile = new DirectoryChooser(); directoryChooserSaveHemiPhotoOutputBitmapFile.setTitle("Choose bitmap files output directory"); directoryChooserSaveHemiPhotoOutputTextFile = new DirectoryChooser(); directoryChooserSaveHemiPhotoOutputTextFile.setTitle("Choose text files output directory"); fileChooserSaveHemiPhotoOutputTextFile = new FileChooser(); fileChooserSaveHemiPhotoOutputTextFile.setTitle("Save text file"); fileChooserOpenVoxelFile = new FileChooser(); fileChooserOpenVoxelFile.setTitle("Open voxel file"); fileChooserOpenVoxelFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Voxel Files", "*.vox")); fileChooserOpenPopMatrixFile = new FileChooser(); fileChooserOpenPopMatrixFile.setTitle("Choose matrix file"); fileChooserOpenPopMatrixFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenSopMatrixFile = new FileChooser(); fileChooserOpenSopMatrixFile.setTitle("Choose matrix file"); fileChooserOpenSopMatrixFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenVopMatrixFile = new FileChooser(); fileChooserOpenVopMatrixFile.setTitle("Choose matrix file"); fileChooserOpenVopMatrixFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenPonderationFile = new FileChooser(); fileChooserOpenPonderationFile.setTitle("Choose ponderation file"); fileChooserOpenPonderationFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenDTMFile = new FileChooser(); fileChooserOpenDTMFile.setTitle("Choose DTM file"); fileChooserOpenDTMFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("DTM Files", "*.asc")); fileChooserOpenPointCloudFile = new FileChooser(); fileChooserOpenPointCloudFile.setTitle("Choose point cloud file"); fileChooserOpenPointCloudFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("TXT Files", "*.txt")); fileChooserOpenMultiResVoxelFile = new FileChooser(); fileChooserOpenMultiResVoxelFile.setTitle("Choose voxel file"); fileChooserOpenMultiResVoxelFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Voxel Files", "*.vox")); fileChooserOpenOutputFileMultiRes = new FileChooser(); fileChooserOpenOutputFileMultiRes.setTitle("Save voxel file"); fileChooserAddTask = new FileChooser(); fileChooserAddTask.setTitle("Choose parameter file"); fileChooserAddTask.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("XML Files", "*.xml")); fileChooserSaveDartFile = new FileChooser(); fileChooserSaveDartFile.setTitle("Save dart file (.maket)"); fileChooserSaveDartFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Maket File", "*.maket")); fileChooserOpenOutputFileMerging = new FileChooser(); fileChooserOpenOutputFileMerging.setTitle("Choose voxel file"); fileChooserOpenOutputFileMerging.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Voxel Files", "*.vox")); fileChooserOpenScriptFile = new FileChooser(); fileChooserOpenScriptFile.setTitle("Choose script file"); fileChooserSaveGroundEnergyOutputFile = new FileChooser(); fileChooserSaveGroundEnergyOutputFile.setTitle("Save ground energy file"); fileChooserOpenPointsPositionFile = new FileChooser(); fileChooserOpenPointsPositionFile.setTitle("Choose points file"); fileChooserOpenPointsPositionFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("TXT Files", "*.txt")); try { viewCapsSetupFrame = new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/ViewCapsSetupFrame.fxml")); Parent root = loader.load(); viewCapsSetupFrameController = loader.getController(); viewCapsSetupFrame.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/FilteringPaneComponent.fxml")); anchorPaneEchoFilteringRxp = loader.load(); filteringPaneController = loader.getController(); filteringPaneController.setFiltersNames("Reflectance", "Amplitude", "Deviation"); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { positionImporterFrame = new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/PositionImporterFrame.fxml")); Parent root = loader.load(); positionImporterFrameController = loader.getController(); positionImporterFrame.setScene(new Scene(root)); positionImporterFrameController.setStage(positionImporterFrame); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { voxelSpaceCroppingFrame = new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/VoxelSpaceCroppingFrame.fxml")); Parent root = loader.load(); voxelSpaceCroppingFrameController = loader.getController(); voxelSpaceCroppingFrame.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { attributsImporterFrame = new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/AttributsImporterFrame.fxml")); Parent root = loader.load(); attributsImporterFrameController = loader.getController(); attributsImporterFrame.setScene(new Scene(root)); attributsImporterFrameController.setStage(attributsImporterFrame); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { textFileParserFrameController = TextFileParserFrameController.getInstance(); } catch (Exception ex) { logger.error("Cannot load fxml file", ex); } try { transformationFrameController = TransformationFrameController.getInstance(); transformationFrame = transformationFrameController.getStage(); } catch (Exception ex) { logger.error("Cannot load fxml file", ex); } updaterFrame = new Stage(); try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/update/UpdaterFrame.fxml")); Parent root = loader.load(); updaterFrameController = loader.getController(); updaterFrame.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } riscanProjectExtractor = new RiscanProjectExtractor(); ptxProjectExtractor = new PTXProjectExtractor(); ptgProjectExtractor = new PTGProjectExtractor(); dateChooserFrame = new Stage(); try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/DateChooserFrame.fxml")); Parent root = loader.load(); dateChooserFrameController = loader.getController(); dateChooserFrame.setScene(new Scene(root)); dateChooserFrameController.setStage(dateChooserFrame); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } comboboxModeALS.getItems().addAll(RS_STR_INPUT_TYPE_LAS, RS_STR_INPUT_TYPE_LAZ, /*RS_STR_INPUT_TYPE_XYZ, */RS_STR_INPUT_TYPE_SHOTS); comboboxModeALS.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (newValue.equals(RS_STR_INPUT_TYPE_SHOTS)) { alsVoxValidationSupport.registerValidator(textFieldTrajectoryFileALS, false, Validators.unregisterValidator); } else { alsVoxValidationSupport.registerValidator(textFieldTrajectoryFileALS, false, Validators.fileExistValidator); } } }); comboboxModeTLS.getItems().setAll("Rxp scan", "Rsp project", "PTX", "PTG"/*, RS_STR_INPUT_TYPE_XYZ, RS_STR_INPUT_TYPE_SHOTS*/); comboboxGroundEnergyOutputFormat.getItems().setAll("txt", "png"); comboboxLaserSpecification.getItems().addAll(LaserSpecification.getPresets()); comboboxLaserSpecification.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<LaserSpecification>() { @Override public void changed(ObservableValue<? extends LaserSpecification> observable, LaserSpecification oldValue, LaserSpecification newValue) { DecimalFormatSymbols symb = new DecimalFormatSymbols(); symb.setDecimalSeparator('.'); DecimalFormat formatter = new DecimalFormat("#####.######", symb); textFieldBeamDiameterAtExit.setText(formatter.format(newValue.getBeamDiameterAtExit())); textFieldBeamDivergence.setText(formatter.format(newValue.getBeamDivergence())); } }); comboboxLaserSpecification.getSelectionModel().select(LaserSpecification.LMS_Q560); comboboxLaserSpecification.disableProperty().bind(checkboxCustomLaserSpecification.selectedProperty()); textFieldBeamDiameterAtExit.disableProperty() .bind(checkboxCustomLaserSpecification.selectedProperty().not()); textFieldBeamDivergence.disableProperty().bind(checkboxCustomLaserSpecification.selectedProperty().not()); listViewProductsFiles.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); listViewProductsFiles.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { int size = listViewProductsFiles.getSelectionModel().getSelectedIndices().size(); if (size == 1) { viewer3DPanelController .updateCurrentVoxelFile(listViewProductsFiles.getSelectionModel().getSelectedItem()); } } }); listViewTaskList.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { int size = listViewTaskList.getSelectionModel().getSelectedIndices().size(); if (size == 1) { buttonLoadSelectedTask.setDisable(false); } else { buttonLoadSelectedTask.setDisable(true); } buttonExecute.setDisable(size == 0); } }); resetMatrices(); calculateMatrixFrame = new Stage(); try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/CalculateMatrixFrame.fxml")); Parent root = loader.load(); calculateMatrixFrameController = loader.getController(); calculateMatrixFrameController.setStage(calculateMatrixFrame); Scene scene = new Scene(root); calculateMatrixFrame.setScene(scene); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } filterFrame = new Stage(); try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/FilterFrame.fxml")); Parent root = loader.load(); filterFrameController = loader.getController(); filterFrameController.setStage(filterFrame); filterFrameController.setFilters("Angle"); filterFrame.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/export/ObjExporterDialog.fxml")); Parent root = loader.load(); objExporterController = loader.getController(); Stage s = new Stage(); objExporterController.setStage(s); s.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } textFieldResolution.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { voxelSpacePanelVoxelizationController.setResolution(Float.valueOf(newValue)); } }); textFieldResolution.textProperty().addListener(voxelSpacePanelVoxelizationController.getChangeListener()); checkboxUseDTMFilter.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (checkboxUseDTMFilter.isSelected()) { buttonOpenDTMFile.setDisable(false); textfieldDTMPath.setDisable(false); textfieldDTMValue.setDisable(false); checkboxApplyVOPMatrix.setDisable(false); labelDTMValue.setDisable(false); labelDTMPath.setDisable(false); } else { buttonOpenDTMFile.setDisable(true); textfieldDTMPath.setDisable(true); textfieldDTMValue.setDisable(true); checkboxApplyVOPMatrix.setDisable(true); labelDTMValue.setDisable(true); labelDTMPath.setDisable(true); } } }); checkboxUseVopMatrix.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { buttonSetVOPMatrix.setDisable(!newValue); } }); checkboxUsePopMatrix.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { checkBoxUseDefaultPopMatrix.setDisable(false); buttonOpenPopMatrixFile.setDisable(false); } else { checkBoxUseDefaultPopMatrix.setDisable(true); buttonOpenPopMatrixFile.setDisable(true); } } }); checkboxUseSopMatrix.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { checkBoxUseDefaultSopMatrix.setDisable(false); buttonOpenSopMatrixFile.setDisable(false); } else { checkBoxUseDefaultSopMatrix.setDisable(true); buttonOpenSopMatrixFile.setDisable(true); } } }); checkboxCalculateGroundEnergy.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { anchorPaneGroundEnergyParameters.setDisable(false); } else { anchorPaneGroundEnergyParameters.setDisable(true); } } }); listviewRxpScans.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<LidarScan>() { @Override public void changed(ObservableValue<? extends LidarScan> observable, LidarScan oldValue, LidarScan newValue) { if (newValue != null) { sopMatrix = newValue.matrix; updateResultMatrix(); } } }); comboboxModeTLS.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { switch (newValue.intValue()) { case 1: case 2: case 3: listviewRxpScans.setDisable(false); checkboxMergeAfter.setDisable(false); textFieldMergedFileName.setDisable(false); disableSopMatrixChoice(false); labelTLSOutputPath.setText("Output path"); break; default: listviewRxpScans.setDisable(true); checkboxMergeAfter.setDisable(true); textFieldMergedFileName.setDisable(true); //disableSopMatrixChoice(true); labelTLSOutputPath.setText("Output file"); } if (newValue.intValue() == 0 || newValue.intValue() == 1) { checkboxEmptyShotsFilter.setDisable(false); } else { checkboxEmptyShotsFilter.setDisable(true); } } }); tabPaneVoxelisation.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { switch (newValue.intValue()) { case 1: disableSopMatrixChoice(false); disablePopMatrixChoice(false); checkboxEmptyShotsFilter.setDisable(false); break; default: disableSopMatrixChoice(true); disablePopMatrixChoice(true); checkboxEmptyShotsFilter.setDisable(true); } switch (newValue.intValue()) { case 0: checkboxCalculateGroundEnergy.setDisable(false); if (checkboxCalculateGroundEnergy.isSelected()) { anchorPaneGroundEnergyParameters.setDisable(true); checkboxCalculateGroundEnergy.setDisable(false); } anchorPaneEchoFiltering.getChildren().set(0, anchorPaneEchoFilteringClassifications); //anchorPaneEchoFilteringClassifications.setVisible(true); anchorpaneBoundingBoxParameters.setDisable(checkboxMultiFiles.isSelected()); hboxAutomaticBBox.setDisable(false); break; default: anchorPaneGroundEnergyParameters.setDisable(true); checkboxCalculateGroundEnergy.setDisable(true); anchorPaneEchoFiltering.getChildren().set(0, anchorPaneEchoFilteringRxp); //anchorPaneEchoFilteringClassifications.setVisible(false); anchorpaneBoundingBoxParameters.setDisable(false); hboxAutomaticBBox.setDisable(true); } } }); int availableCores = Runtime.getRuntime().availableProcessors(); sliderRSPCoresToUse.setMin(1); sliderRSPCoresToUse.setMax(availableCores); sliderRSPCoresToUse.setValue(availableCores); textFieldInputFileALS.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldTrajectoryFileALS.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldOutputFileALS.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldInputFileTLS.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldOutputFileMerging.setOnDragOver(DragAndDropHelper.dragOverEvent); textfieldDTMPath.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldOutputFileGroundEnergy.setOnDragOver(DragAndDropHelper.dragOverEvent); listViewTaskList.setOnDragOver(DragAndDropHelper.dragOverEvent); listViewProductsFiles.setOnDragOver(DragAndDropHelper.dragOverEvent); textfieldVoxelFilePathTransmittance.setOnDragOver(DragAndDropHelper.dragOverEvent); textfieldOutputTextFilePath.setOnDragOver(DragAndDropHelper.dragOverEvent); textfieldOutputBitmapFilePath.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldInputFileALS.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles() && db.getFiles().size() == 1) { success = true; for (File file : db.getFiles()) { if (file != null) { textFieldInputFileALS.setText(file.getAbsolutePath()); selectALSInputMode(file); } } } event.setDropCompleted(success); event.consume(); } }); textFieldTrajectoryFileALS.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles() && db.getFiles().size() == 1) { success = true; for (File file : db.getFiles()) { if (file != null) { onTrajectoryFileChoosed(file); } } } event.setDropCompleted(success); event.consume(); } }); textFieldInputFileTLS.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles() && db.getFiles().size() == 1) { success = true; for (File file : db.getFiles()) { if (file != null) { onInputFileTLSChoosed(file); } } } event.setDropCompleted(success); event.consume(); } }); setDragDroppedSingleFileEvent(textFieldOutputFileALS); setDragDroppedSingleFileEvent(textFieldOutputFileMerging); setDragDroppedSingleFileEvent(textfieldDTMPath); setDragDroppedSingleFileEvent(textFieldOutputFileGroundEnergy); setDragDroppedSingleFileEvent(textfieldVoxelFilePathTransmittance); setDragDroppedSingleFileEvent(textfieldOutputTextFilePath); setDragDroppedSingleFileEvent(textfieldOutputBitmapFilePath); listViewTaskList.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles()) { success = true; for (File file : db.getFiles()) { addFileToTaskList(file); } } event.setDropCompleted(success); event.consume(); } }); listViewProductsFiles.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles()) { success = true; for (File file : db.getFiles()) { addFileToProductsList(file); } } event.setDropCompleted(success); event.consume(); } }); listViewProductsFiles.setOnDragDetected(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { Dragboard db = listViewProductsFiles.startDragAndDrop(TransferMode.COPY); ClipboardContent content = new ClipboardContent(); content.putFiles(listViewProductsFiles.getSelectionModel().getSelectedItems()); db.setContent(content); event.consume(); } }); addPointcloudFilterComponent(); checkboxUsePointcloudFilter.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { hBoxPointCloudFiltering.setDisable(!newValue); ObservableList<Node> list = vBoxPointCloudFiltering.getChildren(); for (Node n : list) { if (n instanceof PointCloudFilterPaneComponent) { PointCloudFilterPaneComponent panel = (PointCloudFilterPaneComponent) n; panel.disableContent(!newValue); } } buttonAddPointcloudFilter.setDisable(!newValue); } }); //displayGThetaAllDistributions(); }
From source file:net.thirdy.blackmarket.controls.ModSelectionPane.java
private void setupModMappingTable() { modMappingTable = new TableViewPlus<>( ImmutableMap.of("Item Type", "itemType", "Type", "modType", "Mod", "mapping"), new double[] { 100, 100, 600 }, masterData); modMappingTable.setMaxHeight(Double.MAX_VALUE); modMappingTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); modMappingTable.setId("modMappingTable"); }