List of usage examples for javafx.scene.layout VBox setVgrow
public static void setVgrow(Node child, Priority value)
From source file:org.sleuthkit.autopsy.imageanalyzer.gui.navpanel.NavPanel.java
@FXML void initialize() { assert hashTab != null : "fx:id=\"hashTab\" was not injected: check your FXML file 'NavPanel.fxml'."; assert hashTree != null : "fx:id=\"hashTree\" was not injected: check your FXML file 'NavPanel.fxml'."; assert navTab != null : "fx:id=\"navTab\" was not injected: check your FXML file 'NavPanel.fxml'."; assert navTabPane != null : "fx:id=\"navTabPane\" was not injected: check your FXML file 'NavPanel.fxml'."; assert navTree != null : "fx:id=\"navTree\" was not injected: check your FXML file 'NavPanel.fxml'."; assert sortByBox != null : "fx:id=\"sortByBox\" was not injected: check your FXML file 'NavPanel.fxml'."; VBox.setVgrow(this, Priority.ALWAYS); navTree.setShowRoot(false);// w w w .j ava 2 s . c o m hashTree.setShowRoot(false); navTree.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); hashTree.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); sortByBox.setCellFactory((ListView<TreeNodeComparators> p) -> new TreeNodeComparators.ComparatorListCell()); sortByBox.setButtonCell(new TreeNodeComparators.ComparatorListCell()); sortByBox.setItems( FXCollections.observableArrayList(FXCollections.observableArrayList(TreeNodeComparators.values()))); sortByBox.getSelectionModel().select(TreeNodeComparators.HIT_COUNT); sortByBox.getSelectionModel().selectedItemProperty().addListener((Observable o) -> { resortHashTree(); }); navTree.setCellFactory((TreeView<TreeNode> p) -> new GroupTreeCell()); hashTree.setCellFactory((TreeView<TreeNode> p) -> new GroupTreeCell()); activeTreeProperty.addListener((Observable o) -> { updateControllersGroup(); activeTreeProperty.get().getSelectionModel().selectedItemProperty().addListener((Observable o1) -> { updateControllersGroup(); }); }); this.activeTreeProperty.set(navTree); navTabPane.getSelectionModel().selectedItemProperty() .addListener((ObservableValue<? extends Tab> ov, Tab t, Tab t1) -> { if (t1 == hashTab) { activeTreeProperty.set(hashTree); } else if (t1 == navTab) { activeTreeProperty.set(navTree); } }); initHashTree(); initNavTree(); controller.getGroupManager().getAnalyzedGroups() .addListener((ListChangeListener.Change<? extends DrawableGroup> change) -> { while (change.next()) { for (DrawableGroup g : change.getAddedSubList()) { insertIntoNavTree(g); if (g.getFilesWithHashSetHitsCount() > 0) { insertIntoHashTree(g); } } for (DrawableGroup g : change.getRemoved()) { removeFromNavTree(g); removeFromHashTree(g); } } }); for (DrawableGroup g : controller.getGroupManager().getAnalyzedGroups()) { insertIntoNavTree(g); if (g.getFilesWithHashSetHitsCount() > 0) { insertIntoHashTree(g); } } controller.viewState().addListener((ObservableValue<? extends GroupViewState> observable, GroupViewState oldValue, GroupViewState newValue) -> { if (newValue != null && newValue.getGroup() != null) { setFocusedGroup(newValue.getGroup()); } }); }
From source file:org.sleuthkit.autopsy.imagegallery.gui.navpanel.NavPanel.java
@FXML void initialize() { assert hashTab != null : "fx:id=\"hashTab\" was not injected: check your FXML file 'NavPanel.fxml'."; assert hashTree != null : "fx:id=\"hashTree\" was not injected: check your FXML file 'NavPanel.fxml'."; assert navTab != null : "fx:id=\"navTab\" was not injected: check your FXML file 'NavPanel.fxml'."; assert navTabPane != null : "fx:id=\"navTabPane\" was not injected: check your FXML file 'NavPanel.fxml'."; assert navTree != null : "fx:id=\"navTree\" was not injected: check your FXML file 'NavPanel.fxml'."; assert sortByBox != null : "fx:id=\"sortByBox\" was not injected: check your FXML file 'NavPanel.fxml'."; VBox.setVgrow(this, Priority.ALWAYS); navTree.setShowRoot(false);// w ww . j a va 2 s. com hashTree.setShowRoot(false); navTree.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); hashTree.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); sortByBox.setCellFactory((ListView<TreeNodeComparators> p) -> new TreeNodeComparators.ComparatorListCell()); sortByBox.setButtonCell(new TreeNodeComparators.ComparatorListCell()); sortByBox.setItems( FXCollections.observableArrayList(FXCollections.observableArrayList(TreeNodeComparators.values()))); sortByBox.getSelectionModel().select(TreeNodeComparators.HIT_COUNT); sortByBox.getSelectionModel().selectedItemProperty().addListener((Observable o) -> { resortHashTree(); }); navTree.setCellFactory((TreeView<TreeNode> p) -> new GroupTreeCell()); hashTree.setCellFactory((TreeView<TreeNode> p) -> new GroupTreeCell()); activeTreeProperty.addListener((Observable o) -> { updateControllersGroup(); activeTreeProperty.get().getSelectionModel().selectedItemProperty().addListener((Observable o1) -> { updateControllersGroup(); }); }); this.activeTreeProperty.set(navTree); navTabPane.getSelectionModel().selectedItemProperty() .addListener((ObservableValue<? extends Tab> ov, Tab t, Tab t1) -> { if (t1 == hashTab) { activeTreeProperty.set(hashTree); } else if (t1 == navTab) { activeTreeProperty.set(navTree); } }); initHashTree(); initNavTree(); controller.getGroupManager().getAnalyzedGroups() .addListener((ListChangeListener.Change<? extends DrawableGroup> change) -> { boolean wasPermuted = false; while (change.next()) { for (DrawableGroup g : change.getAddedSubList()) { insertIntoNavTree(g); if (g.getHashSetHitsCount() > 0) { insertIntoHashTree(g); } } for (DrawableGroup g : change.getRemoved()) { removeFromNavTree(g); removeFromHashTree(g); } if (change.wasPermutated()) { // Handle this afterward wasPermuted = true; } } if (wasPermuted) { rebuildTrees(); } }); for (DrawableGroup g : controller.getGroupManager().getAnalyzedGroups()) { insertIntoNavTree(g); if (g.getHashSetHitsCount() > 0) { insertIntoHashTree(g); } } controller.viewState().addListener((ObservableValue<? extends GroupViewState> observable, GroupViewState oldValue, GroupViewState newValue) -> { if (newValue != null && newValue.getGroup() != null) { setFocusedGroup(newValue.getGroup()); } }); }
From source file:org.specvis.view.screenandlumscale.ViewFitLumScaleController.java
private void initLineChart() { // 1. Define axes. NumberAxis xAxis = new NumberAxis(); NumberAxis yAxis = new NumberAxis(); xAxis.setLabel("HSB Brightness (%)"); yAxis.setLabel("Luminance (cd/m2)"); // 2. Init lineChart. lineChart = new LineChart<>(xAxis, yAxis); lineChart.setTitle("Screen luminance scale"); // 3. Define chart series. XYChart.Series seriesFittedLuminance = new XYChart.Series(); seriesFittedLuminance.setName("Fitted luminance"); XYChart.Series seriesMeasuredLuminance = new XYChart.Series(); seriesMeasuredLuminance.setName("Measured luminance"); // 4. Get luminance scale. LuminanceScale luminanceScale;//from ww w .j a v a2 s . co m if (StartApplication.getSpecvisData().getUiSettingsScreenAndLuminanceScale() .isThisWindowOpenedForStimulus()) { luminanceScale = StartApplication.getSpecvisData().getUiSettingsScreenAndLuminanceScale() .getStimulusLuminanceScale(); } else { luminanceScale = StartApplication.getSpecvisData().getUiSettingsScreenAndLuminanceScale() .getBackgroundLuminanceScale(); } // 5. Create short brightness vector. double[] shortBrightnessVector = new double[] { 0, 20, 40, 60, 80, 100 }; // 6. Get measured luminance values. double[] measuredLuminances = new double[] { luminanceScale.getLuminanceForBrightness0(), luminanceScale.getLuminanceForBrightness20(), luminanceScale.getLuminanceForBrightness40(), luminanceScale.getLuminanceForBrightness60(), luminanceScale.getLuminanceForBrightness80(), luminanceScale.getLuminanceForBrightness100() }; // 7. Create full brightness vector. double[] fullBrightnessVector = functions.createBrightnessVector(101); // 8. Nest data in series. for (int i = 0; i < fullBrightnessVector.length; i++) { seriesFittedLuminance.getData().add(new XYChart.Data(fullBrightnessVector[i], luminanceScale.getFittedLuminanceForEachBrightnessValue()[i])); } for (int i = 0; i < shortBrightnessVector.length; i++) { seriesMeasuredLuminance.getData() .add(new XYChart.Data(shortBrightnessVector[i], measuredLuminances[i])); } // 9. Add series to lineChart. lineChart.getData().addAll(seriesFittedLuminance, seriesMeasuredLuminance); vBox.getChildren().remove(vBox.getChildren().size() - 1); vBox.getChildren().add(lineChart); VBox.setVgrow(lineChart, Priority.ALWAYS); }
From source file:poe.trade.assist.SearchPane.java
public SearchPane(List<Search> searchList) { data = new SimpleListProperty<>(FXCollections.observableArrayList(searchList)); website.setOnAction(e -> SwingUtil.openUrlViaBrowser(website.getText())); setupSearchTable();/*from w w w. j a va 2 s . c o m*/ setupFilterTextField(); info.setWrapText(true); // setupColumns(); setupAddFields(); setupTableClickListener(); addButton.setOnAction((ActionEvent e) -> { data.add(new Search(addName.getText(), addTags.getText(), addURL.getText(), addAuto.isSelected(), "price_in_chaos")); addName.clear(); addTags.clear(); addURL.clear(); addAuto.setSelected(false); }); remButton.setOnAction((ActionEvent e) -> { int index = searchTable.getSelectionModel().getSelectedIndex(); // if (index != -1) { // searchTable.getItems().remove(index); // } searchTable.remove(index); }); final HBox hb = new HBox(3); hb.getChildren().addAll(addAuto, addButton, remButton); final VBox vb = new VBox(3, addName, addTags, addURL, hb); setSpacing(5); setPadding(new Insets(10, 0, 0, 10)); getChildren().addAll(tagFilterField, nameFilterField, showOnlyNew, searchTable, vb, info); VBox.setVgrow(searchTable, Priority.ALWAYS); setMaxWidth(Double.MAX_VALUE); }
From source file:qupath.lib.gui.tma.TMASummaryViewer.java
private Pane getCustomizeTablePane() { TableView<TreeTableColumn<TMAEntry, ?>> tableColumns = new TableView<>(); tableColumns.setPlaceholder(new Text("No columns available")); tableColumns.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); tableColumns.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); SortedList<TreeTableColumn<TMAEntry, ?>> sortedColumns = new SortedList<>( table.getColumns().filtered(p -> !p.getText().trim().isEmpty())); sortedColumns.setComparator((c1, c2) -> c1.getText().compareTo(c2.getText())); tableColumns.setItems(sortedColumns); sortedColumns.comparatorProperty().bind(tableColumns.comparatorProperty()); // sortedColumns.comparatorProperty().bind(tableColumns.comparatorProperty()); TableColumn<TreeTableColumn<TMAEntry, ?>, String> columnName = new TableColumn<>("Column"); columnName.setCellValueFactory(v -> v.getValue().textProperty()); TableColumn<TreeTableColumn<TMAEntry, ?>, Boolean> columnVisible = new TableColumn<>("Visible"); columnVisible.setCellValueFactory(v -> v.getValue().visibleProperty()); // columnVisible.setCellValueFactory(col -> { // SimpleBooleanProperty prop = new SimpleBooleanProperty(col.getValue().isVisible()); // prop.addListener((v, o, n) -> col.getValue().setVisible(n)); // return prop; // });/*w w w . j av a 2s .c o m*/ tableColumns.setEditable(true); columnVisible.setCellFactory(v -> new CheckBoxTableCell<>()); tableColumns.getColumns().add(columnName); tableColumns.getColumns().add(columnVisible); ContextMenu contextMenu = new ContextMenu(); Action actionShowSelected = new Action("Show selected", e -> { for (TreeTableColumn<?, ?> col : tableColumns.getSelectionModel().getSelectedItems()) { if (col != null) col.setVisible(true); else { // Not sure why this happens...? logger.trace("Selected column is null!"); } } }); Action actionHideSelected = new Action("Hide selected", e -> { for (TreeTableColumn<?, ?> col : tableColumns.getSelectionModel().getSelectedItems()) { if (col != null) col.setVisible(false); else { // Not sure why this happens...? logger.trace("Selected column is null!"); } } }); contextMenu.getItems().addAll(ActionUtils.createMenuItem(actionShowSelected), ActionUtils.createMenuItem(actionHideSelected)); tableColumns.setContextMenu(contextMenu); tableColumns.setTooltip( new Tooltip("Show or hide table columns - right-click to change multiple columns at once")); BorderPane paneColumns = new BorderPane(tableColumns); paneColumns.setBottom(PanelToolsFX.createColumnGridControls(ActionUtils.createButton(actionShowSelected), ActionUtils.createButton(actionHideSelected))); VBox paneRows = new VBox(); // Create a box to filter on some metadata text ComboBox<String> comboMetadata = new ComboBox<>(); comboMetadata.setItems(metadataNames); comboMetadata.getSelectionModel().getSelectedItem(); comboMetadata.setPromptText("Select column"); TextField tfFilter = new TextField(); CheckBox cbExact = new CheckBox("Exact"); // Set listeners cbExact.selectedProperty().addListener( (v, o, n) -> setMetadataTextPredicate(comboMetadata.getSelectionModel().getSelectedItem(), tfFilter.getText(), cbExact.isSelected(), !cbExact.isSelected())); tfFilter.textProperty().addListener( (v, o, n) -> setMetadataTextPredicate(comboMetadata.getSelectionModel().getSelectedItem(), tfFilter.getText(), cbExact.isSelected(), !cbExact.isSelected())); comboMetadata.getSelectionModel().selectedItemProperty().addListener( (v, o, n) -> setMetadataTextPredicate(comboMetadata.getSelectionModel().getSelectedItem(), tfFilter.getText(), cbExact.isSelected(), !cbExact.isSelected())); GridPane paneMetadata = new GridPane(); paneMetadata.add(comboMetadata, 0, 0); paneMetadata.add(tfFilter, 1, 0); paneMetadata.add(cbExact, 2, 0); paneMetadata.setPadding(new Insets(10, 10, 10, 10)); paneMetadata.setVgap(2); paneMetadata.setHgap(5); comboMetadata.setMaxWidth(Double.MAX_VALUE); GridPane.setHgrow(tfFilter, Priority.ALWAYS); GridPane.setFillWidth(comboMetadata, Boolean.TRUE); GridPane.setFillWidth(tfFilter, Boolean.TRUE); TitledPane tpMetadata = new TitledPane("Metadata filter", paneMetadata); tpMetadata.setExpanded(false); // tpMetadata.setCollapsible(false); Tooltip tooltipMetadata = new Tooltip( "Enter text to filter entries according to a selected metadata column"); Tooltip.install(paneMetadata, tooltipMetadata); tpMetadata.setTooltip(tooltipMetadata); paneRows.getChildren().add(tpMetadata); // Add measurement predicate TextField tfCommand = new TextField(); tfCommand.setTooltip(new Tooltip("Predicate used to filter entries for inclusion")); TextFields.bindAutoCompletion(tfCommand, e -> { int ind = tfCommand.getText().lastIndexOf("\""); if (ind < 0) return Collections.emptyList(); String part = tfCommand.getText().substring(ind + 1); return measurementNames.stream().filter(n -> n.startsWith(part)).map(n -> "\"" + n + "\" ") .collect(Collectors.toList()); }); String instructions = "Enter a predicate to filter entries.\n" + "Only entries passing the test will be included in any results.\n" + "Examples of predicates include:\n" + " \"Num Tumor\" > 200\n" + " \"Num Tumor\" > 100 && \"Num Stroma\" < 1000"; // labelInstructions.setTooltip(new Tooltip("Note: measurement names must be in \"inverted commands\" and\n" + // "&& indicates 'and', while || indicates 'or'.")); BorderPane paneMeasurementFilter = new BorderPane(tfCommand); Label label = new Label("Predicate: "); label.setAlignment(Pos.CENTER); label.setMaxHeight(Double.MAX_VALUE); paneMeasurementFilter.setLeft(label); Button btnApply = new Button("Apply"); btnApply.setOnAction(e -> { TablePredicate predicateNew = new TablePredicate(tfCommand.getText()); if (predicateNew.isValid()) { predicateMeasurements.set(predicateNew); } else { DisplayHelpers.showErrorMessage("Invalid predicate", "Current predicate '" + tfCommand.getText() + "' is invalid!"); } e.consume(); }); TitledPane tpMeasurementFilter = new TitledPane("Measurement filter", paneMeasurementFilter); tpMeasurementFilter.setExpanded(false); Tooltip tooltipInstructions = new Tooltip(instructions); tpMeasurementFilter.setTooltip(tooltipInstructions); Tooltip.install(paneMeasurementFilter, tooltipInstructions); paneMeasurementFilter.setRight(btnApply); paneRows.getChildren().add(tpMeasurementFilter); logger.info("Predicate set to: {}", predicateMeasurements.get()); VBox pane = new VBox(); // TitledPane tpColumns = new TitledPane("Select column", paneColumns); // tpColumns.setMaxHeight(Double.MAX_VALUE); // tpColumns.setCollapsible(false); pane.getChildren().addAll(paneColumns, new Separator(), paneRows); VBox.setVgrow(paneColumns, Priority.ALWAYS); return pane; }
From source file:se.trixon.mapollage.ui.config.FoldersTab.java
private void createUI() { VBox leftBox = new VBox(); VBox rightBox = new VBox(); setContent(leftBox);/* ww w .j a v a 2s. c o m*/ //Left Pane Label rootNameLabel = new Label(mBundle.getString("FoldersTab.rootNameLabel")); Label rootDescLabel = new Label(mBundle.getString("FoldersTab.rootDescriptionLabel")); Label regexLabel = new Label(Dict.DEFAULT_VALUE.toString()); leftBox.getChildren().addAll(rootNameLabel, mRootNameTextField, rootDescLabel, mRootDescTextArea, rightBox); VBox.setVgrow(mRootDescTextArea, Priority.ALWAYS); //Right Pane mFolderByDirectoryRadioButton.setToggleGroup(mToggleGroup); mFolderByDateRadioButton.setToggleGroup(mToggleGroup); mFolderByRegexRadioButton.setToggleGroup(mToggleGroup); mFolderByNoneRadioButton.setToggleGroup(mToggleGroup); mDatePatternComboBox.setMaxWidth(Double.MAX_VALUE); mDatePatternComboBox.setEditable(true); mDatePatternComboBox .setItems(FXCollections.observableList(Arrays.asList(mBundle.getString("dateFormats").split(";")))); Label label = new Label(mBundle.getString("FoldersTab.folderByLabel")); rightBox.getChildren().addAll(label, mFolderByDirectoryRadioButton, mFolderByDateRadioButton, mDatePatternComboBox, mFolderByRegexRadioButton, mRegexTextField, regexLabel, mRegexDefaultTextField, mFolderByNoneRadioButton); addTopPadding(rootDescLabel, mFolderByDirectoryRadioButton, mFolderByDateRadioButton, mFolderByRegexRadioButton, regexLabel, mFolderByNoneRadioButton, rightBox); Insets leftInsets = new Insets(0, 0, 0, 24); VBox.setMargin(mDatePatternComboBox, leftInsets); VBox.setMargin(mRegexTextField, leftInsets); VBox.setMargin(mRegexDefaultTextField, leftInsets); VBox.setMargin(regexLabel, leftInsets); mDatePatternComboBox.disableProperty().bind(mFolderByDateRadioButton.selectedProperty().not()); mRegexTextField.disableProperty().bind(mFolderByRegexRadioButton.selectedProperty().not()); mRegexDefaultTextField.disableProperty().bind(mFolderByRegexRadioButton.selectedProperty().not()); // EventHandler eventHandler = (EventHandler) (Event event) -> { //// sValidationSupport.initInitialDecoration(); // sValidationSupport.getValidationDecorator().removeDecorations(mDatePatternComboBox); // // sValidationSupport.redecorate(); // System.out.println(event); // }; // // mFolderByDateRadioButton.setOnAction(eventHandler); // mFolderByDirectoryRadioButton.setOnAction(eventHandler); // mFolderByNoneRadioButton.setOnAction(eventHandler); // mFolderByRegexRadioButton.setOnAction(eventHandler); }