/**
* Sets the items for all combo boxes in newLogEntryTab view
*/
private void setAllComboBoxItems(){
Consumer<ComboBox<String>> disableComboBoxIfEmpty = (comboBox) -> {
if (comboBox.getItems().isEmpty()) {
comboBox.setDisable(true);
} else {comboBox.setDisable(false);}
};
// Establish process for populating a combo box
BiConsumer<ComboBox<String>, ObservableList<String>> setComboBoxItems = (comboBox, observableList) -> {
observableList.addListener((ListChangeListener<String>) c -> {
comboBox.setItems(observableList);
disableComboBoxIfEmpty.accept(comboBox);
});
comboBox.setItems(observableList);
disableComboBoxIfEmpty.accept(comboBox);
};
// Set company combo box items
sortedCompanyNames = new SortedList<>(companyNames, String.CASE_INSENSITIVE_ORDER);
setComboBoxItems.accept(companyComboBox, sortedCompanyNames);
// Set location combo box items
sortedLocationNames = new SortedList<>(locationNames, String.CASE_INSENSITIVE_ORDER);
setComboBoxItems.accept(locationComboBox, sortedLocationNames);
// Set supervisor combo box items
sortedSupervisorDisplayNames = new SortedList<>(supervisorDisplayNames, String.CASE_INSENSITIVE_ORDER);
setComboBoxItems.accept(supervisorComboBox, sortedSupervisorDisplayNames);
}
NewLogEntryTabController.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:Recordian
作者:
评论列表
文章目录