use of io.jmix.ui.component.LookupComponent in project jmix by jmix-framework.
the class StandardLookup method setSelectHandler.
@Override
public void setSelectHandler(@Nullable Consumer<Collection<T>> selectHandler) {
this.selectHandler = selectHandler;
Component lookupActionsLayout = getLookupActionsLayout();
if (lookupActionsLayout != null) {
lookupActionsLayout.setVisible(true);
Component lookupComponent = getLookupComponent();
if (lookupComponent instanceof LookupSelectionChangeNotifier) {
LookupSelectionChangeNotifier selectionNotifier = (LookupSelectionChangeNotifier) lookupComponent;
Action commitAction = getWindow().getAction(LOOKUP_SELECT_ACTION_ID);
if (commitAction != null) {
// noinspection unchecked
selectionNotifier.addLookupValueChangeListener(valueChangeEvent -> commitAction.setEnabled(!selectionNotifier.getLookupSelectedItems().isEmpty()));
commitAction.setEnabled(!selectionNotifier.getLookupSelectedItems().isEmpty());
}
}
}
}
Aggregations