@Test public void selectNoRow() { TreeTableView<?> treeTableNode = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view"); Platform.runLater(() -> { treeTableNode.getSelectionModel().select(0); treeTable.marathon_select(""); }); new Wait("Waiting for no selection") { @Override public boolean until() { return treeTableNode.getSelectionModel().getSelectedIndices().size() == 0; } }; }
@SuppressWarnings("unchecked") @Override public boolean marathon_select(String value) { TreeTableView<?> treeTableView = (TreeTableView<?>) getComponent(); TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel(); if (value.equals("")) { selectionModel.clearSelection(); return true; } else if (value.equals("all")) { selectionModel.clearSelection(); if (!selectionModel.isCellSelectionEnabled()) { int rowCount = treeTableView.getExpandedItemCount(); for (int i = 0; i < rowCount; i++) { selectionModel.select(i); } return true; } else { selectionModel.clearSelection(); selectionModel.selectRange(0, getTreeTableColumnAt(treeTableView, 0), treeTableView.getExpandedItemCount() - 1, getTreeTableColumnAt(treeTableView, treeTableView.getColumns().size() - 1)); return true; } } else if (!selectionModel.isCellSelectionEnabled()) { selectionModel.clearSelection(); int[] selectedRows = getTreeTableSelectedRows(treeTableView, value); for (int selectedRow : selectedRows) { if (getVisibleCellAt(treeTableView, selectedRow, 0) == null) { treeTableView.scrollTo(selectedRow); } selectionModel.select(selectedRow); } return true; } else { selectionModel.clearSelection(); selectTreeTableCells(treeTableView, value); return true; } }
JavaFXTreeTableViewElement extends JavaFXElement { @SuppressWarnings("unchecked") @Override public boolean marathon_select(String value) { TreeTableView<?> treeTableView = (TreeTableView<?>) getComponent(); TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel(); if (value.equals("")) { selectionModel.clearSelection(); return true; } else if (value.equals("all")) { selectionModel.clearSelection(); if (!selectionModel.isCellSelectionEnabled()) { int rowCount = treeTableView.getExpandedItemCount(); for (int i = 0; i < rowCount; i++) { selectionModel.select(i); } return true; } else { selectionModel.clearSelection(); selectionModel.selectRange(0, getTreeTableColumnAt(treeTableView, 0), treeTableView.getExpandedItemCount() - 1, getTreeTableColumnAt(treeTableView, treeTableView.getColumns().size() - 1)); return true; } } else if (!selectionModel.isCellSelectionEnabled()) { selectionModel.clearSelection(); int[] selectedRows = getTreeTableSelectedRows(treeTableView, value); for (int selectedRow : selectedRows) { if (getVisibleCellAt(treeTableView, selectedRow, 0) == null) { treeTableView.scrollTo(selectedRow); } selectionModel.select(selectedRow); } return true; } else { selectionModel.clearSelection(); selectTreeTableCells(treeTableView, value); return true; } } }
JavaFXTreeTableViewElement extends JavaFXElement { @SuppressWarnings("unchecked") @Override public boolean marathon_select(String value) { TreeTableView<?> treeTableView = (TreeTableView<?>) getComponent(); TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel(); if (value.equals("")) { selectionModel.clearSelection(); return true; } else if (value.equals("all")) { selectionModel.clearSelection(); if (!selectionModel.isCellSelectionEnabled()) { int rowCount = treeTableView.getExpandedItemCount(); for (int i = 0; i < rowCount; i++) { selectionModel.select(i); } return true; } else { selectionModel.clearSelection(); selectionModel.selectRange(0, getTreeTableColumnAt(treeTableView, 0), treeTableView.getExpandedItemCount() - 1, getTreeTableColumnAt(treeTableView, treeTableView.getColumns().size() - 1)); return true; } } else if (!selectionModel.isCellSelectionEnabled()) { selectionModel.clearSelection(); int[] selectedRows = getTreeTableSelectedRows(treeTableView, value); for (int selectedRow : selectedRows) { if (getVisibleCellAt(treeTableView, selectedRow, 0) == null) { treeTableView.scrollTo(selectedRow); } selectionModel.select(selectedRow); } return true; } else { selectionModel.clearSelection(); selectTreeTableCells(treeTableView, value); return true; } } JavaFXTreeTableViewElement(Node component, IJavaFXAgent driver, JFXWindow window); }
JavaFXTreeTableViewElement extends JavaFXElement { @SuppressWarnings("unchecked") @Override public boolean marathon_select(String value) { TreeTableView<?> treeTableView = (TreeTableView<?>) getComponent(); TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel(); if (value.equals("")) { selectionModel.clearSelection(); return true; } else if (value.equals("all")) { selectionModel.clearSelection(); if (!selectionModel.isCellSelectionEnabled()) { int rowCount = treeTableView.getExpandedItemCount(); for (int i = 0; i < rowCount; i++) { selectionModel.select(i); } return true; } else { selectionModel.clearSelection(); selectionModel.selectRange(0, getTreeTableColumnAt(treeTableView, 0), treeTableView.getExpandedItemCount() - 1, getTreeTableColumnAt(treeTableView, treeTableView.getColumns().size() - 1)); return true; } } else if (!selectionModel.isCellSelectionEnabled()) { selectionModel.clearSelection(); int[] selectedRows = getTreeTableSelectedRows(treeTableView, value); for (int selectedRow : selectedRows) { if (getVisibleCellAt(treeTableView, selectedRow, 0) == null) { treeTableView.scrollTo(selectedRow); } selectionModel.select(selectedRow); } return true; } else { selectionModel.clearSelection(); selectTreeTableCells(treeTableView, value); return true; } } JavaFXTreeTableViewElement(Node component, IJavaFXAgent driver, JFXWindow window); @Override List<IJavaFXElement> getByPseudoElement(String selector, Object[] params); @SuppressWarnings("unchecked") @Override boolean marathon_select(String value); @Override String _getText(); }
JavaFXTreeTableViewElement extends JavaFXElement { @SuppressWarnings("unchecked") @Override public boolean marathon_select(String value) { TreeTableView<?> treeTableView = (TreeTableView<?>) getComponent(); TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel(); if (value.equals("")) { selectionModel.clearSelection(); return true; } else if (value.equals("all")) { selectionModel.clearSelection(); if (!selectionModel.isCellSelectionEnabled()) { int rowCount = treeTableView.getExpandedItemCount(); for (int i = 0; i < rowCount; i++) { selectionModel.select(i); } return true; } else { selectionModel.clearSelection(); selectionModel.selectRange(0, getTreeTableColumnAt(treeTableView, 0), treeTableView.getExpandedItemCount() - 1, getTreeTableColumnAt(treeTableView, treeTableView.getColumns().size() - 1)); return true; } } else if (!selectionModel.isCellSelectionEnabled()) { selectionModel.clearSelection(); int[] selectedRows = getTreeTableSelectedRows(treeTableView, value); for (int selectedRow : selectedRows) { if (getVisibleCellAt(treeTableView, selectedRow, 0) == null) { treeTableView.scrollTo(selectedRow); } selectionModel.select(selectedRow); } return true; } else { selectionModel.clearSelection(); selectTreeTableCells(treeTableView, value); return true; } } JavaFXTreeTableViewElement(Node component, IJavaFXAgent driver, JFXWindow window); @Override List<IJavaFXElement> getByPseudoElement(String selector, Object[] params); @SuppressWarnings("unchecked") @Override boolean marathon_select(String value); @Override String _getText(); static final Logger LOGGER; }