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 8968633b32b9581e72c0bba01c9fb48260501d7a..18c4927a7686940a24be264a4ae8d572de354ee3 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,7 +1,7 @@ DynamicList.java 786300e2e914826da239329d190abea1710478ea GREEN DynamicListContentProvider.java 817cba44f246a361207a88ef9a4e1869215803f7 GREEN DynamicStreamContentProvider.java f46e91400609cba54793dd240be0fe2aa0d5cced GREEN -DynamicTreeContentProviderBase.java 0f6e0a6894752d135847608bc45efa504972bb28 GREEN +DynamicTreeContentProviderBase.java 91896b1fb5104d126544c44c1ff8c30f2a13a8d6 GREEN DynamicTreeItem.java 7486071d20e896d6ca9a9101bf105caccf3656d0 GREEN DynamicTreeItemBase.java d883066ecc181120302ca32f328538de7a45b093 GREEN DynamicTreeTableUIProviderBase.java 1078bd28a6bce5a5a2c60500f2aa1d8b1fdd341b GREEN 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 0f6e0a6894752d135847608bc45efa504972bb28..91896b1fb5104d126544c44c1ff8c30f2a13a8d6 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 @@ -33,6 +33,11 @@ public abstract class DynamicTreeContentProviderBase<T> { /** The current filter expression. */ private String filterExpression = null; + /** Returns the sorter comparator. */ + protected Comparator<T> getSortingComparator() { + return (o1, o2) -> 0; + } + /** Sets the filter expression. */ public void setFilterExpression(String filterExpression) { this.filterExpression = filterExpression; @@ -46,34 +51,26 @@ public abstract class DynamicTreeContentProviderBase<T> { return filterExpression; } - /** - * Returns the filter predicate for the given filter value. The default checks if the object's - * toString() contains the filter value. Sub-classes may override or implement - * {@link #filter(Object, String)}. - */ - protected Predicate<T> getFilterPredicate() { - if(getFilterExpression() != null && !"".equals(getFilterExpression().trim())) { - return (o) -> { - return filter(o, getFilterExpression()); - }; - } - return (o) -> true; - } - /** Sub-classes may override to implement simple filter behavior. */ protected boolean filter(T element, String filterValue) { if(element == null) { return false; } - if(filterValue == null || "".equals(filterValue)) { + if(filterValue == null || "".equals(filterValue.trim())) { return true; } return element.toString().toLowerCase().contains(filterValue.toLowerCase()); } - /** Returns the sorter comparator. */ - protected Comparator<T> getSortingComparator() { - return (o1, o2) -> 0; + /** + * Creates a filter predicate for the filter expression returned by + * {@link #getFilterExpression()}. To customize the filter, subclasses may override + * {@link #getFilterExpression()} and {@link #filter(Object, String)}. + */ + private Predicate<T> getFilterPredicate() { + return (o) -> { + return filter(o, getFilterExpression()); + }; } /** Returns the filtered children of the given element. */