从ObservableList过滤FilteredList的值

时间:2019-01-17 15:02:01

标签: java javafx

我试图做的是从sourceListContainerListverbosityListContainercomponentSearchboxContainerTextdetailsSearchboxContainerText一起过滤值。

我试图遍历sourceListContainerListverbosityListContainer中的值,并将它们添加到Predicate中,但是最终表现得很奇怪,而且似乎不可行解决问题。

public void filter(){

    ObservableList<String> sourceListContainerList = filtersContainer.getSourceListContainerList();
    ObservableList<String> verbosityListContainerList = filtersContainer.getVerbosityListContainerList();
    String componentSearchboxContainerText = filtersContainer.getComponentSearchboxContainerText();
    String detailsSearchboxContainerText = filtersContainer.getDetailsSearchboxContainerText();

    System.out.println("Source list values: " + sourceListContainerList);
    System.out.println("Verbosity list values: " + verbosityListContainerList);
    System.out.println("Component search value: " + componentSearchboxContainerText);
    System.out.println("Details search value: " + detailsSearchboxContainerText);

    logFilteredList.setPredicate(log ->
            log.getComponent().toLowerCase().contains(componentSearchboxContainerText.toLowerCase()) &&
            log.getDetails().toLowerCase().contains(detailsSearchboxContainerText.toLowerCase())
    );
}

我希望logFilteredList可以过滤所有4个值/值列表。

0 个答案:

没有答案