return "";
}
});
}
UIButton toggle = find("toggleActivation", UIButton.class);
if (toggle != null) {
toggle.subscribe(new ActivateEventListener() {
@Override
public void onActivated(UIWidget button) {
if (moduleList.getSelection() != null) {
// Toggle
if (moduleList.getSelection().isSelected() && moduleList.getSelection().isExplicitSelection()) {
deselect(moduleList.getSelection());
} else if (moduleList.getSelection().isValidToSelect()) {
select(moduleList.getSelection());
}
}
}
});
toggle.bindVisible(new ReadOnlyBinding<Boolean>() {
@Override
public Boolean get() {
return moduleList.getSelection() != null
&& (moduleList.getSelection().isSelected() || moduleList.getSelection().isValidToSelect());
}
});
toggle.bindText(new ReadOnlyBinding<String>() {
@Override
public String get() {
if (moduleList.getSelection() != null) {
if (moduleList.getSelection().isExplicitSelection()) {
return "Deactivate";
} else {
return "Activate";
}
}
return "";
}
});
}
UIButton enableAll = find("enableAll", UIButton.class);
if (enableAll != null) {
enableAll.subscribe(new ActivateEventListener() {
@Override
public void onActivated(UIWidget button) {
for (ModuleSelectionInfo info : sortedModules) {
if (!info.isExplicitSelection() && info.isValidToSelect()) {
select(info);
}
}
}
});
}
UIButton disableAll = find("disableAll", UIButton.class);
if (disableAll != null) {
disableAll.subscribe(new ActivateEventListener() {
@Override
public void onActivated(UIWidget button) {
for (ModuleSelectionInfo info : sortedModules) {
if (info.isSelected() && info.isExplicitSelection()) {
deselect(info);