Hi i created 3 checkbox dynamically and now i want if i select any two checckbox then thired checkbox will be disable automatically. Please tell me how i can do it.
this is my code …
@SuppressWarnings(“serial”)
private VerticalLayout createAdditionLayout() {
VerticalLayout layout = new VerticalLayout();
layout.setSizeFull();
layout.setSpacing(true);
layout.setMargin(true);
ModelResponse modelResponse = modelDesignerListenerFunctions.getModelList();
if (modelResponse != null) {
for (final ModelDetails model : modelResponse.getList()) {
final CheckBox c = new CheckBox(model.getModelName());
layout.addComponent(c);
c.addValueChangeListener(new ValueChangeListener() {
@SuppressWarnings("deprecation")
@Override
public void valueChange(ValueChangeEvent event) {
Boolean b = (Boolean) event.getProperty()
.getValue();
if (b) {
listCheck.add(model.getModelName());
set.add(model.getModelId());
check++;
} else {
listCheck.remove(model.getModelName())
set.remove(model.getModelId());
check--;
}
});
}