List of usage examples for com.vaadin.ui Label addStyleName
@Override public void addStyleName(String style)
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 av a 2 s .com 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.bookery.AppHeader.java
License:Open Source License
private MHorizontalLayout createSearchBar() { Label header = new Label("Bookery"); header.addStyleName(ValoTheme.LABEL_BOLD); header.setSizeUndefined();/*from w w w. j a va2 s. c om*/ header.addStyleName(ValoTheme.LABEL_H3); searchText = new TextField(); searchText.setIcon(FontAwesome.SEARCH); searchText.addStyleName(ValoTheme.TEXTFIELD_LARGE); searchText.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); searchText.setWidth(100, Unit.PERCENTAGE); searchText.setInputPrompt("hier einfach suchen.."); Button searchButton = new Button("such!", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Navigator navigator = ((App) UI.getCurrent()).getNavigator(); if (navigator.getState().contains("search")) { navigator.navigateTo(navigator.getState()); } else { navigator.navigateTo(SearchView.id); } } }); searchButton.addStyleName(ValoTheme.BUTTON_LARGE); searchText.addShortcutListener(new Button.ClickShortcut(searchButton, ShortcutAction.KeyCode.ENTER)); MHorizontalLayout layout = new MHorizontalLayout(header, searchText, searchButton); layout.setWidth(100, Unit.PERCENTAGE); layout.setExpandRatio(searchText, 1.0f); return layout; }
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();/*w w w . j a v a 2 s.c om*/ 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.AdminView.java
License:Open Source License
public VerticalLayout createServerSettings() { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*from w ww . j a v a 2s . com*/ Label titleLabel = new Label("General Settings"); titleLabel.addStyleName(ValoTheme.LABEL_H2); //layout.addComponent(titleLabel); layout.addComponent(serverSettingsLayout); Button resetIndex = new Button("reset Index", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { presenter.resetIndex(); Notification.show("Succesfully reset Index", Notification.Type.HUMANIZED_MESSAGE); } catch (IOException | SolrServerException ex) { Notification.show(ex.getMessage(), Notification.Type.ERROR_MESSAGE); } } }); resetIndex.addStyleName(ValoTheme.BUTTON_DANGER); final TextField eMailAdress = new TextField(null, "felix.husse@medavis.de"); eMailAdress.setColumns(35); Button testMail = new Button("Test Mail", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { presenter.sendEmail(eMailAdress.getValue()); Notification.show("Mail succesfully sent!", Notification.Type.HUMANIZED_MESSAGE); } catch (MessagingException ex) { Notification.show("Mail failed!" + ex.getMessage(), Notification.Type.ERROR_MESSAGE); } } }); testMail.setEnabled(true); Button resetBatchJobs = new Button("reset BatchJobs", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { presenter.resetBatchJobs(); Notification.show("Succesfully reset Batchjobs", Notification.Type.HUMANIZED_MESSAGE); } }); resetBatchJobs.addStyleName(ValoTheme.BUTTON_DANGER); HorizontalLayout mailLayout = new HorizontalLayout(eMailAdress, testMail, resetBatchJobs); layout.addComponents(resetIndex, mailLayout); return layout; }
From source file:de.fatalix.bookery.view.admin.BatchJobsLayout.java
private Layout createEmptyLayout() { Label label = new Label("Add new job..."); label.setSizeUndefined();//from ww w.ja v a2 s .com 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.admin.ServerSettingsLayout.java
License:Open Source License
@PostConstruct private void postInit() { addStyleName("bookery-content"); formLayout = new FormLayout(); formLayout.addStyleName("light"); formLayout.addComponents(generateFields()); formLayout.addComponents(generateStatusFields()); Button checkSolr = new Button("check", new Button.ClickListener() { @Override/*from w w w . ja v a 2s . c o m*/ public void buttonClick(Button.ClickEvent event) { checkSolr(); } }); checkSolr.addStyleName(ValoTheme.BUTTON_SMALL); checkSolr.addStyleName(ValoTheme.BUTTON_FRIENDLY); formLayout.addComponent(checkSolr); Label titleLabel = new Label("General Settings"); titleLabel.addStyleName(ValoTheme.LABEL_H2); addComponents(titleLabel, formLayout); }
From source file:de.fatalix.bookery.view.admin.ServerSettingsLayout.java
License:Open Source License
private Label[] generateStatusFields() { statusFields = new ArrayList<>(); Label solrStatus = new Label("Offline " + FontAwesome.TIMES_CIRCLE.getHtml(), ContentMode.HTML); solrStatus.addStyleName("red-icon"); solrStatus.setCaption("Status"); statusFields.add(solrStatus);/* w ww . j ava 2 s. co m*/ Label numberOfDocs = new Label("100"); numberOfDocs.setCaption("Library"); statusFields.add(numberOfDocs); Label sizeOnDisk = new Label("73MB"); sizeOnDisk.setCaption("Size"); statusFields.add(sizeOnDisk); Label[] result = new Label[statusFields.size()]; return statusFields.toArray(result); }
From source file:de.fatalix.bookery.view.admin.ServerSettingsLayout.java
License:Open Source License
private void checkSolr() { try {/* w w w . j a v a 2s.c om*/ long numDocs = presenter.getSolrInfo(); for (Label label : statusFields) { if (label.getCaption().equals("Status")) { label.setValue("Online " + FontAwesome.CHECK_CIRCLE.getHtml()); label.removeStyleName("red-icon"); label.addStyleName("green-icon"); } else if (label.getCaption().equals("Library")) { label.setValue(numDocs + " Books"); } } } catch (SolrServerException | IOException ex) { logger.error(ex, ex); for (Label label : statusFields) { if (label.getCaption().equals("Status")) { label.setValue(ex.getLocalizedMessage() + " " + FontAwesome.CHECK_CIRCLE.getHtml()); label.addStyleName("red-icon"); label.removeStyleName("green-icon"); } else if (label.getCaption().equals("Num Docs")) { label.setValue("NA"); } } } }
From source file:de.fatalix.bookery.view.common.BookMenuLayout.java
@PostConstruct private void postInit() { addStyleName("bookery-menu-wrapper"); addStyleName("bookery-menu"); Label titleLabel = new Label("Bookery Menu"); titleLabel.addStyleName(ValoTheme.LABEL_COLORED); titleLabel.addStyleName(ValoTheme.LABEL_BOLD); Button cancelButton = new Button("close", new Button.ClickListener() { @Override// ww w. ja v a2 s. c om public void buttonClick(Button.ClickEvent event) { setLayoutVisible(false); } }); cancelButton.setClickShortcut(ShortcutAction.KeyCode.ESCAPE); cancelButton.addStyleName(ValoTheme.BUTTON_DANGER); VerticalLayout rootLayout = new VerticalLayout(titleLabel, cancelButton); rootLayout.setSpacing(true); addComponent(rootLayout); }
From source file:de.fatalix.bookery.view.common.SuggestLaneLayout.java
License:Open Source License
private VerticalLayout createEmptyDummy() { Label label = new Label("hab nix gfundn"); label.addStyleName(ValoTheme.LABEL_H2); label.addStyleName(ValoTheme.LABEL_COLORED); label.setSizeUndefined();//from w w w .j ava2 s. c o m VerticalLayout dummyLayout = new VerticalLayout(label); dummyLayout.setHeight("150px"); dummyLayout.setWidth("800px"); dummyLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); return dummyLayout; }