diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/.ratings b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/.ratings index 3e45f94c4093ed5ace0c18f9768a45acbddc7f9a..3ef238d8425fcf37bc9d91f32eab1332757e8bc1 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/.ratings +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/.ratings @@ -1 +1,2 @@ -ModelElementTreeViewer.java 9c7637313b0ce4d70566ebb4f90dfca0d9931d09 GREEN +DynamicTreeTableNameProvider.java 3ca45f24b94e97b02313e80b16ba8b370f541541 GREEN +ModelElementTreeViewer.java b541376d1b21d38dec80ae6dd5357fe289dcb643 GREEN diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/DynamicTreeTableNameProvider.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/DynamicTreeTableNameProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..3ca45f24b94e97b02313e80b16ba8b370f541541 --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/DynamicTreeTableNameProvider.java @@ -0,0 +1,37 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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.base.ui.javafx.control.treetableview; + +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableUIProviderBase; +import org.fortiss.tooling.kernel.model.INamedElement; + +/** + * Extensible {@link DynamicTreeTableUIProviderBase} providing the names of elements in the first + * column. + * + * @author diewald + */ +public class DynamicTreeTableNameProvider<T extends INamedElement> + extends DynamicTreeTableUIProviderBase<T> { + /** {@inheritDoc} */ + @Override + public String getLabel(T element, int column) { + if(column == 0) { + return element.getName(); + } + return null; + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/ModelElementTreeViewer.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/ModelElementTreeViewer.java index 9c7637313b0ce4d70566ebb4f90dfca0d9931d09..b541376d1b21d38dec80ae6dd5357fe289dcb643 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/ModelElementTreeViewer.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/ModelElementTreeViewer.java @@ -25,7 +25,7 @@ import org.fortiss.tooling.base.model.element.IHierarchicElement; import org.fortiss.tooling.base.model.element.IModelElement; import org.fortiss.tooling.common.ui.javafx.AF3FXViewPart; import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeContentProviderBase; -import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeItem; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeItemBase; import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeUIProviderBase; import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeViewer; import org.fortiss.tooling.kernel.model.INamedElement; @@ -131,7 +131,12 @@ public class ModelElementTreeViewer<T extends INamedElement> { /** Expands the tree down to the given value. */ public void expandItem(T value) { - DynamicTreeItem<T> item = dynTreeViewer.findItem(value); + DynamicTreeItemBase<T> item = dynTreeViewer.findItem(value); dynTreeViewer.expandItem(item); } + + /** Returns the {@link DynamicTreeItemBase} of the given {@code value} if it exists. */ + public DynamicTreeItemBase<T> findItem(T value) { + return dynTreeViewer.findItem(value); + } } diff --git a/org.fortiss.tooling.common.ui/.classpath b/org.fortiss.tooling.common.ui/.classpath index 0920a6fed0bb5a3313c4f46b95ea1fcb99101429..68769be698d53ccfa66089606406c1afe54c939d 100644 --- a/org.fortiss.tooling.common.ui/.classpath +++ b/org.fortiss.tooling.common.ui/.classpath @@ -3,6 +3,11 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="external-src"/> <classpathentry kind="src" path="res"/> + <classpathentry exported="true" kind="lib" path="lib/controlsfx-11.0.2.jar" sourcepath="lib/controlsfx-11.0.2-sources.jar"> + <attributes> + <attribute name="javadoc_location" value="jar:platform:/resource/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-javadoc.jar!/"/> + </attributes> + </classpathentry> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"> <attributes> <attribute name="module" value="true"/> diff --git a/org.fortiss.tooling.common.ui/META-INF/MANIFEST.MF b/org.fortiss.tooling.common.ui/META-INF/MANIFEST.MF index 8904b24d996d445d452ec69850534811444df865..8bfe85a7e12837873c671306b1c388c58163c498 100644 --- a/org.fortiss.tooling.common.ui/META-INF/MANIFEST.MF +++ b/org.fortiss.tooling.common.ui/META-INF/MANIFEST.MF @@ -24,7 +24,8 @@ Require-Bundle: org.fortiss.tooling.common;visibility:=reexport, Bundle-ClassPath: ., lib/org.conqat.ide.commons.gef.jar, lib/org.conqat.ide.commons.ui.jar, - lib/swt-grouplayout.jar + lib/swt-grouplayout.jar, + lib/controlsfx-11.0.2.jar Export-Package: aerofx, aquafx, jfxtras, @@ -69,6 +70,20 @@ Export-Package: aerofx, org.conqat.ide.commons.ui.xmlmodel, org.conqat.ide.commons.ui.xmlmodel.databinding, org.conqat.ide.commons.ui.xmlmodel.undo, + org.controlsfx.control, + org.controlsfx.control.action, + org.controlsfx.control.cell, + org.controlsfx.control.decoration, + org.controlsfx.control.table, + org.controlsfx.control.table.model, + org.controlsfx.control.textfield, + org.controlsfx.dialog, + org.controlsfx.glyphfont, + org.controlsfx.property, + org.controlsfx.property.editor, + org.controlsfx.tools, + org.controlsfx.validation, + org.controlsfx.validation.decoration, org.eclipse.gmf.runtime.draw2d.ui.figures, org.eclipse.gmf.runtime.draw2d.ui.geometry, org.eclipse.jface.viewers, @@ -80,7 +95,6 @@ Export-Package: aerofx, org.fortiss.tooling.common.ui.javafx, org.fortiss.tooling.common.ui.javafx.control.treetableview, org.fortiss.tooling.common.ui.javafx.layout, - org.fortiss.tooling.common.ui.javafx.style, org.fortiss.tooling.common.ui.javafx.lwfxef, org.fortiss.tooling.common.ui.javafx.lwfxef.change, org.fortiss.tooling.common.ui.javafx.lwfxef.controller, @@ -96,6 +110,7 @@ Export-Package: aerofx, org.fortiss.tooling.common.ui.javafx.lwfxef.visual.elliptic, org.fortiss.tooling.common.ui.javafx.lwfxef.visual.rectangular, org.fortiss.tooling.common.ui.javafx.lwfxef.visual.widgets, + org.fortiss.tooling.common.ui.javafx.style, org.fortiss.tooling.common.ui.javafx.util Bundle-Vendor: fortiss GmbH Bundle-Activator: org.fortiss.tooling.common.ui.ToolingCommonUIActivator diff --git a/org.fortiss.tooling.common.ui/build.properties b/org.fortiss.tooling.common.ui/build.properties index 15f0431a4cec282c6243329a527a4754af3d8fd7..7e845aef4697e9d73c38739b7f670209ae04e1a0 100644 --- a/org.fortiss.tooling.common.ui/build.properties +++ b/org.fortiss.tooling.common.ui/build.properties @@ -6,7 +6,8 @@ bin.includes = .,\ lib/org.conqat.ide.commons.ui.jar,\ lib/swt-grouplayout.jar,\ res/,\ - icons/ + icons/,\ + lib/controlsfx-11.0.2.jar jars.compile.order = . source.. = src/,\ res/,\ diff --git a/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-javadoc.jar b/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-javadoc.jar new file mode 100644 index 0000000000000000000000000000000000000000..5111ad27bce8ee8e7a2dc3cf5d54e69d13b597bf Binary files /dev/null and b/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-javadoc.jar differ diff --git a/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-sources.jar b/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-sources.jar new file mode 100644 index 0000000000000000000000000000000000000000..26c842885fe58f8c0fc1a2ff7d5fdf7c84edc2d7 Binary files /dev/null and b/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-sources.jar differ diff --git a/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2.jar b/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2.jar new file mode 100644 index 0000000000000000000000000000000000000000..229be507f29a785eb6f235542064703420e35d82 Binary files /dev/null and b/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2.jar differ diff --git a/org.fortiss.tooling.common.ui/lib/license-controlsFX.txt b/org.fortiss.tooling.common.ui/lib/license-controlsFX.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c084bb20d0cc2350f1a0e2d4dcb2a75b72ac40d --- /dev/null +++ b/org.fortiss.tooling.common.ui/lib/license-controlsFX.txt @@ -0,0 +1,29 @@ +License of the ControlsFX library + +Copyright (c) 2013, ControlsFX +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of ControlsFX, any associated website, nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/.ratings index 925a4859f625d2879fb2a81017f7e7649f75f97d..825df80796e30c4c40591907a2748bb3bcb5ce4d 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/.ratings @@ -1 +1 @@ -AF3FXViewPart.java 3e4510f9e9f86ecf5ba29432342acd50e030aaaa GREEN +AF3FXViewPart.java af974e21c086a86134d4b2d6cdf9da1a31aea7de GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/AF3FXViewPart.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/AF3FXViewPart.java index 3e4510f9e9f86ecf5ba29432342acd50e030aaaa..af974e21c086a86134d4b2d6cdf9da1a31aea7de 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/AF3FXViewPart.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/AF3FXViewPart.java @@ -49,7 +49,7 @@ public abstract class AF3FXViewPart extends FXViewPart { private Pane root; /** Specifies the view part's layout and logic. */ - private ICompositeFXController<? extends Node, ? extends Node> controller; + protected final ICompositeFXController<? extends Node, ? extends Node> controller; /** * Constructor. Allows to pass the view's FXML definition file. 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 e3a97d52ba827fa99f31034194e9bd0c20278bc8..8968633b32b9581e72c0bba01c9fb48260501d7a 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 @@ -1,8 +1,14 @@ -DynamicTreeContentProviderBase.java 6760a6dc5721175b1dada8f30fd9da05f7bcc4b3 GREEN -DynamicTreeItem.java 75dc5534b119ffdb3c10a65810c2a0f330b7955e GREEN -DynamicTreeTableUIProviderBase.java f78c0f8b52fbc939166b3f94f7f6006cc0f4d32b GREEN -DynamicTreeTableViewer.java 9eb192873acf4f08ab3570c195d8828224a61934 GREEN -DynamicTreeUIProviderBase.java e9b68607683de279d0cb8712a28dc131c5c33ece GREEN -DynamicTreeViewer.java 725f41f4fb4b6bfa813f010fb9083ab02eea164a GREEN +DynamicList.java 786300e2e914826da239329d190abea1710478ea GREEN +DynamicListContentProvider.java 817cba44f246a361207a88ef9a4e1869215803f7 GREEN +DynamicStreamContentProvider.java f46e91400609cba54793dd240be0fe2aa0d5cced GREEN +DynamicTreeContentProviderBase.java 0f6e0a6894752d135847608bc45efa504972bb28 GREEN +DynamicTreeItem.java 7486071d20e896d6ca9a9101bf105caccf3656d0 GREEN +DynamicTreeItemBase.java d883066ecc181120302ca32f328538de7a45b093 GREEN +DynamicTreeTableUIProviderBase.java 1078bd28a6bce5a5a2c60500f2aa1d8b1fdd341b GREEN +DynamicTreeTableViewer.java ea4ac3530edfa179cfce53bdd7e3a7ae80c435e4 GREEN +DynamicTreeUIProviderBase.java 82d3c051213f0147f4c67ad247a08696cee73110 GREEN +DynamicTreeViewer.java e58d2cf7239e45f1b790ce9770a8a8649b1b5fb9 GREEN DynamicTreeViewerBase.java a2013538b62d86f6a09efdf2cd78babac2072484 GREEN +EmptyChildrenContentProvider.java 51b4468f9df8423abeea5ac6aa2f6cf99c2eb512 GREEN IDoubleClickHandler.java 447f7769dead9a106b3ea3139ef0da51eb0b9a89 GREEN +IDynamicItem.java 083d02459e7ec33542d9910c04abe2581e0b5422 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicList.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicList.java new file mode 100644 index 0000000000000000000000000000000000000000..786300e2e914826da239329d190abea1710478ea --- /dev/null +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicList.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2016, 2018 fortiss GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v2.0 which is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Florian Hoelzl (fortiss GmbH) - initial implementation + * Alexander Diewald (fortiss GmbH) - backport to AF3 & Integration + * improvements + * + *******************************************************************************/ +package org.fortiss.tooling.common.ui.javafx.control.treetableview; + +import java.util.Collection; +import java.util.HashMap; +import java.util.function.Supplier; +import java.util.stream.Stream; + +import javafx.scene.control.TreeItem; + +/** + * {@link TreeItem} with support for dynamic children using the + * {@link DynamicList#update()} method. + */ +public class DynamicList<T> extends DynamicTreeItemBase<T> { + /** The viewer. */ + private DynamicTreeContentProviderBase<T> contentProvider; + + /** + * Constructor. The given {@link Supplier} is queried on updates to retrieve a recent list of + * elements to display. + */ + @SuppressWarnings("unchecked") + public DynamicList(Supplier<Stream<T>> data, + DynamicStreamContentProvider<T, Supplier<Stream<T>>> contentProvider) { + super((T)data); + this.contentProvider = contentProvider; + } + + /** Constructor. The given collection must be updated by the initializer to reflect changes. */ + @SuppressWarnings("unchecked") + public DynamicList(Collection<T> data, DynamicTreeContentProviderBase<T> contentProvider) { + super((T)data); + this.contentProvider = contentProvider; + } + + /** {@inheritDoc} */ + @Override + public void update() { + // remember expanded state of children + HashMap<T, TreeItem<T>> expanded = new HashMap<>(); + for(TreeItem<T> c : getChildren()) { + if(c.isExpanded()) { + expanded.put(c.getValue(), c); + } + } + // get list of children and create tree items + getChildren().clear(); + for(T element : contentProvider.getFilteredSortedChildren(getValue())) { + DynamicTreeItem<T> dti = new DynamicTreeItem<T>(element, contentProvider); + getChildren().add(dti); + dti.update(); + } + } + + /** {@inheritDoc} */ + @Override + public boolean isLeaf() { + Collection<? extends Object> children = + contentProvider.getFilteredSortedChildren(getValue()); + return children == null || children.isEmpty(); + } +} diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicListContentProvider.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicListContentProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..817cba44f246a361207a88ef9a4e1869215803f7 --- /dev/null +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicListContentProvider.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2016, 2018 fortiss GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v2.0 which is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Florian Hoelzl (fortiss GmbH) - initial implementation + * Alexander Diewald (fortiss GmbH) - backport to AF3 & Integration + * improvements + * + *******************************************************************************/ +package org.fortiss.tooling.common.ui.javafx.control.treetableview; + +import static java.util.Collections.emptyList; + +import java.util.Collection; + +/** + * Base class for implementing tree content providers used in {@link DynamicTreeViewer} and + * {@link DynamicTreeTableViewer}. + */ +public class DynamicListContentProvider<T> extends DynamicTreeContentProviderBase<T> { + /** Returns the children of the given parent in the tree. */ + @SuppressWarnings("unchecked") + @Override + protected Collection<T> getChildren(T parent) { + // Pseudo-cast... + if(parent instanceof Collection) { + return (Collection<T>)parent; + } + return emptyList(); + } +} diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicStreamContentProvider.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicStreamContentProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..f46e91400609cba54793dd240be0fe2aa0d5cced --- /dev/null +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicStreamContentProvider.java @@ -0,0 +1,42 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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 static java.util.stream.Collectors.toList; + +import java.util.Collection; +import java.util.function.Supplier; +import java.util.stream.Stream; + +/** + * Content provider whose element list is dynamically retrieved from a supplier. + * + * @author diewald + */ +public class DynamicStreamContentProvider<T, S extends Supplier<Stream<T>>> + extends DynamicTreeContentProviderBase<T> { + + /** {@inheritDoc} */ + @Override + protected Collection<? extends T> getChildren(T parent) { + if(parent instanceof Supplier) { + @SuppressWarnings("unchecked") Supplier<Stream<T>> supp = ((S)parent); + return supp.get().collect(toList()); + } + return emptyList(); + } +} diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeContentProviderBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeContentProviderBase.java index 6760a6dc5721175b1dada8f30fd9da05f7bcc4b3..0f6e0a6894752d135847608bc45efa504972bb28 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeContentProviderBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeContentProviderBase.java @@ -51,10 +51,10 @@ public abstract class DynamicTreeContentProviderBase<T> { * toString() contains the filter value. Sub-classes may override or implement * {@link #filter(Object, String)}. */ - protected Predicate<T> getFilterPredicate(String filterValue) { - if(filterValue != null && !"".equals(filterValue.trim())) { + protected Predicate<T> getFilterPredicate() { + if(getFilterExpression() != null && !"".equals(getFilterExpression().trim())) { return (o) -> { - return filter(o, filterValue); + return filter(o, getFilterExpression()); }; } return (o) -> true; @@ -77,12 +77,19 @@ public abstract class DynamicTreeContentProviderBase<T> { } /** Returns the filtered children of the given element. */ + @SuppressWarnings("unchecked") public final Collection<? extends T> getFilteredSortedChildren(T parent) { - Collection<? extends T> l = getChildren(parent); + Collection<? extends T> l = null; + if(parent instanceof Collection) { + l = (Collection<T>)parent; + } else { + l = getChildren(parent); + } + if(l == null) { return emptyList(); } - return l.stream().filter(getFilterPredicate(getFilterExpression())) - .sorted(getSortingComparator()).collect(toList()); + return l.stream().filter(getFilterPredicate()).sorted(getSortingComparator()) + .collect(toList()); } } 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 75dc5534b119ffdb3c10a65810c2a0f330b7955e..7486071d20e896d6ca9a9101bf105caccf3656d0 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 @@ -24,17 +24,18 @@ import javafx.scene.control.TreeItem; * {@link TreeItem} with support for dynamic children using the * {@link DynamicTreeItem#update()} method. */ -public class DynamicTreeItem<T> extends TreeItem<T> { +public class DynamicTreeItem<T> extends DynamicTreeItemBase<T> { /** The viewer. */ - private DynamicTreeViewerBase<T> viewer; + private DynamicTreeContentProviderBase<T> contentProvider; /** Constructor. */ - public DynamicTreeItem(T data, DynamicTreeViewerBase<T> viewer) { + public DynamicTreeItem(T data, DynamicTreeContentProviderBase<T> viewer) { super(data); - this.viewer = viewer; + this.contentProvider = viewer; } - /** Updates the children of this item from the underlying content model. */ + /** {@inheritDoc} */ + @Override public void update() { // remember expanded state of children HashMap<T, TreeItem<T>> expanded = new HashMap<>(); @@ -45,13 +46,12 @@ public class DynamicTreeItem<T> extends TreeItem<T> { } // get list of children and create tree items getChildren().clear(); - DynamicTreeContentProviderBase<T> cp = viewer.getContentProvider(); - for(T element : cp.getFilteredSortedChildren(getValue())) { + for(T element : contentProvider.getFilteredSortedChildren(getValue())) { DynamicTreeItem<T> dti; if(expanded.containsKey(element)) { dti = (DynamicTreeItem<T>)expanded.get(element); } else { - dti = new DynamicTreeItem<T>(element, viewer); + dti = new DynamicTreeItem<T>(element, contentProvider); } getChildren().add(dti); dti.update(); @@ -61,7 +61,8 @@ public class DynamicTreeItem<T> extends TreeItem<T> { /** {@inheritDoc} */ @Override public boolean isLeaf() { - Collection<? extends Object> children = viewer.getContentProvider().getChildren(getValue()); + Collection<? extends Object> children = + contentProvider.getFilteredSortedChildren(getValue()); return children == null || children.isEmpty(); } } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItemBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItemBase.java new file mode 100644 index 0000000000000000000000000000000000000000..d883066ecc181120302ca32f328538de7a45b093 --- /dev/null +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItemBase.java @@ -0,0 +1,31 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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 javafx.scene.control.TreeItem; + +/** + * Base class for dynamic {@link TreeItem}s. + * + * @author diewald + */ +public abstract class DynamicTreeItemBase<T> extends TreeItem<T> implements IDynamicItem { + + /** Constructor. */ + public DynamicTreeItemBase(T data) { + super(data); + } +} diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java index f78c0f8b52fbc939166b3f94f7f6006cc0f4d32b..1078bd28a6bce5a5a2c60500f2aa1d8b1fdd341b 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java @@ -61,6 +61,20 @@ public abstract class DynamicTreeTableUIProviderBase<T> { return null; } + /** + * Returns the style that shall be applied to the {@link TreeItem} of the given element. Return + * {@code null} for the default style. + * + * @param element + * to apply a style to. + * @param column + * column of to apply the style (the element is a row in the table). + * @return style of the element in the CSS format. + */ + public String getCellStyle(T element, int column) { + return null; + } + /** * @param element * the element to be displayed in the current row @@ -249,6 +263,17 @@ public abstract class DynamicTreeTableUIProviderBase<T> { validateOnKeyReleased(t, columnIndex, item, tf.getText()); } }); + tf.focusedProperty().addListener(new ChangeListener<Boolean>() { + // If the focus is lost (user clicking elsewhere), the currently entered value is + // committed. + @Override + public void changed(ObservableValue<? extends Boolean> val, Boolean oldVal, + Boolean newVal) { + if(!newVal) { + commitEdit(tf.getText()); + } + } + }); } /** {@inheritDoc} */ @@ -308,6 +333,11 @@ public abstract class DynamicTreeTableUIProviderBase<T> { // JFX-builtin handling is non-operation in Linux. addContextMenuHandler(menu, data); } + + String style = getCellStyle(data, colIndex); + if(style != null) { + this.setStyle(style); + } } this.setGraphic(icon); this.setContextMenu(menu); 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 9eb192873acf4f08ab3570c195d8828224a61934..ea4ac3530edfa179cfce53bdd7e3a7ae80c435e4 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,11 @@ package org.fortiss.tooling.common.ui.javafx.control.treetableview; import static java.lang.Integer.MAX_VALUE; +import static javafx.scene.control.cell.CheckBoxTreeTableCell.forTreeTableColumn; + +import java.util.Collection; +import java.util.function.Supplier; +import java.util.stream.Stream; import javafx.beans.property.SimpleObjectProperty; import javafx.scene.control.SelectionMode; @@ -24,7 +29,6 @@ import javafx.scene.control.TreeTableColumn; import javafx.scene.control.TreeTableRow; import javafx.scene.control.TreeTableView; import javafx.scene.control.TreeTableView.TreeTableViewSelectionModel; -import javafx.scene.control.cell.CheckBoxTreeTableCell; import javafx.scene.input.TransferMode; import javafx.util.Callback; @@ -45,15 +49,51 @@ public final class DynamicTreeTableViewer<T> extends DynamicTreeViewerBase<T> { /** The UI provider of this tree-table. */ private final DynamicTreeTableUIProviderBase<T> uiProvider; + /** + * Constructor. The given {@link Supplier} is queried on updates to obtain a list of elements to + * display. + */ + public DynamicTreeTableViewer(TreeTableView<T> view, Supplier<Stream<T>> listFctn, + DynamicStreamContentProvider<T, Supplier<Stream<T>>> contentProvider, + DynamicTreeTableUIProviderBase<T> uiProvider) { + this(view, new DynamicList<T>(listFctn, contentProvider), false, 0, contentProvider, + uiProvider); + } + + /** + * Constructor. The given input collection must be updated by the caller such that changes are + * reflected in the corresponding {@link TreeTableView}. + */ + public DynamicTreeTableViewer(TreeTableView<T> view, Collection<T> list, + DynamicListContentProvider<T> contentProvider, + DynamicTreeTableUIProviderBase<T> uiProvider) { + this(view, new DynamicList<T>(list, contentProvider), false, 0, contentProvider, + uiProvider); + } + /** Constructor. */ public DynamicTreeTableViewer(TreeTableView<T> view, T root, boolean showRoot, int revealLevel, DynamicTreeContentProviderBase<T> contentProvider, DynamicTreeTableUIProviderBase<T> uiProvider) { + this(view, new DynamicTreeItem<T>(root, contentProvider), showRoot, revealLevel, + contentProvider, uiProvider); + } + + /** Constructor. */ + public DynamicTreeTableViewer(T root, boolean showRoot, int revealLevel, + DynamicTreeContentProviderBase<T> contentProvider, + DynamicTreeTableUIProviderBase<T> uiProvider) { + this(new TreeTableView<T>(), root, showRoot, revealLevel, contentProvider, uiProvider); + } + + /** Constructor. */ + public DynamicTreeTableViewer(TreeTableView<T> view, DynamicTreeItemBase<T> rootItem, + boolean showRoot, int revealLevel, DynamicTreeContentProviderBase<T> contentProvider, + DynamicTreeTableUIProviderBase<T> uiProvider) { super(view, contentProvider); this.uiProvider = uiProvider; // construct view this.view = view; - DynamicTreeItem<T> rootItem = new DynamicTreeItem<T>(root, this); view.setRoot(rootItem); view.setShowRoot(showRoot); view.setEditable(true); @@ -88,21 +128,14 @@ public final class DynamicTreeTableViewer<T> extends DynamicTreeViewerBase<T> { }); rootItem.update(); - // expand to reveal (+1 if root node is not shown + // expand to reveal (+1 if root node is not shown) expandItem(rootItem, showRoot ? revealLevel : revealLevel + 1); } - /** Constructor. */ - public DynamicTreeTableViewer(T root, boolean showRoot, int revealLevel, - DynamicTreeContentProviderBase<T> contentProvider, - DynamicTreeTableUIProviderBase<T> uiProvider) { - this(new TreeTableView<T>(), root, showRoot, revealLevel, contentProvider, uiProvider); - } - /** Updates the viewer content. */ public void update() { // wild cast works: see constructor - DynamicTreeItem<T> rootItem = (DynamicTreeItem<T>)view.getRoot(); + IDynamicItem rootItem = (IDynamicItem)view.getRoot(); rootItem.update(); view.refresh(); } @@ -164,24 +197,12 @@ public final class DynamicTreeTableViewer<T> extends DynamicTreeViewerBase<T> { int num = view.getColumns().size(); TreeTableColumn<T, Boolean> column = new TreeTableColumn<>(headerLabel); column.setPrefWidth(prefWidth); - column.setCellFactory(CheckBoxTreeTableCell.forTreeTableColumn(column)); + column.setCellFactory(forTreeTableColumn(column)); uiProvider.applyToCheckboxColumn(num, column); view.getColumns().add(column); return column; } - /** - * Adds a column to the table part of the view. The labels, context menus and icons are shown as - * defined in the {@link DynamicTreeTableUIProviderBase}. - * - * @deprecated use {@link DynamicTreeTableUIProviderBase} - */ - @Deprecated - public TreeTableColumn<T, String> addColumn(String headerLabel, int prefWidth, - @SuppressWarnings("unused") boolean readOnly) { - return addColumn(headerLabel, prefWidth); - } - /** Returns the underlying {@link TreeTableView}. */ public TreeTableView<T> getControl() { return view; diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeUIProviderBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeUIProviderBase.java index e9b68607683de279d0cb8712a28dc131c5c33ece..82d3c051213f0147f4c67ad247a08696cee73110 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeUIProviderBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeUIProviderBase.java @@ -15,6 +15,7 @@ package org.fortiss.tooling.common.ui.javafx.control.treetableview; import javafx.scene.Node; import javafx.scene.control.ContextMenu; +import javafx.scene.control.TreeItem; import javafx.scene.input.ClipboardContent; import javafx.scene.input.Dragboard; @@ -41,6 +42,18 @@ public abstract class DynamicTreeUIProviderBase<T> { return null; } + /** + * Returns the style that shall be applied to the {@link TreeItem} of the given element. Return + * {@code null} for the default style. + * + * @param element + * to apply a style to. + * @return style of the element in the CSS format. + */ + public String getCellStyle(T element) { + return null; + } + /** * @param element * the displayed element diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeViewer.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeViewer.java index 725f41f4fb4b6bfa813f010fb9083ab02eea164a..e58d2cf7239e45f1b790ce9770a8a8649b1b5fb9 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeViewer.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeViewer.java @@ -17,10 +17,13 @@ package org.fortiss.tooling.common.ui.javafx.control.treetableview; import static org.apache.commons.lang3.SystemUtils.IS_OS_LINUX; +import java.util.Collection; + import javafx.beans.value.ChangeListener; import javafx.scene.control.ContextMenu; import javafx.scene.control.TreeCell; import javafx.scene.control.TreeItem; +import javafx.scene.control.TreeTableView; import javafx.scene.control.TreeView; import javafx.scene.input.ClipboardContent; import javafx.scene.input.DragEvent; @@ -38,21 +41,47 @@ public final class DynamicTreeViewer<T> extends DynamicTreeViewerBase<T> { /** The {@link TreeView} control to be managed. */ private final TreeView<T> view; /** {@link TreeItem} constructed for the root object. */ - private final DynamicTreeItem<T> rootItem; + private final DynamicTreeItemBase<T> rootItem; /** The UI provider implementation. */ private final DynamicTreeUIProviderBase<T> uiProvider; /** The selection change listener. */ private ChangeListener<Object> selectionChangeListener = null; + /** + * Constructor. The given input collection must be updated by the caller such that changes are + * reflected in the corresponding {@link TreeTableView}. + */ + public DynamicTreeViewer(TreeView<T> view, Collection<T> list, + DynamicListContentProvider<T> contentProvider, + DynamicTreeUIProviderBase<T> uiProvider) { + this(view, new DynamicList<T>(list, contentProvider), false, 0, contentProvider, + uiProvider); + } + /** Constructor. */ public DynamicTreeViewer(TreeView<T> view, T root, boolean showRoot, int revealLevel, DynamicTreeContentProviderBase<T> contentProvider, DynamicTreeUIProviderBase<T> uiProvider) { + this(view, new DynamicTreeItem<T>(root, contentProvider), showRoot, revealLevel, + contentProvider, uiProvider); + } + + /** Constructor. */ + public DynamicTreeViewer(T root, boolean showRoot, int revealLevel, + DynamicTreeContentProviderBase<T> contentProvider, + DynamicTreeUIProviderBase<T> uiProvider) { + this(new TreeView<T>(), root, showRoot, revealLevel, contentProvider, uiProvider); + } + + /** Constructor. */ + public DynamicTreeViewer(TreeView<T> view, DynamicTreeItemBase<T> rootItem, boolean showRoot, + int revealLevel, DynamicTreeContentProviderBase<T> contentProvider, + DynamicTreeUIProviderBase<T> uiProvider) { super(view, contentProvider); this.uiProvider = uiProvider; // construct view this.view = view; - rootItem = new DynamicTreeItem<T>(root, this); + this.rootItem = rootItem; view.setRoot(rootItem); view.setShowRoot(showRoot); configureCellFactory(); @@ -68,36 +97,29 @@ public final class DynamicTreeViewer<T> extends DynamicTreeViewerBase<T> { expandItem(rootItem, showRoot ? revealLevel : revealLevel + 1); } - /** Constructor. */ - public DynamicTreeViewer(T root, boolean showRoot, int revealLevel, - DynamicTreeContentProviderBase<T> contentProvider, - DynamicTreeUIProviderBase<T> uiProvider) { - this(new TreeView<T>(), root, showRoot, revealLevel, contentProvider, uiProvider); - } - /** Updates the tree view. */ public void update() { // wild cast works: see constructor - DynamicTreeItem<T> rootItem = (DynamicTreeItem<T>)view.getRoot(); + DynamicTreeItemBase<T> rootItem = (DynamicTreeItemBase<T>)view.getRoot(); rootItem.update(); } /** Sets the selection of this tree view. */ public void setSelection(Object value) { // wild cast works: see constructor - DynamicTreeItem<T> rootItem = (DynamicTreeItem<T>)view.getRoot(); - DynamicTreeItem<T> item = findItem(rootItem, value); + DynamicTreeItemBase<T> rootItem = (DynamicTreeItemBase<T>)view.getRoot(); + DynamicTreeItemBase<T> item = findItem(rootItem, value); int row = view.getRow(item); view.getSelectionModel().select(row); } /** Searches the {@link DynamicTreeItem} for the given value from the root. */ - public DynamicTreeItem<T> findItem(T value) { + public DynamicTreeItemBase<T> findItem(T value) { return findItem(rootItem, value); } /** Searches the {@link DynamicTreeItem} for the given value. */ - public DynamicTreeItem<T> findItem(DynamicTreeItem<T> item, Object value) { + public DynamicTreeItemBase<T> findItem(DynamicTreeItemBase<T> item, Object value) { if(item == null || value == null || item.getValue() == null) { return null; } @@ -105,8 +127,8 @@ public final class DynamicTreeViewer<T> extends DynamicTreeViewerBase<T> { return item; } for(TreeItem<T> subItem : item.getChildren()) { - if(subItem instanceof DynamicTreeItem) { - DynamicTreeItem<T> i = findItem((DynamicTreeItem<T>)subItem, value); + if(subItem instanceof DynamicTreeItemBase) { + DynamicTreeItemBase<T> i = findItem((DynamicTreeItemBase<T>)subItem, value); if(i != null) { return i; } @@ -137,6 +159,8 @@ public final class DynamicTreeViewer<T> extends DynamicTreeViewerBase<T> { this.setText(uiProvider.getLabel(item)); this.setGraphic(uiProvider.getIconNode(item)); + this.setStyle(uiProvider.getCellStyle(item)); + this.setOnDragDetected(evt -> { dragDetected(evt, this, item); }); 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 0000000000000000000000000000000000000000..51b4468f9df8423abeea5ac6aa2f6cf99c2eb512 --- /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(); + } +} diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/IDynamicItem.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/IDynamicItem.java new file mode 100644 index 0000000000000000000000000000000000000000..083d02459e7ec33542d9910c04abe2581e0b5422 --- /dev/null +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/IDynamicItem.java @@ -0,0 +1,29 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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 javafx.scene.control.TreeItem; + +/** + * Common methods of dynamic {@link TreeItem}s of lists and tables. + * + * @author diewald + */ +public interface IDynamicItem { + + /** Updates the children of this item from the underlying content model. */ + public void update(); +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/.ratings index 3eaf205055aa0f29358d52b9ec081c6466a441ba..3ae4b409f10d61647e757cce57470e67ab4f936f 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/.ratings +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/.ratings @@ -2,9 +2,7 @@ DoubleClick.java a94d27299814a93b0d8914050a5da7378a7eccd1 GREEN GenericNewMenu.java 7e0dd435cb5ca6d4b486235ec17eef3e5c7aa5f6 GREEN LibraryViewDragSourceAdapter.java 56ef61b214ef5d6cb5b751791a92158bda0391ec GREEN LinkWithEditorPartListener.java c5ab74424378e7b158a805c4dd14fc03c8abeded GREEN -MarkerViewContentProvider.java 4cb1192baebe21bca951c439c163d0c171512515 GREEN -MarkerViewPart.java cbb650271b6877af205421b7cb11f930440a7ef9 GREEN -ModelElementsViewFX.java b1d03d57b67bf2c7b1d8da0ad3b16ea7d59efab5 GREEN +ModelElementsViewFX.java 68accd2cc94a0df58a2742329f75f6fda25a8606 GREEN NavigatorNewMenu.java a35e391960d1dacbe7f77982e53e1891e9382d5a GREEN NavigatorTreeContentComparator.java d9f1354cfdff78b104b28887d2397e5ca0e9755b GREEN NavigatorTreeContentProvider.java 1fbe97bebf3805cc1af190cecd784fc1cfd12306 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ModelElementsViewFX.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ModelElementsViewFX.java index b1d03d57b67bf2c7b1d8da0ad3b16ea7d59efab5..68accd2cc94a0df58a2742329f75f6fda25a8606 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ModelElementsViewFX.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ModelElementsViewFX.java @@ -24,7 +24,6 @@ import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParent import java.util.Collection; import java.util.List; import java.util.Set; -import java.util.function.Predicate; import org.conqat.ide.commons.ui.ui.EmptyPartListener; import org.conqat.lib.commons.collections.IdentityHashSet; @@ -193,19 +192,6 @@ public final class ModelElementsViewFX extends FXViewPart { } return false; } - - /** {@inheritDoc} */ - @Override - protected Predicate<Object> getFilterPredicate(String filterValue) { - // this override is needed, because super implementation does not - // call filter(Object, String) when filter value is null. - if(filterValue == null || "".equals(filterValue)) { - return (o) -> { - return filter(o, null); - }; - } - return super.getFilterPredicate(filterValue); - } } /** {@link DynamicTreeUIProviderBase} for the library view. */ diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/.ratings b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/.ratings index de432414d1ed2b332919fa81b6d94cf3adea2324..7559b41bf611f07b204b659593d47b93676353d3 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/.ratings +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/.ratings @@ -7,7 +7,7 @@ ElementCompositorService.java 98c5d27e09881e60aa4f87c1ac0c7787cdec9f7c GREEN LibraryPrototypeProvider.java b77eddbdca78f561ffb1233e98817be361c690ae GREEN LibraryService.java d22671ba820466062852c15873698adf28960d94 GREEN LoggingService.java da784259f7b456b54bf75c41ec268f64919ce78d GREEN -MigrationService.java 2f800eac9793aa736089a802bbfc2c4c1c09770d GREEN +MigrationService.java 8df3452b6dd58424ee581fc7ac4f801244e8d63b GREEN PersistencyService.java 2e3936012a9b7217a293cbe8272ffa5f02518045 GREEN PrototypeService.java cf8e6fa96ba9c2f65b24400054ed68e93238a975 GREEN ToolingKernelInternal.java f6e7114825748683c7f1d040b41ab854a6c4d79b GREEN diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/MigrationService.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/MigrationService.java index 2f800eac9793aa736089a802bbfc2c4c1c09770d..8df3452b6dd58424ee581fc7ac4f801244e8d63b 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/MigrationService.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/MigrationService.java @@ -118,7 +118,8 @@ public class MigrationService extends ObjectAwareServiceBase<IMigrationProvider> error(ToolingKernelActivator.getDefault(), "Migrating " + input.getSaveableName() + " failed: A need for " + "migration is indicated although the migration was " + - "already performed. Please fix the migrator (or model)."); + "already performed. Please fix the migrator " + + provider.getClass().getSimpleName() + " or the model."); } } unknownFeatures.entrySet().removeAll(migratedFeatures.entrySet());