static A enableComponentAccordingToVar(BoolVarWithNotify var, A c) { if (var != null) { Runnable update = -> setEnabled(c, var!); bindToComponent(c, -> var.onChangeAndNow(update), -> var.removeChangeListener(update)); } ret c; }