javafx.scene.control.TreeTableView Java Examples
The following examples show how to use
javafx.scene.control.TreeTableView.
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: JavaFXTreeTableViewElementTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Test public void selectNoCell() { TreeTableView<?> treeTableNode = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view"); Platform.runLater(() -> { TreeTableViewSelectionModel<?> selectionModel = treeTableNode.getSelectionModel(); selectionModel.setCellSelectionEnabled(true); selectionModel.select(0, getTreeTableColumnAt(treeTableNode, 0)); treeTable.marathon_select(""); }); new Wait("Waiting for no cell selection") { @Override public boolean until() { return treeTableNode.getSelectionModel().getSelectedCells().size() == 0; } }; }
Example #2
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 #3
Source File: RFXTreeTableViewTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Test public void selectACell() { TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel(); selectionModel.setCellSelectionEnabled(true); 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); 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\"]]}", recording.getParameters()[0]); }
Example #4
Source File: RFXTreeTableViewTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void getText() { TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view"); LoggingRecorder lr = new LoggingRecorder(); List<String> text = new ArrayList<>(); Platform.runLater(() -> { RFXTreeTableView rfxTreeTableView = new RFXTreeTableView(treeTableView, null, null, lr); treeTableView.getSelectionModel().select(2); rfxTreeTableView.focusLost(null); text.add(rfxTreeTableView.getAttribute("text")); }); new Wait("Waiting for tree table view text.") { @Override public boolean until() { return text.size() > 0; } }; AssertJUnit.assertEquals("{\"rows\":[\"/Sales Department/Emma Jones\"]}", text.get(0)); }
Example #5
Source File: ServiceViewer.java From diirt with MIT License | 6 votes |
public ServiceViewer() { FXMLLoader fxmlLoader = new FXMLLoader( getClass().getResource("ServiceViewer.fxml")); fxmlLoader.setRoot(this); fxmlLoader.setController(this); try { fxmlLoader.load(); } catch (IOException exception) { throw new RuntimeException(exception); } TreeItem<BrowserItem> root = new TreeBrowserItem(new ServiceRootBrowserItem()); root.setExpanded(true); servicesTreeTable.setRoot(root); servicesTreeTable.setShowRoot(false); servicesTreeTable.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY); TreeTableColumn<BrowserItem,String> nameCol = new TreeTableColumn<>("Name"); TreeTableColumn<BrowserItem,String> descriptionCol = new TreeTableColumn<>("Description"); servicesTreeTable.getColumns().setAll(nameCol, descriptionCol); nameCol.setCellValueFactory(new TreeItemPropertyValueFactory<>("name")); descriptionCol.setCellValueFactory(new TreeItemPropertyValueFactory<>("description")); }
Example #6
Source File: JavaFXElementPropertyAccessor.java From marathonv5 with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") private String getTreeTableItemText(TreeTableView<?> treeTableView, TreeItem<?> lastPathComponent) { @SuppressWarnings("rawtypes") TreeTableColumn treeTableColumn = treeTableView.getTreeColumn(); if (treeTableColumn == null) { treeTableColumn = treeTableView.getColumns().get(0); } ObservableValue<?> cellObservableValue = treeTableColumn.getCellObservableValue(lastPathComponent); String original = cellObservableValue.getValue().toString(); String itemText = original; int suffixIndex = 0; TreeItem<?> parent = lastPathComponent.getParent(); if (parent == null) return itemText; ObservableList<?> children = parent.getChildren(); for (int i = 0; i < children.indexOf(lastPathComponent); i++) { TreeItem<?> child = (TreeItem<?>) children.get(i); cellObservableValue = treeTableColumn.getCellObservableValue(child); String current = cellObservableValue.getValue().toString(); if (current.equals(original)) { itemText = String.format("%s(%d)", original, ++suffixIndex); } } return itemText; }
Example #7
Source File: RFXTreeTableViewTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@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 #8
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 #9
Source File: JavaFXElementPropertyAccessor.java From marathonv5 with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") protected void selectTreeTableCells(TreeTableView<?> treeTableView, String value) { @SuppressWarnings("rawtypes") TreeTableViewSelectionModel selectionModel = treeTableView.getSelectionModel(); JSONObject cells = new JSONObject(value); JSONArray object = (JSONArray) cells.get("cells"); for (int i = 0; i < object.length(); i++) { JSONArray jsonArray = object.getJSONArray(i); int rowIndex = getTreeTableNodeIndex(treeTableView, jsonArray.getString(0)); int columnIndex = getTreeTableColumnIndex(treeTableView, jsonArray.getString(1)); @SuppressWarnings("rawtypes") TreeTableColumn column = treeTableView.getColumns().get(columnIndex); if (getVisibleCellAt(treeTableView, rowIndex, columnIndex) == null) { treeTableView.scrollToColumn(column); treeTableView.scrollTo(rowIndex); } selectionModel.select(rowIndex, column); } }
Example #10
Source File: JavaFXTreeTableViewElement.java From marathonv5 with Apache License 2.0 | 6 votes |
@Override public List<IJavaFXElement> getByPseudoElement(String selector, Object[] params) { if (selector.equals("root")) { return Arrays.asList(new JavaFXTreeTableViewCellElement(this, 0, 0)); } else if (selector.equals("mnth-cell")) { return Arrays.asList(new JavaFXTreeTableViewCellElement(this, ((Integer) params[0]).intValue() - 1, ((Integer) params[1]).intValue() - 1)); } else if (selector.equals("all-cells")) { TreeTableView<?> tableView = (TreeTableView<?>) getComponent(); int rowCount = tableView.getExpandedItemCount(); int columnCount = tableView.getColumns().size(); ArrayList<IJavaFXElement> r = new ArrayList<>(); for (int i = 0; i < rowCount; i++) { for (int j = 0; j < columnCount; j++) { r.add(new JavaFXTreeTableViewCellElement(this, i, j)); } } return r; } else if (selector.equals("select-by-properties")) { return findSelectByProperties(new JSONObject((String) params[0])); } return super.getByPseudoElement(selector, params); }
Example #11
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 #12
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 #13
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 #14
Source File: RFXTreeTableViewTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void selectMulptipleRows() { 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); treeTableView.getSelectionModel().selectIndices(2, 4); rfxTreeTableView.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("{\"rows\":[\"/Sales Department/Emma Jones\",\"/Sales Department/Anna Black\"]}", recording.getParameters()[0]); }
Example #15
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 #16
Source File: RFXComponentTest.java From marathonv5 with Apache License 2.0 | 6 votes |
protected Point2D getPoint(TreeTableView<?> treeTableView, int rowIndex, int columnIndex) { Set<Node> treeTableRowCell = treeTableView.lookupAll(".tree-table-row-cell"); TreeTableRow<?> row = null; for (Node tableRow : treeTableRowCell) { TreeTableRow<?> r = (TreeTableRow<?>) tableRow; if (r.getIndex() == rowIndex) { row = r; break; } } Set<Node> cells = row.lookupAll(".tree-table-cell"); for (Node node : cells) { TreeTableCell<?, ?> cell = (TreeTableCell<?, ?>) node; if (treeTableView.getColumns().indexOf(cell.getTableColumn()) == columnIndex) { Bounds bounds = cell.getBoundsInParent(); Point2D localToParent = cell.localToParent(bounds.getWidth() / 2, bounds.getHeight() / 2); Point2D rowLocal = row.localToScene(localToParent, true); return rowLocal; } } return null; }
Example #17
Source File: TextTableExt.java From Jupiter with GNU General Public License v3.0 | 5 votes |
/** * Initializes a new table view extension. * * @param tableView tree table view to extend */ public TextTableExt(JFXTreeTableView<StatementItem> treeTableView) { this.treeTableView = treeTableView; // Callback to monitor row creation and to identify visible screen rows final Callback<TreeTableView<StatementItem>, TreeTableRow<StatementItem>> rf = treeTableView.getRowFactory(); // modify row factory final Callback<TreeTableView<StatementItem>, TreeTableRow<StatementItem>> modifiedRowFactory = param -> { TreeTableRow<StatementItem> r = rf != null ? rf.call(param) : new TreeTableRow<StatementItem>(); // Save row, this implementation relies on JaxaFX re-using TableRow efficiently rows.add(r); return r; }; treeTableView.setRowFactory(modifiedRowFactory); }
Example #18
Source File: JavaFXTreeTableViewElementTest.java From marathonv5 with Apache License 2.0 | 5 votes |
@Test public void selectACell() { TreeTableView<?> treeTableNode = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view"); Platform.runLater(() -> { TreeTableViewSelectionModel<?> selectionModel = treeTableNode.getSelectionModel(); selectionModel.setCellSelectionEnabled(true); treeTable.marathon_select("{\"cells\":[[\"/Sales Department/Ethan Williams\",\"Employee\"]]}"); }); new Wait("Waiting for cell to be selected") { @Override public boolean until() { return treeTableNode.getSelectionModel().getSelectedCells().size() == 1; } }; }
Example #19
Source File: RFXTreeTableView.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public String _getText() { if (row != -1 && column != -1) { TreeTableCell<?, ?> treeTableCell = getCellAt((TreeTableView<?>) node, row, column); if (treeTableCell != null) { return treeTableCell.getText(); } } return getTreeTableSelection((TreeTableView<?>) node); }
Example #20
Source File: RFXTreeTableViewTest.java From marathonv5 with Apache License 2.0 | 5 votes |
@Test public void selectNoRows() { TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { RFXTreeTableView rfxTreeTableView = new RFXTreeTableView(treeTableView, null, null, lr); rfxTreeTableView.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("", recording.getParameters()[0]); }
Example #21
Source File: ChoiceBoxTreeTableSampleApp.java From marathonv5 with Apache License 2.0 | 5 votes |
@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 #22
Source File: TextFieldTreeTableSampleApp.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) { primaryStage.setTitle("TreeTable View Sample"); primaryStage.setScene(new Scene(new TextFieldTreeTableSample())); primaryStage.sizeToScene(); primaryStage.show(); TreeTableView<?> treeTableView = (TreeTableView<?>) primaryStage.getScene().getRoot().lookup(".tree-table-view"); treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); }
Example #23
Source File: TreeTableCellSampleApp.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) { primaryStage.setTitle("TreeTable View Cell Sample"); primaryStage.setScene(new Scene(new TreeTableSample())); primaryStage.sizeToScene(); primaryStage.show(); TreeTableView<?> treeTableView = (TreeTableView<?>) primaryStage.getScene().getRoot().lookup(".tree-table-view"); TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel(); selectionModel.setCellSelectionEnabled(true); selectionModel.setSelectionMode(SelectionMode.MULTIPLE); }
Example #24
Source File: ComboBoxTreeTableSampleApp.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) { primaryStage.setTitle("TreeTable View Sample"); primaryStage.setScene(new Scene(new ComboBoxTreeTableSample())); primaryStage.sizeToScene(); primaryStage.show(); TreeTableView<?> treeTableView = (TreeTableView<?>) primaryStage.getScene().getRoot().lookup(".tree-table-view"); treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); }
Example #25
Source File: CheckBoxTreeTableSampleApp.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) { primaryStage.setTitle("CheckBox TreeTable View Sample"); primaryStage.setScene(new Scene(new CheckBoxTreeTableSample())); primaryStage.sizeToScene(); primaryStage.show(); TreeTableView<?> treeTableView = (TreeTableView<?>) primaryStage.getScene().getRoot().lookup(".tree-table-view"); treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); }
Example #26
Source File: FxTreeTable.java From FxDock with Apache License 2.0 | 5 votes |
public void setAutoResizeMode(boolean on) { autoResizeMode.set(on); if(on) { // TODO implement a better resizing policy that uses preferred column width tree.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY); } else { tree.setColumnResizePolicy(TreeTableView.UNCONSTRAINED_RESIZE_POLICY); } fixHorizontalScrollbar(); }
Example #27
Source File: FeatureTablePopupMenu.java From old-mzmine3 with GNU General Public License v2.0 | 5 votes |
public FeatureTablePopupMenu(FeatureTable featureTable, TreeTableView<FeatureTableRow> treeTable) { this.featureTable = featureTable; this.treeTable = treeTable; /* * Show menu */ Menu showMenu = new Menu("Show"); // XIC MenuItem xicItem = new MenuItem("Extracted Ion Chromatogram (XIC)"); xicItem.setOnAction(handleClick("XIC")); showMenu.getItems().addAll(xicItem); getItems().addAll(showMenu); getItems().addAll(new SeparatorMenuItem()); /* * Other items */ // Expand MenuItem expandItem = new MenuItem("Expand all groups"); expandItem.setOnAction(handleClick("Expand")); getItems().addAll(expandItem); // Collapse MenuItem collapsItem = new MenuItem("Collapse all groups"); collapsItem.setOnAction(handleClick("Collapse")); getItems().addAll(collapsItem); getItems().addAll(new SeparatorMenuItem()); // Delete MenuItem deleteItem = new MenuItem("Delete selected row(s)"); deleteItem.setOnAction(handleClick("Delete")); getItems().addAll(deleteItem); }
Example #28
Source File: TableUtils.java From old-mzmine3 with GNU General Public License v2.0 | 5 votes |
public void handle(final KeyEvent keyEvent) { if (keyCodeCompination.match(keyEvent)) { if (keyEvent.getSource() instanceof TreeTableView) { // Copy to clipboard copySelectionToClipboard((TreeTableView<?>) keyEvent.getSource()); // Event is handled, consume it keyEvent.consume(); } } }
Example #29
Source File: FormulaFunctionViewer.java From diirt with MIT License | 5 votes |
public FormulaFunctionViewer() { FXMLLoader fxmlLoader = new FXMLLoader( getClass().getResource("FormulaFunctionViewer.fxml")); fxmlLoader.setRoot(this); fxmlLoader.setController(this); try { fxmlLoader.load(); } catch (IOException exception) { throw new RuntimeException(exception); } // functionsTreeTable = new TreeTableView<>(); // setHgrow(functionsTreeTable, Priority.ALWAYS); TreeItem<BrowserItem> root = new TreeBrowserItem(new FormulaFunctionRootBrowserItem()); root.setExpanded(true); functionsTreeTable.setRoot(root); functionsTreeTable.setShowRoot(false); functionsTreeTable.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY); TreeTableColumn<BrowserItem,String> nameCol = new TreeTableColumn<>("Name"); TreeTableColumn<BrowserItem,String> descriptionCol = new TreeTableColumn<>("Description"); functionsTreeTable.getColumns().setAll(nameCol, descriptionCol); nameCol.setCellValueFactory(new TreeItemPropertyValueFactory<>("name")); descriptionCol.setCellValueFactory(new TreeItemPropertyValueFactory<>("description")); }
Example #30
Source File: RFXTreeTableView.java From marathonv5 with Apache License 2.0 | 5 votes |
public RFXTreeTableView(Node source, JSONOMapConfig omapConfig, Point2D point, IJSONRecorder recorder) { super(source, omapConfig, point, recorder); TreeTableView<?> treeTableView = (TreeTableView<?>) source; if (source == null) { return; } if (treeTableView.getEditingCell() != null) { TreeTablePosition<?, ?> editingCell = treeTableView.getEditingCell(); row = editingCell.getRow(); column = editingCell.getColumn(); } else { if (point != null) { column = getTreeTableColumnAt(treeTableView, point); row = getTreeTableRowAt(treeTableView, point); } else { ObservableList<?> selectedCells = treeTableView.getSelectionModel().getSelectedCells(); for (Object cell : selectedCells) { TreeTablePosition<?, ?> tablePosition = (TreeTablePosition<?, ?>) cell; column = tablePosition.getColumn(); row = tablePosition.getRow(); } } } cellInfo = getTreeTableCellText(treeTableView, row, column); if (row == -1 || column == -1) { row = column = -1; } }