Example usage for com.vaadin.v7.ui ComboBox getItemIds

List of usage examples for com.vaadin.v7.ui ComboBox getItemIds

Introduction

In this page you can find the example usage for com.vaadin.v7.ui ComboBox getItemIds.

Prototype

@Override
public Collection<?> getItemIds() 

Source Link

Document

Gets the item Id collection from the container.

Usage

From source file:de.symeda.sormas.ui.symptoms.SymptomsForm.java

License:Open Source License

@SuppressWarnings("rawtypes")
private void addListenerForOnsetFields(ComboBox onsetSymptom, DateField onsetDateField) {
    List<String> allPropertyIds = Stream
            .concat(unconditionalSymptomFieldIds.stream(), conditionalBleedingSymptomFieldIds.stream())
            .collect(Collectors.toList());
    allPropertyIds.add(SymptomsDto.LESIONS_THAT_ITCH);

    for (Object sourcePropertyId : allPropertyIds) {
        Field sourceField = getFieldGroup().getField(sourcePropertyId);
        sourceField.addValueChangeListener(event -> {
            if (sourceField.getValue() == SymptomState.YES) {
                onsetSymptom.addItem(sourceField.getCaption());
                onsetDateField.setEnabled(true);
            } else {
                onsetSymptom.removeItem(sourceField.getCaption());
                onsetDateField.setEnabled(
                        isAnySymptomSetToYes(getFieldGroup(), allPropertyIds, Arrays.asList(SymptomState.YES)));
            }/*from w w w  .jav a  2 s.co  m*/
            onsetSymptom.setEnabled(!onsetSymptom.getItemIds().isEmpty());
        });
    }
    onsetSymptom.setEnabled(false); // will be updated by listener if needed
    onsetDateField.setEnabled(false); // will be updated by listener if needed
}