From f0e0b9603c64821c35c9a90e69285b349e0ffcfe Mon Sep 17 00:00:00 2001 From: Simon Barner <barner@fortiss.org> Date: Mon, 13 Dec 2021 18:33:42 +0100 Subject: [PATCH] GREEN (with minor changes) Issue-Ref: 4182 Issue-Url: https://git.fortiss.org/af3/af3/-/issues/4182 Signed-off-by: Simon Barner <barner@fortiss.org> --- .../common/ui/javafx/control/treetableview/.ratings | 4 ++-- .../javafx/control/treetableview/DynamicTreeItem.java | 10 ++++------ .../control/treetableview/DynamicTreeTableViewer.java | 7 ++++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings index ce8955e7e..2c9037824 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings @@ -3,10 +3,10 @@ DynamicListContentProvider.java 817cba44f246a361207a88ef9a4e1869215803f7 GREEN DynamicStreamContentProvider.java f46e91400609cba54793dd240be0fe2aa0d5cced GREEN DynamicTextFieldTreeTableCell.java de24117e6f785b328f1ff62383626a0b4b54e8ff GREEN DynamicTreeContentProviderBase.java 91896b1fb5104d126544c44c1ff8c30f2a13a8d6 GREEN -DynamicTreeItem.java 2c4364e68d00f4ebd15cfbbdda7f991440ecc728 YELLOW +DynamicTreeItem.java 7e81ea98038b5eca90df583e0268d4e8f37aaf25 GREEN DynamicTreeItemBase.java d883066ecc181120302ca32f328538de7a45b093 GREEN DynamicTreeTableUIProviderBase.java d150a4c379cc41aab2a44a5f1643f4956332c8e3 GREEN -DynamicTreeTableViewer.java 7ee2471bd403e4be19a3c12460f3af622b526357 YELLOW +DynamicTreeTableViewer.java 62712ba0f72b57c55256648204566ac2448b8d56 GREEN DynamicTreeUIProviderBase.java 82d3c051213f0147f4c67ad247a08696cee73110 GREEN DynamicTreeViewer.java 545f1ca10b7b3cad171b294a4b447875da45c9ed GREEN DynamicTreeViewerBase.java a2013538b62d86f6a09efdf2cd78babac2072484 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItem.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItem.java index 2c4364e68..7e81ea980 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItem.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItem.java @@ -39,12 +39,10 @@ public class DynamicTreeItem<T> extends DynamicTreeItemBase<T> { /** {@inheritDoc} */ @Override public void update() { - /* - * This method is written so that in the common cases of deleting a child, inserting a child - * and swapping two children, it only updates the affected children. Especially in these - * common - * cases, this is much faster than clearing and re-populating the list of children. - */ + + // This method is written so that in the common cases of deleting a child, inserting a child + // and swapping two children, it only updates the affected children. Especially in these + // common cases, this is much faster than clearing and re-populating the list of children. List<TreeItem<T>> children = getChildren(); HashMap<T, Boolean> expanded = new HashMap<>(); diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableViewer.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableViewer.java index 7ee2471bd..62712ba0f 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableViewer.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableViewer.java @@ -16,6 +16,7 @@ package org.fortiss.tooling.common.ui.javafx.control.treetableview; import static java.lang.Integer.MAX_VALUE; +import static java.util.stream.Collectors.toList; import static javafx.scene.control.cell.CheckBoxTreeTableCell.forTreeTableColumn; import java.util.Collection; @@ -23,10 +24,10 @@ import java.util.List; import java.util.Map; import java.util.function.Function; import java.util.function.Supplier; -import java.util.stream.Collectors; import java.util.stream.Stream; import javafx.beans.property.SimpleObjectProperty; +import javafx.collections.ObservableList; import javafx.scene.control.Label; import javafx.scene.control.SelectionMode; import javafx.scene.control.TreeItem; @@ -152,8 +153,8 @@ public final class DynamicTreeTableViewer<T> extends DynamicTreeViewerBase<T> { /** Returns a list of all selected values */ private List<T> getSelectedValues() { - return view.getSelectionModel().getSelectedItems().stream().map(c -> c.getValue()) - .collect(Collectors.toList()); + ObservableList<TreeItem<T>> selectedItems = view.getSelectionModel().getSelectedItems(); + return selectedItems.stream().map(c -> c.getValue()).collect(toList()); } /** Selects the given values in item's subtree */ -- GitLab