javafx.scene.control.MultipleSelectionModel Java Examples
The following examples show how to use
javafx.scene.control.MultipleSelectionModel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AppStateList.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
/** * Fill a list of app states. * * @param sceneNode the scene node */ @FxThread public void fill(@NotNull final SceneNode sceneNode) { final ListView<EditableSceneAppState> listView = getListView(); final MultipleSelectionModel<EditableSceneAppState> selectionModel = listView.getSelectionModel(); final EditableSceneAppState selected = selectionModel.getSelectedItem(); final ObservableList<EditableSceneAppState> items = listView.getItems(); items.clear(); final List<SceneAppState> appStates = sceneNode.getAppStates(); appStates.stream().filter(EditableSceneAppState.class::isInstance) .map(EditableSceneAppState.class::cast) .forEach(items::add); if (selected != null && appStates.contains(selected)) { selectionModel.select(selected); } }
Example #2
Source File: AssetEditorDialog.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
@Override @FxThread protected void processOk() { super.processOk(); final ResourceTree resourceTree = getResourceTree(); final MultipleSelectionModel<TreeItem<ResourceElement>> selectionModel = resourceTree.getSelectionModel(); final TreeItem<ResourceElement> selectedItem = selectionModel.getSelectedItem(); if (selectedItem == null) { hide(); return; } processOpen(selectedItem.getValue()); }
Example #3
Source File: VirtualAssetEditorDialog.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
@Override @FxThread protected void processOk() { super.processOk(); final VirtualResourceTree<C> resourceTree = getResourceTree(); final MultipleSelectionModel<TreeItem<VirtualResourceElement<?>>> selectionModel = resourceTree.getSelectionModel(); final TreeItem<VirtualResourceElement<?>> selectedItem = selectionModel.getSelectedItem(); if (selectedItem == null) { hide(); return; } final VirtualResourceElement<?> element = selectedItem.getValue(); final Object object = element.getObject(); final Class<C> type = getObjectsType(); if (type.isInstance(object)) { getConsumer().accept(type.cast(object)); } }
Example #4
Source File: VirtualAssetEditorDialog.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
@Override @FxThread protected @NotNull ObservableBooleanValue buildAdditionalDisableCondition() { final VirtualResourceTree<C> resourceTree = getResourceTree(); final MultipleSelectionModel<TreeItem<VirtualResourceElement<?>>> selectionModel = resourceTree.getSelectionModel(); final ReadOnlyObjectProperty<TreeItem<VirtualResourceElement<?>>> selectedItemProperty = selectionModel.selectedItemProperty(); final Class<C> type = getObjectsType(); final BooleanBinding typeCondition = new BooleanBinding() { @Override protected boolean computeValue() { final TreeItem<VirtualResourceElement<?>> treeItem = selectedItemProperty.get(); return treeItem == null || !type.isInstance(treeItem.getValue().getObject()); } @Override public Boolean getValue() { return computeValue(); } }; return Bindings.or(selectedItemProperty.isNull(), typeCondition); }
Example #5
Source File: FilterList.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
/** * Fill a list of filters. * * @param sceneNode the scene node */ @FxThread public void fill(@NotNull final SceneNode sceneNode) { final MultipleSelectionModel<EditableSceneFilter> selectionModel = listView.getSelectionModel(); final EditableSceneFilter selected = selectionModel.getSelectedItem(); final ObservableList<EditableSceneFilter> items = listView.getItems(); items.clear(); final List<SceneFilter> filters = sceneNode.getFilters(); filters.stream().filter(EditableSceneFilter.class::isInstance) .map(EditableSceneFilter.class::cast) .forEach(items::add); if (selected != null && filters.contains(selected)) { selectionModel.select(selected); } }
Example #6
Source File: AddAnnotationDialog.java From phoebus with Eclipse Public License 1.0 | 6 votes |
private boolean checkInput() { if (traces.isEmpty()) { new Alert(AlertType.INFORMATION, Messages.AddAnnotation_NoTraces).showAndWait(); return false; } final MultipleSelectionModel<Trace<XTYPE>> seletion = trace_list.getSelectionModel(); final Trace<XTYPE> item = seletion.isEmpty() ? traces.get(0) : seletion.getSelectedItem(); final String content = text.getText().trim(); if (content.isEmpty()) { new Alert(AlertType.WARNING, Messages.AddAnnotation_NoContent).showAndWait(); return false; } plot.addAnnotation(item, content); return true; }
Example #7
Source File: WidgetTree.java From phoebus with Eclipse Public License 1.0 | 6 votes |
/** Called by selection handler when selected widgets have changed, or on new model * @param widgets Widgets to select in tree */ public void setSelectedWidgets(final List<Widget> widgets) { if (! active.compareAndSet(false, true)) return; try { final MultipleSelectionModel<TreeItem<WidgetOrTab>> selection = tree_view.getSelectionModel(); selection.clearSelection(); for (Widget widget : widgets) selection.select(widget2tree.get(widget)); // If something's selected, show it. // Otherwise leave tree at current position. final int index = selection.getSelectedIndex(); if (index >= 0) tree_view.scrollTo(index); } finally { active.set(false); } }
Example #8
Source File: RFXListViewTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void selectMultipleItemSelection() { ListView<?> listView = (ListView<?>) getPrimaryStage().getScene().getRoot().lookup(".list-view"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(new Runnable() { @Override public void run() { MultipleSelectionModel<?> selectionModel = listView.getSelectionModel(); selectionModel.setSelectionMode(SelectionMode.MULTIPLE); selectionModel.selectIndices(2, 6); RFXListView rfxListView = new RFXListView(listView, null, null, lr); rfxListView.focusLost(new RFXListView(null, null, null, lr)); } }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("[\"Long Row 3\",\"Row 7\"]", recording.getParameters()[0]); }
Example #9
Source File: RFXTreeViewTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void getTextForMultipleSelection() { @SuppressWarnings("rawtypes") TreeView treeView = (TreeView) getPrimaryStage().getScene().getRoot().lookup(".tree-view"); LoggingRecorder lr = new LoggingRecorder(); List<String> text = new ArrayList<>(); Platform.runLater(new Runnable() { @Override public void run() { RFXTreeView rTreeView = new RFXTreeView(treeView, null, null, lr); @SuppressWarnings("rawtypes") MultipleSelectionModel selectionModel = treeView.getSelectionModel(); selectionModel.setSelectionMode(SelectionMode.MULTIPLE); selectionModel.selectIndices(2, 3); rTreeView.focusLost(new RFXTreeView(null, null, null, null)); text.add(rTreeView.getAttribute("text")); } }); new Wait("Waiting for tree text.") { @Override public boolean until() { return text.size() > 0; } }; AssertJUnit.assertEquals("[\"/Root node/Child Node 2\",\"/Root node/Child Node 3\"]", text.get(0)); }
Example #10
Source File: RFXListViewTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void getTextForMultipleSelection() { ListView<?> listView = (ListView<?>) getPrimaryStage().getScene().getRoot().lookup(".list-view"); LoggingRecorder lr = new LoggingRecorder(); List<String> text = new ArrayList<>(); Platform.runLater(new Runnable() { @Override public void run() { MultipleSelectionModel<?> selectionModel = listView.getSelectionModel(); selectionModel.setSelectionMode(SelectionMode.MULTIPLE); selectionModel.selectIndices(2, 8); RFXListView rfxListView = new RFXListView(listView, null, null, lr); rfxListView.focusLost(new RFXListView(null, null, null, lr)); text.add(rfxListView.getAttribute("text")); } }); new Wait("Waiting for list text.") { @Override public boolean until() { return text.size() > 0; } }; AssertJUnit.assertEquals("[\"Long Row 3\",\"Row 9\"]", text.get(0)); }
Example #11
Source File: AppStateList.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
/** * Handle removing an old app state. */ @FxThread private void removeAppState() { final MultipleSelectionModel<EditableSceneAppState> selectionModel = getListView().getSelectionModel(); final EditableSceneAppState appState = selectionModel.getSelectedItem(); final SceneNode sceneNode = changeConsumer.getCurrentModel(); changeConsumer.execute(new RemoveAppStateOperation(appState, sceneNode)); }
Example #12
Source File: AppStateList.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
/** * Create components of this component. */ @FxThread private void createComponents() { listView = new ListView<>(); listView.setCellFactory(param -> new AppStateListCell(this)); listView.setEditable(false); listView.setFocusTraversable(true); listView.prefHeightProperty().bind(heightProperty()); listView.prefWidthProperty().bind(widthProperty()); listView.setFixedCellSize(FxConstants.LIST_CELL_HEIGHT); final MultipleSelectionModel<EditableSceneAppState> selectionModel = listView.getSelectionModel(); selectionModel.selectedItemProperty().addListener((observable, oldValue, newValue) -> selectHandler.accept(newValue)); final Button addButton = new Button(); addButton.setGraphic(new ImageView(Icons.ADD_12)); addButton.setOnAction(event -> addAppState()); final Button removeButton = new Button(); removeButton.setGraphic(new ImageView(Icons.REMOVE_12)); removeButton.setOnAction(event -> removeAppState()); removeButton.disableProperty().bind(selectionModel.selectedItemProperty().isNull()); final HBox buttonContainer = new HBox(addButton, removeButton); FXUtils.addToPane(listView, this); FXUtils.addToPane(buttonContainer, this); FXUtils.addClassTo(buttonContainer, CssClasses.DEF_HBOX); FXUtils.addClassTo(addButton, CssClasses.BUTTON_WITHOUT_RIGHT_BORDER); FXUtils.addClassTo(removeButton, CssClasses.BUTTON_WITHOUT_LEFT_BORDER); FXUtils.addClassTo(listView, CssClasses.TRANSPARENT_LIST_VIEW); DynamicIconSupport.addSupport(addButton, removeButton); }
Example #13
Source File: AssetEditorDialog.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
@Override @FxThread protected @NotNull ObservableBooleanValue buildAdditionalDisableCondition() { final ResourceTree resourceTree = getResourceTree(); final MultipleSelectionModel<TreeItem<ResourceElement>> selectionModel = resourceTree.getSelectionModel(); final ReadOnlyObjectProperty<TreeItem<ResourceElement>> selectedItemProperty = selectionModel.selectedItemProperty(); return selectedItemProperty.isNull(); }
Example #14
Source File: ChartMeasurementSelector.java From chart-fx with Apache License 2.0 | 5 votes |
public ChartMeasurementSelector(final ParameterMeasurements plugin, final AbstractChartMeasurement dataSetMeasurement, final int requiredNumberOfChartMeasurements) { super(); if (plugin == null) { throw new IllegalArgumentException("plugin must not be null"); } final Label label = new Label("Selected Measurement: "); GridPane.setConstraints(label, 0, 0); chartMeasurementListView = new ListView<>(plugin.getChartMeasurements().filtered(t -> !t.equals(dataSetMeasurement))); GridPane.setConstraints(chartMeasurementListView, 1, 0); chartMeasurementListView.setOrientation(Orientation.VERTICAL); chartMeasurementListView.setPrefSize(-1, DEFAULT_SELECTOR_HEIGHT); chartMeasurementListView.setCellFactory(list -> new ChartMeasurementLabel()); chartMeasurementListView.setPrefHeight(Math.max(2, plugin.getChartMeasurements().size()) * ROW_HEIGHT + 2.0); MultipleSelectionModel<AbstractChartMeasurement> selModel = chartMeasurementListView.getSelectionModel(); if (requiredNumberOfChartMeasurements == 1) { selModel.setSelectionMode(SelectionMode.SINGLE); } else if (requiredNumberOfChartMeasurements >= 2) { selModel.setSelectionMode(SelectionMode.MULTIPLE); } // add default initially selected ChartMeasurements if (selModel.getSelectedIndices().isEmpty() && plugin.getChartMeasurements().size() >= requiredNumberOfChartMeasurements) { for (int i = 0; i < requiredNumberOfChartMeasurements; i++) { selModel.select(i); } } if (selModel.getSelectedIndices().size() < requiredNumberOfChartMeasurements && LOGGER.isWarnEnabled()) { LOGGER.atWarn().addArgument(plugin.getChartMeasurements().size()).addArgument(requiredNumberOfChartMeasurements).log("could not add default selection: required {} vs. selected {}"); } if (requiredNumberOfChartMeasurements >= 1) { getChildren().addAll(label, chartMeasurementListView); } }
Example #15
Source File: ListLayout.java From marathonv5 with Apache License 2.0 | 5 votes |
private VBox createListView() { listViewBox = new VBox(5); classPathListView = new ListView<ClassPathElement>(classPathListItems); classPathListView.setPrefHeight(Node.BASELINE_OFFSET_SAME_AS_HEIGHT); classPathListView.setId("ClassPathList"); classPathListView.setCellFactory((e) -> { ClassPathCell classPathCell = new ClassPathCell(); classPathCell.setId("ClassPathCell"); return classPathCell; }); if (!isSingleSelection()) { classPathListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); } classPathListView.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) -> { MultipleSelectionModel<ClassPathElement> selectionModel = classPathListView.getSelectionModel(); int itemCount = classPathListItems.size(); int selectedIndex = selectionModel.getSelectedIndex(); setButtonState(deleteButton, selectedIndex != -1); boolean enable = selectedIndex != 0 && selectedIndex != -1 && itemCount > 1; setButtonState(upButton, enable); enable = selectedIndex != itemCount - 1 && selectedIndex != -1 && itemCount > 1; setButtonState(downButton, enable); }); listViewBox.getChildren().add(classPathListView); HBox.setHgrow(listViewBox, Priority.ALWAYS); VBox.setVgrow(classPathListView, Priority.ALWAYS); return listViewBox; }
Example #16
Source File: HistoryUpDownHandler.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void handle(ActionEvent event) { MultipleSelectionModel<JSONObject> selectionModel = historyView.getSelectionModel(); ObservableList<JSONObject> items = historyView.getItems(); int selectedIndex = selectionModel.getSelectedIndex(); JSONObject selectedItem = selectionModel.getSelectedItem(); items.remove(selectedItem); if (shouldMoveUp) { items.add(selectedIndex - 1, selectedItem); } else { items.add(selectedIndex + 1, selectedItem); } selectionModel.select(selectedItem); TestRunnerHistory.getInstance().rewrite("favourites", items); }
Example #17
Source File: UpDownHandler.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void handle(ActionEvent event) { MultipleSelectionModel<ClassPathElement> selectionModel = classPathListView.getSelectionModel(); ObservableList<ClassPathElement> items = classPathListView.getItems(); int selectedIndex = selectionModel.getSelectedIndex(); ClassPathElement selectedItem = selectionModel.getSelectedItem(); items.remove(selectedItem); if (shouldMoveUp) { items.add(selectedIndex - 1, selectedItem); } else { items.add(selectedIndex + 1, selectedItem); } selectionModel.clearAndSelect(items.indexOf(selectedItem)); }
Example #18
Source File: FilterList.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
/** * Create components of this component. */ @FxThread private void createComponents() { listView = new ListView<>(); listView.setCellFactory(param -> new FilterListCell(this)); listView.setEditable(false); listView.setFocusTraversable(true); listView.prefHeightProperty().bind(heightProperty()); listView.prefWidthProperty().bind(widthProperty()); listView.setFixedCellSize(FxConstants.LIST_CELL_HEIGHT); final MultipleSelectionModel<EditableSceneFilter> selectionModel = listView.getSelectionModel(); selectionModel.selectedItemProperty().addListener((observable, oldValue, newValue) -> selectHandler.accept(newValue)); final Button addButton = new Button(); addButton.setGraphic(new ImageView(Icons.ADD_12)); addButton.setOnAction(event -> addFilter()); final Button removeButton = new Button(); removeButton.setGraphic(new ImageView(Icons.REMOVE_12)); removeButton.setOnAction(event -> removeFilter()); removeButton.disableProperty().bind(selectionModel.selectedItemProperty().isNull()); final HBox buttonContainer = new HBox(addButton, removeButton); FXUtils.addToPane(listView, this); FXUtils.addToPane(buttonContainer, this); FXUtils.addClassTo(buttonContainer, CssClasses.DEF_HBOX); FXUtils.addClassTo(addButton, CssClasses.BUTTON_WITHOUT_RIGHT_BORDER); FXUtils.addClassTo(removeButton, CssClasses.BUTTON_WITHOUT_LEFT_BORDER); FXUtils.addClassTo(listView, CssClasses.TRANSPARENT_LIST_VIEW); DynamicIconSupport.addSupport(addButton, removeButton); }
Example #19
Source File: DataSetSelector.java From chart-fx with Apache License 2.0 | 5 votes |
public DataSetSelector(final ParameterMeasurements plugin, final int requiredNumberOfDataSets) { super(); if (plugin == null) { throw new IllegalArgumentException("plugin must not be null"); } // wrap observable Array List, to prevent resetting the selection model whenever getAllDatasets() is called // somewhere in the code. allDataSets = plugin.getChart() != null ? FXCollections.observableArrayList(plugin.getChart().getAllDatasets()) : FXCollections.emptyObservableList(); final Label label = new Label("Selected Dataset: "); GridPane.setConstraints(label, 0, 0); dataSetListView = new ListView<>(allDataSets); GridPane.setConstraints(dataSetListView, 1, 0); dataSetListView.setOrientation(Orientation.VERTICAL); dataSetListView.setPrefSize(-1, DEFAULT_SELECTOR_HEIGHT); dataSetListView.setCellFactory(list -> new DataSetLabel()); dataSetListView.setPrefHeight(Math.max(2, allDataSets.size()) * ROW_HEIGHT + 2.0); MultipleSelectionModel<DataSet> selModel = dataSetListView.getSelectionModel(); if (requiredNumberOfDataSets == 1) { selModel.setSelectionMode(SelectionMode.SINGLE); } else if (requiredNumberOfDataSets >= 2) { selModel.setSelectionMode(SelectionMode.MULTIPLE); } // add default initially selected DataSets if (selModel.getSelectedIndices().isEmpty() && allDataSets.size() >= requiredNumberOfDataSets) { for (int i = 0; i < requiredNumberOfDataSets; i++) { selModel.select(i); } } if (requiredNumberOfDataSets >= 1) { getChildren().addAll(label, dataSetListView); } }
Example #20
Source File: FilterList.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
/** * Remove the selected filter. */ @FxThread private void removeFilter() { final MultipleSelectionModel<EditableSceneFilter> selectionModel = listView.getSelectionModel(); final EditableSceneFilter filter = selectionModel.getSelectedItem(); final SceneNode sceneNode = changeConsumer.getCurrentModel(); changeConsumer.execute(new RemoveSceneFilterOperation(filter, sceneNode)); }
Example #21
Source File: FilterList.java From jmonkeybuilder with Apache License 2.0 | 4 votes |
/** * Clear selection. */ @FxThread public void clearSelection() { final MultipleSelectionModel<EditableSceneFilter> selectionModel = listView.getSelectionModel(); selectionModel.select(null); }
Example #22
Source File: FilterList.java From jmonkeybuilder with Apache License 2.0 | 4 votes |
/** * Get the current selected item. * * @return the current selected item. */ @FxThread public @Nullable EditableSceneFilter getSelected() { final MultipleSelectionModel<EditableSceneFilter> selectionModel = listView.getSelectionModel(); return selectionModel.getSelectedItem(); }
Example #23
Source File: LazyLoadingBehavior.java From dolphin-platform with Apache License 2.0 | 4 votes |
private LazyLoadingBehavior(Control control, ObjectProperty<ObservableList<T>> items, MultipleSelectionModel<T> selectionModel) { this.control = control; this.items = new SimpleObjectProperty<>(); this.items.bind(items); this.model = new SimpleObjectProperty<>(); selectionModel.getSelectedItems().addListener((javafx.collections.ListChangeListener<? super T>) e -> { getModel().setSelectedValue(selectionModel.getSelectedItem()); getModel().getSelectedValues().setAll(selectionModel.getSelectedItems()); }); ValueChangeListener<Integer> listLenghtListener = e -> { if (getModel() == null || getModel().listLengthProperty().get() == null) { this.getItems().clear(); } else if (getItems().size() < getModel().listLengthProperty().get()) { IntStream.range(getItems().size(), getModel().listLengthProperty().get()).forEach(i -> getItems().add(createElementPlaceholder())); } else if (getItems().size() > getModel().listLengthProperty().get()) { getItems().remove(getModel().listLengthProperty().get(), getItems().size()); } }; ListChangeListener<T> listContentListener = e -> { e.getChanges().forEach(c -> { if (c.isRemoved()) { c.getRemovedElements().forEach(elem -> getItems().set(elem.indexProperty().get(), createElementPlaceholder())); } else if (c.isAdded()) { for (int i = c.getFrom(); i < c.getTo(); i++) { getItems().set(e.getSource().get(i).indexProperty().get(), e.getSource().get(i)); } } else if (c.isReplaced()) { for (int i = c.getFrom(); i < c.getTo(); i++) { getItems().set(e.getSource().get(i).indexProperty().get(), e.getSource().get(i)); } } }); }; model.addListener((obs, oldVal, newVal) -> { if (listLenghtListenerSubscription != null) { listLenghtListenerSubscription.unsubscribe(); } if (listContentListenerSubscription != null) { listContentListenerSubscription.unsubscribe(); } if (newVal != null) { listLenghtListenerSubscription = newVal.listLengthProperty().onChanged(listLenghtListener); listContentListenerSubscription = newVal.getLoadedContent().onChanged(listContentListener); } listLenghtListener.valueChanged(null); }); control.skinProperty().addListener(e -> init()); if(control.getSkin() != null) { init(); } }
Example #24
Source File: StructuredListCell.java From dolphin-platform with Apache License 2.0 | 4 votes |
private void simpleSelect() { ListView lv = getListView(); int index = getIndex(); MultipleSelectionModel sm = lv.getSelectionModel(); lv.getSelectionModel().clearAndSelect(index); }
Example #25
Source File: SettingsWindow.java From MSPaintIDE with MIT License | 4 votes |
public SettingsWindow(MainGUI mainGUI, List<SettingItem> settingItems, String startPath) throws IOException { super(); this.mainGUI = mainGUI; this.settingItems = settingItems; this.startPath = startPath; FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("gui/PopupWindow.fxml")); loader.setController(this); Parent root = loader.load(); ImageView icon = new ImageView(getClass().getClassLoader().getResource("icons/taskbar/ms-paint-logo-colored.png").toString()); icon.setFitHeight(25); icon.setFitWidth(25); JFXDecorator jfxDecorator = new JFXDecorator(this, root, false, true, true); jfxDecorator.setGraphic(icon); jfxDecorator.setTitle("Settings"); Scene scene = new Scene(jfxDecorator); scene.getStylesheets().add("style.css"); setScene(scene); this.mainGUI.getThemeManager().addStage(this); show(); setTitle("Settings"); getIcons().add(new Image(getClass().getClassLoader().getResourceAsStream("ms-paint-logo-taskbar.png"))); toggleStuff = newValue -> Map.of( "gridpane-theme", "gridpane-theme-dark", "theme-text", "dark-text", "search-label", "dark", "found-context", "dark", "language-selection", "language-selection-dark" ).forEach((key, value) -> root.lookupAll("." + key) .stream() .map(Node::getStyleClass) .forEach(styles -> { if (newValue) { styles.add(value); } else { while (styles.remove(value)); } })); SettingsManager.getInstance().onChangeSetting(Setting.DARK_THEME, toggleStuff, true); List<TreeItem<SettingItem>> children = tree.getRoot().getChildren(); if (startPath != null) { children.stream().flatMap(x -> Stream.of(x.isLeaf() ? x : x.getChildren())).map(TreeItem.class::cast).forEach(genericItem -> { SettingItem item = ((TreeItem<SettingItem>) genericItem).getValue(); MultipleSelectionModel<TreeItem<SettingItem>> selectionModel = tree.getSelectionModel(); if (item.toString().equalsIgnoreCase(startPath)) selectionModel.select(genericItem); }); } tree.getSelectionModel().select(0); }
Example #26
Source File: AppStateList.java From jmonkeybuilder with Apache License 2.0 | 4 votes |
/** * Get the current selected item. * * @return the current selected item. */ @FxThread public @Nullable EditableSceneAppState getSelected() { final MultipleSelectionModel<EditableSceneAppState> selectionModel = getListView().getSelectionModel(); return selectionModel.getSelectedItem(); }
Example #27
Source File: AppStateList.java From jmonkeybuilder with Apache License 2.0 | 4 votes |
/** * Clear selection. */ @FxThread public void clearSelection() { final MultipleSelectionModel<EditableSceneAppState> selectionModel = getListView().getSelectionModel(); selectionModel.select(null); }
Example #28
Source File: ListViewActionsHandler.java From kafka-message-tool with MIT License | 4 votes |
private ObservableList<AppModelObject> getSelectedModelObjects() { final MultipleSelectionModel<AppModelObject> selectionModel = listView.getSelectionModel(); return selectionModel.getSelectedItems(); }
Example #29
Source File: DataSetSelector.java From chart-fx with Apache License 2.0 | 4 votes |
public ObservableList<DataSet> getSelectedDataSets() { MultipleSelectionModel<DataSet> selModel = dataSetListView.getSelectionModel(); return selModel.getSelectedItems(); }
Example #30
Source File: DataSetSelector.java From chart-fx with Apache License 2.0 | 4 votes |
public DataSet getSelectedDataSet() { MultipleSelectionModel<DataSet> selModel = dataSetListView.getSelectionModel(); return selModel.getSelectedItem(); }