Search in sources :

Example 11 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project opencms-core by alkacon.

the class CmsShowVersionButtons method diff.

/**
 * @see org.opencms.ui.dialogs.history.diff.I_CmsDiffProvider#diff(org.opencms.file.CmsObject, org.opencms.gwt.shared.CmsHistoryResourceBean, org.opencms.gwt.shared.CmsHistoryResourceBean)
 */
public Optional<Component> diff(CmsObject cms, CmsHistoryResourceBean v1, CmsHistoryResourceBean v2) {
    Panel panel = new Panel("");
    panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    HorizontalLayout hl = new HorizontalLayout();
    panel.setContent(hl);
    hl.addComponent(createButton(cms, v1));
    hl.addComponent(createButton(cms, v2));
    VerticalLayout outerContainer = new VerticalLayout();
    outerContainer.addComponent(hl);
    outerContainer.setComponentAlignment(hl, Alignment.MIDDLE_RIGHT);
    outerContainer.setMargin(true);
    hl.setSpacing(true);
    return Optional.fromNullable((Component) outerContainer);
}
Also used : Panel(com.vaadin.ui.Panel) VerticalLayout(com.vaadin.v7.ui.VerticalLayout) HorizontalLayout(com.vaadin.v7.ui.HorizontalLayout)

Example 12 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project opencms-core by alkacon.

the class CmsPermissionDialog method addEntryTableToLayout.

/**
 * Adds list of entries to layout.<p>
 *
 * @param entries the ace list
 * @param layout layout
 * @param editable boolean
 * @param inheritedRes boolean
 */
private void addEntryTableToLayout(List<CmsAccessControlEntry> entries, VerticalLayout layout, boolean editable, boolean inheritedRes) {
    final CmsPermissionViewTable table = new CmsPermissionViewTable(m_cms, entries, editable, inheritedRes, m_parents, this);
    HorizontalLayout hl = new HorizontalLayout();
    Label label = new Label(CmsVaadinUtils.getMessageText(Messages.GUI_PERMISSION_COUNT_1, new Integer(table.getContainerDataSource().size())));
    label.addStyleName("o-report");
    hl.addComponent(label);
    TextField tableFilter = new TextField();
    tableFilter.setIcon(FontOpenCms.FILTER);
    tableFilter.setInputPrompt(CmsVaadinUtils.getMessageText(org.opencms.ui.apps.Messages.GUI_EXPLORER_FILTER_0));
    tableFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    tableFilter.setWidth("200px");
    tableFilter.addTextChangeListener(new TextChangeListener() {

        private static final long serialVersionUID = 1L;

        public void textChange(TextChangeEvent event) {
            table.filterTable(event.getText());
        }
    });
    hl.addComponent(tableFilter);
    hl.setWidth("100%");
    hl.setExpandRatio(label, 1);
    hl.setMargin(true);
    hl.setComponentAlignment(tableFilter, com.vaadin.ui.Alignment.MIDDLE_RIGHT);
    if (table.getContainerDataSource().size() == 0) {
        layout.addComponent(CmsVaadinUtils.getInfoLayout(Messages.GUI_PERMISSION_EMPTY_0));
    } else {
        layout.addComponent(hl);
        layout.addComponent(table);
        CmsVaadinUtils.centerWindow(this);
    }
}
Also used : TextChangeEvent(com.vaadin.v7.event.FieldEvents.TextChangeEvent) Label(com.vaadin.v7.ui.Label) TextField(com.vaadin.v7.ui.TextField) TextChangeListener(com.vaadin.v7.event.FieldEvents.TextChangeListener) HorizontalLayout(com.vaadin.v7.ui.HorizontalLayout)

Example 13 with HorizontalLayout

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

the class CaseContactsView method createStatusFilterBar.

public HorizontalLayout createStatusFilterBar() {
    HorizontalLayout statusFilterLayout = new HorizontalLayout();
    statusFilterLayout.setSpacing(true);
    statusFilterLayout.setWidth("100%");
    statusFilterLayout.addStyleName(CssStyles.VSPACE_3);
    statusButtons = new HashMap<>();
    Button statusAll = ButtonHelper.createButton(Captions.all, e -> {
        criteria.contactStatus(null);
        navigateTo(criteria);
    }, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
    statusAll.setCaptionAsHtml(true);
    statusFilterLayout.addComponent(statusAll);
    statusButtons.put(statusAll, I18nProperties.getCaption(Captions.all));
    activeStatusButton = statusAll;
    for (ContactStatus status : ContactStatus.values()) {
        Button statusButton = ButtonHelper.createButton(status.toString(), e -> {
            criteria.contactStatus(status);
            navigateTo(criteria);
        }, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER, CssStyles.BUTTON_FILTER_LIGHT);
        statusButton.setData(status);
        statusButton.setCaptionAsHtml(true);
        statusFilterLayout.addComponent(statusButton);
        statusButtons.put(statusButton, status.toString());
    }
    statusFilterLayout.setExpandRatio(statusFilterLayout.getComponent(statusFilterLayout.getComponentCount() - 1), 1);
    // Bulk operation dropdown
    if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
        statusFilterLayout.setWidth(100, Unit.PERCENTAGE);
        MenuBar bulkOperationsDropdown = MenuBarHelper.createDropDown(Captions.bulkActions, new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkEdit), VaadinIcons.ELLIPSIS_H, selectedItem -> {
            ControllerProvider.getContactController().showBulkContactDataEditComponent(grid.asMultiSelect().getSelectedItems(), getCaseRef().getUuid());
        }), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkCancelFollowUp), VaadinIcons.CLOSE, selectedItem -> {
            ControllerProvider.getContactController().cancelFollowUpOfAllSelectedItems(grid.asMultiSelect().getSelectedItems(), () -> navigateTo(criteria));
        }), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkLostToFollowUp), VaadinIcons.UNLINK, selectedItem -> {
            ControllerProvider.getContactController().setAllSelectedItemsToLostToFollowUp(grid.asMultiSelect().getSelectedItems(), () -> navigateTo(criteria));
        }), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, selectedItem -> {
            ControllerProvider.getContactController().deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), () -> navigateTo(criteria));
        }));
        statusFilterLayout.addComponent(bulkOperationsDropdown);
        statusFilterLayout.setComponentAlignment(bulkOperationsDropdown, Alignment.TOP_RIGHT);
        statusFilterLayout.setExpandRatio(bulkOperationsDropdown, 1);
    }
    if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_IMPORT)) {
        Button importButton = ButtonHelper.createIconButton(Captions.actionImport, VaadinIcons.UPLOAD, e -> {
            Window popupWindow = VaadinUiUtil.showPopupWindow(new CaseContactsImportLayout(FacadeProvider.getCaseFacade().getCaseDataByUuid(criteria.getCaze().getUuid())));
            popupWindow.setCaption(I18nProperties.getString(Strings.headingImportCaseContacts));
            popupWindow.addCloseListener(c -> {
                grid.reload();
            });
        }, ValoTheme.BUTTON_PRIMARY);
        statusFilterLayout.addComponent(importButton);
        statusFilterLayout.setComponentAlignment(importButton, Alignment.MIDDLE_RIGHT);
        if (!UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
            statusFilterLayout.setExpandRatio(importButton, 1);
        }
    }
    if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_EXPORT)) {
        VerticalLayout exportLayout = new VerticalLayout();
        exportLayout.setSpacing(true);
        exportLayout.setMargin(true);
        exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL);
        exportLayout.setWidth(200, Unit.PIXELS);
        PopupButton exportButton = ButtonHelper.createIconPopupButton(Captions.export, VaadinIcons.DOWNLOAD, exportLayout);
        statusFilterLayout.addComponent(exportButton);
        statusFilterLayout.setComponentAlignment(exportButton, Alignment.MIDDLE_RIGHT);
        if (!UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
            statusFilterLayout.setExpandRatio(exportButton, 1);
        }
        StreamResource streamResource = GridExportStreamResource.createStreamResourceWithSelectedItems(grid, () -> viewConfiguration.isInEagerMode() ? this.grid.asMultiSelect().getSelectedItems() : null, ExportEntityName.CONTACTS);
        addExportButton(streamResource, exportButton, exportLayout, VaadinIcons.TABLE, Captions.exportBasic, Descriptions.descExportButton);
        StreamResource extendedExportStreamResource = ContactDownloadUtil.createContactExportResource(grid.getCriteria(), this::getSelectedRows, null);
        addExportButton(extendedExportStreamResource, exportButton, exportLayout, VaadinIcons.FILE_TEXT, Captions.exportDetailed, Descriptions.descDetailedExportButton);
        Button btnCustomExport = ButtonHelper.createIconButton(Captions.exportCustom, VaadinIcons.FILE_TEXT, e -> {
            ControllerProvider.getCustomExportController().openContactExportWindow(grid.getCriteria(), this::getSelectedRows);
        }, ValoTheme.BUTTON_PRIMARY);
        btnCustomExport.setDescription(I18nProperties.getString(Strings.infoCustomExport));
        btnCustomExport.setWidth(100, Unit.PERCENTAGE);
        exportLayout.addComponent(btnCustomExport);
        // Warning if no filters have been selected
        Label warningLabel = new Label(I18nProperties.getString(Strings.infoExportNoFilters));
        warningLabel.setWidth(100, Unit.PERCENTAGE);
        exportLayout.addComponent(warningLabel);
        warningLabel.setVisible(false);
        exportButton.addClickListener(e -> warningLabel.setVisible(!criteria.hasAnyFilterActive()));
    }
    if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_CREATE)) {
        final CaseDataDto caseDto = FacadeProvider.getCaseFacade().getCaseDataByUuid(this.getCaseRef().getUuid());
        final ExpandableButton lineListingButton = new ExpandableButton(Captions.lineListing).expand(e -> ControllerProvider.getContactController().openLineListingWindow(caseDto));
        statusFilterLayout.addComponent(lineListingButton);
        final Button newButton = ButtonHelper.createIconButtonWithCaption(Captions.contactNewContact, I18nProperties.getPrefixCaption(ContactDto.I18N_PREFIX, Captions.contactNewContact), VaadinIcons.PLUS_CIRCLE, e -> ControllerProvider.getContactController().create(this.getCaseRef()), ValoTheme.BUTTON_PRIMARY);
        statusFilterLayout.addComponent(newButton);
        statusFilterLayout.setComponentAlignment(newButton, Alignment.MIDDLE_RIGHT);
    }
    statusFilterLayout.addStyleName("top-bar");
    activeStatusButton = statusAll;
    return statusFilterLayout;
}
Also used : ContactCriteria(de.symeda.sormas.api.contact.ContactCriteria) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) Alignment(com.vaadin.ui.Alignment) Window(com.vaadin.ui.Window) DetailSubComponentWrapper(de.symeda.sormas.ui.utils.DetailSubComponentWrapper) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) ExportEntityName(de.symeda.sormas.ui.utils.ExportEntityName) ContactDownloadUtil(de.symeda.sormas.ui.utils.ContactDownloadUtil) ViewModelProviders(de.symeda.sormas.ui.ViewModelProviders) CssStyles(de.symeda.sormas.ui.utils.CssStyles) ExpandableButton(de.symeda.sormas.ui.utils.components.expandablebutton.ExpandableButton) ContactIndexDto(de.symeda.sormas.api.contact.ContactIndexDto) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) VaadinIcons(com.vaadin.icons.VaadinIcons) ComboBoxHelper(de.symeda.sormas.ui.utils.ComboBoxHelper) ShortcutAction(com.vaadin.event.ShortcutAction) UserProvider(de.symeda.sormas.ui.UserProvider) ValoTheme(com.vaadin.ui.themes.ValoTheme) MenuBar(com.vaadin.ui.MenuBar) ComboBox(com.vaadin.v7.ui.ComboBox) Set(java.util.Set) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) Collectors(java.util.stream.Collectors) ContactClassification(de.symeda.sormas.api.contact.ContactClassification) ContactGrid(de.symeda.sormas.ui.contact.ContactGrid) ContactDto(de.symeda.sormas.api.contact.ContactDto) TextField(com.vaadin.v7.ui.TextField) Descriptions(de.symeda.sormas.api.i18n.Descriptions) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) StreamResource(com.vaadin.server.StreamResource) VaadinUiUtil(de.symeda.sormas.ui.utils.VaadinUiUtil) FacadeProvider(de.symeda.sormas.api.FacadeProvider) VerticalLayout(com.vaadin.ui.VerticalLayout) GridExportStreamResource(de.symeda.sormas.ui.utils.GridExportStreamResource) HashMap(java.util.HashMap) PopupButton(org.vaadin.hene.popupbutton.PopupButton) ViewConfiguration(de.symeda.sormas.ui.utils.ViewConfiguration) Label(com.vaadin.ui.Label) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) ContentMode(com.vaadin.shared.ui.ContentMode) ContactStatus(de.symeda.sormas.api.contact.ContactStatus) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) UserDto(de.symeda.sormas.api.user.UserDto) Captions(de.symeda.sormas.api.i18n.Captions) UserReferenceDto(de.symeda.sormas.api.user.UserReferenceDto) UserRight(de.symeda.sormas.api.user.UserRight) Button(com.vaadin.ui.Button) LayoutUtil(de.symeda.sormas.ui.utils.LayoutUtil) HorizontalLayout(com.vaadin.ui.HorizontalLayout) CaseContactsImportLayout(de.symeda.sormas.ui.contact.importer.CaseContactsImportLayout) Strings(de.symeda.sormas.api.i18n.Strings) Collections(java.util.Collections) Window(com.vaadin.ui.Window) ExpandableButton(de.symeda.sormas.ui.utils.components.expandablebutton.ExpandableButton) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) Label(com.vaadin.ui.Label) MenuBar(com.vaadin.ui.MenuBar) HorizontalLayout(com.vaadin.ui.HorizontalLayout) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) PopupButton(org.vaadin.hene.popupbutton.PopupButton) StreamResource(com.vaadin.server.StreamResource) GridExportStreamResource(de.symeda.sormas.ui.utils.GridExportStreamResource) ExpandableButton(de.symeda.sormas.ui.utils.components.expandablebutton.ExpandableButton) PopupButton(org.vaadin.hene.popupbutton.PopupButton) Button(com.vaadin.ui.Button) ContactStatus(de.symeda.sormas.api.contact.ContactStatus) CaseContactsImportLayout(de.symeda.sormas.ui.contact.importer.CaseContactsImportLayout) VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 14 with HorizontalLayout

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

the class CaseContactsView method createFilterBar.

public HorizontalLayout createFilterBar() {
    HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.setSpacing(true);
    topLayout.setSizeUndefined();
    classificationFilter = ComboBoxHelper.createComboBoxV7();
    classificationFilter.setWidth(240, Unit.PIXELS);
    classificationFilter.setInputPrompt(I18nProperties.getPrefixCaption(ContactIndexDto.I18N_PREFIX, ContactIndexDto.CONTACT_CLASSIFICATION));
    classificationFilter.addValueChangeListener(e -> criteria.setContactClassification((ContactClassification) e.getProperty().getValue()));
    topLayout.addComponent(classificationFilter);
    UserDto user = UserProvider.getCurrent().getUser();
    regionFilter = ComboBoxHelper.createComboBoxV7();
    if (user.getRegion() == null) {
        regionFilter.setWidth(240, Unit.PIXELS);
        regionFilter.setInputPrompt(I18nProperties.getPrefixCaption(ContactIndexDto.I18N_PREFIX, ContactIndexDto.REGION_UUID));
        regionFilter.addItems(FacadeProvider.getRegionFacade().getAllActiveByServerCountry());
        regionFilter.addValueChangeListener(e -> {
            RegionReferenceDto region = (RegionReferenceDto) e.getProperty().getValue();
            if (region != null) {
                officerFilter.addItems(FacadeProvider.getUserFacade().getUsersByRegionAndRights(region, criteria.getDisease(), UserRight.CONTACT_RESPONSIBLE));
            } else {
                officerFilter.removeAllItems();
            }
            criteria.region(region);
        });
        topLayout.addComponent(regionFilter);
    }
    districtFilter = ComboBoxHelper.createComboBoxV7();
    districtFilter.setWidth(240, Unit.PIXELS);
    districtFilter.setInputPrompt(I18nProperties.getPrefixCaption(ContactIndexDto.I18N_PREFIX, ContactIndexDto.DISTRICT_UUID));
    districtFilter.addValueChangeListener(e -> criteria.district((DistrictReferenceDto) e.getProperty().getValue()));
    if (user.getRegion() != null && user.getDistrict() == null) {
        districtFilter.addItems(FacadeProvider.getDistrictFacade().getAllActiveByRegion(user.getRegion().getUuid()));
        districtFilter.setEnabled(true);
    } else {
        regionFilter.addValueChangeListener(e -> {
            RegionReferenceDto region = (RegionReferenceDto) e.getProperty().getValue();
            districtFilter.removeAllItems();
            if (region != null) {
                districtFilter.addItems(FacadeProvider.getDistrictFacade().getAllActiveByRegion(region.getUuid()));
                districtFilter.setEnabled(true);
            } else {
                districtFilter.setEnabled(false);
            }
        });
        districtFilter.setEnabled(false);
    }
    topLayout.addComponent(districtFilter);
    Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML);
    infoLabel.setSizeUndefined();
    infoLabel.setDescription(I18nProperties.getString(Strings.infoContactsViewRegionDistrictFilter), ContentMode.HTML);
    CssStyles.style(infoLabel, CssStyles.LABEL_XLARGE, CssStyles.LABEL_SECONDARY);
    topLayout.addComponent(infoLabel);
    officerFilter = ComboBoxHelper.createComboBoxV7();
    officerFilter.setWidth(240, Unit.PIXELS);
    officerFilter.setInputPrompt(I18nProperties.getPrefixCaption(ContactIndexDto.I18N_PREFIX, ContactIndexDto.CONTACT_OFFICER_UUID));
    officerFilter.addValueChangeListener(e -> criteria.setContactOfficer((UserReferenceDto) e.getProperty().getValue()));
    if (user.getRegion() != null) {
        officerFilter.addItems(FacadeProvider.getUserFacade().getUsersByRegionAndRights(user.getRegion(), criteria.getDisease(), UserRight.CONTACT_RESPONSIBLE));
    }
    topLayout.addComponent(officerFilter);
    searchField = new TextField();
    searchField.setWidth(150, Unit.PIXELS);
    searchField.setNullRepresentation("");
    searchField.setInputPrompt(I18nProperties.getString(Strings.promptContactsSearchField));
    searchField.addTextChangeListener(e -> criteria.setContactOrCaseLike(e.getText()));
    topLayout.addComponent(searchField);
    personLikeField = new TextField();
    personLikeField.setWidth(150, Unit.PIXELS);
    personLikeField.setNullRepresentation("");
    personLikeField.setInputPrompt(I18nProperties.getString(Strings.promptRelatedPersonLikeField));
    personLikeField.addTextChangeListener(e -> criteria.setPersonLike(e.getText()));
    topLayout.addComponent(personLikeField);
    resetButton = ButtonHelper.createButton(Captions.actionResetFilters, event -> {
        ViewModelProviders.of(CaseContactsView.class).remove(ContactCriteria.class);
        navigateTo(null);
    });
    resetButton.setVisible(false);
    topLayout.addComponent(resetButton);
    applyButton = ButtonHelper.createButton(Captions.actionApplyFilters, event -> navigateTo(criteria));
    applyButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    applyButton.setVisible(false);
    topLayout.addComponent(applyButton);
    classificationFilter.addValueChangeListener(e -> updateApplyResetButtons());
    regionFilter.addValueChangeListener(e -> updateApplyResetButtons());
    officerFilter.addValueChangeListener(e -> updateApplyResetButtons());
    districtFilter.addValueChangeListener(e -> updateApplyResetButtons());
    searchField.addValueChangeListener(e -> updateApplyResetButtons());
    personLikeField.addValueChangeListener(e -> updateApplyResetButtons());
    return topLayout;
}
Also used : UserReferenceDto(de.symeda.sormas.api.user.UserReferenceDto) ContactCriteria(de.symeda.sormas.api.contact.ContactCriteria) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) Alignment(com.vaadin.ui.Alignment) Window(com.vaadin.ui.Window) DetailSubComponentWrapper(de.symeda.sormas.ui.utils.DetailSubComponentWrapper) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) ExportEntityName(de.symeda.sormas.ui.utils.ExportEntityName) ContactDownloadUtil(de.symeda.sormas.ui.utils.ContactDownloadUtil) ViewModelProviders(de.symeda.sormas.ui.ViewModelProviders) CssStyles(de.symeda.sormas.ui.utils.CssStyles) ExpandableButton(de.symeda.sormas.ui.utils.components.expandablebutton.ExpandableButton) ContactIndexDto(de.symeda.sormas.api.contact.ContactIndexDto) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) VaadinIcons(com.vaadin.icons.VaadinIcons) ComboBoxHelper(de.symeda.sormas.ui.utils.ComboBoxHelper) ShortcutAction(com.vaadin.event.ShortcutAction) UserProvider(de.symeda.sormas.ui.UserProvider) ValoTheme(com.vaadin.ui.themes.ValoTheme) MenuBar(com.vaadin.ui.MenuBar) ComboBox(com.vaadin.v7.ui.ComboBox) Set(java.util.Set) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) Collectors(java.util.stream.Collectors) ContactClassification(de.symeda.sormas.api.contact.ContactClassification) ContactGrid(de.symeda.sormas.ui.contact.ContactGrid) ContactDto(de.symeda.sormas.api.contact.ContactDto) TextField(com.vaadin.v7.ui.TextField) Descriptions(de.symeda.sormas.api.i18n.Descriptions) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) StreamResource(com.vaadin.server.StreamResource) VaadinUiUtil(de.symeda.sormas.ui.utils.VaadinUiUtil) FacadeProvider(de.symeda.sormas.api.FacadeProvider) VerticalLayout(com.vaadin.ui.VerticalLayout) GridExportStreamResource(de.symeda.sormas.ui.utils.GridExportStreamResource) HashMap(java.util.HashMap) PopupButton(org.vaadin.hene.popupbutton.PopupButton) ViewConfiguration(de.symeda.sormas.ui.utils.ViewConfiguration) Label(com.vaadin.ui.Label) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) ContentMode(com.vaadin.shared.ui.ContentMode) ContactStatus(de.symeda.sormas.api.contact.ContactStatus) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) UserDto(de.symeda.sormas.api.user.UserDto) Captions(de.symeda.sormas.api.i18n.Captions) UserReferenceDto(de.symeda.sormas.api.user.UserReferenceDto) UserRight(de.symeda.sormas.api.user.UserRight) Button(com.vaadin.ui.Button) LayoutUtil(de.symeda.sormas.ui.utils.LayoutUtil) HorizontalLayout(com.vaadin.ui.HorizontalLayout) CaseContactsImportLayout(de.symeda.sormas.ui.contact.importer.CaseContactsImportLayout) Strings(de.symeda.sormas.api.i18n.Strings) Collections(java.util.Collections) ContactClassification(de.symeda.sormas.api.contact.ContactClassification) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) UserDto(de.symeda.sormas.api.user.UserDto) Label(com.vaadin.ui.Label) ContactCriteria(de.symeda.sormas.api.contact.ContactCriteria) TextField(com.vaadin.v7.ui.TextField) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 15 with HorizontalLayout

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

the class ClinicalCourseView method createClinicalVisitsHeader.

private VerticalLayout createClinicalVisitsHeader() {
    VerticalLayout clinicalVisitsHeader = new VerticalLayout();
    clinicalVisitsHeader.setMargin(false);
    clinicalVisitsHeader.setSpacing(false);
    clinicalVisitsHeader.setWidth(100, Unit.PERCENTAGE);
    HorizontalLayout headlineRow = new HorizontalLayout();
    headlineRow.setMargin(false);
    headlineRow.setSpacing(true);
    headlineRow.setWidth(100, Unit.PERCENTAGE);
    {
        Label clinicalVisitsLabel = new Label(I18nProperties.getString(Strings.entityClinicalVisits));
        CssStyles.style(clinicalVisitsLabel, CssStyles.H3);
        headlineRow.addComponent(clinicalVisitsLabel);
        headlineRow.setExpandRatio(clinicalVisitsLabel, 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.getClinicalCourseController().deleteAllSelectedClinicalVisits(clinicalVisitGrid.getSelectedRows(), new Runnable() {

                    public void run() {
                        clinicalVisitGrid.reload();
                    }
                });
            }));
            headlineRow.addComponent(bulkOperationsDropdown);
            headlineRow.setComponentAlignment(bulkOperationsDropdown, Alignment.MIDDLE_RIGHT);
        }
        Button newClinicalVisitButton = ButtonHelper.createButton(Captions.clinicalVisitNewClinicalVisit, e -> {
            ControllerProvider.getClinicalCourseController().openClinicalVisitCreateForm(clinicalVisitCriteria.getClinicalCourse(), getCaseRef().getUuid(), this::reloadClinicalVisitGrid);
        }, ValoTheme.BUTTON_PRIMARY);
        headlineRow.addComponent(newClinicalVisitButton);
        headlineRow.setComponentAlignment(newClinicalVisitButton, Alignment.MIDDLE_RIGHT);
    }
    clinicalVisitsHeader.addComponent(headlineRow);
    return clinicalVisitsHeader;
}
Also used : 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) ClinicalVisitCriteria(de.symeda.sormas.api.clinicalcourse.ClinicalVisitCriteria) AbstractCaseView(de.symeda.sormas.ui.caze.AbstractCaseView) ViewModelProviders(de.symeda.sormas.ui.ViewModelProviders) CssStyles(de.symeda.sormas.ui.utils.CssStyles) CommitDiscardWrapperComponent(de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) Label(com.vaadin.ui.Label) VaadinIcons(com.vaadin.icons.VaadinIcons) UserProvider(de.symeda.sormas.ui.UserProvider) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) ValoTheme(com.vaadin.ui.themes.ValoTheme) MenuBar(com.vaadin.ui.MenuBar) 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) HeightMode(com.vaadin.v7.shared.ui.grid.HeightMode) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Strings(de.symeda.sormas.api.i18n.Strings) ClinicalCourseDto(de.symeda.sormas.api.clinicalcourse.ClinicalCourseDto) Button(com.vaadin.ui.Button) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) MenuBar(com.vaadin.ui.MenuBar) 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