Example usage for com.vaadin.ui Label setStyleName

List of usage examples for com.vaadin.ui Label setStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Label setStyleName.

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

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 ww  w  .  j a va 2  s .c om*/
    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:fi.jasoft.simplecalendar.demo.SimpleCalendarDemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    setLocale(DEFAULT_LOCALE);//from  w ww  .j a  v  a2 s. co  m

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);

    Label lbl = new Label("SimpleCalendar");
    lbl.setStyleName(Reindeer.LABEL_H1);
    content.addComponent(lbl);

    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth("100%");
    layout.setSpacing(true);

    final SimpleCalendar calendar = new SimpleCalendar();
    calendar.setImmediate(true);
    calendar.addValueChangeListener(new Property.ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            Notification.show(calendar.getValue().toString());
        }
    });

    calendar.setMultiSelect(true);

    layout.addComponent(calendar);

    Label description = new Label("A calendar component that supports the following features:<ul>"
            + "<li>Selecting multiple dates by control click</li>" + "<li>Range selection with shift click</li>"
            + "<li>Keyboard navigation with arrow keys</li>" + "<li>Possibility to disable certain dates</li>"
            + "<li>Date tooltips</li>" + "<li>Limit start and end dates of calendar</li>"
            + "<li>Selecting multiple locales", ContentMode.HTML);
    layout.addComponent(description);
    layout.setExpandRatio(description, 1);

    content.addComponent(layout);

    BeanItemContainer<Locale> locales = new BeanItemContainer<Locale>(Locale.class);
    locales.addAll(Arrays.asList(Locale.getAvailableLocales()));

    NativeSelect localeSelect = new NativeSelect();
    localeSelect.setContainerDataSource(locales);
    localeSelect.setValue(DEFAULT_LOCALE);
    localeSelect.setImmediate(true);
    localeSelect.setItemCaptionMode(ItemCaptionMode.PROPERTY);
    localeSelect.setItemCaptionPropertyId("displayName");
    localeSelect.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            calendar.setLocale((Locale) event.getProperty().getValue());
        }
    });
    content.addComponent(new HorizontalLayout(new Label("Locale:"), localeSelect));

    final CheckBox disableWeekends = new CheckBox("Disable weekends", false);
    disableWeekends.setImmediate(true);
    disableWeekends.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (disableWeekends.getValue()) {
                calendar.setDisabledWeekDays(Weekday.SATURDAY, Weekday.SUNDAY);
            } else {
                calendar.setDisabledWeekDays();
            }
        }
    });
    content.addComponent(disableWeekends);

    final CheckBox disable15th = new CheckBox("Disable 15th each month", false);
    disable15th.setImmediate(true);
    disable15th.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (disable15th.getValue()) {
                calendar.setDisabledMonthlyDates(15);
            } else {
                calendar.setDisabledMonthlyDates();
            }
        }
    });
    content.addComponent(disable15th);

    final CheckBox disableToday = new CheckBox("Disable todays date", false);
    disableToday.setImmediate(true);
    disableToday.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (disableToday.getValue()) {
                calendar.setDisabledDates(new Date());
            } else {
                calendar.setDisabledDates();
            }
        }
    });
    content.addComponent(disableToday);

    final CheckBox allowFutureDate = new CheckBox("Only allow future dates", false);
    allowFutureDate.setImmediate(true);
    allowFutureDate.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (allowFutureDate.getValue()) {
                calendar.setStartDate(new Date());
            } else {
                calendar.setStartDate(null);
            }
        }
    });
    content.addComponent(allowFutureDate);

    final CheckBox allowPastDate = new CheckBox("Only allow past dates", false);
    allowPastDate.setImmediate(true);
    allowPastDate.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (allowPastDate.getValue()) {
                calendar.setEndDate(new Date());
            } else {
                calendar.setEndDate(null);
            }
        }
    });
    content.addComponent(allowPastDate);

    setContent(content);
}

From source file:fr.amapj.view.engine.grid.booleangrid.PopupBooleanGrid.java

License:Open Source License

private void displayErrorOnInitialCondition(String str, VerticalLayout mainLayout) {
    Label label = new Label(str, ContentMode.HTML);
    label.setStyleName(ChameleonTheme.LABEL_BIG);
    mainLayout.addComponent(label);/*from ww w.j av a  2 s . co m*/
}

From source file:fr.amapj.view.engine.popup.errorpopup.ErrorPopup.java

License:Open Source License

protected void createContent(VerticalLayout contentLayout) {
    setColorStyle(ColorStyle.RED);/*from  w w  w. ja v  a 2 s .c  o m*/

    // Message logg 
    SessionParameters p = SessionManager.getSessionParameters();
    String debugMessage = null;
    if (p != null) {
        debugMessage = p.userNom + " " + p.userPrenom + " a rencontr une erreur :" + message;
        p.incNbError();
    } else {
        debugMessage = "Pas d'utilisateur encore logg. Erreur :" + message;
    }
    logger.info(debugMessage, throwable);

    String constraintInfo = getConstraintInfo(throwable);
    if (constraintInfo != null) {
        logger.info("Constraint Information:" + constraintInfo);
    }

    // Message utilisateur
    String msg = "Dsol, une erreur est survenue.<br/>";
    if (message != null) {
        msg = msg + "Information supplmentaire:<br/>" + message + "<br/>";
    }
    if (constraintInfo != null) {
        msg = msg + "<br/>" + constraintInfo + "<br/>";
    }

    msg = msg + "Veuillez cliquer sur OK pour continuer<br/>";

    // Construction de la zone de texte
    HorizontalLayout hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);
    hlTexte.setSpacing(true);
    hlTexte.setWidth("100%");

    Label textArea = new Label(msg, ContentMode.HTML);
    textArea.setStyleName(ChameleonTheme.TEXTFIELD_BIG);
    textArea.setWidth("80%");

    hlTexte.addComponent(textArea);
    hlTexte.setExpandRatio(textArea, 1);
    hlTexte.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);
}

From source file:fr.amapj.view.engine.popup.formpopup.AbstractFormPopup.java

License:Open Source License

protected Label addLabel(String content, ContentMode mode) {
    Label l = new Label(content, mode);
    l.setStyleName(ChameleonTheme.LABEL_BIG);
    l.setWidth("80%");
    form.addComponent(l);//from w w w . j a  v a2s  . co  m

    return l;
}

From source file:fr.amapj.view.engine.popup.formpopup.tab.TabFormPopup.java

License:Open Source License

protected void createContent(VerticalLayout contentLayout) {
    ////  w w w .  ja v a  2s  .  c om
    contentLayout.addStyleName("wizard-popup"); // TODO 

    // Vrification des conditions initiales
    String str = checkInitialCondition();
    if (str != null) {
        errorInInitialCondition = true;
        Label label = new Label(str, ContentMode.HTML);
        label.setStyleName(ChameleonTheme.LABEL_BIG);
        contentLayout.addComponent(label);
        return;
    }

    // Mise en place des onglets
    addTabInfo();
    tabSheet = new TabSheet();
    for (int i = 0; i < tabInfos.size(); i++) {
        TabInfo tabInfo = tabInfos.get(i);

        tabInfo.verticalLayout = new VerticalLayout();
        tabInfo.verticalLayout.setData(i);
        tabSheet.addTab(tabInfo.verticalLayout, tabInfo.tabName);
    }
    tabSheet.addSelectedTabChangeListener(this);
    contentLayout.addComponent(tabSheet);

    vLayout = new VerticalLayout();
    contentLayout.addComponent(vLayout);

    // Affichage du premier onglet 
    updateForm(tabInfos.get(0));
    selectedTab = 0;

}

From source file:fr.amapj.view.engine.popup.formpopup.WizardFormPopup.java

License:Open Source License

private void displayErrorOnInitialCondition(String str) {
    Label label = new Label(str, ContentMode.HTML);
    label.setStyleName(ChameleonTheme.LABEL_BIG);
    contentLayout.addComponent(label);/*from www.java  2 s.c  om*/
}

From source file:fr.amapj.view.engine.popup.suppressionpopup.SuppressionPopup.java

License:Open Source License

protected void createContent(VerticalLayout contentLayout) {

    setWidth(40, 450);/*from ww  w . jav  a2  s  .  c o m*/

    // Construction de la zone de texte
    HorizontalLayout hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);
    hlTexte.setSpacing(true);
    hlTexte.setWidth("100%");

    Label textArea = new Label(message);
    textArea.setStyleName(ChameleonTheme.TEXTFIELD_BIG);
    textArea.setWidth("80%");

    hlTexte.addComponent(textArea);
    hlTexte.setExpandRatio(textArea, 1);
    hlTexte.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);

    if (secured) {
        hlTexte = new HorizontalLayout();
        hlTexte.setMargin(true);
        hlTexte.setSpacing(true);
        hlTexte.setWidth("100%");

        textArea = new Label(
                "Veuillez confirmer en saississant le mot SUPPRIMER dans le champ de saisie ci dessous");
        textArea.setStyleName(ChameleonTheme.TEXTFIELD_BIG);
        textArea.setWidth("80%");

        hlTexte.addComponent(textArea);
        hlTexte.setExpandRatio(textArea, 1);
        hlTexte.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);

        contentLayout.addComponent(hlTexte);

        hlTexte = new HorizontalLayout();
        hlTexte.setMargin(true);
        hlTexte.setSpacing(true);
        hlTexte.setWidth("100%");

        TextField textField = new TextField();
        textField.setStyleName(ChameleonTheme.TEXTFIELD_BIG);
        textField.setWidth("80%");
        textField.setImmediate(true);
        textField.setBuffered(false);

        hlTexte.addComponent(textField);
        hlTexte.setExpandRatio(textField, 1);
        hlTexte.setComponentAlignment(textField, Alignment.MIDDLE_CENTER);

        textField.addTextChangeListener(new TextChangeListener() {
            @Override
            public void textChange(TextChangeEvent event) {
                if (event.getText().equals("SUPPRIMER")) {
                    okButton.setEnabled(true);
                } else {
                    okButton.setEnabled(false);
                }
            }
        });

        contentLayout.addComponent(hlTexte);
    }

}

From source file:fr.amapj.view.views.gestioncontratsignes.PopupCopyAllMailForContrat.java

License:Open Source License

protected void createContent(VerticalLayout contentLayout) {

    List<String> mails = new GestionContratSigneService().getAllMails(idModeleContrat);

    // Construction de la zone de texte explicative
    String msg = "Pour envoyer un mail  tous adhrents de ce contrat , vous devez :<br/><ul>"
            + "<li>Faire un copier de toutes les adresses e-mail en faisant Ctrl+C ou en faisant clic droit + Copier sur la zone bleue ci dessous</li>"
            + "<li>Ouvrir votre outil favori pour l'envoi des mails (Thunderbird, Gmail, Outlook, ...)</li>"
            + "<li>Faire nouveau message</li>"
            + "<li>Faire un coller de toutes les adresses e-mail en faisant Ctrl+V ou en faisant clic droit + Coller dans la liste des destinataires du message.</li></ul>";

    HorizontalLayout hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);/* w w w .  j ava 2 s . c  o  m*/
    hlTexte.setSpacing(true);
    hlTexte.setWidth("100%");

    Label textArea = new Label(msg, ContentMode.HTML);
    textArea.setStyleName(ChameleonTheme.TEXTFIELD_BIG);
    textArea.setWidth("80%");

    hlTexte.addComponent(textArea);
    hlTexte.setExpandRatio(textArea, 1);
    hlTexte.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);

    // Construction de la zone d'affichage des mails
    hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);
    hlTexte.setSpacing(true);
    hlTexte.setWidth("100%");

    TextArea listeMails = new TextArea("");
    listeMails.setValue(CollectionUtils.asString(mails, ","));
    listeMails.setReadOnly(true);
    listeMails.selectAll();
    listeMails.setWidth("80%");
    listeMails.setHeight(5, Unit.CM);

    hlTexte.addComponent(listeMails);
    hlTexte.setExpandRatio(listeMails, 1);
    hlTexte.setComponentAlignment(listeMails, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);

}

From source file:fr.amapj.view.views.listeadherents.PopupCopyAllMail.java

License:Open Source License

protected void createContent(VerticalLayout contentLayout) {

    // Construction de la zone de texte explicative
    String msg = "Pour envoyer un mail  tous les amapiens, vous devez :<br/><ul>"
            + "<li>Faire un copier de toutes les adresses e-mail en faisant Ctrl+C ou en faisant clic droit + Copier sur la zone bleue ci dessous</li>"
            + "<li>Ouvrir votre outil favori pour l'envoi des mails (Thunderbird, Gmail, Outlook, ...)</li>"
            + "<li>Faire nouveau message</li>"
            + "<li>Faire un coller de toutes les adresses e-mail en faisant Ctrl+V ou en faisant clic droit + Coller dans la liste des destinataires du message.</li></ul>";

    HorizontalLayout hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);//w  w  w  .java  2s .  c om
    hlTexte.setSpacing(true);
    hlTexte.setWidth("100%");

    Label textArea = new Label(msg, ContentMode.HTML);
    textArea.setStyleName(ChameleonTheme.TEXTFIELD_BIG);
    textArea.setWidth("80%");

    hlTexte.addComponent(textArea);
    hlTexte.setExpandRatio(textArea, 1);
    hlTexte.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);

    // Construction de la zone d'affichage des mails
    hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);
    hlTexte.setSpacing(true);
    hlTexte.setWidth("100%");

    TextArea listeMails = new TextArea("");
    listeMails.setValue(mails);
    listeMails.setReadOnly(true);
    listeMails.selectAll();
    listeMails.setWidth("80%");
    listeMails.setHeight(5, Unit.CM);

    hlTexte.addComponent(listeMails);
    hlTexte.setExpandRatio(listeMails, 1);
    hlTexte.setComponentAlignment(listeMails, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);

}