public void setContent(Optional<NoticeBoardMenu> optMenu) {
getChildren().clear();
if (optMenu.isPresent()) {
NoticeBoardMenu menu = optMenu.get();
final Label title = menu.getTitle();
title.getStyleClass().add("scrollPaneContent-title");
getChildren().add(title);
for (NoticeBoardMenuEntry menuItem : menu.getMenuEntries()) {
final DecoratedText label = menuItem.getLabel();
getChildren().add(label);
if (menuItem.getDisabled()) {
applyStyle(label, DISABLED_LABEL_STYLE);
} else if (menuItem.getSelected()) {
applyStyle(label, ACTIVE_LABEL_STYLE);
} else {
applyStyle(label, DEFAULT_LABEL_STYLE);
}
menuItem.selectedProperty().addListener((observable, oldValue, newValue) ->
setSelectedStyle(label, newValue));
menuItem.disabledProperty().addListener((observable, oldValue, newValue) ->
setDisabledStyle(label, newValue));
}
}
}
private void applyStyle(DecoratedText text, String styleClass) {