Java Code Examples for javafx.scene.control.SelectionMode

The following are top voted examples for showing how to use javafx.scene.control.SelectionMode. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: code-tracker   File: MainController.java   View source code 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void initialize(URL location, ResourceBundle resources) {
    // Initializes test base, tester and test map to access and modify the algorithm base
    testBase = TestBase.INSTANCE;   // Gets a reference to the test base
    tester = new Tester();          //
    testMap = tester.getTestMap();

    // Binds the list view with a list of algorithms (list items)
    listItems = FXCollections.observableList(new ArrayList<>(testMap.keySet()));
    list.itemsProperty().bindBidirectional(new SimpleListProperty<>(listItems));
    list.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    list.getSelectionModel().selectedItemProperty().addListener((((observable, oldValue, newValue) -> {
        if(newValue != null) {
            textArea.setText(testMap.get(newValue).getContent());
        } else {
            textArea.clear();
        }
    })));
    list.getSelectionModel().select(0);

    // Initializes the trie that stores all algorithm names
    algorithmNameTrie = new Trie();
    for(String algorithmName : testMap.keySet()) {
        algorithmNameTrie.addWord(algorithmName);
    }

    // Binds search field with the list view (displays search result)
    searchField.textProperty().addListener((observable, oldValue, newValue) -> {
        listItems.setAll(algorithmNameTrie.getWords(newValue.toLowerCase()));
        if(!listItems.isEmpty()) {
            list.getSelectionModel().select(0);
        }
    });

    // For unknown reasons, this style does not work on css, so I put it in here
    textArea.setStyle("-fx-focus-color: transparent; -fx-text-box-border: transparent;");
    textArea.setFocusTraversable(false);
}
 
Example 2
Project: marathonv5   File: ListViewCellFactorySample.java   View source code 6 votes vote down vote up
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 3
Project: marathonv5   File: JavaFXTreeTableViewElementTest.java   View source code 6 votes vote down vote up
@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 4
Project: marathonv5   File: JavaFXTableViewElementScrollTest.java   View source code 6 votes vote down vote up
@Test public void scrollMultipleRows() {
    Stage primaryStage = getPrimaryStage();
    primaryStage.setWidth(250);
    primaryStage.setHeight(250);
    TableView<?> tableViewNode = (TableView<?>) primaryStage.getScene().getRoot().lookup(".table-view");
    Platform.runLater(() -> {
        tableViewNode.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        tableView.marathon_select("{\"rows\":[2,9]}");
    });
    new Wait("Wating for rows to be select.") {
        @Override public boolean until() {
            return tableViewNode.getSelectionModel().getSelectedIndices().size() > 1;
        }
    };
    new Wait("Waiting for the point to be in viewport") {
        @Override public boolean until() {
            Point2D point = getPoint(tableViewNode, 2, 9);
            return tableViewNode.getBoundsInLocal().contains(point);
        }
    };
}
 
Example 5
Project: marathonv5   File: ListViewCellFactorySample.java   View source code 6 votes vote down vote up
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 6
Project: marathonv5   File: SimpleListViewScrollSample.java   View source code 6 votes vote down vote up
@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 7
Project: marathonv5   File: ChoiceBoxTreeTableSampleApp.java   View source code 6 votes vote down vote up
@Override public void start(Stage primaryStage) {
    primaryStage.setTitle("TreeTable View Sample");
    primaryStage.setScene(new Scene(new ChoiceBoxTreeTableSample()));
    primaryStage.sizeToScene();
    primaryStage.show();
    TreeTableView<?> treeTableView = (TreeTableView<?>) primaryStage.getScene().getRoot().lookup(".tree-table-view");
    treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
}
 
Example 8
Project: marathonv5   File: TreeTableSampleApp.java   View source code 6 votes vote down vote up
@Override public void start(Stage primaryStage) {
    primaryStage.setTitle("TreeTable View Sample");
    primaryStage.setScene(new Scene(new TreeTableSample()));
    primaryStage.sizeToScene();
    primaryStage.show();
    TreeTableView<?> treeTableView = (TreeTableView<?>) primaryStage.getScene().getRoot().lookup(".tree-table-view");
    treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
}
 
Example 9
Project: marathonv5   File: RFXTreeTableViewTest.java   View source code 6 votes vote down vote up
@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 10
Project: marathonv5   File: RFXTreeTableViewTest.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked") @Test public void selectMultipleCells() {
    TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel();
        selectionModel.setCellSelectionEnabled(true);
        selectionModel.setSelectionMode(SelectionMode.MULTIPLE);
        Point2D point = getPoint(treeTableView, 1, 0);
        RFXTreeTableView rfxTreeTableView = new RFXTreeTableView(treeTableView, null, point, lr);
        rfxTreeTableView.focusGained(null);
        @SuppressWarnings("rawtypes")
        TreeTableColumn column = getTreeTableColumnAt(treeTableView, 0);
        selectionModel.select(1, column);
        selectionModel.select(3, getTreeTableColumnAt(treeTableView, 1));
        rfxTreeTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals(
            "{\"cells\":[[\"/Sales Department/Ethan Williams\",\"Employee\"],[\"/Sales Department/Michael Brown\",\"Email\"]]}",
            recording.getParameters()[0]);
}
 
Example 11
Project: marathonv5   File: RFXTreeTableViewTest.java   View source code 6 votes vote down vote up
@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 12
Project: marathonv5   File: RFXTreeViewTest.java   View source code 6 votes vote down vote up
@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 13
Project: marathonv5   File: RFXTableViewTest.java   View source code 6 votes vote down vote up
@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 14
Project: marathonv5   File: RFXTableViewTest.java   View source code 6 votes vote down vote up
@Test public void selectAllRows() {
    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().selectRange(0, 5);
        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 15
Project: marathonv5   File: RFXTableViewTest.java   View source code 6 votes vote down vote up
@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 16
Project: marathonv5   File: RFXTableViewTest.java   View source code 6 votes vote down vote up
@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 17
Project: marathonv5   File: RFXListViewTest.java   View source code 6 votes vote down vote up
@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 18
Project: marathonv5   File: RFXListViewTest.java   View source code 6 votes vote down vote up
@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 19
Project: CSLMusicModStationCreator   File: ConjunctionEditor.java   View source code 6 votes vote down vote up
@FXML
private void initialize() {
    content.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    addEntry.showingProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> observableValue, Boolean aBoolean, Boolean t1) {
            rebuildAddItemMenu();
        }
    });

    content.setOnKeyPressed(keyEvent -> {
        if(keyEvent.getCode() == KeyCode.DELETE) {
            removeEntries();
        }
    });
}
 
Example 20
Project: CSLMusicModStationCreator   File: ContextEntryEditor.java   View source code 6 votes vote down vote up
@FXML
private void initialize() {

    songs.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    contextCollections.getCheckModel().getCheckedItems().addListener(new ListChangeListener<String>() {
        @Override
        public void onChanged(Change<? extends String> change) {
            updateSongsAutoComplete();
        }
    });
    songs.setOnKeyPressed(keyEvent -> {
        if(keyEvent.getCode() == KeyCode.DELETE) {
            removeSongs();
        }
    });
}
 
Example 21
Project: qupath-tracking-extension   File: ExtendedViewTrackerPlayback.java   View source code 6 votes vote down vote up
public static TableView<ViewRecordingFrame> makeTable(QuPathViewer viewer, ViewTracker tracker) {

        TableView<ViewRecordingFrame> table = new TableView();

        for (int i = 0; i < nCols(tracker); ++i) {
            TableColumn<ViewRecordingFrame, Object> column = new TableColumn(getColumnName(i));
            final int j = i;
            column.setCellValueFactory(frame -> new SimpleObjectProperty(
                    getColumnValue((ViewRecordingFrame)frame.getValue(), j)));
            table.getColumns().add(column);
        }

        table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        table.getSelectionModel().selectedItemProperty().addListener((v, o, frame) -> {
            if (frame != null) {
                setViewerForFrame(viewer, frame);
            }
        });
        ObservableList<ViewRecordingFrame> frameList = FXCollections.observableArrayList(
                TrackerUtils.getFramesAsArrayList(tracker));

        table.setItems(frameList);
        return table;
    }
 
Example 22
Project: Gargoyle   File: FilePropertiesComposite.java   View source code 6 votes vote down vote up
@FXML
public void initialize() {
	StringConverter<PieChart.Data> labelConverter = new StringConverter<PieChart.Data>() {

		@Override
		public String toString(Data d) {
			String formatedValue = String.format("%s\n%.2f %%", d.getName(), d.getPieValue());
			return formatedValue;
		}

		@Override
		public Data fromString(String string) {
			return null;
		}
	};
	picChart.setLabelConverter(labelConverter);
	picChart.setTooltipConverter(labelConverter);

	tbFileProperties.getItems().addAll(apply(this.file));

	tbFileProperties.getSelectionModel().setCellSelectionEnabled(true);
	tbFileProperties.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

	FxUtil.installClipboardKeyEvent(tbFileProperties);
	FxClipboardUtil.installCopyPasteHandler(tbFileProperties);
}
 
Example 23
Project: openjfx-8u-dev-tests   File: ListViewApp.java   View source code 6 votes vote down vote up
private void reset() {
    //view.setItems(new ArrayList<Object>());
    while (view.getItems().size() > 0) {
        view.getItems().remove(0);
    }
    view.getItems().addAll(Arrays.asList(DEFAULT_ITEMS));
    view.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    view.getSelectionModel().clearSelection();
    textToAdd.setText("item");

    if (addItemsOnInit > 0) {
        for (int i = 0; i < addItemsOnInit; ++i) {
            view.getItems().add(0, "item " + (addItemsOnInit - i));
        }
    }
}
 
Example 24
Project: openjfx-8u-dev-tests   File: NewListViewTest.java   View source code 6 votes vote down vote up
protected void commonClickingTest(Orientation orientation, SelectionMode selectionMode) throws InterruptedException, Throwable {
    setSize(130, 130);
    setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, SelectionMode.MULTIPLE, Properties.selectionMode);
    setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, SelectionMode.SINGLE, Properties.selectionMode);
    setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, selectionMode, Properties.selectionMode);

    setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, orientation, Properties.orientation);
    for (int i = 1; i < listItems; i++) {
        addElement(String.valueOf(Integer.valueOf((int) Math.round(Math.pow(i, i)))), i - 1);
    }

    selectionCycle(0, listItems - 1, null, selectionMode);

    localReset();

    selectionCycle(0, listItems - 1, KeyboardButtons.SHIFT, selectionMode);

    localReset();

    selectionCycle(0, listItems - 1, KeyboardButtons.CONTROL, selectionMode);
}
 
Example 25
Project: openjfx-8u-dev-tests   File: NewListViewTest.java   View source code 6 votes vote down vote up
@Test(timeout = 300000)
/**
 * Add big amount of elements in a list and select some of the according to
 * some rule. After that checks, whether focus is correct.
 */
public void simpleSelectionScreenShotTest() throws InterruptedException, Throwable {
    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 200);
    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, 200);
    setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, SelectionMode.MULTIPLE, Properties.selectionMode);
    setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, Orientation.HORIZONTAL, Properties.orientation);

    final int elementsCount = 15;
    addAndSelectElements(elementsCount);

    final int step = 6;
    checkScreenshotsWithStep("SimpleTest", elementsCount, step);
}
 
Example 26
Project: ReqTraq   File: TreeTablePane.java   View source code 6 votes vote down vote up
public TreeTablePane()
{
	tree = new TreeTableView<>();
	tree.setShowRoot(false);
	tree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
	tree.setEditable(true);
	tree.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY);
	FX.style(tree, CssTools.NO_HORIZONTAL_SCROLL_BAR, TREE);
	
	handler = new TreeTableHandler<Page>(tree);
	
	setupActions();
	
	addColumn(Page.Field.TITLE, "Title");
	addColumn(Page.Field.TIME_CREATED, "Created");
	addColumn(Page.Field.STATUS, "Status");
	
	setCenter(tree);
}
 
Example 27
Project: JttDesktop   File: TestTableView.java   View source code 6 votes vote down vote up
/**
 * Method to construct the table.
 * @param database the {@link JenkinsDatabase} providing the {@link TestClass}es.
 */
public void constructLayout( JenkinsDatabase database ) {
   root = new TreeItem<>();
   root.setExpanded( true );
   
   database.testClasses().forEach( test -> {
      createBranch( root, test );
   } );

   TreeTableView< TestTableItem > treeTableView = new TreeTableView<>( root );
   treeTableView.setEditable( false );
   treeTableView.getSelectionModel().setSelectionMode( SelectionMode.MULTIPLE );

   createDescriptionColumn( treeTableView, DESCRIPTION_COLUMN_NAME, DESCRIPTION_COLUMN_INDEX, DESCRIPTION_COLUMN_WIDTH );
   createDescriptionColumn( treeTableView, STATUS_COLUMN_NAME, STATUS_COLUMN_INDEX, COMMON_COLUMN_WIDTH );
   createDescriptionColumn( treeTableView, SKIPPED_COLUMN_NAME, SKIPPED_COLUMN_INDEX, COMMON_COLUMN_WIDTH );
   createDescriptionColumn( treeTableView, AGE_COLUMN_NAME, AGE_COLUMN_INDEX, COMMON_COLUMN_WIDTH );
   createDescriptionColumn( treeTableView, DURATION_COLUMN_NAME, DURATION_COLUMN_INDEX, COMMON_COLUMN_WIDTH );
   
   treeTableView.setShowRoot( false );
   treeTableView.setTableMenuButtonVisible( true );
   setCenter( treeTableView );
}
 
Example 28
Project: JttDesktop   File: AssignmentDetailControllerTest.java   View source code 6 votes vote down vote up
@Before public void initialiseSystemUnderTest(){
   TestApplication.startPlatform();
   MockitoAnnotations.initMocks( this );
   
   assignmentA = new UserAssignment( new JenkinsUserImpl( "A" ), 0, "", "" );
   assignmentB = new UserAssignment( new JenkinsUserImpl( "B" ), 0, "", "" );
   
   itemA = new AssignedTreeItem( assignmentA );
   itemB = new AssignedTreeItem( assignmentB );
   tree = new TreeTableView<>();
   tree.getSelectionModel().setSelectionMode( SelectionMode.MULTIPLE );
   tree.setRoot( new TreeItem<>() );
   tree.getRoot().setExpanded( true );
   tree.getRoot().getChildren().add( new TreeItem<>( itemA ) );
   tree.getRoot().getChildren().add( new TreeItem<>( itemB ) );
   
   systemUnderTest = new AssignmentDetailController( tree, area );
}
 
Example 29
Project: certmgr   File: ExtendedKeyUsageController.java   View source code 6 votes vote down vote up
/**
 * Initialize the dialog.
 *
 * @param expertMode Whether to run in expert mode ({@code true}) or not ({@code false}).
 * @return This controller.
 */
public ExtendedKeyUsageController init(boolean expertMode) {
	this.ctlCritical.setSelected(ExtendedKeyUsageExtensionData.CRITICAL_DEFAULT);

	ObservableList<ExtendedKeyUsage> usageItems = this.ctlUsages.getItems();

	for (ExtendedKeyUsage usage : ExtendedKeyUsage.instances()) {
		if (!ExtendedKeyUsage.ANY.equals(usage)) {
			usageItems.add(usage);
		}
	}
	usageItems.sort((o1, o2) -> o1.name().compareTo(o2.name()));
	this.ctlUsages.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
	this.ctlAnyUsage.setSelected(false);
	return this;
}
 
Example 30
Project: certmgr   File: KeyUsageController.java   View source code 6 votes vote down vote up
/**
 * Initialize the dialog.
 *
 * @param expertMode Whether to run in expert mode ({@code true}) or not ({@code false}).
 * @return This controller.
 */
public KeyUsageController init(boolean expertMode) {
	this.ctlCritical.setSelected(KeyUsageExtensionData.CRITICAL_DEFAULT);

	ObservableList<KeyUsage> usageItems = this.ctlUsages.getItems();

	for (KeyUsage usage : KeyUsage.instances()) {
		if (!KeyUsage.ANY.equals(usage)) {
			usageItems.add(usage);
		}
	}
	usageItems.sort((o1, o2) -> o1.name().compareTo(o2.name()));
	this.ctlUsages.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
	this.ctlAnyUsage.setSelected(false);
	return this;
}
 
Example 31
Project: qupath   File: SingleFeatureClassifierCommand.java   View source code 6 votes vote down vote up
InputPane(final ObservableList<PathClass> availableClasses) {
	// Input classes - classification will only be applied to objects of this class
	listInputClasses.setItems(availableClasses);
	listInputClasses.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
	listInputClasses.setPrefHeight(200);
	pane = new TitledPane("Input", listInputClasses);
	pane.setCollapsible(false);
	
	listInputClasses.getSelectionModel().selectedItemProperty().addListener((v, o, n) -> {
		// Not sure why, but this needs to be deferred to later...
		Platform.runLater(() -> selectedItemList.setAll(listInputClasses.getSelectionModel().getSelectedItems()));
	});
	
	Tooltip tooltip = new Tooltip("Select input classifications - only objects with these classes will be reclassified");
	pane.setTooltip(tooltip);
	listInputClasses.setTooltip(tooltip);
}
 
Example 32
Project: LuoYing   File: AssetsForm.java   View source code 6 votes vote down vote up
public AssetsForm() {
        getChildren().add(assetTree);
        
        assetTree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        assetTree.setOnMouseClicked((e) -> {
            if (e.getButton() == MouseButton.SECONDARY) {
                doShowPopup(e.getScreenX(), e.getScreenY());
                e.consume();
            } else if (e.getButton() == MouseButton.PRIMARY && e.getClickCount() == 2) {
                editMenu.fire();
                e.consume();
            }
        });
        
        assetTree.setOnDragDetected(this::doDragDetected);
        assetTree.setOnDragDone(this::doDragDone);
//        assetTree.setOnDragOver(this::doDragOver);
        assetTree.prefWidthProperty().bind(widthProperty());
        assetTree.prefHeightProperty().bind(heightProperty());

        updateAassetDir();
        Manager.getConfigManager().addListener(this);
        setPrefHeight(300);
    }
 
Example 33
Project: MatroskaBatch   File: RemoteFileChooserController.java   View source code 6 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources) {
	mainList.getSelectionModel().setSelectionMode(multiselect ? SelectionMode.MULTIPLE : SelectionMode.SINGLE);
	mainList.setCellFactory(new Callback<ListView<RESTPath>, ListCell<RESTPath>>() {
		@Override
		public ListCell<RESTPath> call(ListView<RESTPath> param) {
			return new RESTPathListCell();
		}
	});
	Platform.runLater(() -> {
		try {
			currentPath = remoteUtils.getRemoteRoot();
			loadDirectory(currentPath);
		} catch (IOException e) {
			throw new RuntimeException("couldn't get root", e);
		}
	});
}
 
Example 34
Project: sgf4j-gui   File: FileTreeView.java   View source code 6 votes vote down vote up
public FileTreeView() {
  super();

  getSelectionModel().setSelectionMode(SelectionMode.SINGLE);

  setCellFactory(new Callback<TreeView<File>, TreeCell<File>>() {
    @Override
    public TreeCell<File> call(TreeView<File> param) {
      return new FileFormatCell();
    }
  });

  final TreeItem<File> fakeRoot = new TreeItem<File>();
  setRoot(fakeRoot);
  setShowRoot(false);

  List<File> rootDevices = Sgf4jGuiUtil.getRootDevices();
  TreeItem<File>[] treeItems = new FileTreeItem[rootDevices.size()];
  for (int i = 0; i < rootDevices.size(); i++) {
    treeItems[i] = new FileTreeItem(rootDevices.get(i));
  }

  fakeRoot.getChildren().addAll(treeItems);

  openTreeAtRightLocation(fakeRoot);
}
 
Example 35
Project: WhoWhatWhere   File: WatchdogController.java   View source code 6 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources)
{
	setColumnCellFactories();
	setGraphics();
	setButtonsDisableStates();

	table.setPlaceholder(new Label("No rules set"));
	table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

	numFieldCooldown.setMinValue(WatchdogUI.minCooldownValue);
	numFieldCooldown.setMaxValue(WatchdogUI.maxCooldownValue);
	
	//show scrollbars only when needed. When not needed, allow to stretch GUI (AnchorPane behavior)
	scrollPane.fitToWidthProperty().bind(scrollPane.widthProperty().greaterThan(scrollPane.getPrefWidth()));
	scrollPane.fitToHeightProperty().bind(scrollPane.heightProperty().greaterThan(scrollPane.getPrefHeight()));
}
 
Example 36
Project: metastone   File: BattleOfDecksConfigView.java   View source code 6 votes vote down vote up
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 37
Project: metastone   File: TrainingConfigView.java   View source code 6 votes vote down vote up
public TrainingConfigView() {
	FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/TrainingConfigView.fxml"));
	fxmlLoader.setRoot(this);
	fxmlLoader.setController(this);

	try {
		fxmlLoader.load();
	} catch (IOException exception) {
		throw new RuntimeException(exception);
	}

	setupDeckBox();
	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 38
Project: performance-test-harness-for-geoevent   File: ReportOptionsController.java   View source code 6 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources) {
    reportTypeLabel.setText(UIMessages.getMessage("UI_REPORT_TYPE_LABEL"));
    reportType.setItems(getReportTypes());
    reportType.setValue(report.getType());
    reportFileLocationLabel.setText(UIMessages.getMessage("UI_REPORT_FILE_LOCATION_LABEL"));
    reportFileLocationBtn.setText(UIMessages.getMessage("UI_REPORT_FILE_BROWSE_LABEL"));
    reportFileLocationBtn.setTooltip(new Tooltip(UIMessages.getMessage("UI_REPORT_FILE_BROWSE_DESC")));
    allCoumnsLabel.setText(UIMessages.getMessage("UI_ALL_COLUMNS_LABEL"));
    selectedCoumnsLabel.setText(UIMessages.getMessage("UI_SELECTED_COLUMNS_LABEL"));
    allColumns.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    selectedColumns.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    okBtn.setText(UIMessages.getMessage("UI_OK_BTN_LABEL"));
    cancelBtn.setText(UIMessages.getMessage("UI_CANCEL_BTN_LABEL"));

    // lookup current directory and add "/report" to it
    updateSelectedReportFile(report.getReportFile());
    updateSelectedReportColumns(report.getReportColumns());
}
 
Example 39
Project: StreamSis   File: MultiSourceFileListerController.java   View source code 6 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources) {
	browseSourceDirButton.disableProperty().bind(manualTitledPane.expandedProperty());
	srcPathTextField.disableProperty().bind(manualTitledPane.expandedProperty());
	fileTable.setPlaceholder(new Label("Let's add some files!"));
	fileTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
	fileNameColumn.setCellValueFactory(
			p -> new ReadOnlyObjectWrapper<String>(p.getValue().getPath()));
	fileNameColumn.setCellFactory(view -> new FileNameCell());
	// indexOf operation might not be very fast. Also the code should ensure that the list with
	// items contains only unique values.
	numberColumn.setCellValueFactory(p -> new ReadOnlyObjectWrapper<String>(
			String.valueOf(p.getTableView().getItems().indexOf(p.getValue()) + 1)));
	manualPaneDotsAnima = new ThreeDotsAnimation(
			"Editing list of <filetype> files", '.',
			manualTitledPane.textProperty(), 1, 500, Timeline.INDEFINITE);
	setValidationForFileTableWithDelay.setCycleCount(1);
	fileTable.getSelectionModel().selectedItemProperty().addListener((o, oldVal, newVal) -> {
		sampleFile.set(newVal);
	});
	initializeListeners();
	// Set tooltips showing file paths.
	GUIUtil.createAndBindTooltipToTextfield(srcPathTextField);
}
 
Example 40
Project: subshare   File: UserPane.java   View source code 6 votes vote down vote up
@FXML
private void assignPgpKeyToThisUserButtonClicked(final ActionEvent event) {
	final SelectPgpKeyDialog dialog = new SelectPgpKeyDialog(getScene().getWindow(),
			new ArrayList<>(getPgp().getMasterKeys()), null, SelectionMode.MULTIPLE,
			"Please select one or more PGP keys you want to 'pull' here.");
	dialog.showAndWait();
	final List<PgpKey> selectedPgpKeys = dialog.getSelectedPgpKeys();
	if (selectedPgpKeys == null || selectedPgpKeys.isEmpty())
		return;

	final Set<PgpKeyId> selectedPgpKeyIds = new HashSet<>(selectedPgpKeys.size());
	for (final PgpKey pgpKey : selectedPgpKeys)
		selectedPgpKeyIds.add(pgpKey.getPgpKeyId());

	for (User user : getUserRegistry().getUsersByPgpKeyIds(selectedPgpKeyIds))
		user.getPgpKeyIds().removeAll(selectedPgpKeyIds);

	user.getPgpKeyIds().addAll(selectedPgpKeyIds);
}