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.catma.ui.Slider.java
License:Open Source License
public Slider(String caption, int min, int max, final String unit) { this.setCaption(caption); setSizeUndefined();/*from www. j ava2 s . com*/ HorizontalLayout sliderLayout = new HorizontalLayout(); sliderLayout.setSpacing(true); this.sliderComp = new SliderComp(min, max); minLabel = new Label(String.valueOf(min)); maxLabel = new Label(String.valueOf(max)); sliderLayout.addComponent(minLabel); sliderLayout.addComponent(sliderComp); sliderLayout.addComponent(maxLabel); addComponent(sliderLayout); setComponentAlignment(sliderLayout, Alignment.MIDDLE_CENTER); final Label current = new Label(sliderComp.getValue().toString()); current.setWidth("100%"); current.addStyleName("slider-centered-text"); addComponent(current); setComponentAlignment(current, Alignment.MIDDLE_CENTER); sliderComp.addListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { current.setValue(event.getProperty().getValue() + (unit.isEmpty() ? "" : " ") + unit); } }); }
From source file:de.catma.ui.tabbedview.TabbedView.java
License:Open Source License
private void initComponents(String noOpenTabsText) { tabSheet = new TabSheet(); tabSheet.setSizeFull();// w w w. ja v a 2 s.c o m noOpenTabsLabel = new Label(noOpenTabsText); noOpenTabsLabel.setSizeFull(); setMargin(true); addComponent(noOpenTabsLabel); setComponentAlignment(noOpenTabsLabel, Alignment.MIDDLE_CENTER); addComponent(tabSheet); tabSheet.hideTabs(true); tabSheet.setHeight("0px"); tabSheet.setCloseHandler(this); setSizeFull(); }
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);// ww w . j a va 2s . c o m } } }); 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.escidoc.admintool.view.start.LandingView.java
License:Open Source License
public void init() { setStyleName(ViewConstants.LANDING_VIEW_STYLE_NAME); setCompositionRoot(viewLayout);/* w w w . j a v a 2 s . co m*/ setSizeFull(); viewLayout.setSizeFull(); viewLayout.setStyleName(ViewConstants.LANDING_VIEW_STYLE_NAME); viewLayout.addComponent(panel); viewLayout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER); panel.setWidth(ViewConstants.LOGIN_WINDOW_WIDTH); panel.setCaption(ViewConstants.WELCOMING_MESSAGE); addEscidocUrlField(); addFooters(); panel.addComponent(formLayout); }
From source file:de.fatalix.app.view.login.LoginView.java
public LoginView() { CssLayout rootLayout = new CssLayout(); rootLayout.addStyleName("login-screen"); Component loginForm = buildLoginForm(); VerticalLayout centeringLayout = new VerticalLayout(); centeringLayout.setStyleName("centering-layout"); centeringLayout.addComponent(loginForm); centeringLayout.setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER); CssLayout loginInformation = buildLoginInformation(); rootLayout.addComponent(centeringLayout); rootLayout.addComponent(loginInformation); setCompositionRoot(rootLayout);/*w w w .j a v a 2 s . com*/ }
From source file:de.fatalix.bookery.view.admin.AdminView.java
License:Open Source License
public HorizontalLayout createUserManagement() { userManagementLayout = new HorizontalLayout(); userManagementLayout.addStyleName("wrapping"); userManagementLayout.setSpacing(true); userManagementLayout.setMargin(true); Label label = new Label("Add new user..."); label.setSizeUndefined();//from w ww.j a v a 2 s. c o m label.addStyleName(ValoTheme.LABEL_LARGE); VerticalLayout emptyLayout = new VerticalLayout(label); emptyLayout.addStyleName("dashed-border"); emptyLayout.setWidth(380, Unit.PIXELS); emptyLayout.setHeight(220, Unit.PIXELS); emptyLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); emptyLayout.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { AppUser appUser = presenter.createNewUser(); AppUserCard appUserCard = appUserCardInstances.get(); appUserCard.loadAppUser(appUser); appUserCard.addAppUserCardListener(AdminView.this); userManagementLayout.addComponent(appUserCard, userManagementLayout.getComponentCount() - 1); } }); userManagementLayout.addComponent(emptyLayout); return userManagementLayout; }
From source file:de.fatalix.bookery.view.admin.BatchJobsLayout.java
private Layout createEmptyLayout() { Label label = new Label("Add new job..."); label.setSizeUndefined();/*from w w w .j av a 2 s.c o m*/ label.addStyleName(ValoTheme.LABEL_LARGE); VerticalLayout emptyLayout = new VerticalLayout(label); emptyLayout.addStyleName("dashed-border"); emptyLayout.setWidth(380, Unit.PIXELS); emptyLayout.setHeight(220, Unit.PIXELS); emptyLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); emptyLayout.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { BatchJobConfiguration jobConfig = presenter.createBatchJob(); BatchJobCard batchJobCard = batchJobCardInstances.get(); batchJobCard.load(jobConfig); batchJobCard.addBatchJobCardListener(BatchJobsLayout.this); batchJobLayout.addComponent(batchJobCard, batchJobLayout.getComponentCount() - 1); } }); return emptyLayout; }
From source file:de.fatalix.bookery.view.common.BookDetailLayout.java
License:Open Source License
private HorizontalLayout createImageLayout() { image = new Image(); image.setImmediate(true);/*from w w w.j av a 2s .com*/ image.setHeight("200px"); image.setWidth("130px"); downloadButton = new Button("download", FontAwesome.DOWNLOAD); downloadButton.addStyleName(ValoTheme.BUTTON_FRIENDLY); downloadButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { loadData(presenter.updateShared(bookEntry, SecurityUtils.getSubject().getPrincipal().toString())); } catch (SolrServerException | IOException ex) { Notification.show("Unexpected Error!\n" + ex.getMessage(), Notification.Type.ERROR_MESSAGE); logger.error(ex, ex); } } }); fileDownloader = new FileDownloader(new StreamResource(new BookStreamSource(null), "blbla.epub")); fileDownloader.extend(downloadButton); sendToKindleButton = new Button("Kindle", FontAwesome.BOOK); sendToKindleButton.addStyleName(ValoTheme.BUTTON_FRIENDLY); sendToKindleButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { presenter.shareBookWithKindle(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()); Notification.show("Book is sent to kindle", Notification.Type.HUMANIZED_MESSAGE); loadData(presenter.updateShared(bookEntry, SecurityUtils.getSubject().getPrincipal().toString())); } catch (SolrServerException | IOException | MessagingException ex) { Notification.show("Unexpected Error!\n" + ex.getMessage(), Notification.Type.ERROR_MESSAGE); logger.error(ex, ex); } } }); likeButton = new Button("0 likes", FontAwesome.THUMBS_O_UP); likeButton.addStyleName(ValoTheme.BUTTON_LINK); likeButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { BookEntry updatedEntry = presenter.updateLike(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()); loadData(updatedEntry); } catch (SolrServerException | IOException ex) { Notification.show("Unexpected Error!\n" + ex.getMessage(), Notification.Type.ERROR_MESSAGE); logger.error(ex, ex); } } }); watchListButton = new Button("merken", FontAwesome.STAR_O); watchListButton.addStyleName(ValoTheme.BUTTON_LINK); watchListButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { presenter.addRemoveFromWatchList(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()); loadData(bookEntry); } }); downloadCount = new Label("0 downloads"); VerticalLayout rightLayout = new VerticalLayout(sendToKindleButton, downloadButton, watchListButton, likeButton, downloadCount); rightLayout.setComponentAlignment(downloadCount, Alignment.MIDDLE_CENTER); rightLayout.setSpacing(true); HorizontalLayout layout = new HorizontalLayout(image, rightLayout); layout.setSpacing(true); return layout; }
From source file:de.fatalix.bookery.view.common.BookSearchLayout.java
License:Open Source License
private VerticalLayout createBookCoverLayout(final BookEntry bookEntry) { Image image = new Image(); image.setDescription(bookEntry.getTitle() + " von " + bookEntry.getAuthor()); image.setHeight("200px"); image.setWidth("130px"); image.setImmediate(true);// ww w.ja va2 s . c o m if (bookEntry.getThumbnail() != null) { StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getThumbnail()); image.setSource(new StreamResource(source, bookEntry.getId() + "_thumb.png")); } else if (bookEntry.getCover() != null) { StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getCover()); image.setSource(new StreamResource(source, bookEntry.getId() + ".png")); } final MButton watchListButton = new MButton() .withIcon(presenter.isOnWatchList(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()) ? FontAwesome.STAR : FontAwesome.STAR_O) .withStyleName(ValoTheme.BUTTON_LINK); watchListButton.addStyleName("quick-action"); watchListButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { watchListButton.setIcon(presenter.addRemoveFromWatchList(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()) ? FontAwesome.STAR : FontAwesome.STAR_O); } }); final MButton likeButton = new MButton().withCaption("" + bookEntry.getLikes()) .withIcon(FontAwesome.THUMBS_O_UP).withStyleName(ValoTheme.BUTTON_LINK); likeButton.addStyleName("quick-action"); likeButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { BookEntry updatedBook = presenter.updateLike(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()); bookEntry.setLikes(updatedBook.getLikes()); bookEntry.setLikedby(updatedBook.getLikedby()); likeButton.setCaption("" + bookEntry.getLikes()); } catch (SolrServerException | IOException ex) { java.util.logging.Logger.getLogger(BookSearchLayout.class.getName()).log(Level.SEVERE, null, ex); } } }); final MButton downloadsButton = new MButton().withCaption("" + bookEntry.getDownloads()) .withIcon(FontAwesome.DOWNLOAD).withStyleName(ValoTheme.BUTTON_LINK); downloadsButton.addStyleName("quick-action"); HorizontalLayout quickActionLayout = new HorizontalLayout(watchListButton, likeButton, downloadsButton); quickActionLayout.addStyleName("quick-action-layout"); VerticalLayout result = new VerticalLayout(image, quickActionLayout); //result.setHeight("210px"); //result.setWidth("140px"); result.addStyleName("pointer-cursor"); result.addStyleName("book-card"); result.setComponentAlignment(image, Alignment.MIDDLE_CENTER); result.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { bookDetailLayout.loadData(bookEntry); bookDetailLayout.setLayoutVisible(true); //BookDetailDialog dialogInstance = bookDetail.get(); //dialogInstance.loadData(bookEntry); //UI.getCurrent().addWindow(dialogInstance); } }); return result; }
From source file:de.fatalix.bookery.view.common.SuggestLaneLayout.java
License:Open Source License
public void loadLane(String title, List<BookEntry> bookEntries, String searchLink) { layout.removeAllComponents();/*from www . j a v a2s. co m*/ titleLabel.setValue(title); this.searchLink = searchLink; if (bookEntries.isEmpty()) { layout.addComponent(createEmptyDummy()); } else { boolean firstBookCover = true; for (BookEntry bookEntry : bookEntries) { VerticalLayout bookCoverLayout = createBookCoverLayout(bookEntry); if (firstBookCover) { bookCoverLayout.addStyleName("mobile"); firstBookCover = false; } else { bookCoverLayout.addStyleName("desktop"); } layout.addComponent(bookCoverLayout); } layout.addComponent(moreLink); layout.setComponentAlignment(moreLink, Alignment.MIDDLE_CENTER); } }