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); }
@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(); } }; }
@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); } }; }
@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(); }
@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); }
@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); }
@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]); }
@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]); }
@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]); }
@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)); }
@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]); }
@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]); }
@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]); }
@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]); }
@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)); }
@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]); }
@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(); } }); }
@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(); } }); }
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; }
@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); }
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)); } } }
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); }
@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); }
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); }
/** * 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 ); }
@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 ); }
/** * 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; }
/** * 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; }
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); }
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); }
@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); } }); }
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); }
@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())); }
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); }
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); }
@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()); }
@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); }
@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); }
@FXML private void assignPgpKeyToOtherUserButtonClicked(final ActionEvent event) { final SelectUserDialog dialog = new SelectUserDialog(getScene().getWindow(), new ArrayList<>(getUserRegistry().getUsers()), null, SelectionMode.SINGLE, "Please select the user to whom you want to 'push' the selected PGP key(s)."); dialog.showAndWait(); final List<User> selectedUsers = dialog.getSelectedUsers(); if (selectedUsers == null || selectedUsers.isEmpty()) return; final User targetUser = selectedUsers.get(0); final Set<PgpKey> selectedPgpKeys = getSelectedPgpKeys(); for (final PgpKey pgpKey : selectedPgpKeys) { user.getPgpKeyIds().remove(pgpKey.getPgpKeyId()); targetUser.getPgpKeyIds().add(pgpKey.getPgpKeyId()); } }