Package com.vaadin.ui.TabSheet

Examples of com.vaadin.ui.TabSheet.Tab


    protected void setup() {
        TabSheet tabSheet = new TabSheet();
        Label l = new Label("Label");
        l.setDescription("This is a label");

        Tab tab = tabSheet.addTab(l, "Tab", null);
        tab.setDescription("This is a tab");
        tab.setComponentError(new UserError("abc error"));

        Tab tab2 = tabSheet.addTab(new Label("Another label, d'oh"), "Tab 2",
                null);
        tab2.setDescription("This is another tab");

        addComponent(tabSheet);
    }
View Full Code Here


    @Override
    protected void setup(VaadinRequest request) {
        TabSheet tabSheet = new TabSheet();

        final Tab tab1 = tabSheet.addTab(new Label("Label 1"), "Tab 1", null);

        final Tab tab2 = tabSheet.addTab(new Label("Label 2"), "Tab 2", null);

        final Tab tab3 = tabSheet.addTab(new Label("Label 3"), "Tab 3", null);

        addComponent(tabSheet);

        Button b = new Button("Set ids", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                tab1.setId("tab1");
                tab2.setId("tab2");
                tab3.setId("tab3");
            }
        });
        addComponent(b);

        Button b2 = new Button("Clear ids", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                tab1.setId(null);
                tab2.setId(null);
                tab3.setId(null);
            }
        });
        addComponent(b2);
    }
View Full Code Here

        for (int i = 0; i < 20; i++) {

            String caption = "Tab " + i;
            Label label = new Label(caption);

            Tab tab = tabSheet.addTab(label, caption);
            tab.setClosable(true);
        }

        addComponent(tabSheet);
    }
View Full Code Here

                            fixedSizeTabSheet.getTab(event.getButton())
                                    .setVisible(false);
                        }

                    });
            Tab t = fixedSizeTabSheet.addTab(b, "Tab " + i, null);
            if (i % 2 == 0) {
                t.setVisible(false);
            }
        }

        addComponent(fixedSizeTabSheet);

        autoWideTabSheet = new TabSheet();
        autoWideTabSheet.setHeight("200px");
        autoWideTabSheet.setWidth(null);

        for (int i = 0; i < 10; i++) {
            Button b = new Button("Hide this tab (" + i + ")",
                    new ClickListener() {

                        @Override
                        public void buttonClick(ClickEvent event) {
                            autoWideTabSheet.getTab(event.getButton())
                                    .setVisible(false);
                        }
                    });

            Tab t = autoWideTabSheet.addTab(b, "Tab " + i, null);
            if (i % 2 == 0) {
                t.setVisible(false);

            }
        }

        addComponent(autoWideTabSheet);
View Full Code Here

        addComponent(new Button("Add tab", new ClickListener() {
            int i = 0;

            @Override
            public void buttonClick(ClickEvent event) {
                Tab t = ts.addTab(new Button("Tab " + ++i));
                ts.setSelectedTab(t);
                ts.focus();
            }
        }));
    }
View Full Code Here

        final TabSheet ts = new TabSheet();
        ts.setHeight("100px");
        l.addComponent(ts);

        for (int i = 1; i < 10; i++) {
            Tab t = ts.addTab(new Label(), "Tab " + i);
            if (i % 2 == 0) {
                t.setIcon(ICON_GLOBE);
            }
            if (i == 2) {
                t.setEnabled(false);
            }
        }

        closable.addListener(new Property.ValueChangeListener() {
View Full Code Here

        a.setWidth("100%");
        a.setHeight("170px");
        l.addComponent(a);

        for (int i = 1; i < 5; i++) {
            Tab t = a.addTab(new Label(), "Sheet " + i);
            if (i % 2 == 0) {
                t.setIcon(ICON_GLOBE);
            }
            if (i == 2) {
                t.setEnabled(false);
            }
        }

        return l;
    }
View Full Code Here

            content.addComponent(new Label("Content for tab " + i));
            if (i == 2) {
                content.addComponent(new Label(
                        "Excepteur sint obcaecat cupiditat non proident culpa. Magna pars studiorum, prodita quaerimus."));
            }
            Tab t = ts.addTab(content, tabcaption);
            t.setClosable(closable);
            t.setEnabled(!disable);

            // First tab is always enabled
            if (i == 1) {
                t.setEnabled(true);
            }

            if (icon) {
                t.setIcon(testIcon.get(false));
            }
        }

        ts.addSelectedTabChangeListener(new SelectedTabChangeListener() {
            @Override
View Full Code Here

     */
    public Tab addTab(Component c, String caption, Resource icon) {
        if (c == null) {
            return null;
        } else if (tabs.containsKey(c)) {
            Tab tab = tabs.get(c);
            tab.setCaption(caption);
            tab.setIcon(icon);
            return tab;
        } else {
            components.addLast(c);
            Tab tab = new TabSheetTabImpl(caption, icon);

            tabs.put(c, tab);
            if (selected == null) {
                selected = c;
                fireSelectedTabChange();
View Full Code Here

        for (final Iterator<Component> i = getComponentIterator(); i.hasNext();) {
            final Component component = i.next();

            orphaned.remove(component);

            Tab tab = tabs.get(component);

            target.startTag("tab");
            if (!tab.isEnabled() && tab.isVisible()) {
                target.addAttribute("disabled", true);
            }

            if (!tab.isVisible()) {
                target.addAttribute("hidden", true);
            }

            if (tab.isClosable()) {
                target.addAttribute("closable", true);
            }

            final Resource icon = tab.getIcon();
            if (icon != null) {
                target.addAttribute("icon", icon);
            }
            final String caption = tab.getCaption();
            if (caption != null && caption.length() > 0) {
                target.addAttribute("caption", caption);
            }

            final String description = tab.getDescription();
            if (description != null) {
                target.addAttribute("description", description);
            }

            final ErrorMessage componentError = tab.getComponentError();
            if (componentError != null) {
                componentError.paint(target);
            }

            target.addAttribute("key", keyMapper.key(component));
View Full Code Here

TOP

Related Classes of com.vaadin.ui.TabSheet.Tab

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.