Search in sources :

Example 41 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project charts by vaadin.

the class ChartsDemoUI method init.

@Override
protected void init(VaadinRequest request) {
    initGATracker();
    tabSheet = new TabSheet();
    tabSheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() {

        @Override
        public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
            com.vaadin.ui.JavaScript.eval("setTimeout(function(){prettyPrint();},300);");
        }
    });
    tabSheet.setSizeFull();
    tabSheet.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
    Link homepage = new Link("Home Page", new ExternalResource("https://vaadin.com/components/vaadin-charts"));
    Link javadoc = new Link("JavaDoc", new ExternalResource("https://vaadin.com/api/com.vaadin/vaadin-charts/" + getVersion() + "/"));
    Link manual = new Link("Manual", new ExternalResource("https://vaadin.com/docs/v8/charts/charts-overview.html"));
    Link pricing = new Link("Pricing", new ExternalResource("https://vaadin.com/pricing"));
    Label version = new Label("Version " + getVersion());
    version.addStyleName("version");
    HorizontalLayout links = new HorizontalLayout(homepage, pricing, javadoc, manual);
    links.setSpacing(true);
    links.addStyleName("links");
    final HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
    horizontalSplitPanel.setSecondComponent(tabSheet);
    horizontalSplitPanel.setSplitPosition(300, Unit.PIXELS);
    horizontalSplitPanel.addStyleName("main-layout");
    ChartOptions.get().setTheme(new ValoLightTheme());
    themeSelector = new ComboBox("Charts Theme:");
    themeSelector.addStyleName("theme-selector");
    themeSelector.addStyleName(ValoTheme.COMBOBOX_SMALL);
    themeSelector.setTextInputAllowed(false);
    com.vaadin.addon.charts.model.style.Theme defaultTheme = new ValoLightTheme();
    Map<com.vaadin.addon.charts.model.style.Theme, String> mapThemes = new HashMap<>();
    com.vaadin.addon.charts.model.style.Theme[] themes = new com.vaadin.addon.charts.model.style.Theme[] { defaultTheme, new ValoDarkTheme(), new VaadinTheme(), new HighChartsDefaultTheme(), new GridTheme(), new GrayTheme(), new SkiesTheme() };
    mapThemes.put(themes[0], "Valo Light");
    mapThemes.put(themes[1], "Valo Dark");
    mapThemes.put(themes[2], "Vaadin");
    mapThemes.put(themes[3], "HighCharts");
    mapThemes.put(themes[4], "Grid");
    mapThemes.put(themes[5], "Gray");
    mapThemes.put(themes[6], "Skies");
    themeSelector.setEmptySelectionAllowed(false);
    themeSelector.setItems(themes);
    themeSelector.setSelectedItem(defaultTheme);
    themeSelector.setItemCaptionGenerator(mapThemes::get);
    themeSelector.addSelectionListener(e -> {
        ChartOptions.get().setTheme(e.getValue());
    });
    final HierarchicalContainer container = getContainer();
    VerticalLayout content = new VerticalLayout();
    content.setSpacing(true);
    content.setMargin(false);
    Label logo = new Label("Vaadin Charts for Vaadin 8");
    logo.setWidth("100%");
    logo.addStyleName("h3");
    logo.addStyleName("logo");
    TextField filterField = new TextField();
    filterField.setPlaceholder("Filter examples");
    filterField.setIcon(FontAwesome.SEARCH);
    filterField.addStyleName("filter");
    filterField.setWidth("100%");
    filterField.addValueChangeListener(e -> {
        container.removeAllContainerFilters();
        String text = e.getValue();
        if (text != null && !text.isEmpty()) {
            expandForFiltering();
            container.addContainerFilter("searchName", text, true, false);
        } else {
            restoreExpandedStates();
        }
    });
    tree = new Tree();
    tree.setImmediate(true);
    tree.setContainerDataSource(container);
    tree.setItemCaptionPropertyId("displayName");
    tree.setNullSelectionAllowed(false);
    tree.setWidth("100%");
    tree.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            Object value = event.getProperty().getValue();
            if (value instanceof Class) {
                updateTabSheet((Class) value);
            } else {
                tree.expandItemsRecursively(value);
            }
        }
    });
    Button trial = new Button("Start Free Trial");
    trial.addStyleName(ValoTheme.BUTTON_PRIMARY);
    trial.addStyleName(ValoTheme.BUTTON_TINY);
    trial.addClickListener(e -> {
        getUI().getPage().open("https://vaadin.com/trial", "_blank");
    });
    content.addComponents(logo, links, trial, filterField, tree, version);
    content.setComponentAlignment(trial, Alignment.MIDDLE_CENTER);
    horizontalSplitPanel.setFirstComponent(content);
    selectItem();
    Page.getCurrent().addUriFragmentChangedListener(new Page.UriFragmentChangedListener() {

        @Override
        public void uriFragmentChanged(Page.UriFragmentChangedEvent event) {
            selectItem();
        }
    });
    setContent(new CssLayout() {

        {
            setSizeFull();
            addComponent(horizontalSplitPanel);
            addComponent(themeSelector);
        }
    });
    if (tracker != null) {
        tracker.trackPageview("/charts");
    }
}
Also used : SkiesTheme(com.vaadin.addon.charts.themes.SkiesTheme) HighChartsDefaultTheme(com.vaadin.addon.charts.themes.HighChartsDefaultTheme) ValoLightTheme(com.vaadin.addon.charts.themes.ValoLightTheme) HashMap(java.util.HashMap) Label(com.vaadin.ui.Label) VaadinTheme(com.vaadin.addon.charts.themes.VaadinTheme) Page(com.vaadin.server.Page) GrayTheme(com.vaadin.addon.charts.themes.GrayTheme) HorizontalLayout(com.vaadin.ui.HorizontalLayout) ValoDarkTheme(com.vaadin.addon.charts.themes.ValoDarkTheme) CssLayout(com.vaadin.ui.CssLayout) Button(com.vaadin.ui.Button) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.ui.TextField) Tree(com.vaadin.v7.ui.Tree) Property(com.vaadin.v7.data.Property) ComboBox(com.vaadin.ui.ComboBox) GridTheme(com.vaadin.addon.charts.themes.GridTheme) ExternalResource(com.vaadin.server.ExternalResource) TabSheet(com.vaadin.ui.TabSheet) HorizontalSplitPanel(com.vaadin.ui.HorizontalSplitPanel) ValoLightTheme(com.vaadin.addon.charts.themes.ValoLightTheme) ValoDarkTheme(com.vaadin.addon.charts.themes.ValoDarkTheme) ValoTheme(com.vaadin.ui.themes.ValoTheme) Theme(com.vaadin.annotations.Theme) GrayTheme(com.vaadin.addon.charts.themes.GrayTheme) VaadinTheme(com.vaadin.addon.charts.themes.VaadinTheme) GridTheme(com.vaadin.addon.charts.themes.GridTheme) HighChartsDefaultTheme(com.vaadin.addon.charts.themes.HighChartsDefaultTheme) SkiesTheme(com.vaadin.addon.charts.themes.SkiesTheme) HierarchicalContainer(com.vaadin.v7.data.util.HierarchicalContainer) Link(com.vaadin.ui.Link)

Example 42 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project charts by vaadin.

the class ServerSideEvents method createControls.

private Layout createControls() {
    visibilityToggling = new CheckBox("Disable series visibility toggling");
    visibilityToggling.addValueChangeListener(e -> {
        chart.setSeriesVisibilityTogglingDisabled(visibilityToggling.getValue());
    });
    final Button firstSeriesVisible = new Button("Hide first series");
    firstSeriesVisible.setId("hideFirstSeries");
    firstSeriesVisible.addClickListener(new Button.ClickListener() {

        boolean hideSeries = true;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            Series firstSeries = chart.getConfiguration().getSeries().get(0);
            ((AbstractSeries) firstSeries).setVisible(!hideSeries);
            hideSeries = !hideSeries;
            String caption = hideSeries ? "Hide first series" : "Show first series";
            firstSeriesVisible.setCaption(caption);
        }
    });
    Button setExtremes = new Button("Toggle extremes");
    setExtremes.setId("setExtremes");
    setExtremes.addClickListener(new Button.ClickListener() {

        public boolean extremesSet;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (extremesSet) {
                chart.getConfiguration().getxAxis().setExtremes(10, 90);
            } else {
                chart.getConfiguration().getxAxis().setExtremes(20, 80);
            }
            extremesSet = !extremesSet;
        }
    });
    final OptionGroup zoomLevels = new OptionGroup("Zoom Type");
    zoomLevels.addItem(ZoomType.XY);
    zoomLevels.addItem(ZoomType.X);
    zoomLevels.addItem(ZoomType.Y);
    zoomLevels.setValue(ZoomType.XY);
    zoomLevels.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            ZoomType zoom = (ZoomType) zoomLevels.getValue();
            chart.getConfiguration().getChart().setZoomType(zoom);
            chart.drawChart();
        }
    });
    Button resetHistory = new Button("Reset history");
    resetHistory.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            lastEvent.setValue(null);
            eventDetails.setValue(null);
            historyLayout.removeAllComponents();
        }
    });
    HorizontalLayout controls = new HorizontalLayout();
    controls.setId("controls");
    controls.setSpacing(true);
    controls.addComponent(visibilityToggling);
    controls.addComponent(firstSeriesVisible);
    controls.addComponent(setExtremes);
    controls.addComponent(zoomLevels);
    controls.addComponent(resetHistory);
    return controls;
}
Also used : ZoomType(com.vaadin.addon.charts.model.ZoomType) HorizontalLayout(com.vaadin.ui.HorizontalLayout) PlotOptionsSeries(com.vaadin.addon.charts.model.PlotOptionsSeries) Series(com.vaadin.addon.charts.model.Series) AbstractSeries(com.vaadin.addon.charts.model.AbstractSeries) DataSeries(com.vaadin.addon.charts.model.DataSeries) OptionGroup(com.vaadin.v7.ui.OptionGroup) Button(com.vaadin.ui.Button) CheckBox(com.vaadin.ui.CheckBox) Property(com.vaadin.v7.data.Property)

Example 43 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project charts by vaadin.

the class ChartWithExternalContainer method getChart.

@Override
protected Component getChart() {
    HorizontalLayout lo = new HorizontalLayout();
    lo.setSpacing(true);
    Container vaadinContainer = ExampleUtil.getOrderContainer();
    ContainerDataSeries container1 = createContainerView1(vaadinContainer);
    ContainerDataSeries container2 = createContainerView2(vaadinContainer);
    Component table = createTable(vaadinContainer);
    Component chart1 = createChart1(container1);
    Component chart2 = createChart2(container2);
    table.setSizeFull();
    chart1.setSizeFull();
    chart2.setSizeFull();
    lo.setWidth("100%");
    lo.setHeight("450px");
    lo.addComponents(table);
    lo.addComponent(chart1);
    lo.addComponent(chart2);
    lo.setExpandRatio(table, 0.2f);
    lo.setExpandRatio(chart1, 0.4f);
    lo.setExpandRatio(chart2, 0.4f);
    return lo;
}
Also used : Container(com.vaadin.v7.data.Container) Component(com.vaadin.ui.Component) ContainerDataSeries(com.vaadin.v7.addon.charts.model.ContainerDataSeries) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 44 with HorizontalLayout

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

the class CommunitiesView method createFilterBar.

private HorizontalLayout createFilterBar() {
    filterLayout = new HorizontalLayout();
    filterLayout.setMargin(false);
    filterLayout.setSpacing(true);
    filterLayout.setWidth(100, Unit.PERCENTAGE);
    searchField = new SearchField();
    searchField.addTextChangeListener(e -> {
        criteria.nameLike(e.getText());
        grid.reload();
    });
    filterLayout.addComponent(searchField);
    countryFilter = addCountryFilter(filterLayout, country -> {
        criteria.country(country);
        grid.reload();
    }, regionFilter);
    countryFilter.addValueChangeListener(country -> {
        CountryReferenceDto countryReferenceDto = (CountryReferenceDto) country.getProperty().getValue();
        criteria.country(countryReferenceDto);
        navigateTo(criteria);
        FieldHelper.updateItems(regionFilter, countryReferenceDto != null ? FacadeProvider.getRegionFacade().getAllActiveByCountry(countryReferenceDto.getUuid()) : null);
    });
    regionFilter = ComboBoxHelper.createComboBoxV7();
    regionFilter.setId(DistrictDto.REGION);
    regionFilter.setWidth(140, Unit.PIXELS);
    regionFilter.setCaption(I18nProperties.getPrefixCaption(DistrictDto.I18N_PREFIX, DistrictDto.REGION));
    regionFilter.addItems(FacadeProvider.getRegionFacade().getAllActiveAsReference());
    regionFilter.addValueChangeListener(e -> {
        RegionReferenceDto region = (RegionReferenceDto) e.getProperty().getValue();
        criteria.region(region);
        navigateTo(criteria);
        FieldHelper.updateItems(districtFilter, region != null ? FacadeProvider.getDistrictFacade().getAllActiveByRegion(region.getUuid()) : null);
    });
    filterLayout.addComponent(regionFilter);
    districtFilter = ComboBoxHelper.createComboBoxV7();
    districtFilter.setId(CommunityDto.DISTRICT);
    districtFilter.setWidth(140, Unit.PIXELS);
    districtFilter.setCaption(I18nProperties.getPrefixCaption(CommunityDto.I18N_PREFIX, CommunityDto.DISTRICT));
    districtFilter.addValueChangeListener(e -> {
        criteria.district((DistrictReferenceDto) e.getProperty().getValue());
        navigateTo(criteria);
    });
    filterLayout.addComponent(districtFilter);
    resetButton = ButtonHelper.createButton(Captions.actionResetFilters, event -> {
        ViewModelProviders.of(CommunitiesView.class).remove(CommunityCriteria.class);
        navigateTo(null);
    }, CssStyles.FORCE_CAPTION);
    resetButton.setVisible(false);
    filterLayout.addComponent(resetButton);
    HorizontalLayout actionButtonsLayout = new HorizontalLayout();
    actionButtonsLayout.setSpacing(true);
    {
        // Show active/archived/all dropdown
        if (UserProvider.getCurrent().hasUserRight(UserRight.INFRASTRUCTURE_VIEW)) {
            relevanceStatusFilter = ComboBoxHelper.createComboBoxV7();
            relevanceStatusFilter.setId("relevanceStatus");
            relevanceStatusFilter.setWidth(220, Unit.PERCENTAGE);
            relevanceStatusFilter.setNullSelectionAllowed(false);
            relevanceStatusFilter.addItems((Object[]) EntityRelevanceStatus.values());
            relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ACTIVE, I18nProperties.getCaption(Captions.communityActiveCommunities));
            relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ARCHIVED, I18nProperties.getCaption(Captions.communityArchivedCommunities));
            relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ALL, I18nProperties.getCaption(Captions.communityAllCommunities));
            relevanceStatusFilter.addValueChangeListener(e -> {
                criteria.relevanceStatus((EntityRelevanceStatus) e.getProperty().getValue());
                navigateTo(criteria);
            });
            actionButtonsLayout.addComponent(relevanceStatusFilter);
            // Bulk operation dropdown
            if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
                bulkOperationsDropdown = MenuBarHelper.createDropDown(Captions.bulkActions, new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.actionArchiveInfrastructure), VaadinIcons.ARCHIVE, selectedItem -> {
                    ControllerProvider.getInfrastructureController().archiveOrDearchiveAllSelectedItems(true, grid.asMultiSelect().getSelectedItems(), InfrastructureType.COMMUNITY, new Runnable() {

                        public void run() {
                            navigateTo(criteria);
                        }
                    });
                }, EntityRelevanceStatus.ACTIVE.equals(criteria.getRelevanceStatus())), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.actionDearchiveInfrastructure), VaadinIcons.ARCHIVE, selectedItem -> {
                    ControllerProvider.getInfrastructureController().archiveOrDearchiveAllSelectedItems(false, grid.asMultiSelect().getSelectedItems(), InfrastructureType.COMMUNITY, new Runnable() {

                        public void run() {
                            navigateTo(criteria);
                        }
                    });
                }, EntityRelevanceStatus.ARCHIVED.equals(criteria.getRelevanceStatus())));
                bulkOperationsDropdown.setVisible(isBulkOperationsDropdownVisible());
                actionButtonsLayout.addComponent(bulkOperationsDropdown);
            }
        }
    }
    filterLayout.addComponent(actionButtonsLayout);
    filterLayout.setComponentAlignment(actionButtonsLayout, Alignment.BOTTOM_RIGHT);
    filterLayout.setExpandRatio(actionButtonsLayout, 1);
    return filterLayout;
}
Also used : FeatureType(de.symeda.sormas.api.feature.FeatureType) RowCount(de.symeda.sormas.ui.utils.RowCount) StreamResource(com.vaadin.server.StreamResource) SearchField(de.symeda.sormas.ui.configuration.infrastructure.components.SearchField) VaadinUiUtil(de.symeda.sormas.ui.utils.VaadinUiUtil) FacadeProvider(de.symeda.sormas.api.FacadeProvider) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) VerticalLayout(com.vaadin.ui.VerticalLayout) Alignment(com.vaadin.ui.Alignment) GridExportStreamResource(de.symeda.sormas.ui.utils.GridExportStreamResource) Window(com.vaadin.ui.Window) EntityRelevanceStatus(de.symeda.sormas.api.EntityRelevanceStatus) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) CommunityDto(de.symeda.sormas.api.infrastructure.community.CommunityDto) ExportEntityName(de.symeda.sormas.ui.utils.ExportEntityName) ViewConfiguration(de.symeda.sormas.ui.utils.ViewConfiguration) CountryReferenceDto(de.symeda.sormas.api.infrastructure.country.CountryReferenceDto) ViewModelProviders(de.symeda.sormas.ui.ViewModelProviders) CssStyles(de.symeda.sormas.ui.utils.CssStyles) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) Label(com.vaadin.ui.Label) ViewChangeEvent(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) VaadinIcons(com.vaadin.icons.VaadinIcons) ComboBoxHelper(de.symeda.sormas.ui.utils.ComboBoxHelper) AbstractConfigurationView(de.symeda.sormas.ui.configuration.AbstractConfigurationView) UserProvider(de.symeda.sormas.ui.UserProvider) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) ValoTheme(com.vaadin.ui.themes.ValoTheme) MenuBar(com.vaadin.ui.MenuBar) ComboBox(com.vaadin.v7.ui.ComboBox) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) InfrastructureType(de.symeda.sormas.api.infrastructure.InfrastructureType) CommunityCriteria(de.symeda.sormas.api.infrastructure.community.CommunityCriteria) FieldHelper(de.symeda.sormas.ui.utils.FieldHelper) Captions(de.symeda.sormas.api.i18n.Captions) UserRight(de.symeda.sormas.api.user.UserRight) Button(com.vaadin.ui.Button) HorizontalLayout(com.vaadin.ui.HorizontalLayout) FileDownloader(com.vaadin.server.FileDownloader) DistrictDto(de.symeda.sormas.api.infrastructure.district.DistrictDto) Descriptions(de.symeda.sormas.api.i18n.Descriptions) Strings(de.symeda.sormas.api.i18n.Strings) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) SearchField(de.symeda.sormas.ui.configuration.infrastructure.components.SearchField) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) CountryReferenceDto(de.symeda.sormas.api.infrastructure.country.CountryReferenceDto) EntityRelevanceStatus(de.symeda.sormas.api.EntityRelevanceStatus) HorizontalLayout(com.vaadin.ui.HorizontalLayout) CommunityCriteria(de.symeda.sormas.api.infrastructure.community.CommunityCriteria)

Example 45 with HorizontalLayout

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

the class DistrictsView method createFilterBar.

private HorizontalLayout createFilterBar() {
    filterLayout = new HorizontalLayout();
    filterLayout.setMargin(false);
    filterLayout.setSpacing(true);
    filterLayout.setWidth(100, Unit.PERCENTAGE);
    searchField = new SearchField();
    searchField.addTextChangeListener(e -> {
        criteria.nameEpidLike(e.getText());
        grid.reload();
    });
    filterLayout.addComponent(searchField);
    countryFilter = addCountryFilter(filterLayout, country -> {
        criteria.country(country);
        grid.reload();
    }, regionFilter);
    countryFilter.addValueChangeListener(country -> {
        CountryReferenceDto countryReferenceDto = (CountryReferenceDto) country.getProperty().getValue();
        criteria.country(countryReferenceDto);
        navigateTo(criteria);
        FieldHelper.updateItems(regionFilter, countryReferenceDto != null ? FacadeProvider.getRegionFacade().getAllActiveByCountry(countryReferenceDto.getUuid()) : null);
    });
    regionFilter = ComboBoxHelper.createComboBoxV7();
    regionFilter.setId(DistrictDto.REGION);
    regionFilter.setWidth(140, Unit.PIXELS);
    regionFilter.setCaption(I18nProperties.getPrefixCaption(DistrictDto.I18N_PREFIX, DistrictDto.REGION));
    regionFilter.addItems(FacadeProvider.getRegionFacade().getAllActiveByServerCountry());
    regionFilter.addValueChangeListener(e -> {
        criteria.region((RegionReferenceDto) e.getProperty().getValue());
        navigateTo(criteria);
    });
    filterLayout.addComponent(regionFilter);
    resetButton = ButtonHelper.createButton(Captions.actionResetFilters, event -> {
        ViewModelProviders.of(DistrictsView.class).remove(DistrictCriteria.class);
        navigateTo(null);
    }, CssStyles.FORCE_CAPTION);
    resetButton.setVisible(false);
    filterLayout.addComponent(resetButton);
    HorizontalLayout actionButtonsLayout = new HorizontalLayout();
    actionButtonsLayout.setSpacing(true);
    {
        // Show active/archived/all dropdown
        if (UserProvider.getCurrent().hasUserRight(UserRight.INFRASTRUCTURE_VIEW)) {
            relevanceStatusFilter = ComboBoxHelper.createComboBoxV7();
            relevanceStatusFilter.setId("relevanceStatus");
            relevanceStatusFilter.setWidth(220, Unit.PERCENTAGE);
            relevanceStatusFilter.setNullSelectionAllowed(false);
            relevanceStatusFilter.addItems((Object[]) EntityRelevanceStatus.values());
            relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ACTIVE, I18nProperties.getCaption(Captions.districtActiveDistricts));
            relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ARCHIVED, I18nProperties.getCaption(Captions.districtArchivedDistricts));
            relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ALL, I18nProperties.getCaption(Captions.districtAllDistricts));
            relevanceStatusFilter.addValueChangeListener(e -> {
                criteria.relevanceStatus((EntityRelevanceStatus) e.getProperty().getValue());
                navigateTo(criteria);
            });
            actionButtonsLayout.addComponent(relevanceStatusFilter);
            // Bulk operation dropdown
            if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
                bulkOperationsDropdown = MenuBarHelper.createDropDown(Captions.bulkActions, new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.actionArchiveInfrastructure), VaadinIcons.ARCHIVE, selectedItem -> {
                    ControllerProvider.getInfrastructureController().archiveOrDearchiveAllSelectedItems(true, grid.asMultiSelect().getSelectedItems(), InfrastructureType.DISTRICT, new Runnable() {

                        public void run() {
                            navigateTo(criteria);
                        }
                    });
                }, EntityRelevanceStatus.ACTIVE.equals(criteria.getRelevanceStatus())), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.actionDearchiveInfrastructure), VaadinIcons.ARCHIVE, selectedItem -> {
                    ControllerProvider.getInfrastructureController().archiveOrDearchiveAllSelectedItems(false, grid.asMultiSelect().getSelectedItems(), InfrastructureType.DISTRICT, new Runnable() {

                        public void run() {
                            navigateTo(criteria);
                        }
                    });
                }, EntityRelevanceStatus.ARCHIVED.equals(criteria.getRelevanceStatus())));
                bulkOperationsDropdown.setVisible(isBulkOperationsDropdownVisible());
                actionButtonsLayout.addComponent(bulkOperationsDropdown);
            }
        }
    }
    filterLayout.addComponent(actionButtonsLayout);
    filterLayout.setComponentAlignment(actionButtonsLayout, Alignment.BOTTOM_RIGHT);
    filterLayout.setExpandRatio(actionButtonsLayout, 1);
    return filterLayout;
}
Also used : FeatureType(de.symeda.sormas.api.feature.FeatureType) RowCount(de.symeda.sormas.ui.utils.RowCount) StreamResource(com.vaadin.server.StreamResource) SearchField(de.symeda.sormas.ui.configuration.infrastructure.components.SearchField) VaadinUiUtil(de.symeda.sormas.ui.utils.VaadinUiUtil) FacadeProvider(de.symeda.sormas.api.FacadeProvider) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) VerticalLayout(com.vaadin.ui.VerticalLayout) Alignment(com.vaadin.ui.Alignment) GridExportStreamResource(de.symeda.sormas.ui.utils.GridExportStreamResource) Window(com.vaadin.ui.Window) EntityRelevanceStatus(de.symeda.sormas.api.EntityRelevanceStatus) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) ExportEntityName(de.symeda.sormas.ui.utils.ExportEntityName) ViewConfiguration(de.symeda.sormas.ui.utils.ViewConfiguration) CountryReferenceDto(de.symeda.sormas.api.infrastructure.country.CountryReferenceDto) ViewModelProviders(de.symeda.sormas.ui.ViewModelProviders) CssStyles(de.symeda.sormas.ui.utils.CssStyles) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) Label(com.vaadin.ui.Label) ViewChangeEvent(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) VaadinIcons(com.vaadin.icons.VaadinIcons) ComboBoxHelper(de.symeda.sormas.ui.utils.ComboBoxHelper) AbstractConfigurationView(de.symeda.sormas.ui.configuration.AbstractConfigurationView) UserProvider(de.symeda.sormas.ui.UserProvider) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) ValoTheme(com.vaadin.ui.themes.ValoTheme) MenuBar(com.vaadin.ui.MenuBar) ComboBox(com.vaadin.v7.ui.ComboBox) InfrastructureType(de.symeda.sormas.api.infrastructure.InfrastructureType) DistrictCriteria(de.symeda.sormas.api.infrastructure.district.DistrictCriteria) FieldHelper(de.symeda.sormas.ui.utils.FieldHelper) Captions(de.symeda.sormas.api.i18n.Captions) UserRight(de.symeda.sormas.api.user.UserRight) Button(com.vaadin.ui.Button) HorizontalLayout(com.vaadin.ui.HorizontalLayout) FileDownloader(com.vaadin.server.FileDownloader) DistrictDto(de.symeda.sormas.api.infrastructure.district.DistrictDto) Descriptions(de.symeda.sormas.api.i18n.Descriptions) Strings(de.symeda.sormas.api.i18n.Strings) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) SearchField(de.symeda.sormas.ui.configuration.infrastructure.components.SearchField) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) CountryReferenceDto(de.symeda.sormas.api.infrastructure.country.CountryReferenceDto) EntityRelevanceStatus(de.symeda.sormas.api.EntityRelevanceStatus) DistrictCriteria(de.symeda.sormas.api.infrastructure.district.DistrictCriteria) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

HorizontalLayout (com.vaadin.ui.HorizontalLayout)53 Button (com.vaadin.ui.Button)37 Label (com.vaadin.ui.Label)32 VerticalLayout (com.vaadin.ui.VerticalLayout)32 ComboBox (com.vaadin.v7.ui.ComboBox)29 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)29 CssStyles (de.symeda.sormas.ui.utils.CssStyles)29 Alignment (com.vaadin.ui.Alignment)28 ValoTheme (com.vaadin.ui.themes.ValoTheme)28 Captions (de.symeda.sormas.api.i18n.Captions)28 ButtonHelper (de.symeda.sormas.ui.utils.ButtonHelper)27 FacadeProvider (de.symeda.sormas.api.FacadeProvider)26 Strings (de.symeda.sormas.api.i18n.Strings)26 VaadinIcons (com.vaadin.icons.VaadinIcons)25 UserProvider (de.symeda.sormas.ui.UserProvider)25 ControllerProvider (de.symeda.sormas.ui.ControllerProvider)24 ComboBoxHelper (de.symeda.sormas.ui.utils.ComboBoxHelper)23 MenuBar (com.vaadin.ui.MenuBar)22 UserRight (de.symeda.sormas.api.user.UserRight)22 ViewModelProviders (de.symeda.sormas.ui.ViewModelProviders)22