From cb6ab1ef93630b8ac07c12c395dee074c22f90aa Mon Sep 17 00:00:00 2001 From: Alexander Diewald <diewald@fortiss.org> Date: Sun, 9 Aug 2020 17:49:25 +0200 Subject: [PATCH] JFX: Content Provider for Lists/Streams of no-child elements Issue-Ref: 3541 Issue-Url: https://af3-developer.fortiss.org/issues/3541 Signed-off-by: Alexander Diewald <diewald@fortiss.org> --- .../ui/javafx/control/treetableview/.ratings | 1 + .../EmptyChildrenContentProvider.java | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/EmptyChildrenContentProvider.java 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 8150b614d..1cd3374f4 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 @@ -9,5 +9,6 @@ DynamicTreeTableViewer.java 129fdcd259e5b7f2528dfeb407676528dcc694be YELLOW DynamicTreeUIProviderBase.java e9b68607683de279d0cb8712a28dc131c5c33ece GREEN DynamicTreeViewer.java 8c20c0941bd299afce1cf237c8e29e21821c2631 YELLOW DynamicTreeViewerBase.java a2013538b62d86f6a09efdf2cd78babac2072484 GREEN +EmptyChildrenContentProvider.java 51b4468f9df8423abeea5ac6aa2f6cf99c2eb512 YELLOW IDoubleClickHandler.java 447f7769dead9a106b3ea3139ef0da51eb0b9a89 GREEN IDynamicItem.java 083d02459e7ec33542d9910c04abe2581e0b5422 YELLOW diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/EmptyChildrenContentProvider.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/EmptyChildrenContentProvider.java new file mode 100644 index 000000000..51b4468f9 --- /dev/null +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/EmptyChildrenContentProvider.java @@ -0,0 +1,35 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2019 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.common.ui.javafx.control.treetableview; + +import static java.util.Collections.emptyList; + +import java.util.Collection; + +/** + * Dummy {@link DynamicListContentProvider} for collections whose elements do not provide further + * children. + * + * @author diewald + */ +public class EmptyChildrenContentProvider<T> extends DynamicListContentProvider<T> { + + /** {@inheritDoc} */ + @Override + protected Collection<T> getChildren(T parent) { + return emptyList(); + } +} -- GitLab