Search in sources :

Example 1 with VSPACE_2

use of de.symeda.sormas.ui.utils.CssStyles.VSPACE_2 in project SORMAS-Project by hzi-braunschweig.

the class OutbreakRegionConfigurationForm method createHeader.

private HorizontalLayout createHeader() {
    HorizontalLayout headerLayout = new HorizontalLayout();
    headerLayout.setWidth(100, Unit.PERCENTAGE);
    headerLayout.setSpacing(true);
    style(headerLayout, VSPACE_2);
    // Headline and info text
    Label infoTextLabel = new Label(I18nProperties.getString(Strings.headingDefineOutbreakDistricts));
    infoTextLabel.setWidthUndefined();
    style(infoTextLabel, VSPACE_TOP_4);
    headerLayout.addComponent(infoTextLabel);
    // Number of affected districts and options to toggle outbreak mode for all districts
    HorizontalLayout allDistrictsLayout = new HorizontalLayout();
    allDistrictsLayout.setWidthUndefined();
    allDistrictsLayout.setSpacing(true);
    {
        Label allDistrictsLabel = new Label(I18nProperties.getString(Strings.headingSetOutbreakStatus));
        allDistrictsLabel.setWidthUndefined();
        style(allDistrictsLabel, VSPACE_TOP_4);
        allDistrictsLayout.addComponent(allDistrictsLabel);
        OptionGroup outbreakToggle = new OptionGroup();
        style(outbreakToggle, ValoTheme.OPTIONGROUP_HORIZONTAL, CssStyles.OPTIONGROUP_HORIZONTAL_SWITCH_CRITICAL);
        outbreakToggle.addItem(OUTBREAK);
        outbreakToggle.addItem(NORMAL);
        if (affectedDistricts.isEmpty()) {
            outbreakToggle.setValue(NORMAL);
        } else if (affectedDistricts.size() == totalDistricts) {
            outbreakToggle.setValue(OUTBREAK);
        }
        outbreakToggle.addValueChangeListener(e -> {
            for (OptionGroup districtOutbreakToggle : outbreakToggles) {
                districtOutbreakToggle.setValue(e.getProperty().getValue());
            }
        });
        outbreakToggle.setWidthUndefined();
        allDistrictsLayout.addComponent(outbreakToggle);
        affectedDistrictsNumberLabel = new Label();
        affectedDistrictsNumberLabel.setWidthUndefined();
        allDistrictsLayout.addComponent(affectedDistrictsNumberLabel);
    }
    headerLayout.addComponent(allDistrictsLayout);
    headerLayout.setComponentAlignment(allDistrictsLayout, Alignment.TOP_RIGHT);
    headerLayout.setExpandRatio(infoTextLabel, 1);
    return headerLayout;
}
Also used : ValoTheme(com.vaadin.ui.themes.ValoTheme) CssStyles.style(de.symeda.sormas.ui.utils.CssStyles.style) FacadeProvider(de.symeda.sormas.api.FacadeProvider) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) VerticalLayout(com.vaadin.ui.VerticalLayout) Alignment(com.vaadin.ui.Alignment) Set(java.util.Set) Captions(de.symeda.sormas.api.i18n.Captions) HashSet(java.util.HashSet) OptionGroup(com.vaadin.v7.ui.OptionGroup) List(java.util.List) CssStyles(de.symeda.sormas.ui.utils.CssStyles) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Label(com.vaadin.ui.Label) VSPACE_TOP_4(de.symeda.sormas.ui.utils.CssStyles.VSPACE_TOP_4) VSPACE_2(de.symeda.sormas.ui.utils.CssStyles.VSPACE_2) VSPACE_3(de.symeda.sormas.ui.utils.CssStyles.VSPACE_3) Strings(de.symeda.sormas.api.i18n.Strings) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) OptionGroup(com.vaadin.v7.ui.OptionGroup) Label(com.vaadin.ui.Label) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

Alignment (com.vaadin.ui.Alignment)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Label (com.vaadin.ui.Label)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 ValoTheme (com.vaadin.ui.themes.ValoTheme)1 OptionGroup (com.vaadin.v7.ui.OptionGroup)1 FacadeProvider (de.symeda.sormas.api.FacadeProvider)1 Captions (de.symeda.sormas.api.i18n.Captions)1 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)1 Strings (de.symeda.sormas.api.i18n.Strings)1 DistrictReferenceDto (de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto)1 RegionReferenceDto (de.symeda.sormas.api.infrastructure.region.RegionReferenceDto)1 CssStyles (de.symeda.sormas.ui.utils.CssStyles)1 VSPACE_2 (de.symeda.sormas.ui.utils.CssStyles.VSPACE_2)1 VSPACE_3 (de.symeda.sormas.ui.utils.CssStyles.VSPACE_3)1 VSPACE_TOP_4 (de.symeda.sormas.ui.utils.CssStyles.VSPACE_TOP_4)1 CssStyles.style (de.symeda.sormas.ui.utils.CssStyles.style)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1