Example usage for com.vaadin.ui Label Label

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

Introduction

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

Prototype

public Label(String text) 

Source Link

Document

Creates a new instance with text content mode and the given text.

Usage

From source file:cib.ladnyik.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    Workbook wb = new XSSFWorkbook();
    window = new Window("My Vaadin Application");
    setMainWindow(window);/* w  ww.j  a v a  2 s  . c o  m*/
    Button button = new Button("Click Me Two Times Three Times XXX");
    button.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            window.addComponent(new Label("Thank you for clicking"));
            System.out.println("Thank you for clicking");
        }
    });
    window.addComponent(button);

}

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

License:Open Source License

private void initComponents() {
    removeAllComponents();/*from  w w  w . j av a  2s. c om*/

    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:cirad.cgh.vcf2fasta.view.Vcf2fastaForm.java

License:Open Source License

private Component getProgressLayout() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);/*from   w  ww  .jav  a2s .  c  o  m*/

    status = new Label("");
    layout.addComponent(this.status);

    progress = new ProgressBar();
    progress.setEnabled(false);
    progress.setVisible(false);
    layout.addComponent(progress);

    return layout;
}

From source file:com.abien.vaadin.helloapp.HelloApp.java

License:Apache License

@Override
public void init() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*w  w w .  j a v  a 2s. c  o  m*/
    Label header = new Label("Vaadin on Java EE");
    header.setStyleName("h1");
    layout.addComponent(header);

    final TextField nameField = new TextField("Input something:");
    final Label greetingLbl = new Label();
    layout.addComponent(nameField);

    layout.addComponent(
            new Button("Say slow Hello, clicking this shouldn't stall other users", new Button.ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    try {
                        Thread.sleep(20 * 1000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(HelloApp.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    getMainWindow().showNotification("Hello!");
                }
            }));

    layout.addComponent(new Button("Say Hello", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            greetingLbl.setCaption(greetingService.sayHello(nameField.getValue().toString()));
            buttonEvents.fire(event);
        }
    }));
    layout.addComponent(greetingLbl);

    Window mainWindow = new Window("Vaadin 6.8 - Java EE Integration", layout);
    setMainWindow(mainWindow);
}

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  .jav a2  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.anothernode.ballkontrolle.BallkontrolleUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {

    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);//  ww  w .  jav  a  2s.  com
    setContent(layout);

    Label team1Player1 = new Label("");
    Label team1Player2 = new Label("");
    Label team2Player1 = new Label("");
    Label team2Player2 = new Label("");

    final Button button = new Button("Draw Teams");
    button.addClickListener(event -> {

        final Drawing drawing = new Drawing(Data.summonPlayers());

        team1Player1.setValue(drawing.getTeam1().getPlayer1().toString());
        team1Player2.setValue(drawing.getTeam1().getPlayer2().toString());
        team2Player1.setValue(drawing.getTeam2().getPlayer1().toString());
        team2Player2.setValue(drawing.getTeam2().getPlayer2().toString());

    });

    layout.addComponent(button);
    layout.addComponent(new Label("Team 1:"));
    layout.addComponent(team1Player1);
    layout.addComponent(team1Player2);
    layout.addComponent(new Label("Team 2:"));
    layout.addComponent(team2Player1);
    layout.addComponent(team2Player2);
}

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();/* ww  w . j av  a 2s  .c o m*/
    title.addStyleName(ValoTheme.LABEL_H3);
    title.addStyleName(ValoTheme.LABEL_LIGHT);
    return title;
}

From source file:com.arcusys.liferay.vaadinplugin.ui.DetailsWindow.java

License:Apache License

private Layout createVaadinDetails() {

    Layout vaadinDetailLayout = new VerticalLayout();
    vaadinDetailLayout.setWidth("900px");

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

    Version currentVersion = ControlPanelPortletUtil.getPortalVaadinVersion();
    VaadinVersion currentVaadinInfo = VaadinVersion.getVaadinVersion(currentVersion);
    Collection<VaadinFileInfo> fileInfos = currentVaadinInfo.getVaadinFilesInfo();

    Collections.sort((List<VaadinFileInfo>) fileInfos, new Comparator<VaadinFileInfo>() {
        @Override//from  www  . j a  v  a2 s . c om
        public int compare(VaadinFileInfo o1, VaadinFileInfo o2) {
            if (o1 == null)
                return -1;
            if (o2 == null)
                return 1;
            return o1.getOrderPriority().compareTo(o2.getOrderPriority());
        }
    });

    for (VaadinFileInfo info : fileInfos) {
        VerticalLayout infoLayout = new VerticalLayout();
        infoLayout.setCaption(info.getName());

        infoLayout.setMargin(new MarginInfo(false, true, true, false));

        Layout versionLayout = new HorizontalLayout();
        versionLayout.setSizeUndefined();
        versionLayout.addComponent(new Label("Version: "));
        String vaadinJarVersion;
        try {
            vaadinJarVersion = ControlPanelPortletUtil.getPortalVaadinJarVersion(
                    info.getPlace() + ControlPanelPortletUtil.FileSeparator + info.getName());
        } catch (Exception ex) {
            vaadinJarVersion = "";
            log.warn("Version for " + vaadinJarVersion + " couldn't be read.", ex);
        }

        versionLayout.addComponent(new Label(vaadinJarVersion));

        infoLayout.addComponent(versionLayout);

        Layout pathLayout = new HorizontalLayout();

        pathLayout.setSizeUndefined();
        pathLayout.addComponent(new Label("Path: "));
        String path = info.getPlace();
        pathLayout.addComponent(new Label(path));

        infoLayout.addComponent(pathLayout);

        vaadinDetails.addComponent(infoLayout);
    }

    vaadinDetailLayout.addComponent(vaadinDetails);
    return vaadinDetailLayout;
}

From source file:com.blogspot.markogronroos.MainUI.java

License:GNU General Public License

@Override
protected void init(VaadinRequest request) {

    final VerticalLayout main = new VerticalLayout();
    main.setMargin(true);//  w w  w  .j  ava2  s.c o m
    setContent(main);

    //Window main = new Window("Test Application");

    // Create a menu bar
    final MenuBar menubar = new MenuBar();
    main.addComponent(menubar);

    // A feedback component
    final Label selection = new Label("-");
    main.addComponent(selection);

    MenuBar.MenuItem menuitem1 = menubar.addItem("JPA Examples", null, null);

    MenuBar.MenuItem menuitem2 = menuitem1.addItem("Other Example", null, null);

    MenuBar.Command mycommand = new MenuBar.Command() {
        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            selection.setValue("Ordered a " + selectedItem.getText() + " from menu.");
            String selectedText = selectedItem.getText();
            if (selectedText.contains("1.1"))
                jpaContTable(main);
            else if (selectedText.contains("1.2"))
                jpaContTable2(main);
            else if (selectedText.contains("1.3"))
                jpaContForm1(main);
            else if (selectedText.contains("1.4"))
                pureJPAExample(main);
            //selectedItem.
        }
    };

    menuitem1.addItem("1.1 demo JPAContainer Table component", null, mycommand);
    menuitem1.addItem("1.2 demo JPAContainer Table component, explicit EntityManager", null, mycommand);
    menuitem1.addItem("1.3 demo JPAContainer Form", null, mycommand);

    menuitem1.addItem("1.4 demo JPA batch", null, mycommand);
    //menuitem1.addItem(menuitem2);

    // Define a common menu command for all the menu items.

    //  initEx2(request);
}

From source file:com.blogspot.markogronroos.MainUI.java

License:GNU General Public License

void show(AbstractOrderedLayout l, String text) {
    l.addComponent(new Label(text));

}