javafx.scene.control.SelectionMode Java Examples
The following examples show how to use
javafx.scene.control.SelectionMode.
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: AlarmTreeView.java From phoebus with Eclipse Public License 1.0 | 6 votes |
/** @param model Model to represent. Must <u>not</u> be running, yet */ public AlarmTreeView(final AlarmClient model) { if (model.isRunning()) throw new IllegalStateException(); changing.setTextFill(Color.WHITE); changing.setBackground(new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY))); this.model = model; tree_view.setShowRoot(false); tree_view.setCellFactory(view -> new AlarmTreeViewCell()); tree_view.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); setTop(createToolbar()); setCenter(tree_view); tree_view.setRoot(createViewItem(model.getRoot())); model.addListener(this); createContextMenu(); addClickSupport(); addDragSupport(); }
Example #2
Source File: FeatureTableFX.java From mzmine3 with GNU General Public License v2.0 | 6 votes |
public FeatureTableFX() { // add dummy root TreeItem<ModularFeatureListRow> root = new TreeItem<>(); root.setExpanded(true); this.setRoot(root); this.setShowRoot(false); this.setTableMenuButtonVisible(true); this.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); this.getSelectionModel().setCellSelectionEnabled(true); setTableEditable(true); /*getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { int io = getRoot().getChildren().indexOf(oldValue); int in = getRoot().getChildren().indexOf(newValue); });*/ parameters = MZmineCore.getConfiguration().getModuleParameters(FeatureTableFXModule.class); rowTypesParameter = parameters.getParameter(FeatureTableFXParameters.showRowTypeColumns); featureTypesParameter = parameters .getParameter(FeatureTableFXParameters.showFeatureTypeColumns); rowItems = FXCollections.observableArrayList(); filteredRowItems = new FilteredList<>(rowItems); columnMap = new HashMap<>(); }
Example #3
Source File: PlanningCenterOnlinePlanDialog.java From Quelea with GNU General Public License v3.0 | 6 votes |
public PlanningCenterOnlinePlanDialog(PlanningCenterOnlineImportDialog importDlg, Plan plan, List<Item> planItems) { importDialog = importDlg; this.plan = plan; this.planItems = planItems; try { FXMLLoader loader = new FXMLLoader(); loader.setController(this); loader.setResources(LabelGrabber.INSTANCE); Parent root = loader.load(getClass().getResourceAsStream("PlanningCenterOnlinePlanDialog.fxml")); setCenter(root); planView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); enablePlanProgressBars(false); LOGGER.log(Level.INFO, "Initialised dialog, updating view"); updateView(); } catch (Exception e) { LOGGER.log(Level.WARNING, "Error", e); } }
Example #4
Source File: ElevantoPlanDialog.java From Quelea with GNU General Public License v3.0 | 6 votes |
public ElevantoPlanDialog(ElevantoImportDialog importDlg, JSONObject plan) { importDialog = importDlg; planJSON = plan; try { FXMLLoader loader = new FXMLLoader(); loader.setController(this); loader.setResources(LabelGrabber.INSTANCE); Parent root = loader.load(getClass().getResourceAsStream("PlanningCenterOnlinePlanDialog.fxml")); setCenter(root); planView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); enablePlanProgressBars(false); LOGGER.log(Level.INFO, "Initialised dialog, updating view"); updateView(); } catch (Exception e) { LOGGER.log(Level.WARNING, "Error", e); } }
Example #5
Source File: AttributeEditorPanel.java From constellation with Apache License 2.0 | 6 votes |
private ListView<Object> createListView(final AttributeData attribute, final ObservableList<Object> listData) { final ListView<Object> newList = new ListView<>(listData); newList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); newList.setCellFactory((ListView<Object> p) -> new AttributeValueCell(attribute.getDataType())); addCopyHandlersToListView(newList, attribute); newList.addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent event) -> { if (event.isShortcutDown() && (event.getCode() == KeyCode.C)) { copySelectedItems(newList, attribute.getDataType()); event.consume(); } else if (event.isShortcutDown() && (event.getCode() == KeyCode.A)) { event.consume(); } }); return newList; }
Example #6
Source File: SaveRequestDialog.java From milkman with MIT License | 6 votes |
public void initialize() { requestName.setText(request.getName()); List<String> collectionNames = getCollectionStrings(); FilteredList<String> filteredList = new FilteredList<String>(FXCollections.observableList(collectionNames)); collectionName.textProperty().addListener(obs-> { String filter = collectionName.getText(); if(filter == null || filter.length() == 0) { Platform.runLater(() -> filteredList.setPredicate(s -> true)); } else { Platform.runLater(() -> filteredList.setPredicate(s -> StringUtils.containsLettersInOrder(s, filter))); } }); collectionList.setItems(filteredList); collectionList.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); collectionList.getSelectionModel().selectedItemProperty().addListener((obs, o, n) -> { if (n != null && n.length() > 0) collectionName.setText(n); }); }
Example #7
Source File: TableVisualisation.java From constellation with Apache License 2.0 | 6 votes |
public TableVisualisation(final AbstractTableTranslator<? extends AnalyticResult<?>, C> translator) { this.translator = translator; this.tableVisualisation = new VBox(); this.tableFilter = new TextField(); tableFilter.setPromptText("Type here to filter results"); this.table = new TableView<>(); table.setPlaceholder(new Label("No results")); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); table.setId("table-visualisation"); table.setPadding(new Insets(5)); tableVisualisation.getChildren().addAll(tableFilter, table); }
Example #8
Source File: NameListPane.java From OpenLabeler with Apache License 2.0 | 6 votes |
public NameListPane() { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/preference/NameListPane.fxml"), bundle); loader.setRoot(this); loader.setController(this); try { loader.load(); } catch (Exception ex) { LOG.log(Level.SEVERE, "Unable to load FXML", ex); } listName.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); listName.setCellFactory(TextFieldListCell.forListView()); listName.setOnEditCommit((EventHandler<ListView.EditEvent<String>>) t -> { listName.getItems().set(t.getIndex(), t.getNewValue()); listName.getSelectionModel().clearAndSelect(t.getIndex()); }); }
Example #9
Source File: BattleOfDecksConfigView.java From metastone with GNU General Public License v2.0 | 6 votes |
public BattleOfDecksConfigView() { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/BattleOfDecksConfigView.fxml")); fxmlLoader.setRoot(this); fxmlLoader.setController(this); try { fxmlLoader.load(); } catch (IOException exception) { throw new RuntimeException(exception); } setupBehaviourBox(); setupNumberOfGamesBox(); selectedDecksListView.setCellFactory(TextFieldListCell.forListView(new DeckStringConverter())); selectedDecksListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); availableDecksListView.setCellFactory(TextFieldListCell.forListView(new DeckStringConverter())); availableDecksListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); addButton.setOnAction(this::handleAddButton); removeButton.setOnAction(this::handleRemoveButton); backButton.setOnAction(event -> NotificationProxy.sendNotification(GameNotification.MAIN_MENU)); startButton.setOnAction(this::handleStartButton); }
Example #10
Source File: EpisodeController.java From Animu-Downloaderu with MIT License | 6 votes |
void loadEpisodes(EpisodeList episodesTmp) { Platform.runLater(() -> { episodes.setAll(episodesTmp.episodes()); episodeList = new ListView<>(); episodeList.setItems(episodes); episodeList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); episodeList.setOnMouseClicked(event -> { int selSize = episodeList.getSelectionModel().getSelectedIndices().size(); this.setCheckBoxStatus(selSize, episodes.size()); }); }); Platform.runLater(() -> { VBox.setVgrow(episodeList, Priority.ALWAYS); episodeBox.getChildren().setAll(episodeList); }); }
Example #11
Source File: PVList.java From phoebus with Eclipse Public License 1.0 | 6 votes |
private void createContextMenu() { // Publish selected items as PV final ListChangeListener<PVInfo> sel_changed = change -> { final List<ProcessVariable> pvs = change.getList() .stream() .map(info -> new ProcessVariable(info.name.get())) .collect(Collectors.toList()); SelectionService.getInstance().setSelection(PVListApplication.DISPLAY_NAME, pvs); }; table.getSelectionModel().getSelectedItems().addListener(sel_changed); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); // Context menu with selection-based entries, i.e. PV contributions final ContextMenu menu = new ContextMenu(); table.setOnContextMenuRequested(event -> { menu.getItems().clear(); ContextMenuHelper.addSupportedEntries(table, menu); menu.show(table.getScene().getWindow()); }); table.setContextMenu(menu); }
Example #12
Source File: BrowserTab.java From marathonv5 with Apache License 2.0 | 6 votes |
public PreferenceTableView() { getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); setPrefHeight(100); setEditable(false); TableColumn<BrowserPreference, String> colName = new TableColumn<>("Name"); colName.setCellValueFactory(new PropertyValueFactory<>("name")); colName.prefWidthProperty().bind(widthProperty().multiply(0.5)); TableColumn<BrowserPreference, String> colType = new TableColumn<>("Type"); colType.setCellValueFactory(new PropertyValueFactory<>("type")); colType.prefWidthProperty().bind(widthProperty().multiply(0.20)); TableColumn<BrowserPreference, String> colValue = new TableColumn<>("Value"); colValue.setCellValueFactory(new PropertyValueFactory<>("value")); colValue.prefWidthProperty().bind(widthProperty().multiply(0.25)); getColumns().add(colName); getColumns().add(colType); getColumns().add(colValue); }
Example #13
Source File: JavaFXTreeTableViewElementTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Test public void selectAllCells() { TreeTableView<?> treeTableNode = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view"); Platform.runLater(() -> { TreeTableViewSelectionModel<?> selectionModel = treeTableNode.getSelectionModel(); selectionModel.setCellSelectionEnabled(true); selectionModel.setSelectionMode(SelectionMode.MULTIPLE); selectionModel.selectRange(0, getTreeTableColumnAt(treeTableNode, 0), treeTableNode.getExpandedItemCount() - 1, getTreeTableColumnAt(treeTableNode, 1)); treeTable.marathon_select("all"); }); new Wait("Waiting for all cells to be selected") { @Override public boolean until() { return treeTableNode.getSelectionModel().getSelectedCells().size() == treeTableNode.getExpandedItemCount() * treeTableNode.getColumns().size(); } }; }
Example #14
Source File: JavaFXTreeTableViewElementTest2.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void getText() { TreeTableView<?> treeTableNode = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view"); List<String> text = new ArrayList<>(); Platform.runLater(() -> { treeTableNode.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); treeTable.marathon_select("{\"rows\":[\"/Sales Department/Emma Jones\",\"/Sales Department/Anna Black\"]}"); text.add(treeTable.getAttribute("text")); }); new Wait("Waiting for tree table text.") { @Override public boolean until() { return text.size() > 0; } }; AssertJUnit.assertEquals("{\"rows\":[\"/Sales Department/Emma Jones\",\"/Sales Department/Anna Black\"]}", text.get(0)); }
Example #15
Source File: ListViewCellFactorySample.java From marathonv5 with Apache License 2.0 | 6 votes |
public ListViewCellFactorySample() { final ListView<Number> listView = new ListView<Number>(); listView.setItems(FXCollections.<Number>observableArrayList( 100.00, -12.34, 33.01, 71.00, 23000.00, -6.00, 0, 42223.00, -12.05, 500.00, 430000.00, 1.00, -4.00, 1922.01, -90.00, 11111.00, 3901349.00, 12.00, -1.00, -2.00, 15.00, 47.50, 12.11 )); listView.setCellFactory(new Callback<ListView<java.lang.Number>, ListCell<java.lang.Number>>() { @Override public ListCell<Number> call(ListView<java.lang.Number> list) { return new MoneyFormatCell(); } }); listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); getChildren().add(listView); }
Example #16
Source File: BadaboomController.java From latexdraw with GNU General Public License v3.0 | 6 votes |
@Override public void initialize(final URL location, final ResourceBundle resources) { final ObservableList<TableColumn<Throwable, ?>> cols = table.getColumns(); ((TableColumn<Throwable, String>) cols.get(0)).setCellValueFactory(cell -> new ReadOnlyStringWrapper(cell.getValue().toString())); ((TableColumn<Throwable, String>) cols.get(1)).setCellValueFactory(cell -> new ReadOnlyStringWrapper(cell.getValue().getMessage())); ((TableColumn<Throwable, String>) cols.get(2)).setCellValueFactory(cell -> { final StackTraceElement[] stackTrace = cell.getValue().getStackTrace(); final String msg = stackTrace.length > 0 ? stackTrace[0].toString() : ""; return new ReadOnlyStringWrapper(msg); }); cols.forEach(col -> col.prefWidthProperty().bind(table.widthProperty().divide(3))); table.itemsProperty().bind(BadaboomCollector.INSTANCE.errorsProperty()); table.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); final Callable<String> converter = () -> { final Throwable ex = table.getSelectionModel().getSelectedItem(); if(ex == null) { return ""; } return Arrays.stream(ex.getStackTrace()).map(Object::toString).collect(Collectors.joining("\n\tat ", ex.toString() + "\n\tat ", "")); //NON-NLS }; stack.textProperty().bind(Bindings.createStringBinding(converter, table.getSelectionModel().selectedItemProperty())); }
Example #17
Source File: SimpleListViewScrollSample.java From marathonv5 with Apache License 2.0 | 6 votes |
@Override public void start(Stage primaryStage) throws Exception { final ListView<String> listView = new ListView<String>(); listView.setItems(FXCollections.observableArrayList("Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6", "Row 7", "Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13", "Row 14", "Row 15", "Row 16", "Row 17", "Row 18", "Row 19", "Row 20", "Row 21", "Row 22", "Row 23", "Row 24", "Row 25")); listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); Button button = new Button("Debug"); button.setOnAction((e) -> { ObservableList<Integer> selectedIndices = listView.getSelectionModel().getSelectedIndices(); for (Integer index : selectedIndices) { ListCell cellAt = getCellAt(listView, index); System.out.println("SimpleListViewScrollSample.SimpleListViewScrollSampleApp.start(" + cellAt + ")"); } }); VBox root = new VBox(listView, button); primaryStage.setScene(new Scene(root, 300, 400)); primaryStage.show(); }
Example #18
Source File: RFXTreeTableViewTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void selectAllRows() { TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); RFXTreeTableView rfxTreeTableView = new RFXTreeTableView(treeTableView, null, null, lr); int count = treeTableView.getExpandedItemCount(); for (int i = 0; i < count; i++) { treeTableView.getSelectionModel().select(i); } rfxTreeTableView.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("all", recording.getParameters()[0]); }
Example #19
Source File: JavaFXTreeTableViewElementTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void getText() { TreeTableView<?> treeTableNode = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view"); List<String> text = new ArrayList<>(); Platform.runLater(() -> { treeTableNode.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); treeTable.marathon_select("{\"rows\":[\"/Sales Department/Emma Jones\",\"/Sales Department/Anna Black\"]}"); text.add(treeTable.getAttribute("text")); }); new Wait("Waiting for tree table text.") { @Override public boolean until() { return text.size() > 0; } }; AssertJUnit.assertEquals("{\"rows\":[\"/Sales Department/Emma Jones\",\"/Sales Department/Anna Black\"]}", text.get(0)); }
Example #20
Source File: RFXTreeTableViewTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Test public void selectAllCells() { TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); RFXTreeTableView rfxTreeTableView = new RFXTreeTableView(treeTableView, null, null, lr); int count = treeTableView.getExpandedItemCount(); treeTableView.getSelectionModel().selectRange(0, getTreeTableColumnAt(treeTableView, 0), count - 1, getTreeTableColumnAt(treeTableView, 1)); rfxTreeTableView.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("all", recording.getParameters()[0]); }
Example #21
Source File: JavaFXTreeTableViewElementTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void selectMultipleCells() { TreeTableView<?> treeTableNode = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view"); Platform.runLater(() -> { TreeTableViewSelectionModel<?> selectionModel = treeTableNode.getSelectionModel(); selectionModel.setSelectionMode(SelectionMode.MULTIPLE); selectionModel.setCellSelectionEnabled(true); treeTable.marathon_select( "{\"cells\":[[\"/Sales Department/Ethan Williams\",\"Employee\"],[\"/Sales Department/Michael Brown\",\"Email\"]]}"); }); new Wait("Waiting for cells to be selected") { @Override public boolean until() { return treeTableNode.getSelectionModel().getSelectedCells().size() == 2; } }; }
Example #22
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 #23
Source File: RFXTableViewTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void selectMulpitleRows() { TableView<?> tableView = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); Point2D point = getPoint(tableView, 1, 1); RFXTableView rfxTableView = new RFXTableView(tableView, null, point, lr); rfxTableView.focusGained(null); tableView.getSelectionModel().selectIndices(1, 3); rfxTableView.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("{\"rows\":[1,3]}", recording.getParameters()[0]); }
Example #24
Source File: RFXTableViewTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Test public void selectMultipleCells() { TableView<?> tableView = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { tableView.getSelectionModel().setCellSelectionEnabled(true); tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); Point2D point = getPoint(tableView, 1, 1); RFXTableView rfxTableView = new RFXTableView(tableView, null, point, lr); rfxTableView.focusGained(null); @SuppressWarnings("rawtypes") TableColumn column = getTableColumnAt(tableView, 1); tableView.getSelectionModel().select(1, column); tableView.getSelectionModel().select(2, column); rfxTableView.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("{\"cells\":[[\"1\",\"Last\"],[\"2\",\"Last\"]]}", recording.getParameters()[0]); }
Example #25
Source File: RFXTableViewTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Test public void selectAllCells() { TableView<?> tableView = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { tableView.getSelectionModel().setCellSelectionEnabled(true); tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); Point2D point = getPoint(tableView, 1, 1); RFXTableView rfxTableView = new RFXTableView(tableView, null, point, lr); rfxTableView.focusGained(null); tableView.getSelectionModel().selectRange(0, getTableColumnAt(tableView, 0), 5, getTableColumnAt(tableView, 2)); rfxTableView.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("all", recording.getParameters()[0]); }
Example #26
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 #27
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 #28
Source File: TextFieldListViewSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public TextFieldListViewSample() { final ListView<String> listView = new ListView<String>(); listView.setItems(FXCollections.observableArrayList("Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6", "Row 7", "Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13", "Row 14", "Row 15", "Row 16", "Row 17", "Row 18", "Row 19", "Row 20")); listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); listView.setEditable(true); listView.setCellFactory(TextFieldListCell.forListView()); getChildren().add(listView); }
Example #29
Source File: JavaFXTableViewElementTest.java From marathonv5 with Apache License 2.0 | 5 votes |
@Test public void selectAllRows() { TableView<?> tableViewNode = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view"); Platform.runLater(() -> { tableViewNode.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); tableView.marathon_select("all"); }); new Wait("Wating for rows to be select.") { @Override public boolean until() { return tableViewNode.getSelectionModel().getSelectedIndices().size() > 1; } }; }
Example #30
Source File: SimpleListViewScrollSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public SimpleListViewScrollSample() { final ListView<String> listView = new ListView<String>(); listView.setItems(FXCollections.observableArrayList("Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6", "Row 7", "Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13", "Row 14", "Row 15", "Row 16", "Row 17", "Row 18", "Row 19", "Row 20", "Row 21", "Row 22", "Row 23", "Row 24", "Row 25")); listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); getChildren().add(listView); }