@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)); }
@Override public void focusLost(RFXComponent next) { TreeView<?> treeView = (TreeView<?>) getComponent(); ObservableList<?> selectedItems = treeView.getSelectionModel().getSelectedItems(); String currentCellText = getTreeCellValue(treeView, row); if (currentCellText != null && !currentCellText.equals(cellValue)) { recorder.recordSelect2(this, currentCellText, true); } if ((next == null || getComponent() != next.getComponent()) && treeView.getSelectionModel().getSelectedItems().size() > 1) { String currListText = getSelectedTreeNodeText(treeView, selectedItems); if (!currListText.equals(treeText)) { recorder.recordSelect(this, currListText); } } }
RFXTreeView extends RFXComponent { @Override public void focusLost(RFXComponent next) { TreeView<?> treeView = (TreeView<?>) getComponent(); ObservableList<?> selectedItems = treeView.getSelectionModel().getSelectedItems(); String currentCellText = getTreeCellValue(treeView, row); if (currentCellText != null && !currentCellText.equals(cellValue)) { recorder.recordSelect2(this, currentCellText, true); } if ((next == null || getComponent() != next.getComponent()) && treeView.getSelectionModel().getSelectedItems().size() > 1) { String currListText = getSelectedTreeNodeText(treeView, selectedItems); if (!currListText.equals(treeText)) { recorder.recordSelect(this, currListText); } } } }
RFXTreeView extends RFXComponent { @Override public void focusLost(RFXComponent next) { TreeView<?> treeView = (TreeView<?>) getComponent(); ObservableList<?> selectedItems = treeView.getSelectionModel().getSelectedItems(); String currentCellText = getTreeCellValue(treeView, row); if (currentCellText != null && !currentCellText.equals(cellValue)) { recorder.recordSelect2(this, currentCellText, true); } if ((next == null || getComponent() != next.getComponent()) && treeView.getSelectionModel().getSelectedItems().size() > 1) { String currListText = getSelectedTreeNodeText(treeView, selectedItems); if (!currListText.equals(treeText)) { recorder.recordSelect(this, currListText); } } } RFXTreeView(Node source, JSONOMapConfig omapConfig, Point2D point, IJSONRecorder recorder); }
RFXTreeView extends RFXComponent { @Override public void focusLost(RFXComponent next) { TreeView<?> treeView = (TreeView<?>) getComponent(); ObservableList<?> selectedItems = treeView.getSelectionModel().getSelectedItems(); String currentCellText = getTreeCellValue(treeView, row); if (currentCellText != null && !currentCellText.equals(cellValue)) { recorder.recordSelect2(this, currentCellText, true); } if ((next == null || getComponent() != next.getComponent()) && treeView.getSelectionModel().getSelectedItems().size() > 1) { String currListText = getSelectedTreeNodeText(treeView, selectedItems); if (!currListText.equals(treeText)) { recorder.recordSelect(this, currListText); } } } RFXTreeView(Node source, JSONOMapConfig omapConfig, Point2D point, IJSONRecorder recorder); @Override void focusGained(RFXComponent prev); @Override void focusLost(RFXComponent next); @Override String getCellInfo(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String _getText(); }
RFXTreeView extends RFXComponent { @Override public void focusLost(RFXComponent next) { TreeView<?> treeView = (TreeView<?>) getComponent(); ObservableList<?> selectedItems = treeView.getSelectionModel().getSelectedItems(); String currentCellText = getTreeCellValue(treeView, row); if (currentCellText != null && !currentCellText.equals(cellValue)) { recorder.recordSelect2(this, currentCellText, true); } if ((next == null || getComponent() != next.getComponent()) && treeView.getSelectionModel().getSelectedItems().size() > 1) { String currListText = getSelectedTreeNodeText(treeView, selectedItems); if (!currListText.equals(treeText)) { recorder.recordSelect(this, currListText); } } } RFXTreeView(Node source, JSONOMapConfig omapConfig, Point2D point, IJSONRecorder recorder); @Override void focusGained(RFXComponent prev); @Override void focusLost(RFXComponent next); @Override String getCellInfo(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String _getText(); static final Logger LOGGER; }