Example usage for com.vaadin.ui Label addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:com.cavisson.gui.dashboard.components.controls.ComboBoxes.java

License:Apache License

public ComboBoxes() {
    setMargin(true);/* w  w w .  j a v a  2s .  com*/

    Label h1 = new Label("Combo Boxes");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    ComboBox combo = new ComboBox("Normal");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
    combo.setNullSelectionAllowed(false);
    combo.select(combo.getItemIds().iterator().next());
    combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
    combo.setItemIcon(combo.getItemIds().iterator().next(), new ThemeResource("../runo/icons/16/document.png"));
    row.addComponent(combo);

    CssLayout group = new CssLayout();
    group.setCaption("Grouped with a Button");
    group.addStyleName("v-component-group");
    row.addComponent(group);

    combo = new ComboBox();
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
    combo.setNullSelectionAllowed(false);
    combo.select(combo.getItemIds().iterator().next());
    combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
    combo.setWidth("240px");
    group.addComponent(combo);
    Button today = new Button("Do It");
    group.addComponent(today);

    combo = new ComboBox("Explicit size");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setWidth("260px");
    combo.setHeight("60px");
    row.addComponent(combo);

    combo = new ComboBox("No text input allowed");
    combo.setInputPrompt("You can click here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setTextInputAllowed(false);
    combo.setNullSelectionAllowed(false);
    combo.select("Option One");
    row.addComponent(combo);

    combo = new ComboBox("Error");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setNullSelectionAllowed(false);
    combo.select("Option One");
    combo.setComponentError(new UserError("Fix it, now!"));
    row.addComponent(combo);

    combo = new ComboBox("Error, borderless");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setNullSelectionAllowed(false);
    combo.select("Option One");
    combo.setComponentError(new UserError("Fix it, now!"));
    combo.addStyleName("borderless");
    row.addComponent(combo);

    combo = new ComboBox("Disabled");
    combo.setInputPrompt("You can't type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setEnabled(false);
    row.addComponent(combo);

    combo = new ComboBox("Custom color");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
    combo.addStyleName("color1");
    row.addComponent(combo);

    combo = new ComboBox("Custom color");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
    combo.addStyleName("color2");
    row.addComponent(combo);

    combo = new ComboBox("Custom color");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
    combo.addStyleName("color3");
    row.addComponent(combo);

    combo = new ComboBox("Small");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
    combo.addStyleName("small");
    row.addComponent(combo);

    combo = new ComboBox("Large");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
    combo.addStyleName("large");
    row.addComponent(combo);

    combo = new ComboBox("Borderless");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.addStyleName("borderless");
    row.addComponent(combo);

    combo = new ComboBox("Tiny");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
    combo.addStyleName("tiny");
    row.addComponent(combo);

    combo = new ComboBox("Huge");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
    combo.addStyleName("huge");
    row.addComponent(combo);
}

From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java

License:Apache License

public CommonParts() {
    setMargin(true);//w  w w  . j a  va2 s .  co m
    addStyleName("content-common");

    Label h1 = new Label("Common UI Elements");
    h1.addStyleName("h1");
    addComponent(h1);

    VerticalLayout row = new VerticalLayout();
    row.setWidth("100%");
    row.setSpacing(true);
    addComponent(row);

    row.addComponent(loadingIndicators());
    row.addComponent(notifications());
    row.addComponent(windows());
    row.addComponent(tooltips());

}

From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java

License:Apache License

Panel loadingIndicators() {
    Panel p = new Panel("Loading Indicator");
    final VerticalLayout content = new VerticalLayout();
    p.setContent(content);/*from   www . j av  a 2  s.  c  o  m*/
    content.setSpacing(true);
    content.setMargin(true);
    content.addComponent(new Label("You can test the loading indicator by pressing the buttons."));

    CssLayout group = new CssLayout();
    group.setCaption("Show the loading indicator for");
    group.addStyleName("v-component-group");
    content.addComponent(group);
    Button loading = new Button("0.8");
    loading.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(800);
            } catch (InterruptedException e) {
            }
        }
    });
    group.addComponent(loading);

    Button delay = new Button("3");
    delay.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
            }
        }
    });
    group.addComponent(delay);

    Button wait = new Button("15");
    wait.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(15000);
            } catch (InterruptedException e) {
            }
        }
    });
    wait.addStyleName("last");
    group.addComponent(wait);
    Label label = new Label("   seconds", ContentMode.HTML);
    label.setSizeUndefined();
    group.addComponent(label);

    Label spinnerDesc = new Label(
            "The theme also provides a mixin that you can use to include a spinner anywhere in your application. The button below reveals a Label with a custom style name, for which the spinner mixin is added.");
    spinnerDesc.addStyleName("small");
    spinnerDesc.setCaption("Spinner");
    content.addComponent(spinnerDesc);

    if (!ValoThemeUI.isTestMode()) {
        final Label spinner = new Label();
        spinner.addStyleName("spinner");

        Button showSpinnerButton = new Button("Show spinner", new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                content.replaceComponent(event.getComponent(), spinner);
            }
        });
        content.addComponent(showSpinnerButton);
    }

    return p;
}

From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java

License:Apache License

Panel tooltips() {
    Panel p = new Panel("Tooltips");
    HorizontalLayout content = new HorizontalLayout() {
        {/*from  w w w.  j  a v a  2 s .  com*/
            setSpacing(true);
            setMargin(true);
            addStyleName("wrapping");

            addComponent(new Label("Try out different tooltips/descriptions by hovering over the labels."));

            Label label = new Label("Simple");
            label.addStyleName("bold");
            label.setDescription("Simple tooltip message");
            addComponent(label);

            label = new Label("Long");
            label.addStyleName("bold");
            label.setDescription(
                    "Long tooltip message. Inmensae subtilitatis, obscuris et malesuada fames. Salutantibus vitae elit libero, a pharetra augue.");
            addComponent(label);

            label = new Label("HTML tooltip");
            label.addStyleName("bold");
            label.setDescription(
                    "<div><h1>Ut enim ad minim veniam, quis nostrud exercitation</h1><p><span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>Donec sed odio operae, eu vulputate felis rhoncus.</span> <span>At nos hinc posthac, sitientis piros Afros.</span> <span>Tu quoque, Brute, fili mi, nihil timor populi, nihil!</span></p><p><span>Gallia est omnis divisa in partes tres, quarum.</span> <span>Praeterea iter est quasdam res quas ex communi.</span> <span>Cum ceteris in veneratione tui montes, nascetur mus.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span> <span>Idque Caesaris facere voluntate liceret: sese habere.</span></p></div>");
            addComponent(label);

            label = new Label("With an error message");
            label.addStyleName("bold");
            label.setDescription("Simple tooltip message");
            label.setComponentError(new UserError("Something terrible has happened"));
            addComponent(label);

            label = new Label("With a long error message");
            label.addStyleName("bold");
            label.setDescription("Simple tooltip message");
            label.setComponentError(new UserError(
                    "<h2>Contra legem facit qui id facit quod lex prohibet <span>Tityre, tu patulae recubans sub tegmine fagi  dolor.</span> <span>Tityre, tu patulae recubans sub tegmine fagi  dolor.</span> <span>Prima luce, cum quibus mons aliud  consensu ab eo.</span> <span>Quid securi etiam tamquam eu fugiat nulla pariatur.</span> <span>Fabio vel iudice vincam, sunt in culpa qui officia.</span> <span>Nihil hic munitissimus habendi senatus locus, nihil horum?</span></p><p><span>Plura mihi bona sunt, inclinet, amari petere vellent.</span> <span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Nec dubitamus multa iter quae et nos invenerat.</span> <span>Quisque ut dolor gravida, placerat libero vel, euismod.</span> <span>Quae vero auctorem tractata ab fiducia dicuntur.</span></h2>",
                    AbstractErrorMessage.ContentMode.HTML, ErrorLevel.CRITICAL));
            addComponent(label);

            label = new Label("Error message only");
            label.addStyleName("bold");
            label.setComponentError(new UserError("Something terrible has happened"));
            addComponent(label);
        }
    };
    p.setContent(content);
    return p;

}

From source file:com.cavisson.gui.dashboard.components.controls.DateFields.java

License:Apache License

public DateFields() {
    setMargin(true);/*ww w  . jav  a  2s  .c o m*/

    Label h1 = new Label("Date Fields");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    DateField date = new DateField("Default resolution");
    setDate(date);
    row.addComponent(date);

    date = new DateField("Error");
    setDate(date);
    date.setComponentError(new UserError("Fix it, now!"));
    row.addComponent(date);

    date = new DateField("Error, borderless");
    setDate(date);
    date.setComponentError(new UserError("Fix it, now!"));
    date.addStyleName("borderless");
    row.addComponent(date);

    CssLayout group = new CssLayout();
    group.setCaption("Grouped with a Button");
    group.addStyleName("v-component-group");
    row.addComponent(group);

    final DateField date2 = new DateField();
    group.addComponent(date2);

    Button today = new Button("Today", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            date2.setValue(new Date());
        }
    });
    group.addComponent(today);

    date = new DateField("Default resolution, explicit size");
    setDate(date);
    row.addComponent(date);
    date.setWidth("260px");
    date.setHeight("60px");

    date = new DateField("Second resolution");
    setDate(date);
    date.setResolution(Resolution.SECOND);
    row.addComponent(date);

    date = new DateField("Minute resolution");
    setDate(date);
    date.setResolution(Resolution.MINUTE);
    row.addComponent(date);

    date = new DateField("Hour resolution");
    setDate(date);
    date.setResolution(Resolution.HOUR);
    row.addComponent(date);

    date = new DateField("Disabled");
    setDate(date);
    date.setResolution(Resolution.HOUR);
    date.setEnabled(false);
    row.addComponent(date);

    date = new DateField("Day resolution");
    setDate(date);
    date.setResolution(Resolution.DAY);
    row.addComponent(date);

    date = new DateField("Month resolution");
    setDate(date);
    date.setResolution(Resolution.MONTH);
    row.addComponent(date);

    date = new DateField("Year resolution");
    setDate(date);
    date.setResolution(Resolution.YEAR);
    row.addComponent(date);

    date = new DateField("Custom color");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName("color1");
    row.addComponent(date);

    date = new DateField("Custom color");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName("color2");
    row.addComponent(date);

    date = new DateField("Custom color");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName("color3");
    row.addComponent(date);

    date = new DateField("Small");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName("small");
    row.addComponent(date);

    date = new DateField("Large");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName("large");
    row.addComponent(date);

    date = new DateField("Borderless");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName("borderless");
    row.addComponent(date);

    date = new DateField("Week numbers");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.setLocale(new Locale("fi", "fi"));
    date.setShowISOWeekNumbers(true);
    row.addComponent(date);

    date = new DateField("US locale");
    setDate(date);
    date.setResolution(Resolution.SECOND);
    date.setLocale(new Locale("en", "US"));
    row.addComponent(date);

    date = new DateField("Custom format");
    setDate(date);
    date.setDateFormat("E dd/MM/yyyy");
    row.addComponent(date);

    date = new DateField("Tiny");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName("tiny");
    row.addComponent(date);

    date = new DateField("Huge");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName("huge");
    row.addComponent(date);

    date = new InlineDateField("Date picker");
    setDate(date);
    row.addComponent(date);

    date = new InlineDateField("Date picker with week numbers");
    setDate(date);
    date.setLocale(new Locale("fi", "fi"));
    date.setShowISOWeekNumbers(true);
    row.addComponent(date);
}

From source file:com.cavisson.gui.dashboard.components.controls.Dragging.java

License:Apache License

public Dragging() {
    setMargin(true);//from   w w  w  .j a  va 2s. c  o  m
    setSpacing(true);

    Label h1 = new Label("Dragging Components");
    h1.addStyleName("h1");
    addComponent(h1);

    MenuBar options = new MenuBar();
    options.setCaption("Drop Hints");
    addComponent(options);

    // Use these styles to hide irrelevant drag hints
    // Can be used either on a parent or directly on the DnDWrapper
    MenuItem opt = options.addItem("Vertical", new MenuBar.Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            if (selectedItem.isChecked()) {
                sample.removeStyleName("no-vertical-drag-hints");
            } else {
                sample.addStyleName("no-vertical-drag-hints");
            }
        }
    });
    opt.setCheckable(true);
    opt.setChecked(true);

    opt = options.addItem("Horizontal", new MenuBar.Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            if (selectedItem.isChecked()) {
                sample.removeStyleName("no-horizontal-drag-hints");
            } else {
                sample.addStyleName("no-horizontal-drag-hints");
            }
        }
    });
    opt.setCheckable(true);
    opt.setChecked(true);

    opt = options.addItem("Box", new MenuBar.Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            if (selectedItem.isChecked()) {
                sample.removeStyleName("no-box-drag-hints");
            } else {
                sample.addStyleName("no-box-drag-hints");
            }
        }
    });
    opt.setCheckable(true);
    opt.setChecked(true);

    sample = new SortableLayout();
    sample.setSizeUndefined();
    sample.setHeight("100px");

    for (final Component component : createComponents()) {
        sample.addComponent(component);
    }

    addComponent(sample);

}

From source file:com.cavisson.gui.dashboard.components.controls.Forms.java

License:Apache License

public Forms() {
    setSpacing(true);//ww  w. jav  a 2s.  c o  m
    setMargin(true);

    Label title = new Label("Forms");
    title.addStyleName("h1");
    addComponent(title);

    final FormLayout form = new FormLayout();
    form.setMargin(false);
    form.setWidth("800px");
    form.addStyleName("light");
    addComponent(form);

    Label section = new Label("Personal Info");
    section.addStyleName("h2");
    section.addStyleName("colored");
    form.addComponent(section);
    StringGenerator sg = new StringGenerator();

    TextField name = new TextField("Name");
    name.setValue(sg.nextString(true) + " " + sg.nextString(true));
    name.setWidth("50%");
    form.addComponent(name);

    DateField birthday = new DateField("Birthday");
    birthday.setValue(new Date(80, 0, 31));
    form.addComponent(birthday);

    TextField username = new TextField("Username");
    username.setValue(sg.nextString(false) + sg.nextString(false));
    username.setRequired(true);
    form.addComponent(username);

    OptionGroup sex = new OptionGroup("Sex");
    sex.addItem("Female");
    sex.addItem("Male");
    sex.select("Male");
    sex.addStyleName("horizontal");
    form.addComponent(sex);

    section = new Label("Contact Info");
    section.addStyleName("h3");
    section.addStyleName("colored");
    form.addComponent(section);

    TextField email = new TextField("Email");
    email.setValue(sg.nextString(false) + "@" + sg.nextString(false) + ".com");
    email.setWidth("50%");
    email.setRequired(true);
    form.addComponent(email);

    TextField location = new TextField("Location");
    location.setValue(sg.nextString(true) + ", " + sg.nextString(true));
    location.setWidth("50%");
    location.setComponentError(new UserError("This address doesn't exist"));
    form.addComponent(location);

    TextField phone = new TextField("Phone");
    phone.setWidth("50%");
    form.addComponent(phone);

    HorizontalLayout wrap = new HorizontalLayout();
    wrap.setSpacing(true);
    wrap.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    wrap.setCaption("Newsletter");
    CheckBox newsletter = new CheckBox("Subscribe to newsletter", true);
    wrap.addComponent(newsletter);

    ComboBox period = new ComboBox();
    period.setTextInputAllowed(false);
    period.addItem("Daily");
    period.addItem("Weekly");
    period.addItem("Montly");
    period.setNullSelectionAllowed(false);
    period.select("Weekly");
    period.addStyleName("small");
    period.setWidth("10em");
    wrap.addComponent(period);
    form.addComponent(wrap);

    section = new Label("Additional Info");
    section.addStyleName("h4");
    section.addStyleName("colored");
    form.addComponent(section);

    TextField website = new TextField("Website");
    website.setInputPrompt("http://");
    website.setWidth("100%");
    form.addComponent(website);

    TextArea shortbio = new TextArea("Short Bio");
    shortbio.setValue(
            "Quis aute iure reprehenderit in voluptate velit esse. Cras mattis iudicium purus sit amet fermentum.");
    shortbio.setWidth("100%");
    shortbio.setRows(2);
    form.addComponent(shortbio);

    final RichTextArea bio = new RichTextArea("Bio");
    bio.setWidth("100%");
    bio.setValue(
            "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi  dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>");
    form.addComponent(bio);

    form.setReadOnly(true);
    bio.setReadOnly(true);

    Button edit = new Button("Edit", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            boolean readOnly = form.isReadOnly();
            if (readOnly) {
                bio.setReadOnly(false);
                form.setReadOnly(false);
                form.removeStyleName("light");
                event.getButton().setCaption("Save");
                event.getButton().addStyleName("primary");
            } else {
                bio.setReadOnly(true);
                form.setReadOnly(true);
                form.addStyleName("light");
                event.getButton().setCaption("Edit");
                event.getButton().removeStyleName("primary");
            }
        }
    });

    HorizontalLayout footer = new HorizontalLayout();
    footer.setMargin(new MarginInfo(true, false, true, false));
    footer.setSpacing(true);
    footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    form.addComponent(footer);
    footer.addComponent(edit);

    Label lastModified = new Label("Last modified by you a minute ago");
    lastModified.addStyleName("light");
    footer.addComponent(lastModified);
}

From source file:com.cavisson.gui.dashboard.components.controls.Labels.java

License:Apache License

public Labels() {
    setMargin(true);/*from   w  ww .  ja v a2  s .  c o  m*/
    addStyleName("content-labels");

    Label h1 = new Label("Labels");
    h1.addStyleName("h1");
    addComponent(h1);

    VerticalLayout left = new VerticalLayout();
    left.setMargin(new MarginInfo(false, true, false, false));
    addComponent(left);

    Label huge = new Label("Huge type for display text.");
    huge.addStyleName("huge");
    left.addComponent(huge);

    Label large = new Label(
            "Large type for introductory text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    large.addStyleName("large");
    left.addComponent(large);

    Label h2 = new Label("Subtitle");
    h2.addStyleName("h2");
    left.addComponent(h2);

    Label normal = new Label(
            "Normal type for plain text, with a <a href=\"https://vaadin.com\">regular link</a>. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.",
            ContentMode.HTML);
    left.addComponent(normal);

    Label h3 = new Label("Small Title");
    h3.addStyleName("h3");
    left.addComponent(h3);

    Label small = new Label(
            "Small type for additional text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    small.addStyleName("small");
    left.addComponent(small);

    Label tiny = new Label("Tiny type for minor text.");
    tiny.addStyleName("tiny");
    left.addComponent(tiny);

    Label h4 = new Label("Section Title");
    h4.addStyleName("h4");
    left.addComponent(h4);

    normal = new Label(
            "Normal type for plain text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    left.addComponent(normal);

    Panel p = new Panel("Additional Label Styles");
    addComponent(p);

    VerticalLayout right = new VerticalLayout();
    right.setSpacing(true);
    right.setMargin(true);
    p.setContent(right);

    Label label = new Label(
            "Bold type for prominent text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    label.addStyleName("bold");
    right.addComponent(label);

    label = new Label(
            "Light type for subtle text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    label.addStyleName("light");
    right.addComponent(label);

    label = new Label(
            "Colored type for highlighted text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    label.addStyleName("colored");
    right.addComponent(label);

    label = new Label("A label for success");
    label.addStyleName("success");
    right.addComponent(label);

    label = new Label("A label for failure");
    label.addStyleName("failure");
    right.addComponent(label);

}

From source file:com.cavisson.gui.dashboard.components.controls.MenuBars.java

License:Apache License

public void init() {
    Label h1 = new Label("Menu Bars");
    h1.addStyleName("h1");
    addComponent(h1);/*from  ww  w.j  a  v a 2 s  .  co m*/

    MenuBar menuBar = getMenuBar();
    menuBar.setCaption("Normal style");
    addComponent(menuBar);

    menuBar = getMenuBar();
    menuBar.setCaption("Small style");
    menuBar.addStyleName("small");
    addComponent(menuBar);

    menuBar = getMenuBar();
    menuBar.setCaption("Borderless style");
    menuBar.addStyleName("borderless");
    addComponent(menuBar);

    menuBar = getMenuBar();
    menuBar.setCaption("Small borderless style");
    menuBar.addStyleName("borderless");
    menuBar.addStyleName("small");
    addComponent(menuBar);

    Label h2 = new Label("Drop Down Button");
    h2.addStyleName("h2");
    addComponent(h2);

    HorizontalLayout wrap = new HorizontalLayout();
    wrap.addStyleName("wrapping");
    wrap.setSpacing(true);
    addComponent(wrap);

    wrap.addComponent(getMenuButton("Normal", false));

    MenuBar split = getMenuButton("Small", false);
    split.addStyleName("small");
    wrap.addComponent(split);

    split = getMenuButton("Borderless", false);
    split.addStyleName("borderless");
    wrap.addComponent(split);

    split = getMenuButton("Themed", false);
    split.addStyleName("color1");
    wrap.addComponent(split);

    split = getMenuButton("Small", false);
    split.addStyleName("color1");
    split.addStyleName("small");
    wrap.addComponent(split);

    h2 = new Label("Split Button");
    h2.addStyleName("h2");
    addComponent(h2);

    wrap = new HorizontalLayout();
    wrap.addStyleName("wrapping");
    wrap.setSpacing(true);
    addComponent(wrap);

    wrap.addComponent(getMenuButton("Normal", true));

    split = getMenuButton("Small", true);
    split.addStyleName("small");
    wrap.addComponent(split);

    split = getMenuButton("Borderless", true);
    split.addStyleName("borderless");
    wrap.addComponent(split);

    split = getMenuButton("Themed", true);
    split.addStyleName("color1");
    wrap.addComponent(split);

    split = getMenuButton("Small", true);
    split.addStyleName("color1");
    split.addStyleName("small");
    wrap.addComponent(split);
}

From source file:com.cavisson.gui.dashboard.components.controls.NativeSelects.java

License:Apache License

public NativeSelects() {
    setMargin(true);/*  ww  w  .java 2  s. co  m*/

    Label h1 = new Label("Selects");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    NativeSelect select = new NativeSelect("Drop Down Select");
    row.addComponent(select);

    ListSelect list = new ListSelect("List Select");
    list.setNewItemsAllowed(true);
    row.addComponent(list);

    TwinColSelect tcs = new TwinColSelect("TwinCol Select");
    tcs.setLeftColumnCaption("Left Column");
    tcs.setRightColumnCaption("Right Column");
    tcs.setNewItemsAllowed(true);
    row.addComponent(tcs);

    TwinColSelect tcs2 = new TwinColSelect("Sized TwinCol Select");
    tcs2.setLeftColumnCaption("Left Column");
    tcs2.setRightColumnCaption("Right Column");
    tcs2.setNewItemsAllowed(true);
    tcs2.setWidth("280px");
    tcs2.setHeight("200px");
    row.addComponent(tcs2);

    for (int i = 1; i <= 10; i++) {
        select.addItem("Option " + i);
        list.addItem("Option " + i);
        tcs.addItem("Option " + i);
        tcs2.addItem("Option " + i);
    }
}