Source:
public void setQueue(MatchmakingQueue queue) { this.queue = queue; playersInQueueLabel.textProperty().bind(createStringBinding( () -> i18n.get("teammatchmaking.playersInQueue", queue.getPlayersInQueue()).toUpperCase(), queue.playersInQueueProperty())); matchFoundLabel.visibleProperty().bind(matchFoundLabel.managedProperty()); matchStartingLabel.visibleProperty().bind(matchStartingLabel.managedProperty()); matchCancelledLabel.visibleProperty().bind(matchCancelledLabel.managedProperty()); queue.matchingStatusProperty().addListener((observable, oldValue, newValue) -> { disableMatchStatus(); if (newValue == null) { return; } switch (newValue) { case MATCH_FOUND -> matchFoundLabel.setManaged(true); case GAME_LAUNCHING -> matchStartingLabel.setManaged(true); case MATCH_CANCELLED -> matchCancelledLabel.setManaged(true); } }); joinLeaveQueueButton.disableProperty().bind(createBooleanBinding( () -> teamMatchmakingService.getParty().getMembers().size() > queue.getTeamSize() || !teamMatchmakingService.getParty().getOwner().equals(playerService.getCurrentPlayer().orElse(null)), teamMatchmakingService.getParty().getMembers(), queue.teamSizeProperty() )); queue.joinedProperty().addListener(observable -> refreshingLabel.setVisible(false)); queue.joinedProperty().addListener(observable -> joinLeaveQueueButton.setSelected(queue.isJoined())); mapPoolButton.setText(i18n.get("teammatchmaking.mapPool").toUpperCase()); queuePopTimeUpdater = new Timeline(1, new KeyFrame(javafx.util.Duration.seconds(0), (ActionEvent event) -> { if (queue.getQueuePopTime() != null) { Instant now = Instant.now(); Duration timeUntilPopQueue = Duration.between(now, queue.getQueuePopTime()); if (!timeUntilPopQueue.isNegative()) { queuePopTimeLabel.setText(i18n.get("teammatchmaking.queuePopTimer", timeUntilPopQueue.toMinutes(), timeUntilPopQueue.toSecondsPart()).toUpperCase()); } } }), new KeyFrame(javafx.util.Duration.seconds(1))); queuePopTimeUpdater.setCycleCount(Timeline.INDEFINITE); queuePopTimeUpdater.play(); }

Target:
public void setQueue(MatchmakingQueue queue) { this.queue = queue; joinLeaveQueueButton.setText(i18n.get(String.format(QUEUE_I18N_PATTERN, queue.getQueueName()))); playersInQueueLabel.textProperty().bind(createStringBinding( () -> i18n.get("teammatchmaking.playersInQueue", queue.getPlayersInQueue()).toUpperCase(), queue.playersInQueueProperty())); JavaFxUtil.bindManagedToVisible(matchFoundLabel, matchStartingLabel, matchCancelledLabel); queue.matchingStatusProperty().addListener((observable, oldValue, newValue) -> { disableMatchStatus(); if (newValue == null) { return; } switch (newValue) { case MATCH_FOUND -> matchFoundLabel.setVisible(true); case GAME_LAUNCHING -> matchStartingLabel.setVisible(true); case MATCH_CANCELLED -> matchCancelledLabel.setVisible(true); default -> log.warn("Unexpected matching status: " + newValue); } }); joinLeaveQueueButton.disableProperty().bind(createBooleanBinding( () -> teamMatchmakingService.getParty().getMembers().size() > queue.getTeamSize() || !teamMatchmakingService.getPlayersInGame().isEmpty() || !teamMatchmakingService.getParty().getOwner().equals(playerService.getCurrentPlayer().orElse(null)), teamMatchmakingService.getParty().getMembers(), queue.teamSizeProperty(), teamMatchmakingService.getPlayersInGame() )); queue.joinedProperty().addListener(observable -> refreshingLabel.setVisible(false)); queue.joinedProperty().addListener(observable -> joinLeaveQueueButton.setSelected(queue.isJoined())); setQueuePopTimeUpdater(queue); }