Package com.vaadin.ui

Examples of com.vaadin.ui.Label


        showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
        showMenu.addStyleName("valo-menu-toggle");
        showMenu.setIcon(FontAwesome.LIST);
        menu.addComponent(showMenu);

        Label title = new Label("<h3>Vaadin <strong>Valo Theme</strong></h3>",
                ContentMode.HTML);
        title.setSizeUndefined();
        top.addComponent(title);
        top.setExpandRatio(title, 1);

        MenuBar settings = new MenuBar();
        settings.addStyleName("user-menu");
        StringGenerator sg = new StringGenerator();
        MenuItem settingsItem = settings.addItem(
                sg.nextString(true) + " " + sg.nextString(true)
                        + sg.nextString(false), new ThemeResource(
                        "../tests-valo/img/profile-pic-300px.jpg"), null);
        settingsItem.addItem("Edit Profile", null);
        settingsItem.addItem("Preferences", null);
        settingsItem.addSeparator();
        settingsItem.addItem("Sign Out", null);
        menu.addComponent(settings);

        menuItemsLayout.setPrimaryStyleName("valo-menuitems");
        menu.addComponent(menuItemsLayout);

        Label label = null;
        int count = -1;
        for (final Entry<String, String> item : menuItems.entrySet()) {
            if (item.getKey().equals("labels")) {
                label = new Label("Components", ContentMode.HTML);
                label.setPrimaryStyleName("valo-menu-subtitle");
                label.addStyleName("h4");
                label.setSizeUndefined();
                menuItemsLayout.addComponent(label);
            }
            if (item.getKey().equals("panels")) {
                label.setValue(label.getValue()
                        + " <span class=\"valo-menu-badge\">" + count
                        + "</span>");
                count = 0;
                label = new Label("Containers", ContentMode.HTML);
                label.setPrimaryStyleName("valo-menu-subtitle");
                label.addStyleName("h4");
                label.setSizeUndefined();
                menuItemsLayout.addComponent(label);
            }
            if (item.getKey().equals("calendar")) {
                label.setValue(label.getValue()
                        + " <span class=\"valo-menu-badge\">" + count
                        + "</span>");
                count = 0;
                label = new Label("Other", ContentMode.HTML);
                label.setPrimaryStyleName("valo-menu-subtitle");
                label.addStyleName("h4");
                label.setSizeUndefined();
                menuItemsLayout.addComponent(label);
            }
            Button b = new Button(item.getValue(), new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    navigator.navigateTo(item.getKey());
                }
            });
            if (count == 2) {
                b.setCaption(b.getCaption()
                        + " <span class=\"valo-menu-badge\">123</span>");
            }
            b.setHtmlContentAllowed(true);
            b.setPrimaryStyleName("valo-menu-item");
            b.setIcon(testIcon.get());
            menuItemsLayout.addComponent(b);
            count++;
        }
        label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">"
                + count + "</span>");

        return menu;
    }
View Full Code Here


        });
        centered.setSizeUndefined();
        layout.setSizeUndefined();
        centered.center();

        Label l = new Label("This window is centered");
        l.setSizeUndefined();
        Button b = new Button(
                "Clicking here should not produce a layout click event");
        b.addListener(new Button.ClickListener() {

            @Override
View Full Code Here

        LegacyWindow main = getMainWindow();

        final VerticalLayout mainLayout = new VerticalLayout();
        main.setContent(mainLayout);

        mainLayout.addComponent(new Label(
                "Replace the floating-point values with an integer"));

        // ///////////////////////////////////////////////////
        // Better working case

        final ObjectProperty<Double> property1 = new ObjectProperty<Double>(
                new Double(42.0));

        // A text field that changes its caption
        final TextField tf1 = new TextField(
                "Changing this field modifies only the textfield", property1);
        tf1.addListener(new Property.ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                // This value change event is called twice if the new
                // input value is an integer. The second time is during
                // paint() of AbstractOrderedLayout.

                System.out.println("Value 2 is: " + property1.getValue());

                tf1.setCaption("With caption " + property1.getValue());
            }
        });
        tf1.setImmediate(true);
        mainLayout.addComponent(tf1);

        // ///////////////////////////////////////////////////
        // Totally failing case

        final ObjectProperty<Double> property2 = new ObjectProperty<Double>(
                new Double(42.0));

        // A text field that adds new components
        final TextField tf2 = new TextField(
                "Changing this field modifies the layout - do it twice",
                property2);
        tf2.addListener(new Property.ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                // This value change event is called twice if the new
                // input value is an integer. The second time is during
                // paint() of AbstractOrderedLayout.

                System.out.println("Value 1 is: " + property2.getValue());

                // When this listener is called the second time in paint(), the
                // add operation causes a ConcurrentModificationException
                mainLayout.addComponent(new Label(
                        "Added a component, value is " + property2.getValue()));
            }
        });
        tf2.setImmediate(true);
        mainLayout.addComponent(tf2);
View Full Code Here

        t.setContainerDataSource(c);

        t.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);

        mainWin.addComponent(new Label(
                "Both rows in table should have same data (default values)"));

        mainWin.addComponent(t);

    }
View Full Code Here

        // w.setContent(ol);
        VerticalLayout hugeLayout = new VerticalLayout();
        hugeLayout.setMargin(true);
        hugeLayout.setSpacing(true);
        for (int i = 0; i < 30; i++) {
            hugeLayout.addComponent(new Label("huge " + i));
        }
        cl.addComponent(hugeLayout, "test");
        // ol.addComponent(hugeLayout);
        setMainWindow(w);
    }
View Full Code Here

public class DateFields extends VerticalLayout implements View {
    public DateFields() {
        setMargin(true);

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

        HorizontalLayout row = new HorizontalLayout();
        row.addStyleName("wrapping");
        row.setSpacing(true);
View Full Code Here

        // mainWindow.getLayout().setSizeFull();
        tabSheet = new TabSheet();
        // tabSheet.setWidth("100%");
        Button button = new Button("Blah");
        button.setWidth("100%");
        Label label1 = new Label("Lorem ipsum");
        Label label2 = new Label("Lorem");
        Label label3 = new Label(
                "Lorema jsdfhak sjdfh kajsdh fkajhd kfjah dkfjah ksfdjh kajsfh kj 1 2 3 4 5 6 7 8 9 10");

        label3.setWidth("800px");
        tabSheet.addTab(label1, "Tab 1", null);
        tabSheet.addTab(label2, "Tab 2", null);
        tabSheet.addTab(label3, "Tab 3", null);
        tabSheet.addTab(new Label("a"), "Tab 4", null);
        tabSheet.addTab(new Label("a"), "Tab 5", null);
        tabSheet.addTab(new Label("a"), "Tab 6", null);
        // mainWindow.addComponent(new Label("123"));
        mainWindow.addComponent(tabSheet);
        mainWindow.addComponent(button);
        // mainWindow.addComponent(new Label("abc"));
    }
View Full Code Here

        t.setColumnExpandRatio("txt", 10);// This column should be 400px wide.
        t.setSelectable(true);
        t.setSizeFull();

        for (int i = 0; i < 10; i++) {
            t.addItem(new Object[] { i, new Label("test " + i),
                    new Button("Button " + i) }, i);
        }

        return t;
View Full Code Here

        final Table t = TestForTablesInitialColumnWidthLogicRendering
                .getTestTable(7, 2000);
        t.setSizeFull();
        ts.addTab(t, "Table, scrollins should not flash", null);

        final Label testContent = new Label(
                "TabSheet by default uses caption, icon, errors etc. from Components. ");

        testContent.setCaption("Introduction to test");

        ts.addTab(testContent);

        final VerticalLayout actions = new VerticalLayout();

        actions.setCaption("Test actions");

        ts.addTab(actions);

        Button b;

        b = new Button(
                "change introduction caption (should add * to tab name)",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        testContent.setCaption(testContent.getCaption() + "*");
                    }
                });
        actions.addComponent(b);

        b = new Button("change tab caption (should add * to tab name)",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        actions.setCaption(actions.getCaption() + "*");
                    }
                });

        actions.addComponent(b);

        final UserError e = new UserError("Test error");

        b = new Button("Toggle error", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                if (testContent.getComponentError() == null) {
                    testContent.setComponentError(e);
                } else {
                    testContent.setComponentError(null);
                }
            }
        });
        actions.addComponent(b);

        b = new Button("Change table caption", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                t.setCaption(t.getCaption() + "*");
            }
        });
        actions.addComponent(b);

        b = new Button("Toggle Table error", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                if (t.getComponentError() == null) {
                    t.setComponentError(e);
                } else {
                    t.setComponentError(null);
                }
            }
        });

        actions.addComponent(b);

        for (int i = 0; i < 20; i++) {
            Label l = new Label("Test Content");
            l.setCaption("Extra tab " + i);
            ts.addComponent(l);
        }

        main.addComponent(ts);

View Full Code Here

*/
public class Labels extends VerticalLayout implements View {
    public Labels() {
        setMargin(true);

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

        HorizontalLayout split = new HorizontalLayout();
        split.setWidth("100%");
        addComponent(split);

        VerticalLayout left = new VerticalLayout();
        left.setMargin(new MarginInfo(false, true, false, false));
        split.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");
        split.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);

    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Label

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.