List of usage examples for com.vaadin.ui HorizontalLayout setWidth
@Override public void setWidth(float width, Unit unit)
From source file:de.symeda.sormas.ui.dashboard.surveillance.SurveillanceDiseaseCarouselLayout.java
License:Open Source License
private HorizontalLayout createEpiCurveAndMapLayout() { HorizontalLayout epiCurveAndMapLayout = new HorizontalLayout(); epiCurveAndMapLayout.setWidth(100, Unit.PERCENTAGE); final int BASE_HEIGHT = 480; epiCurveAndMapLayout.setHeight(BASE_HEIGHT, Unit.PIXELS); epiCurveAndMapLayout.addComponent(epiCurveComponent); epiCurveAndMapLayout.addComponent(mapComponent); epiCurveComponent.setExpandListener(expanded -> { if (expanded) { removeComponent(statisticsComponent); epiCurveAndMapLayout.removeComponent(mapComponent); epiCurveAndMapLayout.setHeight(100, Unit.PERCENTAGE); setHeight(100, Unit.PERCENTAGE); } else {//from www . j a v a2s . c o m addComponent(statisticsComponent, 1); epiCurveAndMapLayout.addComponent(mapComponent, 1); epiCurveAndMapLayout.setHeight(BASE_HEIGHT, Unit.PIXELS); setHeightUndefined(); } if (externalExpandListener != null) { externalExpandListener.accept(expanded); } }); mapComponent.setExpandListener(expanded -> { if (expanded) { removeComponent(statisticsComponent); epiCurveAndMapLayout.removeComponent(epiCurveComponent); epiCurveAndMapLayout.setHeight(100, Unit.PERCENTAGE); setHeight(100, Unit.PERCENTAGE); } else { addComponent(statisticsComponent, 1); epiCurveAndMapLayout.addComponent(epiCurveComponent, 0); epiCurveAndMapLayout.setHeight(BASE_HEIGHT, Unit.PIXELS); setHeightUndefined(); } if (externalExpandListener != null) { externalExpandListener.accept(expanded); } }); return epiCurveAndMapLayout; }
From source file:de.symeda.sormas.ui.dashboard.surveillance.SurveillanceOverviewLayout.java
License:Open Source License
private void addDiseaseBurdenView() { HorizontalLayout layout = new HorizontalLayout(); layout.setWidth(100, Unit.PERCENTAGE); layout.setMargin(false);/*from w w w . ja v a 2 s . co m*/ layout.addComponent(diseaseTileViewLayout); layout.setExpandRatio(diseaseTileViewLayout, 1); // "Expand" and "Collapse" buttons Button showTableViewButton = new Button("", VaadinIcons.TABLE); CssStyles.style(showTableViewButton, CssStyles.BUTTON_SUBTLE); showTableViewButton.addStyleName(CssStyles.VSPACE_NONE); Button showTileViewButton = new Button("", VaadinIcons.SQUARE_SHADOW); CssStyles.style(showTileViewButton, CssStyles.BUTTON_SUBTLE); showTileViewButton.addStyleName(CssStyles.VSPACE_NONE); showTableViewButton.addClickListener(e -> { layout.removeComponent(diseaseTileViewLayout); layout.addComponent(diseaseBurdenComponent); layout.setExpandRatio(diseaseBurdenComponent, 1); layout.removeComponent(showTableViewButton); layout.addComponent(showTileViewButton); layout.setComponentAlignment(showTileViewButton, Alignment.TOP_RIGHT); }); showTileViewButton.addClickListener(e -> { layout.removeComponent(diseaseBurdenComponent); layout.addComponent(diseaseTileViewLayout); layout.setExpandRatio(diseaseTileViewLayout, 1); layout.removeComponent(showTileViewButton); layout.addComponent(showTableViewButton); layout.setComponentAlignment(showTableViewButton, Alignment.TOP_RIGHT); }); layout.addComponent(showTableViewButton); layout.setComponentAlignment(showTableViewButton, Alignment.TOP_RIGHT); diseaseBurdenView = layout; addComponent(diseaseBurdenView, BURDEN_LOC); if (UserRole.isSupervisor(UserProvider.getCurrent().getUser().getUserRoles())) showTableViewButton.click(); }
From source file:de.symeda.sormas.ui.dashboard.surveillance.SurveillanceOverviewLayout.java
License:Open Source License
private void addShowMoreAndLessButtons() { HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setHeightUndefined();/*from www . j a v a 2s . co m*/ buttonsLayout.setWidth(100, Unit.PERCENTAGE); buttonsLayout.setMargin(new MarginInfo(false, true)); showMoreButton = new Button(I18nProperties.getCaption(Captions.dashboardShowAllDiseases), VaadinIcons.CHEVRON_DOWN); CssStyles.style(showMoreButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_4); showLessButton = new Button(I18nProperties.getCaption(Captions.dashboardShowFirstDiseases), VaadinIcons.CHEVRON_UP); CssStyles.style(showLessButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_4); hideOverview = new CheckBox(I18nProperties.getCaption(Captions.dashboardHideOverview)); CssStyles.style(hideOverview, CssStyles.VSPACE_3); showMoreButton.addClickListener(e -> { isShowingAllDiseases = true; refresh(); showMoreButton.setVisible(false); showLessButton.setVisible(true); }); showLessButton.addClickListener(e -> { isShowingAllDiseases = false; refresh(); showLessButton.setVisible(false); showMoreButton.setVisible(true); }); hideOverview.addValueChangeListener(e -> { if (hideOverview.getValue()) { diseaseBurdenView.setVisible(false); diseaseDifferenceComponent.setVisible(false); showLessButton.setVisible(false); showMoreButton.setVisible(false); } else { diseaseBurdenView.setVisible(true); diseaseDifferenceComponent.setVisible(true); showLessButton.setVisible(isShowingAllDiseases); showMoreButton.setVisible(!isShowingAllDiseases); } }); buttonsLayout.addComponent(showMoreButton); buttonsLayout.addComponent(showLessButton); buttonsLayout.setComponentAlignment(showMoreButton, Alignment.BOTTOM_CENTER); buttonsLayout.setExpandRatio(showMoreButton, 1); buttonsLayout.setComponentAlignment(showLessButton, Alignment.BOTTOM_CENTER); buttonsLayout.setExpandRatio(showLessButton, 1); buttonsLayout.addComponent(hideOverview); buttonsLayout.setComponentAlignment(hideOverview, Alignment.BOTTOM_RIGHT); buttonsLayout.setExpandRatio(hideOverview, 0); addComponent(buttonsLayout, EXTEND_BUTTONS_LOC); isShowingAllDiseases = false; showLessButton.setVisible(false); buttonsLayout.setExpandRatio(showLessButton, 1); }
From source file:de.symeda.sormas.ui.events.EventsView.java
License:Open Source License
public HorizontalLayout createStatusFilterBar() { HorizontalLayout statusFilterLayout = new HorizontalLayout(); statusFilterLayout.setSpacing(true); statusFilterLayout.setMargin(false); statusFilterLayout.setWidth(100, Unit.PERCENTAGE); statusFilterLayout.addStyleName(CssStyles.VSPACE_3); statusButtons = new HashMap<>(); Button statusAll = new Button(I18nProperties.getCaption(Captions.all), e -> { criteria.eventStatus(null);//from ww w . j av a 2s. c o m navigateTo(criteria); }); CssStyles.style(statusAll, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER); statusAll.setCaptionAsHtml(true); statusFilterLayout.addComponent(statusAll); statusButtons.put(statusAll, I18nProperties.getCaption(Captions.all)); activeStatusButton = statusAll; for (EventStatus status : EventStatus.values()) { Button statusButton = new Button(status.toString(), e -> { criteria.eventStatus(status); navigateTo(criteria); }); statusButton.setData(status); CssStyles.style(statusButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER, CssStyles.BUTTON_FILTER_LIGHT); statusButton.setCaptionAsHtml(true); statusFilterLayout.addComponent(statusButton); statusButtons.put(statusButton, status.toString()); } HorizontalLayout actionButtonsLayout = new HorizontalLayout(); actionButtonsLayout.setSpacing(true); { // Show archived/active cases button if (UserProvider.getCurrent().hasUserRight(UserRight.EVENT_VIEW_ARCHIVED)) { switchArchivedActiveButton = new Button(I18nProperties.getCaption(Captions.eventShowArchived)); switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_LINK); switchArchivedActiveButton.addClickListener(e -> { criteria.archived(Boolean.TRUE.equals(criteria.getArchived()) ? null : Boolean.TRUE); navigateTo(criteria); }); actionButtonsLayout.addComponent(switchArchivedActiveButton); } // Bulk operation dropdown if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) { MenuBar bulkOperationsDropdown = new MenuBar(); MenuItem bulkOperationsItem = bulkOperationsDropdown .addItem(I18nProperties.getCaption(Captions.bulkActions), null); Command changeCommand = selectedItem -> { ControllerProvider.getEventController() .showBulkEventDataEditComponent(grid.asMultiSelect().getSelectedItems()); }; bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkEdit), VaadinIcons.ELLIPSIS_H, changeCommand); Command deleteCommand = selectedItem -> { ControllerProvider.getEventController() .deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() { public void run() { grid.reload(); } }); }; bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, deleteCommand); Command archiveCommand = selectedItem -> { ControllerProvider.getEventController() .archiveAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() { public void run() { grid.reload(); } }); }; archiveItem = bulkOperationsItem.addItem( I18nProperties.getCaption(I18nProperties.getCaption(Captions.actionArchive)), VaadinIcons.ARCHIVE, archiveCommand); Command dearchiveCommand = selectedItem -> { ControllerProvider.getEventController() .dearchiveAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() { public void run() { grid.reload(); } }); }; dearchiveItem = bulkOperationsItem.addItem( I18nProperties.getCaption(I18nProperties.getCaption(Captions.actionDearchive)), VaadinIcons.ARCHIVE, dearchiveCommand); dearchiveItem.setVisible(false); actionButtonsLayout.addComponent(bulkOperationsDropdown); } } statusFilterLayout.addComponent(actionButtonsLayout); statusFilterLayout.setComponentAlignment(actionButtonsLayout, Alignment.TOP_RIGHT); statusFilterLayout.setExpandRatio(actionButtonsLayout, 1); return statusFilterLayout; }
From source file:de.symeda.sormas.ui.person.PersonSelectField.java
License:Open Source License
@Override protected Component initContent() { VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);/*ww w . j a va 2 s . c om*/ layout.setSizeUndefined(); layout.setWidth(100, Unit.PERCENTAGE); HorizontalLayout nameLayout = new HorizontalLayout(); nameLayout.setSpacing(true); nameLayout.setWidth(100, Unit.PERCENTAGE); firstNameField.setCaption(I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.FIRST_NAME)); firstNameField.setWidth(100, Unit.PERCENTAGE); firstNameField.setRequired(true); nameLayout.addComponent(firstNameField); lastNameField.setCaption(I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.LAST_NAME)); lastNameField.setWidth(100, Unit.PERCENTAGE); lastNameField.setRequired(true); nameLayout.addComponent(lastNameField); CssStyles.style(searchMatchesButton, CssStyles.FORCE_CAPTION, ValoTheme.BUTTON_PRIMARY); searchMatchesButton.addClickListener(e -> { personGrid.reload(firstNameField.getValue(), lastNameField.getValue()); selectBestMatch(); }); nameLayout.addComponent(searchMatchesButton); layout.addComponent(nameLayout); selectPerson = new OptionGroup(null); selectPerson.addItem(SELECT_PERSON); selectPerson.setItemCaption(SELECT_PERSON, I18nProperties.getCaption(Captions.personSelect)); CssStyles.style(selectPerson, CssStyles.VSPACE_NONE); selectPerson.addValueChangeListener(e -> { if (e.getProperty().getValue() != null) { createNewPerson.setValue(null); personGrid.setEnabled(true); if (selectionChangeCallback != null) { selectionChangeCallback.accept(personGrid.getSelectedRow() != null); } } }); layout.addComponent(selectPerson); initPersonGrid(); // unselect "create new" when person is selected personGrid.addSelectionListener(e -> { if (e.getSelected().size() > 0) { createNewPerson.setValue(null); } }); layout.addComponent(personGrid); personGrid.addSelectionListener(e -> { if (selectionChangeCallback != null) { selectionChangeCallback.accept(!e.getSelected().isEmpty()); } }); createNewPerson = new OptionGroup(null); createNewPerson.addItem(CREATE_PERSON); createNewPerson.setItemCaption(CREATE_PERSON, I18nProperties.getCaption(Captions.personCreateNew)); // unselect grid when "create new" is selected createNewPerson.addValueChangeListener(e -> { if (e.getProperty().getValue() != null) { selectPerson.setValue(null); personGrid.select(null); personGrid.setEnabled(false); if (selectionChangeCallback != null) { selectionChangeCallback.accept(true); } } }); layout.addComponent(createNewPerson); // set field values based on internal value setInternalValue(super.getInternalValue()); return layout; }
From source file:de.symeda.sormas.ui.reports.ReportsView.java
License:Open Source License
public HorizontalLayout createFilterBar() { HorizontalLayout filterLayout = new HorizontalLayout(); filterLayout.setMargin(false);//from w w w .j ava2 s . c o m filterLayout.setSpacing(true); filterLayout.addStyleName(CssStyles.VSPACE_3); filterLayout.setWidth(100, Unit.PERCENTAGE); EpiWeek prevEpiWeek = DateHelper.getPreviousEpiWeek(new Date()); int year = prevEpiWeek.getYear(); int week = prevEpiWeek.getWeek(); yearFilter = new ComboBox(); yearFilter.setWidth(200, Unit.PIXELS); yearFilter.addItems(DateHelper.getYearsToNow()); yearFilter.select(year); yearFilter.setCaption(I18nProperties.getString(Strings.year)); yearFilter.setItemCaptionMode(ItemCaptionMode.ID_TOSTRING); yearFilter.addValueChangeListener(e -> { updateEpiWeeks((int) e.getProperty().getValue(), (int) epiWeekFilter.getValue()); reloadGrid(); }); filterLayout.addComponent(yearFilter); epiWeekFilter = new ComboBox(); epiWeekFilter.setWidth(200, Unit.PIXELS); updateEpiWeeks(year, week); epiWeekFilter.setCaption(I18nProperties.getString(Strings.epiWeek)); epiWeekFilter.addValueChangeListener(e -> { reloadGrid(); }); filterLayout.addComponent(epiWeekFilter); Button lastWeekButton = new Button(I18nProperties.getCaption(Captions.dashboardLastWeek)); lastWeekButton.addStyleName(CssStyles.FORCE_CAPTION); lastWeekButton.addClickListener(e -> { EpiWeek epiWeek = DateHelper.getPreviousEpiWeek(new Date()); yearFilter.select(epiWeek.getYear()); epiWeekFilter.select(epiWeek.getWeek()); }); filterLayout.addComponent(lastWeekButton); Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML); infoLabel.setDescription(I18nProperties.getString(Strings.infoWeeklyReportsView)); infoLabel.setSizeUndefined(); CssStyles.style(infoLabel, CssStyles.LABEL_XLARGE, CssStyles.LABEL_SECONDARY); filterLayout.addComponent(infoLabel); filterLayout.setComponentAlignment(infoLabel, Alignment.MIDDLE_RIGHT); filterLayout.setExpandRatio(infoLabel, 1); return filterLayout; }
From source file:de.symeda.sormas.ui.samples.PathogenTestListComponent.java
License:Open Source License
public PathogenTestListComponent(SampleReferenceDto sampleRef, BiConsumer<PathogenTestResultType, Boolean> testChangedCallback) { setWidth(100, Unit.PERCENTAGE);//w w w . ja va 2 s . co m HorizontalLayout componentHeader = new HorizontalLayout(); componentHeader.setWidth(100, Unit.PERCENTAGE); addComponent(componentHeader); list = new PathogenTestList(sampleRef, testChangedCallback); addComponent(list); list.reload(); Label testsHeader = new Label(I18nProperties.getString(Strings.headingTests)); testsHeader.addStyleName(CssStyles.H3); componentHeader.addComponent(testsHeader); if (UserProvider.getCurrent().hasUserRight(UserRight.PATHOGEN_TEST_CREATE)) { createButton = new Button(I18nProperties.getCaption(Captions.pathogenTestNewTest)); createButton.addStyleName(ValoTheme.BUTTON_PRIMARY); createButton.setIcon(VaadinIcons.PLUS_CIRCLE); createButton.addClickListener(e -> ControllerProvider.getPathogenTestController().create(sampleRef, 0, list::reload, testChangedCallback)); componentHeader.addComponent(createButton); componentHeader.setComponentAlignment(createButton, Alignment.MIDDLE_RIGHT); } }
From source file:de.symeda.sormas.ui.samples.PathogenTestListEntry.java
License:Open Source License
public PathogenTestListEntry(PathogenTestDto pathogenTest) { setSpacing(true);//from w w w . j a v a 2s. c om setMargin(false); setWidth(100, Unit.PERCENTAGE); addStyleName(CssStyles.SORMAS_LIST_ENTRY); this.pathogenTest = pathogenTest; VerticalLayout labelLayout = new VerticalLayout(); labelLayout.setSpacing(false); labelLayout.setMargin(false); labelLayout.setWidth(100, Unit.PERCENTAGE); addComponent(labelLayout); setExpandRatio(labelLayout, 1); HorizontalLayout topLabelLayout = new HorizontalLayout(); topLabelLayout.setSpacing(false); topLabelLayout.setMargin(false); topLabelLayout.setWidth(100, Unit.PERCENTAGE); labelLayout.addComponent(topLabelLayout); Label labelTopLeft = new Label( PathogenTestType.toString(pathogenTest.getTestType(), pathogenTest.getTestTypeText())); CssStyles.style(labelTopLeft, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE); topLabelLayout.addComponent(labelTopLeft); if (pathogenTest.getTestResultVerified()) { Label labelTopRight = new Label(VaadinIcons.CHECK_CIRCLE.getHtml(), ContentMode.HTML); labelTopRight.setSizeUndefined(); labelTopRight.addStyleName(CssStyles.LABEL_LARGE); labelTopRight.setDescription(I18nProperties.getPrefixCaption(PathogenTestDto.I18N_PREFIX, PathogenTestDto.TEST_RESULT_VERIFIED)); topLabelLayout.addComponent(labelTopRight); topLabelLayout.setComponentAlignment(labelTopRight, Alignment.TOP_RIGHT); } if (!DataHelper.isNullOrEmpty(pathogenTest.getTestResultText())) { Label resultTextLabel = new Label(pathogenTest.getTestResultText()); labelLayout.addComponent(resultTextLabel); } HorizontalLayout middleLabelLayout = new HorizontalLayout(); middleLabelLayout.setSpacing(false); middleLabelLayout.setMargin(false); middleLabelLayout.setWidth(100, Unit.PERCENTAGE); labelLayout.addComponent(middleLabelLayout); Label labelLeft = new Label(DataHelper.toStringNullable( DiseaseHelper.toString(pathogenTest.getTestedDisease(), pathogenTest.getTestedDiseaseDetails()))); middleLabelLayout.addComponent(labelLeft); Label labelRight = new Label(DateHelper.formatLocalShortDateTime(pathogenTest.getTestDateTime())); labelRight.addStyleName(CssStyles.ALIGN_RIGHT); middleLabelLayout.addComponent(labelRight); middleLabelLayout.setComponentAlignment(labelRight, Alignment.TOP_RIGHT); Label labelBottom = new Label(DataHelper.toStringNullable(pathogenTest.getTestResult())); CssStyles.style(labelBottom, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE); if (pathogenTest.getTestResult() == PathogenTestResultType.POSITIVE) CssStyles.style(labelBottom, CssStyles.LABEL_CRITICAL); else CssStyles.style(labelBottom, CssStyles.LABEL_WARNING); labelLayout.addComponent(labelBottom); }
From source file:de.symeda.sormas.ui.samples.SampleGridComponent.java
License:Open Source License
public HorizontalLayout createShipmentFilterBar() { HorizontalLayout shipmentFilterLayout = new HorizontalLayout(); shipmentFilterLayout.setMargin(false); shipmentFilterLayout.setSpacing(true); shipmentFilterLayout.setWidth(100, Unit.PERCENTAGE); shipmentFilterLayout.addStyleName(CssStyles.VSPACE_3); statusButtons = new HashMap<>(); HorizontalLayout buttonFilterLayout = new HorizontalLayout(); buttonFilterLayout.setSpacing(true); {//from w w w .j a v a 2 s. co m Button statusAll = new Button(I18nProperties.getCaption(Captions.all), e -> processStatusChange(null)); CssStyles.style(statusAll, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER); statusAll.setCaptionAsHtml(true); buttonFilterLayout.addComponent(statusAll); statusButtons.put(statusAll, I18nProperties.getCaption(Captions.all)); activeStatusButton = statusAll; Button notShippedButton = new Button(I18nProperties.getCaption(Captions.sampleNotShipped), e -> processStatusChange(NOT_SHIPPED)); initializeStatusButton(notShippedButton, buttonFilterLayout, NOT_SHIPPED, I18nProperties.getCaption(Captions.sampleNotShipped)); Button shippedButton = new Button(I18nProperties.getCaption(Captions.sampleShipped), e -> processStatusChange(SHIPPED)); initializeStatusButton(shippedButton, buttonFilterLayout, SHIPPED, I18nProperties.getCaption(Captions.sampleShipped)); Button receivedButton = new Button(I18nProperties.getCaption(Captions.sampleReceived), e -> processStatusChange(RECEIVED)); initializeStatusButton(receivedButton, buttonFilterLayout, RECEIVED, I18nProperties.getCaption(Captions.sampleReceived)); Button referredButton = new Button(I18nProperties.getCaption(Captions.sampleReferred), e -> processStatusChange(REFERRED)); initializeStatusButton(referredButton, buttonFilterLayout, REFERRED, I18nProperties.getCaption(Captions.sampleReferred)); } shipmentFilterLayout.addComponent(buttonFilterLayout); HorizontalLayout actionButtonsLayout = new HorizontalLayout(); actionButtonsLayout.setSpacing(true); { // Show archived/active cases button if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_VIEW_ARCHIVED)) { switchArchivedActiveButton = new Button(I18nProperties.getCaption(Captions.sampleShowArchived)); switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_LINK); switchArchivedActiveButton.addClickListener(e -> { criteria.archived(Boolean.TRUE.equals(criteria.getArchived()) ? null : Boolean.TRUE); samplesView.navigateTo(criteria); }); actionButtonsLayout.addComponent(switchArchivedActiveButton); } // Bulk operation dropdown if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) { shipmentFilterLayout.setWidth(100, Unit.PERCENTAGE); MenuBar bulkOperationsDropdown = new MenuBar(); MenuItem bulkOperationsItem = bulkOperationsDropdown .addItem(I18nProperties.getCaption(Captions.bulkActions), null); Command deleteCommand = selectedItem -> { ControllerProvider.getSampleController() .deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() { public void run() { grid.reload(); } }); }; bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, deleteCommand); actionButtonsLayout.addComponent(bulkOperationsDropdown); } } shipmentFilterLayout.addComponent(actionButtonsLayout); shipmentFilterLayout.setComponentAlignment(actionButtonsLayout, Alignment.TOP_RIGHT); shipmentFilterLayout.setExpandRatio(actionButtonsLayout, 1); return shipmentFilterLayout; }
From source file:de.symeda.sormas.ui.samples.SampleListComponent.java
License:Open Source License
public SampleListComponent(CaseReferenceDto caseRef) { setWidth(100, Unit.PERCENTAGE);//w w w.ja v a2 s . c o m setMargin(false); setSpacing(false); HorizontalLayout componentHeader = new HorizontalLayout(); componentHeader.setMargin(false); componentHeader.setSpacing(false); componentHeader.setWidth(100, Unit.PERCENTAGE); addComponent(componentHeader); list = new SampleList(caseRef); addComponent(list); list.reload(); Label tasksHeader = new Label(I18nProperties.getString(Strings.entitySamples)); tasksHeader.addStyleName(CssStyles.H3); componentHeader.addComponent(tasksHeader); if (UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_CREATE)) { createButton = new Button(I18nProperties.getCaption(Captions.sampleNewSample)); createButton.addStyleName(ValoTheme.BUTTON_PRIMARY); createButton.setIcon(VaadinIcons.PLUS_CIRCLE); createButton .addClickListener(e -> ControllerProvider.getSampleController().create(caseRef, this::reload)); componentHeader.addComponent(createButton); componentHeader.setComponentAlignment(createButton, Alignment.MIDDLE_RIGHT); } }