List of usage examples for com.vaadin.ui Alignment MIDDLE_LEFT
Alignment MIDDLE_LEFT
To view the source code for com.vaadin.ui Alignment MIDDLE_LEFT.
Click Source Link
From source file:de.catma.ui.tagger.pager.PagerComponent.java
License:Open Source License
private void initComponents() { setSpacing(true);/* w w w. j a va 2 s.co m*/ firstPageButton = new Button(); addComponent(firstPageButton); previousPageButton = new Button(); addComponent(previousPageButton); pageInput = new NumberField(1); pageInput.setImmediate(true); pageInput.setStyleName("pager-pageinput"); pageInput.setWidth("30px"); addComponent(pageInput); lastPageNumberLabel = new Label("/NA"); addComponent(lastPageNumberLabel); this.setComponentAlignment(lastPageNumberLabel, Alignment.MIDDLE_LEFT); nextPageButton = new Button(); addComponent(nextPageButton); lastPageButton = new Button(); addComponent(lastPageButton); }
From source file:de.escidoc.admintool.view.EscidocPagedTable.java
License:Open Source License
public HorizontalLayout createControls() { // final Label itemsPerPageLabel = new Label("Items per page:"); final Label pageLabel = new Label("Page: ", Label.CONTENT_XHTML); final TextField currentPageTextField = new TextField(); currentPageTextField.setValue(String.valueOf(getCurrentPage())); currentPageTextField.addValidator(new IntegerValidator(null)); final Label separatorLabel = new Label(" / ", Label.CONTENT_XHTML); final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), Label.CONTENT_XHTML); currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL); currentPageTextField.setImmediate(true); currentPageTextField.addListener(new ValueChangeListener() { private static final long serialVersionUID = -2255853716069800092L; public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) { if (currentPageTextField.isValid() && currentPageTextField.getValue() != null) { @SuppressWarnings("boxing") final int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue())); setCurrentPage(page);/*from w w w .j a v a2s.com*/ } } }); pageLabel.setWidth(null); currentPageTextField.setWidth("20px"); separatorLabel.setWidth(null); totalPagesLabel.setWidth(null); final HorizontalLayout controlBar = new HorizontalLayout(); final HorizontalLayout pageSize = new HorizontalLayout(); final HorizontalLayout pageManagement = new HorizontalLayout(); final Button first = new Button("<<", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { setCurrentPage(0); } }); final Button previous = new Button("<", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { previousPage(); } }); final Button next = new Button(">", new ClickListener() { private static final long serialVersionUID = -1927138212640638452L; public void buttonClick(final ClickEvent event) { nextPage(); } }); final Button last = new Button(">>", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { setCurrentPage(getTotalAmountOfPages()); } }); first.setStyleName(BaseTheme.BUTTON_LINK); previous.setStyleName(BaseTheme.BUTTON_LINK); next.setStyleName(BaseTheme.BUTTON_LINK); last.setStyleName(BaseTheme.BUTTON_LINK); pageLabel.addStyleName("pagedtable-pagecaption"); currentPageTextField.addStyleName("pagedtable-pagefield"); separatorLabel.addStyleName("pagedtable-separator"); totalPagesLabel.addStyleName("pagedtable-total"); first.addStyleName("pagedtable-first"); previous.addStyleName("pagedtable-previous"); next.addStyleName("pagedtable-next"); last.addStyleName("pagedtable-last"); pageLabel.addStyleName("pagedtable-label"); currentPageTextField.addStyleName("pagedtable-label"); separatorLabel.addStyleName("pagedtable-label"); totalPagesLabel.addStyleName("pagedtable-label"); first.addStyleName("pagedtable-button"); previous.addStyleName("pagedtable-button"); next.addStyleName("pagedtable-button"); last.addStyleName("pagedtable-button"); pageSize.setSpacing(true); pageManagement.addComponent(first); pageManagement.addComponent(previous); pageManagement.addComponent(pageLabel); pageManagement.addComponent(currentPageTextField); pageManagement.addComponent(separatorLabel); pageManagement.addComponent(totalPagesLabel); pageManagement.addComponent(next); pageManagement.addComponent(last); pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT); pageManagement.setWidth(null); pageManagement.setSpacing(true); controlBar.addComponent(pageSize); controlBar.addComponent(pageManagement); controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER); controlBar.setWidth("100%"); controlBar.setExpandRatio(pageSize, 1); addListener(new PageChangeListener() { @SuppressWarnings("boxing") public void pageChanged(final PagedTableChangeEvent event) { previous.setEnabled(true); next.setEnabled(true); currentPageTextField.setValue(String.valueOf(getCurrentPage())); totalPagesLabel.setValue(getTotalAmountOfPages()); } }); return controlBar; }
From source file:de.fatalix.bookery.AppHeader.java
License:Open Source License
private HorizontalLayout createTop() { Label header = new Label("Bookery"); header.addStyleName(ValoTheme.LABEL_BOLD); //header.addStyleName(ValoTheme.LABEL_H3); header.setSizeUndefined();// w w w . j a v a 2s . c o m MHorizontalLayout layout = new MHorizontalLayout(header); layout.setWidth(100, Unit.PERCENTAGE); layout.setExpandRatio(header, 1.0f); layout.setComponentAlignment(header, Alignment.MIDDLE_LEFT); //layout.setComponentAlignment(logoutButton, Alignment.BOTTOM_RIGHT); return layout; }
From source file:de.fatalix.lighty.web.component.LightyHeader.java
public LightyHeader() { addStyleName(LightyTheme.HEADER_BACKGROUND); setWidth(100, Unit.PERCENTAGE);/*from w w w. j a v a 2 s. com*/ Image image = new Image(null, new ThemeResource("img/lighty-icon.png")); image.setWidth(64, Unit.PIXELS); image.setHeight(64, Unit.PIXELS); Label headerTitle = new Label("Lighty App"); headerTitle.addStyleName(LightyLabels.TITLE_CAPTION); addComponents(image, headerTitle); setExpandRatio(headerTitle, 1.0f); setComponentAlignment(headerTitle, Alignment.MIDDLE_LEFT); }
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 a2 s .c om*/ 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.metas.ui.web.vaadin.window.editor.FieldEditorsContainer.java
License:Open Source License
private void addChildEditor(final Label label, final Component editorComp, final PropertyLayoutInfo layoutInfo) { final GridLayout content = getContent(); int labelColumn = contentNextColumn * 2; int labelRow = contentNextRow; if (layoutInfo.isNextColumn()) { labelColumn = content.getColumns(); labelRow = 0;//from w ww .j ava2s . co m } final int editorRowsSpan = layoutInfo.getRowsSpan(); final int editorColumnFrom = labelColumn + 1; final int editorColumnTo = editorColumnFrom; final int editorRowFrom = labelRow; final int editorRowTo = editorRowFrom + (editorRowsSpan - 1); if (editorColumnTo >= content.getColumns()) { content.setColumns(editorColumnTo + 1); } if (editorRowTo >= content.getRows()) { content.setRows(editorRowTo + 1); } // // if (label != null) { content.addComponent(label, labelColumn, labelRow); content.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); } content.addComponent(editorComp, editorColumnFrom, editorRowFrom, editorColumnTo, editorRowTo); content.setComponentAlignment(editorComp, Alignment.MIDDLE_LEFT); editorComp.setSizeFull(); // // // contentNextColumn; contentNextRow = editorRowTo + 1; }
From source file:de.symeda.sormas.ui.dashboard.statistics.DashboardStatisticsGraphicalGrowthElement.java
License:Open Source License
public DashboardStatisticsGraphicalGrowthElement(String caption, String svgFillClass) { this.setMargin(false); this.setSpacing(false); HorizontalLayout captionAndValueLayout = new HorizontalLayout(); captionAndValueLayout.setMargin(false); captionAndValueLayout.setSpacing(false); captionAndValueLayout.setWidth(100, Unit.PERCENTAGE); Label captionLabel = new Label(caption); CssStyles.style(captionLabel, CssStyles.LABEL_SECONDARY, CssStyles.LABEL_BOLD); captionAndValueLayout.addComponent(captionLabel); countLabel = new Label(); CssStyles.style(countLabel, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_BOLD, CssStyles.HSPACE_RIGHT_4); countLabel.setWidthUndefined();// ww w. j a v a 2s. co m captionAndValueLayout.addComponent(countLabel); growthLabel = new Label(); growthLabel.setHeightUndefined(); growthLabel.setWidthUndefined(); growthLabel.setContentMode(ContentMode.HTML); CssStyles.style(growthLabel, CssStyles.LABEL_SMALL, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_BOLD, CssStyles.HSPACE_RIGHT_4); captionAndValueLayout.addComponent(growthLabel); percentageLabel = new Label(); CssStyles.style(percentageLabel, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_BOLD); percentageLabel.setWidthUndefined(); captionAndValueLayout.addComponent(percentageLabel); captionAndValueLayout.setComponentAlignment(captionLabel, Alignment.MIDDLE_LEFT); captionAndValueLayout.setComponentAlignment(countLabel, Alignment.MIDDLE_RIGHT); captionAndValueLayout.setComponentAlignment(growthLabel, Alignment.MIDDLE_RIGHT); captionAndValueLayout.setComponentAlignment(percentageLabel, Alignment.MIDDLE_RIGHT); captionAndValueLayout.setExpandRatio(captionLabel, 1); addComponent(captionAndValueLayout); svgBarElement = new SvgBarElement(svgFillClass); svgBarElement.setWidth(100, Unit.PERCENTAGE); addComponent(svgBarElement); }
From source file:de.symeda.sormas.ui.dashboard.statistics.DashboardStatisticsPercentageElement.java
License:Open Source License
public DashboardStatisticsPercentageElement(String caption, String svgFillClass) { this.setMargin(false); this.setSpacing(false); HorizontalLayout captionAndValueLayout = new HorizontalLayout(); captionAndValueLayout.setWidth(100, Unit.PERCENTAGE); Label captionLabel = new Label(caption); captionLabel.setWidthUndefined();/*from w ww. j a v a 2 s .c o m*/ CssStyles.style(captionLabel, CssStyles.LABEL_SECONDARY, CssStyles.LABEL_BOLD); captionAndValueLayout.addComponent(captionLabel); percentageLabel = new Label(); CssStyles.style(percentageLabel, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_BOLD); percentageLabel.setWidthUndefined(); captionAndValueLayout.addComponent(percentageLabel); captionAndValueLayout.setComponentAlignment(captionLabel, Alignment.MIDDLE_LEFT); captionAndValueLayout.setComponentAlignment(percentageLabel, Alignment.MIDDLE_RIGHT); addComponent(captionAndValueLayout); svgBarElement = new SvgBarElement(svgFillClass); svgBarElement.setWidth(100, Unit.PERCENTAGE); addComponent(svgBarElement); }
From source file:de.symeda.sormas.ui.dashboard.surveillance.SurveillanceDiseaseCarouselLayout.java
License:Open Source License
private HorizontalLayout createCarouselMenuLayout() { HorizontalLayout layout = new HorizontalLayout(); layout.setMargin(false);//from w w w .jav a 2s . c om CssStyles.style(layout, CssStyles.HSPACE_LEFT_2); CheckBox autoSlide = this.setupSlideShow(); layout.addComponent(autoSlide); layout.setComponentAlignment(autoSlide, Alignment.MIDDLE_LEFT); carouselMenu = new SubMenu(); for (Disease disease : diseases) { carouselMenu.addView(disease.getName(), disease.toShortString(), (e) -> { this.changeSelectedDisease(disease); }); } if (diseases.size() > 0) { this.setActiveDisease(diseases.get(0)); } layout.addComponent(carouselMenu); return layout; }
From source file:de.symeda.sormas.ui.statistics.DatabaseExportView.java
License:Open Source License
public DatabaseExportView() { super(VIEW_NAME); databaseTableToggles = new HashMap<>(); databaseExportLayout = new VerticalLayout(); databaseExportLayout.setSpacing(false); databaseExportLayout.setMargin(false); HorizontalLayout headerLayout = new HorizontalLayout(); headerLayout.setSpacing(true);/*from w ww . j a v a 2 s . co m*/ headerLayout.setMargin(false); Label infoLabel = new Label(I18nProperties.getString(Strings.infoDatabaseExportTables)); headerLayout.addComponent(infoLabel); headerLayout.setComponentAlignment(infoLabel, Alignment.MIDDLE_LEFT); headerLayout.addComponent(createSelectionButtonsLayout()); databaseExportLayout.addComponent(headerLayout); databaseExportLayout.addComponent(createDatabaseTablesLayout()); Button exportButton = new Button(I18nProperties.getCaption(Captions.export), VaadinIcons.DOWNLOAD); CssStyles.style(exportButton, ValoTheme.BUTTON_PRIMARY); StreamResource streamResource = DownloadUtil.createDatabaseExportStreamResource(this, "sormas_export_" + DateHelper.formatDateForExport(new Date()) + ".zip", "application/zip"); FileDownloader fileDownloader = new FileDownloader(streamResource); fileDownloader.extend(exportButton); databaseExportLayout.addComponent(exportButton); databaseExportLayout.setMargin(true); databaseExportLayout.setSpacing(true); addComponent(databaseExportLayout); }