List of usage examples for com.vaadin.ui Alignment MIDDLE_CENTER
Alignment MIDDLE_CENTER
To view the source code for com.vaadin.ui Alignment MIDDLE_CENTER.
Click Source Link
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();// w ww .j av a 2 s . c o m error.setStyleName(ValoTheme.LABEL_FAILURE); setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); addComponent(error); setSizeFull(); }
From source file:de.kaiserpfalzEdv.office.ui.web.KPOfficeUI.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { mainLayout = new VerticalLayout(); mainLayout.setSizeFull();//from ww w. ja v a 2 s . c o m mainLayout.setHeight(100f, Unit.PERCENTAGE); mainLayout.setWidth(100f, Unit.PERCENTAGE); mainLayout.setMargin(false); mainLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); setContent(mainLayout); eventBus.publish(EventScope.SESSION, this, Action.START); mainLayout.addComponent(presenter.getView()); }
From source file:de.kaiserpfalzEdv.office.ui.web.widgets.about.AboutPanel.java
License:Apache License
@PostConstruct public void init() { Image logo = new Image(null, new ThemeResource("../images/lichti-wappen.png")); logo.setId("about-logo"); logo.setAlternateText("Logo: Kaiserpfalz EDV-Service"); logo.setWidth(150f, Unit.PIXELS);// w ww. j a va2 s . c om logo.setHeight(170f, Unit.PIXELS); logo.setCaption("Kaiserpfalz EDV-Service"); addComponent(logo); setComponentAlignment(logo, Alignment.MIDDLE_CENTER); Label name = new Label( "<div style='text-align: center;'><b>" + application.get(ApplicationMetaData.APPLICATION_NAME) + "</b>" + "<br/>" + "<i><small>Version " + application.get(ApplicationMetaData.APPLICATION_VERSION) + "</small></i></div>", ContentMode.HTML); name.setWidth(200f, Unit.PIXELS); addComponent(name); setComponentAlignment(name, Alignment.MIDDLE_CENTER); addComponent(new Label("")); addComponent(new Label("License: " + license.getId())); addComponent(new Label("Licensee: " + license.getLicensee())); addComponent(new Label("")); addComponent(new Label("Issued: " + license.getIssueDate())); addComponent(new Label("Issuer: " + license.getIssuer())); addComponent(new Label("")); addComponent(new Label("Valid (Time): " + license.getStart() + " - " + license.getExpiry())); addComponent(new Label("Valid (Version): " + license.getVersionRange().getStart() + " - " + license.getVersionRange().getEnd())); LOG.trace("Initialized: {}", this); LOG.trace(" application: {}", application); LOG.trace(" license: {}", license); }
From source file:de.metas.ui.web.vaadin.login.LoginViewImpl.java
License:Open Source License
public LoginViewImpl() { super();/*from w w w .j a v a 2s .co m*/ setSizeFull(); mainPanel.setSizeUndefined(); mainPanel.setSpacing(true); // loginPanel.addStyleName("login-panel"); // // Header { final CssLayout labels = new CssLayout(); labels.addStyleName("labels"); final Image logo = new Image(); logo.setSource(Theme.getProductLogoLargeResource()); mainPanel.addComponent(logo); } // // Fields { currentPanel = loginPanel; mainPanel.addComponent(loginPanel); loginPanel.focus(); } // addComponent(mainPanel); setComponentAlignment(mainPanel, Alignment.MIDDLE_CENTER); }
From source file:de.steinwedel.messagebox.MessageBox.java
License:Apache License
/** * Sets an icon to the message dialog.//from w w w .j a v a 2 s . com * * @param icon An embedded resource * @param width The width i.e. "48px" * @param height The height i.e. "48px" * @return The {@link MessageBox} instance itself */ public MessageBox withIcon(Component icon, String width, String height) { if (this.icon != null) { contentLayout.removeComponent(this.icon); } this.icon = icon; if (icon != null) { contentLayout.addComponent(icon, 0); contentLayout.setComponentAlignment(icon, Alignment.MIDDLE_CENTER); icon.setWidth(width); icon.setHeight(height); } return this; }
From source file:de.steinwedel.messagebox.MessageBox.java
License:Apache License
/** * Sets a component as content to the message dialog. * * @param messageComponent The component as content * @return The {@link MessageBox} instance itself *//* w w w. java 2s . c o m*/ public MessageBox withMessage(Component messageComponent) { if (this.messageComponent != null) { contentLayout.removeComponent(this.messageComponent); } this.messageComponent = messageComponent; if (messageComponent != null) { messageComponent.setSizeFull(); contentLayout.addComponent(messageComponent, contentLayout.getComponentCount()); contentLayout.setExpandRatio(messageComponent, 1.0f); contentLayout.setComponentAlignment(messageComponent, Alignment.MIDDLE_CENTER); } return this; }
From source file:de.steinwedel.messagebox.MessageBox.java
License:Apache License
/** * Shows the dialog./*from ww w .j a v a 2 s. c o m*/ */ public void open() { // Ensure, that the dialog has at least one button if (!buttonAdded && BUTTON_ADD_CLOSE_PER_DEFAULT) { withCloseButton(); } // Apply some layouting options to the buttons for (int i = 0; i < buttonLayout.getComponentCount(); i++) { Component c = buttonLayout.getComponent(i); if (buttonWidth != null && c instanceof Button) { Button b = (Button) c; b.setWidth(buttonWidth); } buttonLayout.setComponentAlignment(c, Alignment.MIDDLE_CENTER); } // Add window to the UI if (DIALOG_DEFAULT_TRANSITION_LISTENER == null || (DIALOG_DEFAULT_TRANSITION_LISTENER != null && DIALOG_DEFAULT_TRANSITION_LISTENER.show(this))) { UI.getCurrent().addWindow(window); } immutable = true; }
From source file:de.symeda.sormas.ui.AboutView.java
License:Open Source License
public AboutView() { CustomLayout aboutContent = new CustomLayout("aboutview"); aboutContent.setStyleName("about-content"); // Info section VerticalLayout infoLayout = new VerticalLayout(); infoLayout.setSpacing(false);//from w ww .ja va2 s .c o m infoLayout.setMargin(false); aboutContent.addComponent(infoLayout, "info"); Label versionLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml() + " " + I18nProperties.getCaption(Captions.aboutSormasVersion) + ": " + InfoProvider.get().getVersion(), ContentMode.HTML); infoLayout.addComponent(versionLabel); Link whatsNewLink = new Link(I18nProperties.getCaption(Captions.aboutWhatsNew), new ExternalResource( "https://github.com/hzi-braunschweig/SORMAS-Project/releases/tag/releases%2Fversion-" + InfoProvider.get().getBaseVersion())); whatsNewLink.setTargetName("_blank"); infoLayout.addComponent(whatsNewLink); Link sormasWebsiteLink = new Link(I18nProperties.getCaption(Captions.aboutSormasWebsite), new ExternalResource("https://sormasorg.helmholtz-hzi.de/")); sormasWebsiteLink.setTargetName("_blank"); infoLayout.addComponent(sormasWebsiteLink); Link sormasGithubLink = new Link("SORMAS Github", new ExternalResource("https://github.com/hzi-braunschweig/SORMAS-Project")); sormasGithubLink.setTargetName("_blank"); infoLayout.addComponent(sormasGithubLink); Link changelogLink = new Link(I18nProperties.getCaption(Captions.aboutChangelog), new ExternalResource("https://github.com/hzi-braunschweig/SORMAS-Project/releases")); changelogLink.setTargetName("_blank"); infoLayout.addComponent(changelogLink); // Documents section VerticalLayout documentsLayout = new VerticalLayout(); documentsLayout.setSpacing(false); documentsLayout.setMargin(false); aboutContent.addComponent(documentsLayout, "documents"); Button classificationDocumentButton = new Button( I18nProperties.getCaption(Captions.aboutCaseClassificationRules)); CssStyles.style(classificationDocumentButton, ValoTheme.BUTTON_LINK, CssStyles.BUTTON_COMPACT); documentsLayout.addComponent(classificationDocumentButton); try { String serverUrl = new URL(((VaadinServletRequest) VaadinService.getCurrentRequest()) .getHttpServletRequest().getRequestURL().toString()).getAuthority(); StreamResource classificationResource = DownloadUtil.createStringStreamResource( ClassificationHtmlRenderer.createHtmlForDownload(serverUrl, FacadeProvider.getDiseaseConfigurationFacade().getAllActivePrimaryDiseases()), "classification_rules.html", "text/html"); new FileDownloader(classificationResource).extend(classificationDocumentButton); } catch (MalformedURLException e) { } Button dataDictionaryButton = new Button(I18nProperties.getCaption(Captions.aboutDataDictionary)); CssStyles.style(dataDictionaryButton, ValoTheme.BUTTON_LINK, CssStyles.BUTTON_COMPACT); documentsLayout.addComponent(dataDictionaryButton); FileDownloader dataDictionaryDownloader = new FileDownloader( new ClassResource("/doc/SORMAS_Data_Dictionary.xlsx")); dataDictionaryDownloader.extend(dataDictionaryButton); Link technicalManualLink = new Link(I18nProperties.getCaption(Captions.aboutTechnicalManual), new ExternalResource( "https://github.com/hzi-braunschweig/SORMAS-Project/files/2585973/SORMAS_Technical_Manual_Webversion_20180911.pdf")); technicalManualLink.setTargetName("_blank"); documentsLayout.addComponent(technicalManualLink); setSizeFull(); setStyleName("about-view"); addComponent(aboutContent); setComponentAlignment(aboutContent, Alignment.MIDDLE_CENTER); }
From source file:de.symeda.sormas.ui.dashboard.statistics.AbstractDashboardStatisticsComponent.java
License:Open Source License
private void addShowMoreAndLessButtons() { showMoreButton = new Button(I18nProperties.getCaption(Captions.dashboardShowAllDiseases), VaadinIcons.CHEVRON_DOWN);//from w ww .j a va2 s .c o m CssStyles.style(showMoreButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_3); showLessButton = new Button(I18nProperties.getCaption(Captions.dashboardShowFirstDiseases), VaadinIcons.CHEVRON_UP); CssStyles.style(showLessButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_3); showMoreButton.addClickListener(e -> { showMoreButton.setVisible(false); showLessButton.setVisible(true); updateStatistics(currentDisease); }); showLessButton.addClickListener(e -> { showLessButton.setVisible(false); showMoreButton.setVisible(true); updateStatistics(currentDisease); }); addComponent(showMoreButton); addComponent(showLessButton); setComponentAlignment(showMoreButton, Alignment.MIDDLE_CENTER); setComponentAlignment(showLessButton, Alignment.MIDDLE_CENTER); showLessButton.setVisible(false); }
From source file:de.symeda.sormas.ui.dashboard.statistics.DashboardStatisticsCountElement.java
License:Open Source License
public DashboardStatisticsCountElement(String caption, CountElementStyle countElementStyle) { this.setMargin(false); this.setSpacing(false); addStyleName("count-element"); addStyleName(countElementStyle.getCssClass()); countLabel = new Label(); countLabel.setSizeUndefined();//from ww w. j av a2 s . co m CssStyles.style(countLabel, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_MEDIUM, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE, CssStyles.VSPACE_5, CssStyles.VSPACE_TOP_NONE); addComponent(countLabel); captionLabel = new Label(caption); captionLabel.setSizeUndefined(); CssStyles.style(captionLabel, CssStyles.LABEL_SECONDARY, CssStyles.LABEL_SMALL, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE, CssStyles.VSPACE_5, CssStyles.VSPACE_TOP_NONE); addComponent(captionLabel); setComponentAlignment(countLabel, Alignment.MIDDLE_CENTER); setComponentAlignment(captionLabel, Alignment.MIDDLE_CENTER); }