Examples of Tab


Examples of com.vaadin.ui.TabSheet.Tab

    }

    @Test
    public void getTabByPosition() {
        TabSheet tabSheet = new TabSheet();
        Tab tab1 = tabSheet.addTab(new Label("aaa"));
        Tab tab2 = tabSheet.addTab(new Label("bbb"));
        Tab tab3 = tabSheet.addTab(new Label("ccc"));

        assertEquals(tab1, tabSheet.getTab(0));
        assertEquals(tab2, tabSheet.getTab(1));
        assertEquals(tab3, tabSheet.getTab(2));
View Full Code Here

Examples of com.vaadin.ui.TabSheet.Tab

    }

    @Test
    public void selectTab() {
        TabSheet tabSheet = new TabSheet();
        Tab tab1 = tabSheet.addTab(new Label("aaa"));
        Tab tab2 = tabSheet.addTab(new Label("bbb"));
        Tab tab3 = tabSheet.addTab(new Label("ccc"));
        Label componentNotInSheet = new Label("ddd");
        Tab tabNotInSheet = new TabSheet().addTab(new Label("eee"));

        assertEquals(tab1.getComponent(), tabSheet.getSelectedTab());

        // Select tab by component...
        tabSheet.setSelectedTab(tab2.getComponent());
View Full Code Here

Examples of com.vaadin.ui.TabSheet.Tab

        Label lbl1 = new Label("aaa");
        Label lbl2 = new Label("bbb");
        Label lbl3 = new Label("ccc");
        Label lbl4 = new Label("ddd");

        Tab tab1 = tabSheet.addTab(lbl1);
        tab1.setCaption("tab1");
        tab1.setClosable(true);
        Tab tab2 = tabSheet.addTab(lbl2);
        tab2.setDescription("description");
        tab2.setEnabled(false);

        // Replace component not in tabsheet with one already in tabsheet -
        // should be no-op
        tabSheet.replaceComponent(lbl3, lbl2);
        assertEquals(2, tabSheet.getComponentCount());
        assertSame(tab1, tabSheet.getTab(lbl1));
        assertSame(tab2, tabSheet.getTab(lbl2));
        assertNull(tabSheet.getTab(lbl3));

        // Replace component not in tabsheet with one not in tabsheet either
        // should add lbl4 as last tab
        tabSheet.replaceComponent(lbl3, lbl4);
        assertEquals(3, tabSheet.getComponentCount());
        assertSame(tab1, tabSheet.getTab(lbl1));
        assertSame(tab2, tabSheet.getTab(lbl2));
        assertEquals(2, tabSheet.getTabPosition(tabSheet.getTab(lbl4)));

        // Replace component in tabsheet with another
        // should swap places, tab association should stay the same but tabs
        // should swap metadata
        tabSheet.replaceComponent(lbl1, lbl2);
        assertSame(tab1, tabSheet.getTab(lbl1));
        assertSame(tab2, tabSheet.getTab(lbl2));
        assertEquals(false, tab1.isClosable());
        assertEquals(true, tab2.isClosable());
        assertEquals(false, tab1.isEnabled());
        assertEquals(true, tab2.isEnabled());
        assertEquals("description", tab1.getDescription());
        assertEquals(null, tab2.getDescription());
        assertEquals(3, tabSheet.getComponentCount());
        assertEquals(1, tabSheet.getTabPosition(tabSheet.getTab(lbl1)));
        assertEquals(0, tabSheet.getTabPosition(tabSheet.getTab(lbl2)));

        // Replace component in tabsheet with one not in tabsheet
View Full Code Here

Examples of com.vaadin.ui.TabSheet.Tab

        tabs.setSelectedTab(two);

        VerticalLayout l = new VerticalLayout();
        l.addComponent(new Label("On third tab"));
        Tab last = tabs.addTab(l);
        last.setCaption("Three");

        addButton("Remove First", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
View Full Code Here

Examples of com.vaadin.ui.TabSheet.Tab

    protected void setup(VaadinRequest request) {
        final Accordion tabs = new Accordion();
        addComponent(tabs);
        tabs.setHeight(500, Unit.PIXELS);
        Button remove = new Button("Remove 'First'");
        final Tab me = tabs.addTab(addTab("First"));
        remove.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                tabs.removeTab(me);
                Tab tab = tabs.addTab(addTab("Next"));
                tabs.setSelectedTab(tab);
            }
        });
        addComponent(remove);
    }
View Full Code Here

Examples of com.vaadin.ui.TabSheet.Tab

    protected void setup() {
        Accordion acc = new Accordion();
        addComponent(acc);

        for (int tabIndex = 0; tabIndex < 5; tabIndex++) {
            Tab tab = acc.addTab(new Label("Tab " + tabIndex));
            tab.setCaption("Tab " + tabIndex);
            tab.setStyleName("tab" + tabIndex);
        }
    }
View Full Code Here

Examples of com.vaadin.ui.TabSheet.Tab

        final TabSheet t = new TabSheet();

        for (int i = 1; i < 4; i++) {
            VerticalLayout v = new VerticalLayout();
            v.addComponent(new Label("Content " + i));
            Tab tab = t.addTab(v, "Tab " + i);
            tab.setClosable(true);
        }
        addComponent(t);
    }
View Full Code Here

Examples of com.vaadin.ui.TabSheet.Tab

        addTab();
        addTab().setComponentError(new UserError("Error!"));
        addTab().setDescription("This is a tab");

        Tab t = addTab();
        t.setComponentError(new UserError("Error!"));
        t.setDescription("This tab has both an error and a description");

        setContent(tabSheet);
        getTooltipConfiguration().setOpenDelay(0);
        getTooltipConfiguration().setQuickOpenDelay(0);
        getTooltipConfiguration().setCloseTimeout(1000);
View Full Code Here

Examples of com.vaadin.ui.TabSheet.Tab

    @Override
    public void setup() {
        setTheme("tests-tickets");

        TabSheet tabsheet = new TabSheet();
        final Tab tab1 = tabsheet.addTab(new Label(), "Tab 1");
        final Tab tab2 = tabsheet.addTab(new Label(), "Tab 2");

        tab1.setStyleName(STYLE_NAME);

        addComponent(new Button("Update style names",
                new Button.ClickListener() {
                    int counter = 0;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        if (tab1.getStyleName() == null) {
                            tab1.setStyleName(STYLE_NAME);
                        } else {
                            tab1.setStyleName(null);
                        }

                        tab2.setStyleName(STYLE_NAME + "_" + (counter++));
                    }
                }));

        addComponent(tabsheet);
    }
View Full Code Here

Examples of com.vaadin.ui.TabSheet.Tab

            for (int c = 0; c < tab; c++) {
                tabCaption += tabCaption;
            }
            tabCaption += " " + tab;

            Tab t = ts.addTab(new Label("Content " + tab), tabCaption);
            t.setClosable(true);

            if (tab % 2 == 0) {
                t.setIcon(new ExternalResource(
                        "/VAADIN/themes/tests-tickets/icons/fi.gif"));
            }
        }

        ts.addStyleName(Reindeer.TABSHEET_MINIMAL);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.