Search in sources :

Example 31 with VerticalLayout

use of com.vaadin.v7.ui.VerticalLayout 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)

Example 32 with VerticalLayout

use of com.vaadin.v7.ui.VerticalLayout in project SORMAS-Project by hzi-braunschweig.

the class CampaignDashboardView method refreshSubTabs.

@SuppressWarnings("deprecation")
private void refreshSubTabs(Page page, String tabId, VerticalLayout subTabLayout) {
    final List<String> subTabs = new ArrayList<>(dataProvider.getSubTabIds(tabId));
    final SubMenu subTabSwitcher = new SubMenu();
    final VerticalLayout subTabSwitcherLayout = new VerticalLayout(subTabSwitcher);
    subTabSwitcherLayout.setMargin(new MarginInfo(false, false, false, true));
    subTabSwitcherLayout.setSpacing(false);
    subTabSwitcherLayout.setId("subTabsOf" + tabId);
    currentSubTabsWrapper = subTabSwitcherLayout;
    subTabLayout.addComponent(subTabSwitcherLayout);
    subTabLayout.setExpandRatio(subTabSwitcherLayout, 0);
    subTabSwitcherLayout.addStyleNames("statistics-sublayout", CssStyles.VSPACE_3);
    subTabs.forEach(subTabId -> subTabSwitcher.addView(subTabId, subTabId, (e) -> {
        subTabLayout.removeComponent(currentDiagramsWrapper);
        if (lastSubTabIdForTabIdAndCampaign.containsKey(dataProvider.getCampaign())) {
            lastSubTabIdForTabIdAndCampaign.get(dataProvider.getCampaign()).put(tabId, subTabId);
        } else {
            final HashMap<String, String> subTabMap = new HashMap<>();
            subTabMap.put(tabId, subTabId);
            lastSubTabIdForTabIdAndCampaign.put(dataProvider.getCampaign(), subTabMap);
        }
        refreshDiagrams(page, subTabLayout, tabId, subTabId);
    }));
    if (!(subTabs.size() > 1)) {
        subTabSwitcherLayout.setVisible(false);
    }
    final Map<String, String> subTabMap = lastSubTabIdForTabIdAndCampaign.get(dataProvider.getCampaign());
    final String lastSubTabId = subTabMap != null ? subTabMap.get(tabId) : null;
    final String activeSubTab = subTabs.isEmpty() ? StringUtils.EMPTY : lastSubTabId != null ? lastSubTabId : subTabs.get(0);
    subTabSwitcher.setActiveView(activeSubTab);
    refreshDiagrams(page, subTabLayout, tabId, activeSubTab);
}
Also used : I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) VerticalLayout(com.vaadin.ui.VerticalLayout) SubMenu(de.symeda.sormas.ui.SubMenu) HashMap(java.util.HashMap) CssLayout(com.vaadin.ui.CssLayout) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) OptionGroup(com.vaadin.v7.ui.OptionGroup) CampaignDiagramDataDto(de.symeda.sormas.api.campaign.diagram.CampaignDiagramDataDto) CssStyles(de.symeda.sormas.ui.utils.CssStyles) Map(java.util.Map) Page(com.vaadin.server.Page) CampaignDiagramDefinitionDto(de.symeda.sormas.api.campaign.diagram.CampaignDiagramDefinitionDto) ViewChangeListener(com.vaadin.navigator.ViewChangeListener) ValoTheme(com.vaadin.ui.themes.ValoTheme) CampaignReferenceDto(de.symeda.sormas.api.campaign.CampaignReferenceDto) UUID(java.util.UUID) AbstractDashboardView(de.symeda.sormas.ui.dashboard.AbstractDashboardView) DashboardType(de.symeda.sormas.ui.dashboard.DashboardType) Collectors(java.util.stream.Collectors) CampaignDashboardElement(de.symeda.sormas.api.campaign.diagram.CampaignDashboardElement) MarginInfo(com.vaadin.shared.ui.MarginInfo) List(java.util.List) Strings(de.symeda.sormas.api.i18n.Strings) Component(com.vaadin.ui.Component) HashMap(java.util.HashMap) MarginInfo(com.vaadin.shared.ui.MarginInfo) ArrayList(java.util.ArrayList) VerticalLayout(com.vaadin.ui.VerticalLayout) SubMenu(de.symeda.sormas.ui.SubMenu)

Example 33 with VerticalLayout

use of com.vaadin.v7.ui.VerticalLayout in project SORMAS-Project by hzi-braunschweig.

the class OutbreakRegionConfigurationForm method createAffectedDistrictsComponent.

private HorizontalLayout createAffectedDistrictsComponent() {
    HorizontalLayout affectedDistrictsComponent = new HorizontalLayout();
    affectedDistrictsComponent.setWidth(100, Unit.PERCENTAGE);
    affectedDistrictsComponent.setMargin(false);
    style(affectedDistrictsComponent, VSPACE_3);
    // Create two columns to display the districts
    VerticalLayout leftColumn = new VerticalLayout();
    leftColumn.setMargin(false);
    VerticalLayout middleColumn = new VerticalLayout();
    middleColumn.setMargin(false);
    VerticalLayout rightColumn = new VerticalLayout();
    rightColumn.setMargin(false);
    affectedDistrictsComponent.addComponent(leftColumn);
    // Add spacer label
    affectedDistrictsComponent.addComponent(new Label());
    affectedDistrictsComponent.addComponent(middleColumn);
    // Add spacer label
    affectedDistrictsComponent.addComponent(new Label());
    affectedDistrictsComponent.addComponent(rightColumn);
    affectedDistrictsComponent.setExpandRatio(leftColumn, 1);
    affectedDistrictsComponent.setExpandRatio(middleColumn, 1);
    affectedDistrictsComponent.setExpandRatio(rightColumn, 1);
    List<DistrictReferenceDto> districts = FacadeProvider.getDistrictFacade().getAllActiveByRegion(region.getUuid());
    int index = 1;
    for (DistrictReferenceDto district : districts) {
        OptionGroup outbreakToggle = createOutbreakToggle(district);
        outbreakToggle.setWidth(100, Unit.PERCENTAGE);
        outbreakToggles[index - 1] = outbreakToggle;
        // Split districts evenly to all three columns
        if ((districts.size() % 3 == 0 && index <= districts.size() / 3) || (districts.size() % 3 != 0 && index <= (districts.size() / 3) + 1)) {
            leftColumn.addComponent(outbreakToggle);
        } else if ((districts.size() % 3 == 0 && index <= districts.size() / 1.5f) || ((districts.size() % 3 == 1 || districts.size() % 3 == 2) && index <= (districts.size() / 1.5f) + 1)) {
            middleColumn.addComponent(outbreakToggle);
        } else {
            rightColumn.addComponent(outbreakToggle);
        }
        index++;
    }
    return affectedDistrictsComponent;
}
Also used : OptionGroup(com.vaadin.v7.ui.OptionGroup) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 34 with VerticalLayout

use of com.vaadin.v7.ui.VerticalLayout in project SORMAS-Project by hzi-braunschweig.

the class DatabaseExportView method createDatabaseTablesLayout.

private HorizontalLayout createDatabaseTablesLayout() {
    HorizontalLayout databaseTablesLayout = new HorizontalLayout();
    databaseTablesLayout.setMargin(false);
    databaseTablesLayout.setSpacing(true);
    VerticalLayout sormasDataLayout = new VerticalLayout();
    sormasDataLayout.setMargin(false);
    sormasDataLayout.setSpacing(false);
    Label sormasDataHeadline = new Label(I18nProperties.getCaption(Captions.exportSormasData));
    CssStyles.style(sormasDataHeadline, CssStyles.H4);
    sormasDataLayout.addComponent(sormasDataHeadline);
    VerticalLayout infrastructureDataLayout = new VerticalLayout();
    infrastructureDataLayout.setMargin(false);
    infrastructureDataLayout.setSpacing(false);
    Label infrastructureDataHeadline = new Label(I18nProperties.getCaption(Captions.exportInfrastructureData));
    CssStyles.style(infrastructureDataHeadline, CssStyles.H4);
    infrastructureDataLayout.addComponent(infrastructureDataHeadline);
    VerticalLayout configurationDataLayout = new VerticalLayout();
    configurationDataLayout.setMargin(false);
    configurationDataLayout.setSpacing(false);
    Label configurationDataHeadline = new Label(I18nProperties.getCaption(Captions.exportConfigurationData));
    CssStyles.style(configurationDataHeadline, CssStyles.H4);
    configurationDataLayout.addComponent(configurationDataHeadline);
    VerticalLayout externalDataLayout = new VerticalLayout();
    externalDataLayout.setMargin(false);
    externalDataLayout.setSpacing(false);
    Label externalDataHeadline = new Label(I18nProperties.getCaption(Captions.exportExternalData));
    CssStyles.style(externalDataHeadline, CssStyles.H4);
    externalDataLayout.addComponent(externalDataHeadline);
    List<FeatureConfigurationDto> featureConfigurations = FacadeProvider.getFeatureConfigurationFacade().getActiveServerFeatureConfigurations();
    ConfigFacade configFacade = FacadeProvider.getConfigFacade();
    for (DatabaseTable databaseTable : DatabaseTable.values()) {
        if (!databaseTable.isEnabled(featureConfigurations, configFacade)) {
            continue;
        }
        CheckBox checkBox = new CheckBox(databaseTable.toString());
        int indent = getIndent(databaseTable);
        if (indent == 1) {
            CssStyles.style(checkBox, CssStyles.INDENT_LEFT_1);
        } else if (indent == 2) {
            CssStyles.style(checkBox, CssStyles.INDENT_LEFT_2);
        } else if (indent == 3) {
            CssStyles.style(checkBox, CssStyles.INDENT_LEFT_3);
        }
        switch(databaseTable.getDatabaseTableType()) {
            case SORMAS:
                sormasDataLayout.addComponent(checkBox);
                break;
            case INFRASTRUCTURE:
                infrastructureDataLayout.addComponent(checkBox);
                break;
            case CONFIGURATION:
                configurationDataLayout.addComponent(checkBox);
                break;
            case EXTERNAL:
                externalDataLayout.addComponent(checkBox);
                break;
            default:
                throw new IllegalArgumentException(databaseTable.getDatabaseTableType().toString());
        }
        databaseTableToggles.put(checkBox, databaseTable);
    }
    databaseTablesLayout.addComponent(sormasDataLayout);
    databaseTablesLayout.addComponent(infrastructureDataLayout);
    databaseTablesLayout.addComponent(configurationDataLayout);
    databaseTablesLayout.addComponent(externalDataLayout);
    return databaseTablesLayout;
}
Also used : CheckBox(com.vaadin.v7.ui.CheckBox) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) DatabaseTable(de.symeda.sormas.api.importexport.DatabaseTable) FeatureConfigurationDto(de.symeda.sormas.api.feature.FeatureConfigurationDto) ConfigFacade(de.symeda.sormas.api.ConfigFacade) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 35 with VerticalLayout

use of com.vaadin.v7.ui.VerticalLayout in project SORMAS-Project by hzi-braunschweig.

the class TherapyView method createTreatmentsHeader.

private VerticalLayout createTreatmentsHeader() {
    VerticalLayout treatmentsHeader = new VerticalLayout();
    treatmentsHeader.setMargin(false);
    treatmentsHeader.setSpacing(false);
    treatmentsHeader.setWidth(100, Unit.PERCENTAGE);
    HorizontalLayout headlineRow = new HorizontalLayout();
    headlineRow.setMargin(false);
    headlineRow.setSpacing(true);
    headlineRow.setWidth(100, Unit.PERCENTAGE);
    {
        Label treatmentsLabel = new Label(I18nProperties.getString(Strings.headingTreatments));
        CssStyles.style(treatmentsLabel, CssStyles.H3);
        headlineRow.addComponent(treatmentsLabel);
        headlineRow.setExpandRatio(treatmentsLabel, 1);
        // Bulk operations
        if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
            MenuBar bulkOperationsDropdown = MenuBarHelper.createDropDown(Captions.bulkActions, new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, selectedItem -> {
                ControllerProvider.getTherapyController().deleteAllSelectedTreatments(treatmentGrid.getSelectedRows(), new Runnable() {

                    public void run() {
                        reloadTreatmentGrid();
                    }
                });
            }));
            headlineRow.addComponent(bulkOperationsDropdown);
            headlineRow.setComponentAlignment(bulkOperationsDropdown, Alignment.MIDDLE_RIGHT);
        }
        Button newTreatmentButton = ButtonHelper.createButton(Captions.treatmentNewTreatment, e -> {
            ControllerProvider.getTherapyController().openTreatmentCreateForm(treatmentCriteria.getTherapy(), this::reloadTreatmentGrid);
        });
        headlineRow.addComponent(newTreatmentButton);
        headlineRow.setComponentAlignment(newTreatmentButton, Alignment.MIDDLE_RIGHT);
    }
    treatmentsHeader.addComponent(headlineRow);
    HorizontalLayout filterRow = new HorizontalLayout();
    filterRow.setMargin(false);
    filterRow.setSpacing(true);
    {
        treatmentTypeFilter = ComboBoxHelper.createComboBoxV7();
        treatmentTypeFilter.setWidth(140, Unit.PIXELS);
        treatmentTypeFilter.setInputPrompt(I18nProperties.getPrefixCaption(TreatmentDto.I18N_PREFIX, TreatmentDto.TREATMENT_TYPE));
        treatmentTypeFilter.addItems((Object[]) TreatmentType.values());
        treatmentTypeFilter.addValueChangeListener(e -> {
            treatmentCriteria.treatmentType(((TreatmentType) e.getProperty().getValue()));
            navigateTo(treatmentCriteria);
        });
        filterRow.addComponent(treatmentTypeFilter);
        treatmentTextFilter = new TextField();
        treatmentTextFilter.setWidth(300, Unit.PIXELS);
        treatmentTextFilter.setNullRepresentation("");
        treatmentTextFilter.setInputPrompt(I18nProperties.getString(Strings.promptTreatmentTextFilter));
        treatmentTextFilter.addTextChangeListener(e -> {
            treatmentCriteria.textFilter(e.getText());
            reloadTreatmentGrid();
        });
        filterRow.addComponent(treatmentTextFilter);
    }
    treatmentsHeader.addComponent(filterRow);
    return treatmentsHeader;
}
Also used : TreatmentType(de.symeda.sormas.api.therapy.TreatmentType) FacadeProvider(de.symeda.sormas.api.FacadeProvider) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) VerticalLayout(com.vaadin.ui.VerticalLayout) Alignment(com.vaadin.ui.Alignment) DetailSubComponentWrapper(de.symeda.sormas.ui.utils.DetailSubComponentWrapper) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) AbstractCaseView(de.symeda.sormas.ui.caze.AbstractCaseView) ViewModelProviders(de.symeda.sormas.ui.ViewModelProviders) CssStyles(de.symeda.sormas.ui.utils.CssStyles) TreatmentCriteria(de.symeda.sormas.api.therapy.TreatmentCriteria) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) Label(com.vaadin.ui.Label) VaadinIcons(com.vaadin.icons.VaadinIcons) ComboBoxHelper(de.symeda.sormas.ui.utils.ComboBoxHelper) UserProvider(de.symeda.sormas.ui.UserProvider) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) ValoTheme(com.vaadin.ui.themes.ValoTheme) PrescriptionDto(de.symeda.sormas.api.therapy.PrescriptionDto) TherapyDto(de.symeda.sormas.api.therapy.TherapyDto) MenuBar(com.vaadin.ui.MenuBar) ComboBox(com.vaadin.v7.ui.ComboBox) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) Captions(de.symeda.sormas.api.i18n.Captions) UserRight(de.symeda.sormas.api.user.UserRight) Button(com.vaadin.ui.Button) PrescriptionCriteria(de.symeda.sormas.api.therapy.PrescriptionCriteria) HeightMode(com.vaadin.v7.shared.ui.grid.HeightMode) HorizontalLayout(com.vaadin.ui.HorizontalLayout) TextField(com.vaadin.v7.ui.TextField) Strings(de.symeda.sormas.api.i18n.Strings) TreatmentDto(de.symeda.sormas.api.therapy.TreatmentDto) Button(com.vaadin.ui.Button) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) MenuBar(com.vaadin.ui.MenuBar) TextField(com.vaadin.v7.ui.TextField) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

VerticalLayout (com.vaadin.v7.ui.VerticalLayout)34 VerticalLayout (com.vaadin.ui.VerticalLayout)25 Button (com.vaadin.ui.Button)22 Label (com.vaadin.ui.Label)18 Label (com.vaadin.v7.ui.Label)17 HorizontalLayout (com.vaadin.ui.HorizontalLayout)16 Window (com.vaadin.ui.Window)12 Component (com.vaadin.ui.Component)11 ValoTheme (com.vaadin.ui.themes.ValoTheme)11 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)11 VaadinIcons (com.vaadin.icons.VaadinIcons)10 Panel (com.vaadin.ui.Panel)10 TextField (com.vaadin.v7.ui.TextField)10 Strings (de.symeda.sormas.api.i18n.Strings)10 ButtonHelper (de.symeda.sormas.ui.utils.ButtonHelper)10 CssStyles (de.symeda.sormas.ui.utils.CssStyles)10 Captions (de.symeda.sormas.api.i18n.Captions)9 Alignment (com.vaadin.ui.Alignment)8 CheckBox (com.vaadin.v7.ui.CheckBox)8 OptionGroup (com.vaadin.v7.ui.OptionGroup)8