首页 > 解决方案 > JavaFX - ListProperty 条件绑定

问题描述

在我的代码中,我有一个绑定到 ListProperty 的 tableview。我能够正确检索所有数据,但我需要根据其中每个对象的特定属性对该数据集应用条件。可能吗?这是模型:

public class Ticket {

private String number;
private String sys_id;
private String short_description;
private String description;
private String opened_by;
private String assigned_to;         // tabella esterna
private String assignment_group;    // tabella esterna
private int incident_state;         // 2: assigned - 3: wip - 4: hold
private String sys_created_on;
private Date sys_updated_on;
private int priority;               // 1: critical
private boolean isVisible;          // per nasconderlo nella tabella riassuntiva
private boolean isAlarmed;          // per silenziare le notifiche

在控制器中,我已将 tableview 绑定到 ListProperty(由 ticketService.ticketsProperty() 返回):

serviceNowTicket_tableView.itemsProperty().bindBidirectional(ticketService.ticketsProperty());

我只需要通过票“isVisible”属性过滤它。也许通过 BooleanBinding?

标签: javafxbindinglistproperty

解决方案


推荐阅读