sclass ConceptsComboBox extends JComboBox {
Concepts concepts;
Class conceptClass;
AWTOnConceptChanges updater;
settable bool allowNull;
settable IPred itemFilter;
*(Concepts *concepts, Class *conceptClass) {
updateItems();
updater = new AWTOnConceptChanges(concepts, this, l0 updateItems);
updater.install();
}
void updateItems {
var l = sortTheList(filterTheList(freshList()));
if (allowNull) l = nullPlus(l);
setComboBoxItems_notifyListeners(this, l);
}
swappable Cl freshList() {
ret main list(concepts, conceptClass);
}
L filterTheList(Cl l) {
ret itemFilter == null ? asList(l) : filter(itemFilter, l);
}
swappable L sortTheList(L l) {
ret sortConceptsByID(l);
}
selfType sorter(IF1> sorter) { sortTheList = sorter; this; }
A get() { ret getSelectedItem_typed(this); }
void select(long conceptID) {
main setSelectedItem(this, getConcept(concepts, conceptClass, conceptID));
}
}