List of usage examples for com.vaadin.ui.themes ValoTheme LABEL_H2
String LABEL_H2
To view the source code for com.vaadin.ui.themes ValoTheme LABEL_H2.
Click Source Link
From source file:dhbw.clippinggorilla.userinterface.views.ClippingView.java
public Component createClippingRow(Article a) { Image imageNewsImage = new Image(); String url = a.getUrlToImage(); if (url == null || url.isEmpty()) { url = a.getSourceAsSource().getLogo().toExternalForm(); }//from w w w . j a v a 2s . c o m imageNewsImage.setSource(new ExternalResource(url)); imageNewsImage.addStyleName("articleimage"); VerticalLayout layoutNewsImage = new VerticalLayout(imageNewsImage); layoutNewsImage.setMargin(false); layoutNewsImage.setSpacing(false); layoutNewsImage.setWidth("200px"); layoutNewsImage.setHeight("150px"); layoutNewsImage.setComponentAlignment(imageNewsImage, Alignment.MIDDLE_CENTER); Label labelHeadLine = new Label(a.getTitle(), ContentMode.HTML); labelHeadLine.addStyleName(ValoTheme.LABEL_H2); labelHeadLine.addStyleName(ValoTheme.LABEL_NO_MARGIN); labelHeadLine.setWidth("100%"); Label labelDescription = new Label(a.getDescription(), ContentMode.HTML); labelDescription.setWidth("100%"); Image imageSource = new Image(); Source s = a.getSourceAsSource(); URL logo = null; if (s != null) { logo = s.getLogo(); } else { Log.error("Source is null: " + a.getSource()); return new Label("INTERNAL ERROR"); } if (logo != null) { imageSource.setSource(new ExternalResource(logo)); } else { Log.error("Sourcelogo is null: " + s.getName()); } imageSource.setHeight("30px"); Label labelSource = new Label(a.getSourceAsSource().getName()); labelSource.addStyleName(ValoTheme.LABEL_SMALL); LocalDateTime time = a.getPublishedAtAsLocalDateTime(); DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG); formatter.withZone(ZoneId.of("Europe/Berlin")); Label labelDate = new Label(time.format(formatter)); labelDate.addStyleName(ValoTheme.LABEL_SMALL); Label labelAuthor = new Label(); labelAuthor.addStyleName(ValoTheme.LABEL_SMALL); labelAuthor.setWidth("100%"); if (a.getAuthor() != null && !a.getAuthor().isEmpty()) { labelAuthor.setValue(a.getAuthor()); } Button openWebsite = new Button(VaadinIcons.EXTERNAL_LINK); openWebsite.addClickListener(e -> UI.getCurrent().getPage().open(a.getUrl(), "_blank", false)); HorizontalLayout layoutArticleOptions = new HorizontalLayout(); layoutArticleOptions.setWidth("100%"); layoutArticleOptions.addComponents(imageSource, labelSource, labelDate, labelAuthor, openWebsite); layoutArticleOptions.setComponentAlignment(imageSource, Alignment.MIDDLE_CENTER); layoutArticleOptions.setComponentAlignment(labelSource, Alignment.MIDDLE_CENTER); layoutArticleOptions.setComponentAlignment(labelDate, Alignment.MIDDLE_CENTER); layoutArticleOptions.setComponentAlignment(labelAuthor, Alignment.MIDDLE_LEFT); layoutArticleOptions.setComponentAlignment(openWebsite, Alignment.MIDDLE_CENTER); layoutArticleOptions.setExpandRatio(labelAuthor, 5); VerticalLayout layoutNewsText = new VerticalLayout(labelHeadLine, labelDescription, layoutArticleOptions); layoutNewsText.setMargin(false); layoutNewsText.setWidth("100%"); HorizontalLayout layoutClipping = new HorizontalLayout(); layoutClipping.setWidth("100%"); layoutClipping.setMargin(true); layoutClipping.addComponents(layoutNewsImage, layoutNewsText); layoutClipping.setComponentAlignment(layoutNewsImage, Alignment.MIDDLE_CENTER); layoutClipping.setExpandRatio(layoutNewsText, 5); layoutClipping.addStyleName(ValoTheme.LAYOUT_CARD); layoutClipping.addStyleName("tags"); return layoutClipping; }
From source file:dhbw.clippinggorilla.userinterface.views.ImpressumView.java
public ImpressumView() { setMargin(true);//from w ww . java 2 s.c o m setWidth("55%"); Label impressumHeader = new Label(); Language.set(Word.IMPRESSUM, impressumHeader); impressumHeader.setStyleName(ValoTheme.LABEL_H1); addComponent(impressumHeader); Label impressumText = new Label(); Language.set(Word.IMPRESSUM_BODY, impressumText); impressumText.setWidth("100%"); impressumText.setContentMode(com.vaadin.shared.ui.ContentMode.HTML); addComponent(impressumText); Grid<Person> studentsGrid = new Grid<>(); List<Person> persons = Arrays.asList(new Person("Dan-Pierre", "Drehlich", Person.Function.TEAMLEADER), new Person("Stefan", "Schmid", Person.Function.RESPONSIBLE_FOR_RESEARCH), new Person("Jan", "Striegel", Person.Function.TECHNICAL_ASSISTANT), new Person("Lisa", "Hartung", Person.Function.RESPONSIBLE_FOR_MODELING_QUALITY_ASSURANCE_AND_DOCUMENTATION), new Person("Tim", "Heinzelmann", Person.Function.RESPONSIBLE_FOR_TESTS), new Person("Josua", "Frank", Person.Function.RESPONSIBLE_FOR_IMPLEMENTATION)); Column c1 = studentsGrid.addColumn(p -> p.getFirstName()); Language.setCustom(Word.FIRST_NAME, s -> c1.setCaption(s)); Column c2 = studentsGrid.addColumn(p -> p.getLastName()); Language.setCustom(Word.LAST_NAME, s -> c2.setCaption(s)); Column c3 = studentsGrid.addColumn(p -> p.getResposibility()); Language.setCustom(Word.RESPONSIBILITY, s -> { c3.setCaption(s); studentsGrid.getDataProvider().refreshAll(); }); studentsGrid.setItems(persons); studentsGrid.setWidth("100%"); studentsGrid.setHeightByRows(6); addComponent(studentsGrid); Label liabilityHeadline = new Label(); Language.set(Word.LIABILITY, liabilityHeadline); liabilityHeadline.setStyleName(ValoTheme.LABEL_H1); addComponent(liabilityHeadline); Label liabilityContentHeadline = new Label(); Language.set(Word.LIABILITY_CONTENT, liabilityContentHeadline); liabilityContentHeadline.setStyleName(ValoTheme.LABEL_H2); addComponent(liabilityContentHeadline); Label liabilityContentText = new Label(); Language.set(Word.LIABILITY_CONTENT_BODY, liabilityContentText); liabilityContentText.setWidth("100%"); addComponent(liabilityContentText); Label liabilityLinksHeadline = new Label(); Language.set(Word.LIABILITY_LINKS, liabilityLinksHeadline); liabilityLinksHeadline.setStyleName(ValoTheme.LABEL_H2); addComponent(liabilityLinksHeadline); Label liabilityLinksText = new Label(); Language.set(Word.LIABILITY_LINKS_BODY, liabilityLinksText); liabilityLinksText.setWidth("100%"); addComponent(liabilityLinksText); Label copyrightHeadline = new Label(); Language.set(Word.COPYRIGHT, copyrightHeadline); copyrightHeadline.setStyleName(ValoTheme.LABEL_H2); addComponent(copyrightHeadline); Label copyrightText = new Label(); Language.set(Word.COPYRIGHT_BODY, copyrightText); copyrightText.setWidth("100%"); addComponent(copyrightText); Label dataProtectionHeadline = new Label(); Language.set(Word.DATAPROTECTION, dataProtectionHeadline); dataProtectionHeadline.setStyleName(ValoTheme.LABEL_H2); addComponent(dataProtectionHeadline); Label dataProtectionText = new Label(); Language.set(Word.DATAPROTECTION_BODY, dataProtectionText); dataProtectionText.setWidth("100%"); addComponent(dataProtectionText); SESSIONS.put(VaadinSession.getCurrent(), this); }
From source file:dhbw.clippinggorilla.userinterface.windows.ManageSourcesWindow.java
public void refreshSources() { sourcesLayout.removeAllComponents(); SourceUtils.getSources().stream().sorted((s1, s2) -> s1.getName().compareToIgnoreCase(s2.getName())) .forEach(source -> {//from w w w.ja v a 2s . c o m try { GridLayout sourceLayout = new GridLayout(4, 1); sourceLayout.setSizeFull(); Image sourceLogo = new Image(); URL url = source.getLogo(); if (url != null) { sourceLogo.setSource(new ExternalResource(url)); } sourceLogo.setWidth("150px"); VerticalLayout sourceText = new VerticalLayout(); sourceText.setSizeFull(); Label labelHeadLine = new Label( source.getCategory().getIcon().getHtml() + " " + source.getName(), ContentMode.HTML); labelHeadLine.addStyleName(ValoTheme.LABEL_H2); Label labelDescription = new Label(source.getDescription(), ContentMode.HTML); labelDescription.addStyleName(ValoTheme.LABEL_SMALL); labelDescription.setWidth("100%"); sourceText.setMargin(false); sourceText.addComponents(labelHeadLine, labelDescription); Button buttonEdit = new Button(VaadinIcons.EDIT); buttonEdit.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonEdit.addClickListener( ce -> UI.getCurrent().addWindow(NewSourceWindow.createEditMode(source))); Button buttonDelete = new Button(VaadinIcons.TRASH); buttonDelete.addStyleName(ValoTheme.BUTTON_DANGER); buttonDelete.addClickListener(ce -> { sourcesLayout.removeComponent(sourceLayout); sourceLayouts.remove(source.getName().toLowerCase().replaceAll(" ", "") .replaceAll("-", "").replaceAll("_", "")); SourceUtils.removeSource(source); }); sourceLayout.addComponents(sourceLogo, sourceText, buttonEdit, buttonDelete); sourceLayout.setComponentAlignment(sourceLogo, Alignment.MIDDLE_CENTER); sourceLayout.setComponentAlignment(buttonEdit, Alignment.MIDDLE_CENTER); sourceLayout.setComponentAlignment(buttonDelete, Alignment.MIDDLE_CENTER); sourceLayout.setColumnExpandRatio(1, 5); sourceLayout.setSpacing(true); sourceLayouts.put(source.getName().toLowerCase().replaceAll(" ", "").replaceAll("-", "") .replaceAll("_", ""), sourceLayout); sourcesLayout.addComponent(sourceLayout); } catch (Exception e) { Log.error("Skipping Source! ", e); } }); }
From source file:fi.jasoft.qrcode.demo.QRCodeDemo.java
License:Apache License
@Override protected void init(VaadinRequest request) { VerticalLayout content = new VerticalLayout(); content.setSizeFull();//from w ww . j a va 2 s .co m setContent(content); Label header = new Label("QR Code Generator"); header.setStyleName(ValoTheme.LABEL_H2); content.addComponent(header); HorizontalSplitPanel root = new HorizontalSplitPanel(); root.setSizeFull(); root.setSplitPosition(50, Unit.PERCENTAGE); root.setLocked(true); Panel panel = new Panel(root); panel.setSizeFull(); content.addComponent(panel); content.setExpandRatio(panel, 1); VerticalLayout first = new VerticalLayout(); first.setSizeFull(); root.setFirstComponent(first); first.addComponent( new HorizontalLayout(createPrimaryColorSelect(), createSecondaryColorSelect(), createSizeSelect())); code = new QRCode(); code.setWidth("100px"); code.setHeight("100px"); final TextArea text = new TextArea("Text embedded in QR Code"); text.setPlaceholder("Type the message of the QR code here"); text.setSizeFull(); text.setValueChangeMode(ValueChangeMode.LAZY); text.addValueChangeListener(e -> { code.setValue(e.getValue()); }); first.addComponent(text); first.setExpandRatio(text, 1); VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); vl.addComponent(code); vl.setComponentAlignment(code, Alignment.MIDDLE_CENTER); root.setSecondComponent(vl); }
From source file:org.jpos.qi.system.EmptyView.java
License:Open Source License
public EmptyView(boolean canAdd) { Label emptyLabel = new Label("There are no items in this view"); emptyLabel.addStyleName(ValoTheme.LABEL_H2); addComponents(emptyLabel);//from ww w .j a va 2 s . co m setComponentAlignment(emptyLabel, Alignment.TOP_CENTER); setExpandRatio(emptyLabel, 0); if (canAdd) { Button addNew = new Button(QI.getQI().getMessage("add")); addNew.setIcon(VaadinIcons.PLUS); String actualRoute = QI.getQI().getNavigator().getState(); addNew.addClickListener(listener -> QI.getQI().getNavigator().navigateTo(actualRoute + "/new")); addNew.addStyleName(ValoTheme.BUTTON_LARGE); addNew.addStyleName(ValoTheme.BUTTON_FRIENDLY); addComponent(addNew); setComponentAlignment(addNew, Alignment.TOP_CENTER); setExpandRatio(addNew, 1); } }
From source file:org.opencms.workplace.tools.git.ui.CmsGitActionResultPanel.java
License:Open Source License
/** * Creates a dialog window with the git action result. * @param message the message written at top. * @param log the log output//from w w w . j a va2 s.c o m * @param isError flag, indicating if an error occurred. * @param buttons the buttons to show at the bottom of the dialog. */ public CmsGitActionResultPanel(String message, String log, boolean isError, List<Button> buttons) { CmsVaadinUtils.readAndLocalizeDesign(this, CmsVaadinUtils.getWpMessagesForCurrentLocale(), null); m_logLabel.setContentMode(ContentMode.PREFORMATTED); if (isError) { m_messageLabel.addStyleName(OpenCmsTheme.LABEL_ERROR); } m_messageLabel.setValue(message); m_logLabel.setValue(log); for (Button button : buttons) { addButton(button); } m_messageLabel.addStyleName(ValoTheme.LABEL_H2); }
From source file:org.vaadin.peholmst.samples.dddwebinar.ui.appointments.BillingSection.java
@PostConstruct void init() {/*from w ww. j a v a 2s .c o m*/ setSpacing(true); setMargin(false); setSizeFull(); Label title = new Label("Billing"); title.addStyleName(ValoTheme.LABEL_H2); addComponent(title); ledgerContainer = new BeanItemContainer<>(LedgerEntry.class); ledger = new Grid("Ledger", ledgerContainer); ledger.setSizeFull(); ledger.setSelectionMode(Grid.SelectionMode.NONE); ledger.setColumns("entryDate", "entryDescription", "entryAmount"); ledger.getColumn("entryDate").setHeaderCaption("Date"); ledger.getColumn("entryDescription").setHeaderCaption("Description"); ledger.getColumn("entryAmount").setHeaderCaption("Amount").setConverter(new MoneyConverter()); ledger.addFooterRowAt(0).getCell("entryDescription").setText("Outstanding"); addComponent(ledger); setExpandRatio(ledger, 1.0f); Accordion receivables = new Accordion(); receivables.setSizeFull(); addComponent(receivables); setExpandRatio(receivables, 1.0f); claimSubSection = new ClaimSubSection(); receivables.addTab(claimSubSection, "Insurance Claim"); invoiceSubSection = new InvoiceSubSection(); receivables.addTab(invoiceSubSection, "Invoice"); model.addObserver(this); // Same scope, no need to remove afterwards }
From source file:org.vaadin.peholmst.samples.dddwebinar.ui.appointments.DoctorSection.java
@PostConstruct void init() {// w w w. j av a2s . c om setSizeFull(); setSpacing(true); Label title = new Label("Doctor"); title.addStyleName(ValoTheme.LABEL_H2); addComponent(title); doctorName = new TextField("Name"); doctorName.setWidth("100%"); addComponent(doctorName); licenseContainer = new BeanItemContainer<>(License.class); licenseContainer.addNestedContainerProperty("type.name"); Grid doctorLicenses = new Grid("Licenses", licenseContainer); doctorLicenses.setColumns("number", "type.name"); doctorLicenses.setSizeFull(); doctorLicenses.setSelectionMode(Grid.SelectionMode.NONE); addComponent(doctorLicenses); setExpandRatio(doctorLicenses, 1.0f); model.addObserver(this); // Same scope, no need to remove afterwards }
From source file:tad.grupo7.ccamistadeslargas.EventosLayout.java
/** * Se muestra el evento en el vertical layout derecho del splitpanel. * * @param e Recoge el evento que se quiere mostrar. */// w w w . j a va 2s .c o m private void mostrarEvento(Evento e) { removeAllComponents(); //T?TULO CssLayout labels = new CssLayout(); labels.addStyleName("labels"); Label l = new Label("Evento " + e.getNombre()); l.setSizeUndefined(); l.addStyleName(ValoTheme.LABEL_H2); l.addStyleName(ValoTheme.LABEL_COLORED); //FORMULARIO POR SI SE QUIERE EDITAR EL EVENTO TextField nombre = new TextField("Nombre"); nombre.setValue(e.getNombre()); nombre.setRequired(true); ComboBox divisa = new ComboBox("Divisa"); divisa.setNullSelectionAllowed(false); divisa.setRequired(true); divisa.addItem(""); divisa.addItem("$"); HorizontalLayout layouth = new HorizontalLayout(); HorizontalLayout layouth2 = new HorizontalLayout(); layouth.setSpacing(true); layouth2.setSpacing(true); final Button actualizar = new Button("Actualizar Evento"); final Button eliminar = new Button("Eliminar Evento"); final Button addPago = new Button("Aadir Pago"); final Button addParticipante = new Button("Aadir Participante"); layouth.addComponents(actualizar, eliminar); layouth2.addComponents(addPago, addParticipante); final Button hacerCuentas = new Button("Hacer las cuentas"); //BOTN PARA ACTUALIZAR EL EVENTO actualizar.addClickListener(clickEvent -> { try { nombre.validate(); divisa.validate(); if (EventoDAO.readDBObject(nombre.getValue(), usuario.getId()) == null) { EventoDAO.update(e.getId(), nombre.getValue(), divisa.getValue().toString()); Notification n = new Notification("Evento actualizado", Notification.Type.ASSISTIVE_NOTIFICATION); n.setPosition(Position.TOP_CENTER); n.show(Page.getCurrent()); mostrarEventos(); } else { Notification n = new Notification("Ya existe un evento con ese nombre", Notification.Type.WARNING_MESSAGE); n.setPosition(Position.TOP_CENTER); n.show(Page.getCurrent()); } } catch (Validator.InvalidValueException ex) { Notification n = new Notification("Error con los campos", Notification.Type.WARNING_MESSAGE); n.setPosition(Position.TOP_CENTER); n.show(Page.getCurrent()); } }); //BOTN PARA QUE SALGA UNA VENTANA EMERGENTE PARA AADIR UN GASTO AL EVENTO addPago.addClickListener(clickEvent -> { mostrarFormularioAddGasto(e); }); //BOTN PARA ELIMINAR EL EVENTO eliminar.addClickListener(clickEvent -> { EventoDAO.delete(e.getId()); removeAllComponents(); mostrarEventos(); }); //BOTN PARA AADIR PARTICIPANTES addParticipante.addClickListener(clickEvent -> { mostrarFormularioAddParticipante(e); }); //BOTN PARA HACER LAS CUENTAS hacerCuentas.addClickListener(clickEvent -> { removeAllComponents(); VerticalLayout vl = new VerticalLayout(); Table tablaResumenPlusvalia = getTablaResumenPlusvalia(e); HorizontalLayout hl1 = new HorizontalLayout(tablaResumenPlusvalia); hl1.setMargin(true); hl1.setSpacing(true); vl.addComponent(hl1); for (Participante p : ParticipanteDAO.readAllFromEvento(e.getId())) { HorizontalLayout hl = new HorizontalLayout(getTablaResumenGastosPorPersona(e, p)); hl.setMargin(true); hl.setSpacing(true); vl.addComponent(hl); } setSplitPosition(100, Sizeable.UNITS_PERCENTAGE); setFirstComponent(vl); }); //TABLA CON TODOS LOS GASTOS DEL EVENTO Table tablaGastos = getTablaGastos(e); //TABLA CON TODOS LOS PARTICIPANTES DEL EVENTO Table tablaParticipantes = getTablaParticipantes(e); //AADIMOS LOS COMPONENTES FormLayout form = new FormLayout(nombre, divisa, layouth, layouth2, hacerCuentas); VerticalLayout vl = new VerticalLayout(l, form, tablaGastos, tablaParticipantes); vl.setMargin(true); setFirstComponent(vl); }
From source file:tad.grupo7.ccamistadeslargas.EventosLayout.java
/** * Se muestra un gasto para poder actualizarlo o eliminarlo. * * @param e Recoge el evento al que pertenece el gasto. *//*from w ww . ja v a 2 s. c om*/ private void mostrarGasto(Gasto g, Evento e) { //T?TULO CssLayout labels = new CssLayout(); labels.addStyleName("labels"); Label l = new Label("Gasto " + g.getNombre()); l.setSizeUndefined(); l.addStyleName(ValoTheme.LABEL_H2); l.addStyleName(ValoTheme.LABEL_COLORED); //FORMULARIO POR SI SE QUIERE EDITAR EL GASTO TextField nombre = new TextField("Titulo"); nombre.setValue(g.getNombre()); nombre.setRequired(true); TextField precio = new TextField("Precio"); precio.setValue(g.getPrecio().toString()); precio.setRequired(true); final Button actualizar = new Button("Actualizar Gasto"); final Button eliminar = new Button("Eliminar Gasto"); //BOTN PARA ACTUALIZAR EL GASTO actualizar.addClickListener(clickEvent -> { try { nombre.validate(); precio.validate(); GastoDAO.update(g.getId(), nombre.getValue(), Double.valueOf(precio.getValue()), g.getIdEvento(), g.getIdPagador(), g.getDeudores()); Notification n = new Notification("Gasto actualizado", Notification.Type.ASSISTIVE_NOTIFICATION); n.setPosition(Position.TOP_CENTER); n.show(Page.getCurrent()); setSecondComponent(null); mostrarEvento(e); } catch (Validator.InvalidValueException ex) { Notification n = new Notification("Error con los campos", Notification.Type.WARNING_MESSAGE); n.setPosition(Position.TOP_CENTER); n.show(Page.getCurrent()); } }); //BOTN PARA ELIMINAR EL GASTO eliminar.addClickListener(clickEvent -> { GastoDAO.delete(g.getId()); removeAllComponents(); mostrarEvento(e); }); //AADIMOS LOS COMPONENTES FormLayout form = new FormLayout(nombre, precio, actualizar, eliminar); VerticalLayout vl = new VerticalLayout(l, form); vl.setMargin(true); setSecondComponent(vl); }