Search in sources :

Example 1 with EpiCurveGrouping

use of de.symeda.sormas.api.dashboard.EpiCurveGrouping in project SORMAS-Project by hzi-braunschweig.

the class AbstractEpiCurveComponent method createFooter.

private HorizontalLayout createFooter() {
    HorizontalLayout epiCurveFooterLayout = new HorizontalLayout();
    epiCurveFooterLayout.setWidth(100, Unit.PERCENTAGE);
    epiCurveFooterLayout.setSpacing(true);
    CssStyles.style(epiCurveFooterLayout, CssStyles.VSPACE_4);
    // Grouping
    VerticalLayout groupingLayout = new VerticalLayout();
    {
        groupingLayout.setMargin(true);
        groupingLayout.setSizeUndefined();
        // Grouping option group
        OptionGroup groupingSelect = new OptionGroup();
        groupingSelect.setWidth(100, Unit.PERCENTAGE);
        groupingSelect.addItems((Object[]) EpiCurveGrouping.values());
        groupingSelect.setValue(epiCurveGrouping);
        groupingSelect.addValueChangeListener(e -> {
            epiCurveGrouping = (EpiCurveGrouping) e.getProperty().getValue();
            clearAndFillEpiCurveChart();
        });
        groupingLayout.addComponent(groupingSelect);
        // "Always show at least 7 entries" checkbox
        CheckBox minimumEntriesCheckbox = new CheckBox(I18nProperties.getCaption(Captions.dashboardShowMinimumEntries));
        CssStyles.style(minimumEntriesCheckbox, CssStyles.VSPACE_NONE);
        minimumEntriesCheckbox.setValue(showMinimumEntries);
        minimumEntriesCheckbox.addValueChangeListener(e -> {
            showMinimumEntries = (boolean) e.getProperty().getValue();
            clearAndFillEpiCurveChart();
        });
        groupingLayout.addComponent(minimumEntriesCheckbox);
    }
    PopupButton groupingDropdown = ButtonHelper.createPopupButton(Captions.dashboardGrouping, groupingLayout, CssStyles.BUTTON_SUBTLE);
    epiCurveFooterLayout.addComponent(groupingDropdown);
    epiCurveFooterLayout.setComponentAlignment(groupingDropdown, Alignment.MIDDLE_RIGHT);
    epiCurveFooterLayout.setExpandRatio(groupingDropdown, 1);
    // Epi curve mode
    AbstractComponent epiCurveModeSelector = createEpiCurveModeSelector();
    epiCurveFooterLayout.addComponent(epiCurveModeSelector);
    epiCurveFooterLayout.setComponentAlignment(epiCurveModeSelector, Alignment.MIDDLE_RIGHT);
    epiCurveFooterLayout.setExpandRatio(epiCurveModeSelector, 0);
    return epiCurveFooterLayout;
}
Also used : Date(java.util.Date) CheckBox(com.vaadin.v7.ui.CheckBox) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) VerticalLayout(com.vaadin.ui.VerticalLayout) Alignment(com.vaadin.ui.Alignment) DateHelper(de.symeda.sormas.api.utils.DateHelper) PopupButton(org.vaadin.hene.popupbutton.PopupButton) Captions(de.symeda.sormas.api.i18n.Captions) HighChart(de.symeda.sormas.ui.highcharts.HighChart) ArrayList(java.util.ArrayList) Consumer(java.util.function.Consumer) OptionGroup(com.vaadin.v7.ui.OptionGroup) DashboardDataProvider(de.symeda.sormas.ui.dashboard.DashboardDataProvider) List(java.util.List) Button(com.vaadin.ui.Button) AbstractComponent(com.vaadin.ui.AbstractComponent) CssStyles(de.symeda.sormas.ui.utils.CssStyles) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Label(com.vaadin.ui.Label) VaadinIcons(com.vaadin.icons.VaadinIcons) Strings(de.symeda.sormas.api.i18n.Strings) EpiCurveGrouping(de.symeda.sormas.api.dashboard.EpiCurveGrouping) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) AbstractComponent(com.vaadin.ui.AbstractComponent) OptionGroup(com.vaadin.v7.ui.OptionGroup) PopupButton(org.vaadin.hene.popupbutton.PopupButton) CheckBox(com.vaadin.v7.ui.CheckBox) EpiCurveGrouping(de.symeda.sormas.api.dashboard.EpiCurveGrouping) VerticalLayout(com.vaadin.ui.VerticalLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

VaadinIcons (com.vaadin.icons.VaadinIcons)1 AbstractComponent (com.vaadin.ui.AbstractComponent)1 Alignment (com.vaadin.ui.Alignment)1 Button (com.vaadin.ui.Button)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Label (com.vaadin.ui.Label)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 CheckBox (com.vaadin.v7.ui.CheckBox)1 OptionGroup (com.vaadin.v7.ui.OptionGroup)1 EpiCurveGrouping (de.symeda.sormas.api.dashboard.EpiCurveGrouping)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 DateHelper (de.symeda.sormas.api.utils.DateHelper)1 DashboardDataProvider (de.symeda.sormas.ui.dashboard.DashboardDataProvider)1 HighChart (de.symeda.sormas.ui.highcharts.HighChart)1 ButtonHelper (de.symeda.sormas.ui.utils.ButtonHelper)1 CssStyles (de.symeda.sormas.ui.utils.CssStyles)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1