本文整理了Java中javafx.collections.ObservableList.filtered()
方法的一些代码示例,展示了ObservableList.filtered()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObservableList.filtered()
方法的具体详情如下:
包路径:javafx.collections.ObservableList
类名称:ObservableList
方法名:filtered
暂无
代码示例来源:origin: speedment/speedment
public ProjectProblemController(){
issues = FXCollections.observableArrayList();
hasErrors = Bindings.isNotEmpty(issues.filtered(issue -> issue.getLevel() == Issue.Level.ERROR));
}
代码示例来源:origin: speedment/speedment
private FilteredList<Node> inRow(RowConstraints row) {
final int index = grid.getRowConstraints().indexOf(row);
return grid.getChildren()
.filtered(node -> {
final Integer rowIndex = GridPane.getRowIndex(node);
return rowIndex != null && index == GridPane.getRowIndex(node);
});
}
代码示例来源:origin: torakiki/pdfsam
private void setFilteredItems(PdfVersion required) {
if (nonNull(required)) {
PdfVersionComboItem selected = getSelectionModel().getSelectedItem();
setItems(unfilteredItems.filtered(t -> t.isHigherOrEqual(required)));
int selecedIndex = getItems().indexOf(selected);
if (selecedIndex != -1) {
getSelectionModel().select(selecedIndex);
} else {
getSelectionModel().selectFirst();
}
}
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls
void dispose() {
if (this.fsSubscription != null) {
this.fsSubscription.dispose();
if (this.children != null) {
this.children.filtered(i -> i instanceof DirPathItemImpl)
.forEach(i -> ((DirPathItemImpl) i).dispose());
}
}
}
}
代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls
void dispose() {
if (this.fsSubscription != null) {
this.fsSubscription.dispose();
if (this.children != null) {
this.children.filtered(i -> i instanceof DirPathItemImpl)
.forEach(i -> ((DirPathItemImpl) i).dispose());
}
}
}
}
代码示例来源:origin: org.fxmisc.richtext/richtextfx
private void updateBackgroundShapes() {
int start = 0;
// calculate shared values among consecutive nodes
FilteredList<Node> nodeList = getChildren().filtered(node -> node instanceof TextExt);
for (Node node : nodeList) {
TextExt text = (TextExt) node;
int end = start + text.getText().length();
Paint backgroundColor = text.getBackgroundColor();
if (backgroundColor != null) {
backgroundShapeHelper.updateSharedShapeRange(backgroundColor, start, end, Paint::equals);
}
BorderAttributes border = new BorderAttributes(text);
if (!border.isNullValue()) {
borderShapeHelper.updateSharedShapeRange(border, start, end, BorderAttributes::equalsFaster);
}
UnderlineAttributes underline = new UnderlineAttributes(text);
if (!underline.isNullValue()) {
underlineShapeHelper.updateSharedShapeRange(underline, start, end, UnderlineAttributes::equalsFaster);
}
start = end;
}
borderShapeHelper.updateSharedShapes();
backgroundShapeHelper.updateSharedShapes();
underlineShapeHelper.updateSharedShapes();
}
代码示例来源:origin: PhoenicisOrg/phoenicis
private ApplicationSidebar createApplicationSidebar() {
/*
* initialize the category lists by:
* 1. filtering by installer categories
* 2. sorting the remaining categories by their name
*/
final SortedList<CategoryDTO> sortedCategories = this.categories
.filtered(category -> category.getType() == CategoryDTO.CategoryType.INSTALLERS)
.sorted(Comparator.comparing(CategoryDTO::getName));
final ApplicationSidebar sidebar = new ApplicationSidebar(filter, sortedCategories, selectedListWidget);
// set the default selection
sidebar.setSelectedListWidget(javaFxSettingsManager.getAppsListType());
// save changes to the list widget selection to the hard drive
sidebar.selectedListWidgetProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
javaFxSettingsManager.setAppsListType(newValue);
javaFxSettingsManager.save();
}
});
return sidebar;
}
代码示例来源:origin: PhoenicisOrg/phoenicis
private LibrarySidebarToggleGroup createSidebarToggleGroup() {
final FilteredList<ShortcutCategoryDTO> filteredShortcutCategories = shortcutCategories
.filtered(filter::filter);
filteredShortcutCategories.predicateProperty().bind(
Bindings.createObjectBinding(() -> filter::filter, filter.searchTermProperty()));
final LibrarySidebarToggleGroup categoryView = new LibrarySidebarToggleGroup(tr("Categories"),
filteredShortcutCategories);
filter.selectedShortcutCategoryProperty().bind(categoryView.selectedElementProperty());
return categoryView;
}
代码示例来源:origin: PhoenicisOrg/phoenicis
private InstallationsSidebarToggleGroup createSidebarToggleGroup() {
final FilteredList<InstallationCategoryDTO> filteredInstallationCategories = installationCategories
.filtered(filter::filter);
filteredInstallationCategories.predicateProperty().bind(
Bindings.createObjectBinding(() -> filter::filter, filter.searchTermProperty()));
final InstallationsSidebarToggleGroup categoryView = new InstallationsSidebarToggleGroup(tr("Categories"),
filteredInstallationCategories);
filter.selectedInstallationCategoryProperty().bind(categoryView.selectedElementProperty());
return categoryView;
}
代码示例来源:origin: PhoenicisOrg/phoenicis
/**
* This method populates the button group showing all installed containers
*/
private ContainersSidebarToggleGroup createSidebarToggleGroup() {
FilteredList<ContainerCategoryDTO> filteredContainerCategories = containerCategories.filtered(filter::filter);
filteredContainerCategories.predicateProperty().bind(
Bindings.createObjectBinding(() -> filter::filter,
filter.searchTermProperty(),
filter.selectedContainerCategoryProperty()));
ContainersSidebarToggleGroup sidebarToggleGroup = new ContainersSidebarToggleGroup(tr("Containers"),
filteredContainerCategories);
filter.selectedContainerCategoryProperty().bind(sidebarToggleGroup.selectedElementProperty());
return sidebarToggleGroup;
}
代码示例来源:origin: PhoenicisOrg/phoenicis
/**
* Creates a filtered version of <code>scripts</code>
*
* @return A filtered version of the scripts list
*/
private FilteredList<ScriptDTO> createFilteredScripts() {
final ApplicationFilter filter = getControl().getFilter();
final FilteredList<ScriptDTO> filteredScripts = scripts.filtered(filter::filter);
filteredScripts.predicateProperty().bind(
Bindings.createObjectBinding(() -> filter::filter,
filter.containAllOSCompatibleApplicationsProperty(),
filter.containCommercialApplicationsProperty(),
filter.containRequiresPatchApplicationsProperty(),
filter.containTestingApplicationsProperty()));
return filteredScripts;
}
代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx
private void selectIntersectingNodes(Parent root, boolean deselect) {
List<Node> selectableNodes = root.getChildrenUnmodifiable().
filtered(n -> n instanceof SelectableNode);
boolean rectBigEnough = rectangle.getWidth() > 1 || rectangle.getHeight() > 1;
for (Node n : selectableNodes) {
boolean selectN = rectangle.intersects(
rectangle.parentToLocal(
n.localToParent(n.getBoundsInLocal())));
SelectableNode sn = (SelectableNode) n;
if ((deselect || potentiallySelected(sn)) || (selectN && rectBigEnough)) {
WindowUtil.getDefaultClipboard().select(
sn, (selectN && rectBigEnough));
}
}
}
代码示例来源:origin: PhoenicisOrg/phoenicis
/**
* This method populates the button group showing all known engine categories
*/
private EnginesSidebarToggleGroup createSidebarToggleGroup() {
final FilteredList<EngineCategoryDTO> filteredEngineCategories = engineCategories.filtered(filter::filter);
filteredEngineCategories.predicateProperty().bind(
Bindings.createObjectBinding(() -> filter::filter,
filter.searchTermProperty(),
filter.showInstalledProperty(),
filter.showNotInstalledProperty()));
final EnginesSidebarToggleGroup categoryView = new EnginesSidebarToggleGroup(tr("Engines"),
filteredEngineCategories);
filter.selectedEngineCategoryProperty().bind(categoryView.selectedElementProperty());
return categoryView;
}
代码示例来源:origin: PhoenicisOrg/phoenicis
private CombinedListWidget<ApplicationDTO> createApplicationListWidget() {
/*
* initialising the application lists by:
* 1. sorting the applications by their name
* 2. filtering them
*/
final FilteredList<ApplicationDTO> filteredApplications = ConcatenatedList
.create(new MappedList<>(
this.categories.filtered(category -> category.getType() == CategoryDTO.CategoryType.INSTALLERS),
CategoryDTO::getApplications))
.sorted(Comparator.comparing(ApplicationDTO::getName))
.filtered(this.filter::filter);
filteredApplications.predicateProperty().bind(
Bindings.createObjectBinding(() -> this.filter::filter,
this.filter.filterTextProperty(), this.filter.filterCategoryProperty(),
this.filter.containAllOSCompatibleApplicationsProperty(),
this.filter.containCommercialApplicationsProperty(),
this.filter.containRequiresPatchApplicationsProperty(),
this.filter.containTestingApplicationsProperty()));
final ObservableList<ListWidgetElement<ApplicationDTO>> listWidgetEntries = new MappedList<>(
filteredApplications,
ListWidgetElement::create);
final CombinedListWidget<ApplicationDTO> listWidget = new CombinedListWidget<>(listWidgetEntries,
selectedListWidget);
this.selectedApplication.bind(Bindings.createObjectBinding(() -> {
final ListWidgetSelection<ApplicationDTO> selection = listWidget.getSelectedElement();
return selection != null ? selection.getItem() : null;
}, listWidget.selectedElementProperty()));
return listWidget;
}
代码示例来源:origin: PhoenicisOrg/phoenicis
private ApplicationSidebarToggleGroup createSidebarToggleGroup() {
final FilteredList<CategoryDTO> filteredCategories = getControl().getItems()
.filtered(getControl().getFilter()::filter);
filteredCategories.predicateProperty().bind(
Bindings.createObjectBinding(() -> getControl().getFilter()::filter,
getControl().searchTermProperty(),
getControl().containAllOSCompatibleApplicationsProperty(),
getControl().containCommercialApplicationsProperty(),
getControl().containRequiresPatchApplicationsProperty(),
getControl().containTestingApplicationsProperty()));
return new ApplicationSidebarToggleGroup(tr("Categories"),
filteredCategories, getControl().filterCategoryProperty());
}
内容来源于网络,如有侵权,请联系作者删除!