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:by.bigvova.views.UserView.UserView.java

License:Apache License

@Override
public void enter(ViewChangeListener.ViewChangeEvent viewChangeEvent) {
    setSizeFull();/*from   w  w  w .ja  v a 2 s.co  m*/
    footerButtons.setSpacing(true);
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setSizeFull();

    Label header = new Label("Meal table");
    header.addStyleName(ValoTheme.LABEL_H1);
    layout.addComponent(header);

    layout.addComponent(mainGrid);
    layout.addComponent(footerButtons);
    layout.setExpandRatio(mainGrid, 1);

    setCompositionRoot(layout);
}

From source file:ch.wscr.management.ui.view.MemberView.java

/**
 * Header der View erstellen/* w  w w .j a  v a2 s.c  o m*/
 *
 * @return der Header
 */
private Component buidViewHeader() {
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth(100f, Unit.PERCENTAGE);
    header.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT);
    header.setSpacing(true);

    Label title = new Label("Mitgliederverwaltung");
    title.setSizeUndefined();
    title.addStyleName(ValoTheme.LABEL_H1);

    header.addComponent(title);

    Label gap = new Label();
    gap.setWidth(10, Unit.PIXELS);

    header.addComponent(gap);
    header.setExpandRatio(title, 1);
    return header;
}

From source file:cirad.cgh.vcf2fasta.view.Vcf2fastaForm.java

License:Open Source License

private void initComponents() {
    removeAllComponents();/*from   w w  w . j av  a2 s . co  m*/

    fieldGroup = new BeanFieldGroup<Vcf2fastaInputBean>(Vcf2fastaInputBean.class);
    vcf2fastaInputBean = new Vcf2fastaInputBean(config);
    fieldGroup.setItemDataSource(vcf2fastaInputBean);

    FormLayout layout = new FormLayout();
    layout.setResponsive(true);
    layout.setMargin(true);
    layout.setWidth("100%");
    //layout.addStyleName("light");
    layout.setImmediate(true);
    addComponent(layout);

    Label section1;
    final ComboBox analysis_combo;
    final ComboBox accession_combo;
    Label section2;
    ComboBox contig_combo;
    TextField interval;
    Label section3;
    Component buttonLayout;
    Component progressLayout;

    section1 = new Label("Input");
    section1.addStyleName("h3 colored");
    layout.addComponent(section1);
    analysis_combo = getComboBox(ANALYSIS_CAPTION, ANALYSIS, getAnalysesList(), false);
    layout.addComponent(analysis_combo);
    accession_combo = getComboBox(ACCESSION_CAPTION, ACCESSION,
            getAccessionsList("Cassava 6.1 WGS Bredeson 61 accessions"), false);
    layout.addComponent(accession_combo);

    analysis_combo.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            accession_combo.setContainerDataSource(getAccessionsList((String) analysis_combo.getValue()));
            accession_combo.select(accession_combo.getContainerDataSource().getItemIds().iterator().next());
        }
    });

    section2 = new Label("Parameters");
    section2.addStyleName("h3 colored");
    layout.addComponent(section2);
    contig_combo = getComboBox(CONTIG_CAPTION, CONTIG, getContigsList(), true);
    layout.addComponent(contig_combo);
    interval = getTextField(INTERVAL_CAPTION, INTERVAL, vcf2fastaUI.getConfig().getString("defaultInterval"),
            20);
    layout.addComponent(interval);

    section3 = new Label("Result");
    section3.addStyleName("h3 colored");
    layout.addComponent(section3);
    resultLayout = new VerticalLayout();
    resultLayout.setSizeFull();
    resultLayout.setMargin(true);
    resultLayout.setSpacing(true);
    resultLayout.addStyleName("light");
    layout.addComponent(resultLayout);

    layout.addComponent(new Label(""));

    buttonLayout = getSubmitLayout();
    layout.addComponent(buttonLayout);
    progressLayout = getProgressLayout();
    layout.addComponent(progressLayout);

    initCommitHandler();
}

From source file:com.adonis.ui.menu.Menu.java

public Menu(PersonService personService, VehicleService vehicleService, Navigator navigator) {
    this.navigator = navigator;
    setPrimaryStyleName(ValoTheme.MENU_ROOT);
    menuPart = new CssLayout();
    menuPart.addStyleName(ValoTheme.MENU_PART);

    setPersonsCrudProperties(personService);
    setVehiclesCrudProperties(vehicleService);

    // header of the menu
    final HorizontalLayout top = new HorizontalLayout();
    top.addStyleName(ValoTheme.MENU_TITLE);
    top.setSpacing(true);//from w w w  . j a  va2 s .  co m

    Label title = new Label("Vehicle manager");
    title.addStyleName(ValoTheme.LABEL_H1);
    title.setSizeUndefined();

    Image image = new Image(null, new ThemeResource("img/car.png"));
    image.setStyleName(ValoTheme.MENU_LOGO);

    top.addComponent(image);
    top.addComponent(title);
    menuPart.addComponent(top);

    // logout menu item
    //        HorizontalLayout logoutLayout = new HorizontalLayout();
    //        logoutLayout.addStyleName(ValoTheme.MENU_ITEM);
    //        logoutLayout.setSpacing(false);
    //
    //        MenuBar logoutMenu = new MenuBar();
    //        logoutMenu.setStyleName(VALO_MENUITEMS);
    //        logoutMenu.addItem("Logout", new MenuBar.Command() {
    //
    //            @Override
    //            public void menuSelected(MenuBar.MenuItem selectedItem) {
    //                VaadinSession.getCurrent().getSession().invalidate();
    //                Page.getCurrent().reload();
    //            }
    //        });
    //
    //        logoutMenu.addStyleName("user-menu");
    //        Image logout = new Image(null, new ThemeResource("img/logout.png"));
    //        logoutLayout.addComponent(logout, 0);
    //        logoutLayout.addComponent(logoutMenu, 1);
    //        menuPart.addComponent(logoutLayout);

    // button for toggling the visibility of the menu when on a small screen
    showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) {
                menuPart.removeStyleName(VALO_MENU_VISIBLE);
            } else {
                menuPart.addStyleName(VALO_MENU_VISIBLE);
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName(VALO_MENU_TOGGLE);
    //        showMenu.setIcon(FontAwesome.NAVICON);
    menuPart.addComponent(showMenu);

    // container for the navigation buttons, which are added by addView()
    menuItemsLayout = new CssLayout();
    menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS);
    menuPart.addComponent(menuItemsLayout);

    addComponent(menuPart);
    addStyleName("backImage");
}

From source file:com.anphat.list.ui.DialogAddMapStaffCustomer.java

private void buildInfoLayout(boolean isCustInfo) {
    infoLayout = new GridLayout();
    infoLayout.setImmediate(true);/* w w  w.  ja v  a  2 s . co m*/
    //        infoLayout.setStyleName("custom-feildset");
    //        infoLayout.setCaptionAsHtml(true);
    infoLayout.setWidth("100.0%");
    infoLayout.setHeight("-1px");
    infoLayout.setMargin(true);
    infoLayout.setSpacing(true);
    infoLayout.setColumns(6);
    infoLayout.setRows(1);

    // lblCustCode
    Label lblCustCode = new Label();
    lblCustCode.addStyleName("v-label-bold");
    lblCustCode.setImmediate(true);
    lblCustCode.setWidth("100.0%");
    lblCustCode.setHeight("-1px");

    // tfCustCode
    txtCustCode = new Label();
    txtCustCode.setImmediate(true);
    txtCustCode.setWidth("100.0%");
    txtCustCode.setHeight("-1px");
    // lblCustCode
    Label lblCustName = new Label();
    lblCustName.addStyleName("v-label-bold");
    lblCustName.setImmediate(true);
    lblCustName.setWidth("100.0%");
    lblCustName.setHeight("-1px");

    // tfCustCode
    txtCustName = new Label();
    txtCustName.setImmediate(true);
    txtCustName.setWidth("100.0%");
    txtCustName.setHeight("-1px");

    if (isCustInfo) {
        //            infoLayout.setCaption(BundleUtils.getString("goods.list.panel.caption.customerinfo"));
        //            lblCustCode.setValue(BundleUtils.getString("goods.list.label.customercode"));
        lblCustName.setValue(BundleUtils.getString("goods.list.label.customername"));
    } else {
        //            infoLayout.setCaption(BundleUtils.getString("goods.list.panel.caption.staffInfo"));
        //            lblCustCode.setValue(BundleUtils.getString("lb.deptstaff.emp.code"));
        lblCustName.setValue(BundleUtils.getString("lb.deptstaff.emp.name"));
    }
    //        infoLayout.addComponent(lblCustCode, 0, 0);
    //        infoLayout.addComponent(txtCustCode, 1, 0);
    infoLayout.addComponent(lblCustName, 0, 0);
    infoLayout.addComponent(txtCustName, 1, 0, 5, 0);
}

From source file:com.antonjohansson.managementcenter.core.web.welcome.WelcomeView.java

License:Apache License

private Component getHeader() {
    Label title = new Label("Management Center");
    title.setSizeUndefined();//from ww w .  j av  a  2  s .  co m
    title.addStyleName(ValoTheme.LABEL_H3);
    title.addStyleName(ValoTheme.LABEL_LIGHT);
    return title;
}

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

License:Apache License

public Accordions() {
    setMargin(true);/*  www  .  ja v  a 2s  . c  om*/

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

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

    row.addComponent(getAccordion("Normal"));

    Accordion ac = getAccordion("Borderless");
    ac.addStyleName("borderless");
    row.addComponent(ac);

}

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

License:Apache License

/**
* 
*///from w w w.  ja v a 2 s  .  co m
public ButtonsAndLinks() {
    setMargin(true);

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

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

    Button button = new Button("Normal");
    row.addComponent(button);

    button = new Button("Disabled");
    button.setEnabled(false);
    row.addComponent(button);

    button = new Button("Primary");
    button.addStyleName("primary");
    row.addComponent(button);

    button = new Button("Friendly");
    button.addStyleName("friendly");
    row.addComponent(button);

    button = new Button("Danger");
    button.addStyleName("danger");
    row.addComponent(button);

    TestIcon testIcon = new TestIcon(10);
    button = new Button("Small");
    button.addStyleName("small");
    button.setIcon(testIcon.get());
    row.addComponent(button);

    button = new Button("Large");
    button.addStyleName("large");
    button.setIcon(testIcon.get());
    row.addComponent(button);

    button = new Button("Top");
    button.addStyleName("icon-align-top");
    button.setIcon(testIcon.get());
    row.addComponent(button);

    button = new Button("Image icon");
    button.setIcon(testIcon.get(true, 16));
    row.addComponent(button);

    button = new Button("Image icon");
    button.addStyleName("icon-align-right");
    button.setIcon(testIcon.get(true));
    row.addComponent(button);

    button = new Button("Photos");
    button.setIcon(testIcon.get());
    row.addComponent(button);

    button = new Button();
    button.setIcon(testIcon.get());
    button.addStyleName("icon-only");
    row.addComponent(button);

    button = new Button("Borderless");
    button.setIcon(testIcon.get());
    button.addStyleName("borderless");
    row.addComponent(button);

    button = new Button("Borderless, colored");
    button.setIcon(testIcon.get());
    button.addStyleName("borderless-colored");
    row.addComponent(button);

    button = new Button("Quiet");
    button.setIcon(testIcon.get());
    button.addStyleName("quiet");
    row.addComponent(button);

    button = new Button("Link style");
    button.setIcon(testIcon.get());
    button.addStyleName("link");
    row.addComponent(button);

    button = new Button("Icon on right");
    button.setIcon(testIcon.get());
    button.addStyleName("icon-align-right");
    row.addComponent(button);

    CssLayout group = new CssLayout();
    group.addStyleName("v-component-group");
    row.addComponent(group);

    button = new Button("One");
    group.addComponent(button);
    button = new Button("Two");
    group.addComponent(button);
    button = new Button("Three");
    group.addComponent(button);

    button = new Button("Tiny");
    button.addStyleName("tiny");
    row.addComponent(button);

    button = new Button("Huge");
    button.addStyleName("huge");
    row.addComponent(button);

    NativeButton nbutton = new NativeButton("Native");
    row.addComponent(nbutton);

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

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

    Link link = new Link("vaadin.com", new ExternalResource("https://vaadin.com"));
    row.addComponent(link);

    link = new Link("Link with icon", new ExternalResource("https://vaadin.com"));
    link.addStyleName("color3");
    link.setIcon(testIcon.get());
    row.addComponent(link);

    link = new Link("Small", new ExternalResource("https://vaadin.com"));
    link.addStyleName("small");
    row.addComponent(link);

    link = new Link("Large", new ExternalResource("https://vaadin.com"));
    link.addStyleName("large");
    row.addComponent(link);

    link = new Link(null, new ExternalResource("https://vaadin.com"));
    link.setIcon(testIcon.get());
    link.addStyleName("large");
    row.addComponent(link);
}

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

License:Apache License

public CheckBoxes() {
    setMargin(true);//  www.  j  a va 2 s .  c om

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

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

    CheckBox check = new CheckBox("Checked", true);
    row.addComponent(check);

    check = new CheckBox("Checked, explicit width, so that the caption should wrap", true);
    row.addComponent(check);
    check.setWidth("150px");

    check = new CheckBox("Not checked");
    row.addComponent(check);

    check = new CheckBox(null, true);
    check.setDescription("No caption");
    row.addComponent(check);

    check = new CheckBox("Custom color", true);
    check.addStyleName("color1");
    row.addComponent(check);

    TestIcon testIcon = new TestIcon(30);
    check = new CheckBox("Custom color", true);
    check.addStyleName("color2");
    check.setIcon(testIcon.get());
    row.addComponent(check);

    check = new CheckBox("With Icon", true);
    check.setIcon(testIcon.get());
    row.addComponent(check);

    check = new CheckBox();
    check.setIcon(testIcon.get(true));
    row.addComponent(check);

    check = new CheckBox("Small", true);
    check.addStyleName("small");
    row.addComponent(check);

    check = new CheckBox("Large", true);
    check.addStyleName("large");
    row.addComponent(check);

    h1 = new Label("Option Groups");
    h1.addStyleName("h1");
    addComponent(h1);

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

    OptionGroup options = new OptionGroup("Choose one, explicit width");
    options.setWidth("200px");
    options.addItem("Option One");
    Item two = options.addItem(
            "Option Two, with a longer caption that should wrap when the components width is explicitly set.");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon(two, testIcon.get());
    options.setItemIcon("Option Three", testIcon.get(true));
    row.addComponent(options);

    options = new OptionGroup("Choose many, explicit width");
    options.setMultiSelect(true);
    options.setWidth("200px");
    options.addItem("Option One");
    two = options.addItem(
            "Option Two, with a longer caption that should wrap when the components width is explicitly set.");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon(two, testIcon.get());
    options.setItemIcon("Option Three", testIcon.get(true));
    row.addComponent(options);

    options = new OptionGroup("Choose one, small");
    options.addStyleName("small");
    options.setMultiSelect(false);
    options.addItem("Option One");
    options.addItem("Option Two");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon("Option Two", testIcon.get());
    options.setItemIcon("Option Three", testIcon.get(true));
    row.addComponent(options);

    options = new OptionGroup("Choose many, small");
    options.addStyleName("small");
    options.setMultiSelect(true);
    options.addItem("Option One");
    options.addItem("Option Two");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon("Option Two", testIcon.get());
    options.setItemIcon("Option Three", testIcon.get(true));
    row.addComponent(options);

    options = new OptionGroup("Choose one, large");
    options.addStyleName("large");
    options.setMultiSelect(false);
    options.addItem("Option One");
    options.addItem("Option Two");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon("Option Two", testIcon.get());
    options.setItemIcon("Option Three", testIcon.get(true));
    row.addComponent(options);

    options = new OptionGroup("Choose many, large");
    options.addStyleName("large");
    options.setMultiSelect(true);
    options.addItem("Option One");
    options.addItem("Option Two");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon("Option Two", testIcon.get());
    options.setItemIcon("Option Three", testIcon.get(true));
    row.addComponent(options);

    options = new OptionGroup("Horizontal items");
    options.addStyleName("horizontal");
    options.addItem("Option One");
    two = options.addItem("Option Two, with a longer caption");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon(two, testIcon.get());
    options.setItemIcon("Option Three", testIcon.get());
    row.addComponent(options);

    options = new OptionGroup("Horizontal items, explicit width");
    options.setMultiSelect(true);
    options.setWidth("500px");
    options.addStyleName("horizontal");
    options.addItem("Option One");
    two = options.addItem("Option Two, with a longer caption");
    options.addItem("Option Three");
    options.select("Option One");
    options.setItemIcon("Option One", testIcon.get());
    options.setItemIcon(two, testIcon.get());
    options.setItemIcon("Option Three", testIcon.get());
    row.addComponent(options);
}

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

License:Apache License

public ColorPickers() {
    setMargin(true);/*from w w w  . ja  v a2s. c  om*/

    Label h1 = new Label("Color Pickers");
    h1.addStyleName("h1");
    addComponent(h1);

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

    TestIcon testIcon = new TestIcon(40);

    ColorPicker cp = new ColorPicker();
    cp.setDefaultCaptionEnabled(true);
    cp.setIcon(testIcon.get());
    cp.setColor(new Color(138, 73, 115));
    row.addComponent(cp);

    cp = new ColorPicker();
    cp.setPopupStyle(PopupStyle.POPUP_SIMPLE);
    cp.setTextfieldVisibility(true);
    row.addComponent(cp);
}