Example usage for com.vaadin.v7.data Container.Indexed removeAllItems

List of usage examples for com.vaadin.v7.data Container.Indexed removeAllItems

Introduction

In this page you can find the example usage for com.vaadin.v7.data Container.Indexed removeAllItems.

Prototype

public boolean removeAllItems() throws UnsupportedOperationException;

Source Link

Document

Removes all Items from the Container.

Usage

From source file:de.symeda.sormas.ui.configuration.outbreak.OutbreakOverviewGrid.java

License:Open Source License

public void reload() {
    Container.Indexed container = getContainerDataSource();
    container.removeAllItems();

    // Initially set all columns to their default value
    for (RegionReferenceDto region : FacadeProvider.getRegionFacade().getAllAsReference()) {
        addItem(region);//from w ww .ja v  a  2s.com
    }

    // Alter cells with regions and diseases that actually have an outbreak
    List<OutbreakDto> activeOutbreaks = FacadeProvider.getOutbreakFacade().getActive();

    for (OutbreakDto outbreak : activeOutbreaks) {
        DistrictReferenceDto outbreakDistrict = outbreak.getDistrict();
        RegionReferenceDto outbreakRegion = FacadeProvider.getDistrictFacade()
                .getDistrictByUuid(outbreakDistrict.getUuid()).getRegion();
        Disease outbreakDisease = outbreak.getDisease();

        // Only show the Outbreak if its Disease is active on the system
        if (Boolean.TRUE
                .equals(FacadeProvider.getDiseaseConfigurationFacade().isActiveDisease(outbreakDisease))) {
            ((OutbreakRegionConfiguration) container.getItem(outbreakRegion).getItemProperty(outbreakDisease)
                    .getValue()).getAffectedDistricts().add(outbreakDistrict);
        }
    }
}