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 14fc759a5eadec223d415c87c55bd82c79d4ce52..3a83dfaa43b0a1718129583a7ed553d2cf4415e1 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,2 +1,2 @@ DynamicTreeTableNameProvider.java 3ca45f24b94e97b02313e80b16ba8b370f541541 GREEN -ModelElementTreeViewer.java 52cc8d0da50af8211de741eddc4d345b76e316fa GREEN +ModelElementTreeViewer.java b541376d1b21d38dec80ae6dd5357fe289dcb643 YELLOW 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 52cc8d0da50af8211de741eddc4d345b76e316fa..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 @@ -134,4 +134,9 @@ public class ModelElementTreeViewer<T extends INamedElement> { 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/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 e09955e054fd430967763e15675b9a093ed772d8..0354ee32efba4cc6878561c5bb568b0c954218f1 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 @@ -4,10 +4,10 @@ DynamicStreamContentProvider.java f46e91400609cba54793dd240be0fe2aa0d5cced GREEN DynamicTreeContentProviderBase.java 0f6e0a6894752d135847608bc45efa504972bb28 GREEN DynamicTreeItem.java 7486071d20e896d6ca9a9101bf105caccf3656d0 GREEN DynamicTreeItemBase.java d883066ecc181120302ca32f328538de7a45b093 GREEN -DynamicTreeTableUIProviderBase.java 94d94d2e6ca1944a0fa166bb49e040b278979686 GREEN +DynamicTreeTableUIProviderBase.java 1078bd28a6bce5a5a2c60500f2aa1d8b1fdd341b YELLOW DynamicTreeTableViewer.java ea4ac3530edfa179cfce53bdd7e3a7ae80c435e4 GREEN -DynamicTreeUIProviderBase.java e9b68607683de279d0cb8712a28dc131c5c33ece GREEN -DynamicTreeViewer.java 8c20c0941bd299afce1cf237c8e29e21821c2631 GREEN +DynamicTreeUIProviderBase.java 82d3c051213f0147f4c67ad247a08696cee73110 YELLOW +DynamicTreeViewer.java e58d2cf7239e45f1b790ce9770a8a8649b1b5fb9 YELLOW DynamicTreeViewerBase.java a2013538b62d86f6a09efdf2cd78babac2072484 GREEN EmptyChildrenContentProvider.java 51b4468f9df8423abeea5ac6aa2f6cf99c2eb512 GREEN IDoubleClickHandler.java 447f7769dead9a106b3ea3139ef0da51eb0b9a89 GREEN 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 94d94d2e6ca1944a0fa166bb49e040b278979686..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 @@ -319,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/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 8c20c0941bd299afce1cf237c8e29e21821c2631..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 @@ -159,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); });