List of usage examples for com.vaadin.ui.themes ValoTheme BUTTON_PRIMARY
String BUTTON_PRIMARY
To view the source code for com.vaadin.ui.themes ValoTheme BUTTON_PRIMARY.
Click Source Link
From source file:de.symeda.sormas.ui.contact.ContactsView.java
License:Open Source License
private void updateArchivedButton() { if (switchArchivedActiveButton == null) { return;//from w w w. ja v a 2 s.co m } if (Boolean.TRUE.equals(criteria.getArchived())) { getViewTitleLabel() .setValue(I18nProperties.getPrefixCaption("View", viewName.replaceAll("/", ".") + ".archive")); switchArchivedActiveButton .setCaption(I18nProperties.getCaption(I18nProperties.getCaption(Captions.contactShowActive))); switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_PRIMARY); } else { getViewTitleLabel().setValue(originalViewTitle); switchArchivedActiveButton .setCaption(I18nProperties.getCaption(I18nProperties.getCaption(Captions.contactShowArchived))); switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_LINK); } }
From source file:de.symeda.sormas.ui.contact.ContactVisitsView.java
License:Open Source License
public HorizontalLayout createTopBar() { HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setSpacing(true);// w w w . j a v a2 s . c om topLayout.setWidth(100, Unit.PERCENTAGE); // statusButtons = new HashMap<>(); // // Button contactButton = new Button(I18nProperties.getCaption(Captions.contactRelated), e -> { // grid.reload(getContactRef()); // processStatusChangeVisuals(e.getButton()); // }); // CssStyles.style(contactButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER); // contactButton.setCaptionAsHtml(true); // topLayout.addComponent(contactButton); // statusButtons.put(contactButton, I18nProperties.getCaption(Captions.contactRelated)); // // Button personButton = new Button(I18nProperties.getCaption(Captions.contactPersonVisits), e -> { // ContactDto contact = FacadeProvider.getContactFacade().getContactByUuid(getContactRef().getUuid()); // grid.reload(contact.getPerson()); // processStatusChangeVisuals(e.getButton()); // }); // CssStyles.style(personButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER, CssStyles.BUTTON_FILTER_LIGHT); // personButton.setCaptionAsHtml(true); // topLayout.addComponent(personButton); // statusButtons.put(personButton, I18nProperties.getCaption(Captions.contactPersonVisits)); // topLayout.setExpandRatio(topLayout.getComponent(topLayout.getComponentCount()-1), 1); // Bulk operation dropdown if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) { topLayout.setWidth(100, Unit.PERCENTAGE); MenuBar bulkOperationsDropdown = new MenuBar(); MenuItem bulkOperationsItem = bulkOperationsDropdown .addItem(I18nProperties.getCaption(Captions.bulkActions), null); Command deleteCommand = selectedItem -> { ControllerProvider.getVisitController() .deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() { public void run() { grid.deselectAll(); grid.reload(); } }); }; bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, deleteCommand); topLayout.addComponent(bulkOperationsDropdown); topLayout.setComponentAlignment(bulkOperationsDropdown, Alignment.TOP_RIGHT); topLayout.setExpandRatio(bulkOperationsDropdown, 1); } if (UserProvider.getCurrent().hasUserRight(UserRight.VISIT_CREATE)) { newButton = new Button(I18nProperties.getCaption(Captions.visitNewVisit)); newButton.addStyleName(ValoTheme.BUTTON_PRIMARY); newButton.setIcon(VaadinIcons.PLUS_CIRCLE); newButton.addClickListener(e -> { ControllerProvider.getVisitController().createVisit(this.getContactRef(), r -> grid.reload()); }); topLayout.addComponent(newButton); topLayout.setComponentAlignment(newButton, Alignment.MIDDLE_RIGHT); } topLayout.addStyleName(CssStyles.VSPACE_3); // activeStatusButton = contactButton; return topLayout; }
From source file:de.symeda.sormas.ui.dashboard.DashboardFilterLayout.java
License:Open Source License
private void createDateFilters() { HorizontalLayout dateFilterLayout = new HorizontalLayout(); dateFilterLayout.addStyleName(CssStyles.LAYOUT_MINIMAL); dateFilterLayout.setSpacing(true);// w w w . j a va2s . c o m addComponent(dateFilterLayout); Date now = new Date(); // Date filters Button todayButton = new Button(I18nProperties.getCaption(Captions.dashboardToday)); initializeDateFilterButton(todayButton); todayButton.addClickListener(e -> { setDateFilter(DateHelper.getStartOfDay(now), DateHelper.getEndOfDay(now)); dashboardView.refreshDashboard(); }); Button yesterdayButton = new Button(I18nProperties.getCaption(Captions.dashboardYesterday)); initializeDateFilterButton(yesterdayButton); yesterdayButton.addClickListener(e -> { setDateFilter(DateHelper.getStartOfDay(DateHelper.subtractDays(now, 1)), DateHelper.getEndOfDay(DateHelper.subtractDays(now, 1))); dashboardView.refreshDashboard(); }); Button thisWeekButton = new Button(I18nProperties.getCaption(Captions.dashboardThisWeek)); initializeDateFilterButton(thisWeekButton); thisWeekButton.addClickListener(e -> { setDateFilter(DateHelper.getStartOfWeek(now), DateHelper.getEndOfWeek(now)); dashboardView.refreshDashboard(); }); CssStyles.style(thisWeekButton, CssStyles.BUTTON_FILTER_DARK); CssStyles.removeStyles(thisWeekButton, CssStyles.BUTTON_FILTER_LIGHT); Button lastWeekButton = new Button(I18nProperties.getCaption(Captions.dashboardLastWeek)); initializeDateFilterButton(lastWeekButton); lastWeekButton.addClickListener(e -> { setDateFilter(DateHelper.getStartOfWeek(DateHelper.subtractWeeks(now, 1)), DateHelper.getEndOfWeek(DateHelper.subtractWeeks(now, 1))); dashboardView.refreshDashboard(); }); Button thisYearButton = new Button(I18nProperties.getCaption(Captions.dashboardThisYear)); initializeDateFilterButton(thisYearButton); thisYearButton.addClickListener(e -> { setDateFilter(DateHelper.getStartOfYear(now), DateHelper.getEndOfYear(now)); dashboardView.refreshDashboard(); }); Button lastYearButton = new Button(I18nProperties.getCaption(Captions.dashboardLastYear)); initializeDateFilterButton(lastYearButton); lastYearButton.addClickListener(e -> { setDateFilter(DateHelper.getStartOfYear(DateHelper.subtractYears(now, 1)), DateHelper.getEndOfYear(DateHelper.subtractYears(now, 1))); dashboardView.refreshDashboard(); }); customButton = new PopupButton(I18nProperties.getCaption(Captions.dashboardCustom)); initializeDateFilterButton(customButton); // Custom filter HorizontalLayout customDateFilterLayout = new HorizontalLayout(); customDateFilterLayout.setSpacing(true); customDateFilterLayout.setMargin(true); // 'Apply custom filter' button Button applyButton = new Button(I18nProperties.getCaption(Captions.dashboardApplyCustomFilter)); CssStyles.style(applyButton, CssStyles.FORCE_CAPTION, ValoTheme.BUTTON_PRIMARY); // Date & Epi Week filter EpiWeekAndDateFilterComponent<NewCaseDateType> weekAndDateFilter = new EpiWeekAndDateFilterComponent<>( applyButton, true, true, I18nProperties.getString(Strings.infoCaseDate)); customDateFilterLayout.addComponent(weekAndDateFilter); dashboardDataProvider .setDateFilterOption((DateFilterOption) weekAndDateFilter.getDateFilterOptionFilter().getValue()); dashboardDataProvider.setFromDate( DateHelper.getEpiWeekStart((EpiWeek) weekAndDateFilter.getWeekFromFilter().getValue())); dashboardDataProvider .setToDate(DateHelper.getEpiWeekEnd((EpiWeek) weekAndDateFilter.getWeekToFilter().getValue())); customDateFilterLayout.addComponent(applyButton); // Apply button listener applyButton.addClickListener(e -> { DateFilterOption dateFilterOption = (DateFilterOption) weekAndDateFilter.getDateFilterOptionFilter() .getValue(); Date fromDate = null; Date toDate = null; EpiWeek fromWeek = null; EpiWeek toWeek = null; dashboardDataProvider.setDateFilterOption(dateFilterOption); if (dateFilterOption == DateFilterOption.DATE) { fromDate = weekAndDateFilter.getDateFromFilter().getValue(); dashboardDataProvider.setFromDate(fromDate); toDate = weekAndDateFilter.getDateToFilter().getValue(); dashboardDataProvider.setToDate(toDate); } else { fromWeek = (EpiWeek) weekAndDateFilter.getWeekFromFilter().getValue(); dashboardDataProvider.setFromDate(DateHelper.getEpiWeekStart(fromWeek)); toWeek = (EpiWeek) weekAndDateFilter.getWeekToFilter().getValue(); dashboardDataProvider.setToDate(DateHelper.getEpiWeekEnd(toWeek)); } if ((fromDate != null && toDate != null) || (fromWeek != null && toWeek != null)) { changeDateFilterButtonsStyles(customButton); dashboardView.refreshDashboard(); if (dateFilterOption == DateFilterOption.DATE) { customButton.setCaption(DateHelper.formatLocalShortDate(fromDate) + " - " + DateHelper.formatLocalShortDate(toDate)); } else { customButton.setCaption(fromWeek.toShortString() + " - " + toWeek.toShortString()); } } else { if (dateFilterOption == DateFilterOption.DATE) { new Notification(I18nProperties.getString(Strings.headingMissingDateFilter), I18nProperties.getString(Strings.messageMissingDateFilter), Type.ERROR_MESSAGE, false) .show(Page.getCurrent()); } else { new Notification(I18nProperties.getString(Strings.headingMissingEpiWeekFilter), I18nProperties.getString(Strings.messageMissingEpiWeekFilter), Type.ERROR_MESSAGE, false).show(Page.getCurrent()); } } }); customButton.setContent(customDateFilterLayout); dateFilterLayout.addComponents(todayButton, yesterdayButton, thisWeekButton, lastWeekButton, thisYearButton, lastYearButton, customButton); infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML); infoLabel.setSizeUndefined(); CssStyles.style(infoLabel, CssStyles.LABEL_XLARGE, CssStyles.LABEL_SECONDARY); addComponent(infoLabel); setComponentAlignment(infoLabel, Alignment.TOP_RIGHT); }
From source file:de.symeda.sormas.ui.events.EventParticipantsView.java
License:Open Source License
public HorizontalLayout createTopBar() { HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setSpacing(true);/*from w w w.j a v a 2 s. c o m*/ topLayout.setWidth("100%"); Label header = new Label(I18nProperties.getPrefixCaption(EventDto.I18N_PREFIX, EventDto.EVENT_PERSONS)); header.setSizeUndefined(); CssStyles.style(header, CssStyles.H2, CssStyles.VSPACE_NONE); topLayout.addComponent(header); // Bulk operation dropdown if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) { topLayout.setWidth(100, Unit.PERCENTAGE); MenuBar bulkOperationsDropdown = new MenuBar(); MenuItem bulkOperationsItem = bulkOperationsDropdown .addItem(I18nProperties.getCaption(Captions.bulkActions), null); Command deleteCommand = selectedItem -> { ControllerProvider.getEventParticipantController() .deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() { public void run() { grid.deselectAll(); grid.reload(); } }); }; bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, deleteCommand); topLayout.addComponent(bulkOperationsDropdown); topLayout.setComponentAlignment(bulkOperationsDropdown, Alignment.TOP_RIGHT); topLayout.setExpandRatio(bulkOperationsDropdown, 1); } if (UserProvider.getCurrent().hasUserRight(UserRight.EVENTPARTICIPANT_CREATE)) { addButton = new Button(I18nProperties.getCaption(Captions.eventParticipantAddPerson)); addButton.addStyleName(ValoTheme.BUTTON_PRIMARY); addButton.setIcon(VaadinIcons.PLUS_CIRCLE); addButton.addClickListener(e -> { ControllerProvider.getEventParticipantController().createEventParticipant(this.getEventRef(), r -> grid.reload()); }); topLayout.addComponent(addButton); topLayout.setComponentAlignment(addButton, Alignment.MIDDLE_RIGHT); } topLayout.addStyleName(CssStyles.VSPACE_3); return topLayout; }
From source file:de.symeda.sormas.ui.events.EventsView.java
License:Open Source License
public EventsView() { super(VIEW_NAME); originalViewTitle = getViewTitleLabel().getValue(); criteria = ViewModelProviders.of(EventsView.class).get(EventCriteria.class); if (criteria.getArchived() == null) { criteria.archived(false);// ww w . j av a 2 s .c o m } grid = new EventGrid(); grid.setCriteria(criteria); gridLayout = new VerticalLayout(); gridLayout.addComponent(createFilterBar()); gridLayout.addComponent(createStatusFilterBar()); gridLayout.addComponent(grid); gridLayout.setMargin(true); gridLayout.setSpacing(false); gridLayout.setSizeFull(); gridLayout.setExpandRatio(grid, 1); gridLayout.setStyleName("crud-main-layout"); grid.getDataProvider().addDataProviderListener(e -> updateStatusButtons()); addComponent(gridLayout); if (UserProvider.getCurrent().hasUserRight(UserRight.EVENT_EXPORT)) { Button exportButton = new Button(I18nProperties.getCaption(Captions.export)); exportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); exportButton.setIcon(VaadinIcons.DOWNLOAD); StreamResource streamResource = new GridExportStreamResource(grid, "sormas_events", "sormas_events_" + DateHelper.formatDateForExport(new Date()) + ".csv"); FileDownloader fileDownloader = new FileDownloader(streamResource); fileDownloader.extend(exportButton); addHeaderComponent(exportButton); } if (UserProvider.getCurrent().hasUserRight(UserRight.EVENT_CREATE)) { createButton = new Button(I18nProperties.getCaption(Captions.eventNewEvent)); createButton.addStyleName(ValoTheme.BUTTON_PRIMARY); createButton.setIcon(VaadinIcons.PLUS_CIRCLE); createButton.addClickListener(e -> ControllerProvider.getEventController().create()); addHeaderComponent(createButton); } }
From source file:de.symeda.sormas.ui.events.EventsView.java
License:Open Source License
private void updateArchivedButton() { if (switchArchivedActiveButton == null) { return;//w ww . j a v a2 s .c o m } if (Boolean.TRUE.equals(criteria.getArchived())) { getViewTitleLabel() .setValue(I18nProperties.getPrefixCaption("View", viewName.replaceAll("/", ".") + ".archive")); switchArchivedActiveButton .setCaption(I18nProperties.getCaption(I18nProperties.getCaption(Captions.eventShowActive))); switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_PRIMARY); if (archiveItem != null && dearchiveItem != null) { archiveItem.setVisible(false); dearchiveItem.setVisible(true); } } else { getViewTitleLabel().setValue(originalViewTitle); switchArchivedActiveButton .setCaption(I18nProperties.getCaption(I18nProperties.getCaption(Captions.eventShowArchived))); switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_LINK); if (archiveItem != null && dearchiveItem != null) { dearchiveItem.setVisible(false); archiveItem.setVisible(true); } } }
From source file:de.symeda.sormas.ui.Menu.java
License:Open Source License
public Menu(Navigator navigator) { this.navigator = navigator; setPrimaryStyleName(ValoTheme.MENU_ROOT); menuPart = new CssLayout(); menuPart.addStyleName(ValoTheme.MENU_PART); // header of the menu final HorizontalLayout top = new HorizontalLayout(); top.setDefaultComponentAlignment(Alignment.TOP_CENTER); top.addStyleName(ValoTheme.MENU_TITLE); top.setSpacing(true);/*from ww w . j a va 2s. c om*/ Label title = new Label("SORMAS"); title.setSizeUndefined(); Image image = new Image(null, new ThemeResource("img/sormas-logo.png")); CssStyles.style(image, ValoTheme.MENU_LOGO, ValoTheme.BUTTON_LINK); image.addClickListener(new MouseEvents.ClickListener() { @Override public void click(MouseEvents.ClickEvent event) { SormasUI.get().getNavigator().navigateTo(SurveillanceDashboardView.VIEW_NAME); } }); top.addComponent(image); top.addComponent(title); menuPart.addComponent(top); // logout menu item MenuBar logoutMenu = new MenuBar(); logoutMenu.addItem(I18nProperties.getCaption(Captions.actionLogout) + " (" + UserProvider.getCurrent().getUserName() + ")", VaadinIcons.SIGN_OUT, new Command() { @Override public void menuSelected(MenuItem selectedItem) { LoginHelper.logout(); } }); logoutMenu.addStyleName("user-menu"); menuPart.addComponent(logoutMenu); // button for toggling the visibility of the menu when on a small screen final Button showMenu = new Button(I18nProperties.getCaption(Captions.menu), new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) { menuPart.removeStyleName(VALO_MENU_VISIBLE); } else { menuPart.addStyleName(VALO_MENU_VISIBLE); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(VALO_MENU_TOGGLE); showMenu.setIcon(VaadinIcons.MENU); menuPart.addComponent(showMenu); // container for the navigation buttons, which are added by addView() menuItemsLayout = new CssLayout(); menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS); menuPart.addComponent(menuItemsLayout); addComponent(menuPart); }
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);/*w ww . jav a 2 s .c o m*/ 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.samples.PathogenTestListComponent.java
License:Open Source License
public PathogenTestListComponent(SampleReferenceDto sampleRef, BiConsumer<PathogenTestResultType, Boolean> testChangedCallback) { setWidth(100, Unit.PERCENTAGE);//from w w w. ja v a2 s . c o 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.SampleGridComponent.java
License:Open Source License
private void updateArchivedButton() { if (switchArchivedActiveButton == null) { return;//from w ww .jav a 2 s. c om } if (Boolean.TRUE.equals(criteria.getArchived())) { viewTitleLabel.setValue(I18nProperties.getPrefixCaption("View", SamplesView.VIEW_NAME.replaceAll("/", ".") + ".archive")); switchArchivedActiveButton.setCaption(I18nProperties.getCaption(Captions.sampleShowActive)); switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_PRIMARY); } else { viewTitleLabel.setValue(originalViewTitle); switchArchivedActiveButton.setCaption(I18nProperties.getCaption(Captions.sampleShowArchived)); switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_LINK); } }