选择元素后,元素不会从ddl中消失;
private void initRestrictedZonesSelector() {
restrictedComboBox.setOnShowing((e) ->
((FilteredList) restrictedComboBox.getItems()).setPredicate(p -> !selectedRestrictedZones.contains(p)));
restrictedComboBox.setOnAction(e -> setRestrictedMarkets());
}
private void setRestrictedMarkets() {
if (StringHelper.isEmpty(String.valueOf(restrictedComboBox.getValue()))) {
return;
}
selectedRestrictedZones.add(String.valueOf(restrictedComboBox.getValue()));
RestrictedZone zone = new RestrictedZone(restrictedComboBox.getValue() + "", selectedRestricted);
zone.setOnDelete((event1) -> Platform.runLater(() -> selectedRestrictedZones.remove(zone.getMarketName())));
selectedRestricted.getChildren().add(zone);
}