List of usage examples for com.vaadin.ui Label setSizeUndefined
@Override public void setSizeUndefined()
From source file:de.gedoplan.webclients.vaadin.views.ErrorView.java
@Override public void myenter(ViewChangeListener.ViewChangeEvent event) { Label error = new Label("Seite konnte nicht gefunden werden !"); error.setSizeUndefined(); error.setStyleName(ValoTheme.LABEL_FAILURE); setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); addComponent(error);//from w ww . j av a2s. c o m setSizeFull(); }
From source file:de.kaiserpfalzEdv.vaadin.menu.impl.MenuImpl.java
License:Apache License
@Inject public MenuImpl(final Authenticator accessControl, final EventBus bus, final I18NHandler i18n, final List<View> allViews) { this.accessControl = accessControl; this.bus = bus; this.i18n = i18n; this.allViews = allViews; setPrimaryStyleName(ValoTheme.MENU_ROOT); menuPart = new CssLayout(); menuPart.addStyleName(ValoTheme.MENU_PART); // header of the menu final HorizontalLayout top = new HorizontalLayout(); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName(ValoTheme.MENU_TITLE); top.setSpacing(true);// w ww .j av a 2 s . c o m Label title = new Label(translate("application.name")); title.addStyleName(ValoTheme.LABEL_H3); title.setSizeUndefined(); Image image = new Image(null, new ThemeResource("img/table-logo.png")); image.setStyleName("logo"); top.addComponent(image); top.addComponent(title); menuPart.addComponent(top); // logout menu item MenuBar logoutMenu = new MenuBar(); logoutMenu.addItem(translate("button.logout.caption"), FontAwesome.valueOf(translate("button.logout.icon")), selectedItem -> { VaadinSession.getCurrent().getSession().invalidate(); Page.getCurrent().reload(); }); 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(translate("application.name"), new ClickListener() { @Override public void buttonClick(final 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(ValoTheme.BUTTON_SMALL); showMenu.addStyleName(VALO_MENU_TOGGLE); showMenu.setIcon(FontAwesome.NAVICON); 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.dashboard.contacts.ContactsDashboardStatisticsComponent.java
License:Open Source License
@Override protected void addThirdComponent() { thirdComponent = new DashboardStatisticsSubComponent(); // Header/*ww w. ja v a 2 s . c o m*/ thirdComponent.addHeader(I18nProperties.getString(Strings.headingFollowUpSituation), null, false); // Visit status of last visit thirdComponent.addMainContent(); CssLayout visitStatusCountLayout = thirdComponent.createCountLayout(true); cooperativeContacts = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardCooperative), CountElementStyle.POSITIVE); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, cooperativeContacts); uncooperativeContacts = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardUncooperative), CountElementStyle.CRITICAL); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, uncooperativeContacts); unavailableContacts = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardUnavailable), CountElementStyle.RELEVANT); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, unavailableContacts); neverVisitedContacts = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardNeverVisited), CountElementStyle.MINOR); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, neverVisitedContacts); Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML); infoLabel.setSizeUndefined(); infoLabel.setDescription(I18nProperties.getDescription(Descriptions.descDashboardFollowUpInfo)); CssStyles.style(infoLabel, CssStyles.LABEL_LARGE, CssStyles.LABEL_SECONDARY, "follow-up-status-info-button"); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, infoLabel); thirdComponent.addComponentToContent(visitStatusCountLayout); // Number of missed visits Label missedVisitsLabel = new Label(I18nProperties.getCaption(Captions.dashboardNotVisitedFor)); CssStyles.style(missedVisitsLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_UPPERCASE, CssStyles.LABEL_BACKGROUND_FOCUS_LIGHT, CssStyles.LABEL_ROUNDED_CORNERS_SLIM); thirdComponent.addComponentToContent(missedVisitsLabel); CssLayout missedVisitsCountLayout = thirdComponent.createCountLayout(false); missedVisitsOneDay = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardOneDay), CountElementStyle.PRIMARY); thirdComponent.addComponentToCountLayout(missedVisitsCountLayout, missedVisitsOneDay); missedVisitsTwoDays = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardTwoDays), CountElementStyle.PRIMARY); thirdComponent.addComponentToCountLayout(missedVisitsCountLayout, missedVisitsTwoDays); missedVisitsThreeDays = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardThreeDays), CountElementStyle.PRIMARY); thirdComponent.addComponentToCountLayout(missedVisitsCountLayout, missedVisitsThreeDays); missedVisitsGtThreeDays = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardGtThreeDays), CountElementStyle.PRIMARY); thirdComponent.addComponentToCountLayout(missedVisitsCountLayout, missedVisitsGtThreeDays); thirdComponent.addComponentToContent(missedVisitsCountLayout); subComponentsLayout.addComponent(thirdComponent, THIRD_LOC); }
From source file:de.symeda.sormas.ui.dashboard.map.DashboardMapComponent.java
License:Open Source License
private HorizontalLayout createHeader() { HorizontalLayout mapHeaderLayout = new HorizontalLayout(); mapHeaderLayout.setWidth(100, Unit.PERCENTAGE); mapHeaderLayout.setSpacing(true);//from w w w. j a v a2 s . c o m CssStyles.style(mapHeaderLayout, CssStyles.VSPACE_4); Label mapLabel = new Label(); if (dashboardDataProvider.getDashboardType() == DashboardType.SURVEILLANCE) { mapLabel.setValue(I18nProperties.getString(Strings.headingCaseStatusMap)); } else { mapLabel.setValue(I18nProperties.getString(Strings.headingContactMap)); } mapLabel.setSizeUndefined(); CssStyles.style(mapLabel, CssStyles.H2, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_NONE); mapHeaderLayout.addComponent(mapLabel); mapHeaderLayout.setComponentAlignment(mapLabel, Alignment.BOTTOM_LEFT); mapHeaderLayout.setExpandRatio(mapLabel, 1); // "Expand" and "Collapse" buttons Button expandMapButton = new Button("", VaadinIcons.EXPAND); CssStyles.style(expandMapButton, CssStyles.BUTTON_SUBTLE); expandMapButton.addStyleName(CssStyles.VSPACE_NONE); Button collapseMapButton = new Button("", VaadinIcons.COMPRESS); CssStyles.style(collapseMapButton, CssStyles.BUTTON_SUBTLE); collapseMapButton.addStyleName(CssStyles.VSPACE_NONE); expandMapButton.addClickListener(e -> { externalExpandListener.accept(true); mapHeaderLayout.removeComponent(expandMapButton); mapHeaderLayout.addComponent(collapseMapButton); mapHeaderLayout.setComponentAlignment(collapseMapButton, Alignment.MIDDLE_RIGHT); }); collapseMapButton.addClickListener(e -> { externalExpandListener.accept(false); mapHeaderLayout.removeComponent(collapseMapButton); mapHeaderLayout.addComponent(expandMapButton); mapHeaderLayout.setComponentAlignment(expandMapButton, Alignment.MIDDLE_RIGHT); }); mapHeaderLayout.addComponent(expandMapButton); mapHeaderLayout.setComponentAlignment(expandMapButton, Alignment.MIDDLE_RIGHT); return mapHeaderLayout; }
From source file:de.symeda.sormas.ui.dashboard.map.DashboardMapComponent.java
License:Open Source License
private static HorizontalLayout buildLegendEntry(AbstractComponent icon, String labelCaption) { HorizontalLayout entry = new HorizontalLayout(); entry.setSpacing(false);/*ww w. j av a2 s. co m*/ entry.setSizeUndefined(); CssStyles.style(icon, CssStyles.HSPACE_RIGHT_4); entry.addComponent(icon); Label label = new Label(labelCaption); label.setSizeUndefined(); label.addStyleName(ValoTheme.LABEL_SMALL); entry.addComponent(label); return entry; }
From source file:de.symeda.sormas.ui.events.EventParticipantsView.java
License:Open Source License
public HorizontalLayout createTopBar() { HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setSpacing(true);// ww 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.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 . ja v a 2 s.co m 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.reports.ReportsView.java
License:Open Source License
public HorizontalLayout createFilterBar() { HorizontalLayout filterLayout = new HorizontalLayout(); filterLayout.setMargin(false);/*from w w w . j ava 2 s . c om*/ 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.PathogenTestListEntry.java
License:Open Source License
public PathogenTestListEntry(PathogenTestDto pathogenTest) { setSpacing(true);/*from ww w. ja v a 2s . co m*/ 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.utils.AbstractView.java
License:Open Source License
protected AbstractView(String viewName) { this.viewName = viewName; setSizeFull();//from w ww . j a va 2 s . com setMargin(false); setSpacing(false); viewHeader = new HorizontalLayout(); viewHeader.setWidth(100, Unit.PERCENTAGE); viewHeader.setHeightUndefined(); viewHeader.setMargin(new MarginInfo(false, true)); viewHeader.setSpacing(true); CssStyles.style(viewHeader, "view-header"); VerticalLayout viewTitleLayout = new VerticalLayout(); { viewTitleLayout.setSizeUndefined(); viewTitleLayout.setSpacing(false); viewTitleLayout.setMargin(false); // note: splitting title and subtitle into labels does not work with the css String viewTitle = I18nProperties.getPrefixCaption("View", viewName.replaceAll("/", ".")); String viewSubTitle = I18nProperties.getPrefixCaption("View", viewName.replaceAll("/", ".") + ".sub", ""); viewTitleLabel = new Label(viewTitle); viewTitleLabel.setSizeUndefined(); CssStyles.style(viewTitleLabel, CssStyles.H1, CssStyles.VSPACE_NONE); viewTitleLayout.addComponent(viewTitleLabel); Label viewSubTitleLabel = new Label(viewSubTitle); viewSubTitleLabel.setSizeUndefined(); CssStyles.style(viewSubTitleLabel, CssStyles.H4, CssStyles.VSPACE_TOP_NONE); viewTitleLayout.addComponent(viewSubTitleLabel); } viewHeader.addComponent(viewTitleLayout); viewHeader.setExpandRatio(viewTitleLayout, 1); addComponent(viewHeader); setExpandRatio(viewHeader, 0); }