Package com.vaadin.ui

Examples of com.vaadin.ui.TabSheet$CloseHandler


*/
public class NewSelectionAfterTabRemove extends AbstractTestUI {

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

        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


public class HiddenTabSheetBrowserResize extends TestBase {

    @Override
    public void setup() {
        final TabSheet tabSheet = new TabSheet();

        tabSheet.addTab(new Label("Label1"), "Tab1");
        tabSheet.addTab(new Label("Label2"), "Tab2");

        Button toggleButton = new Button("Toggle TabSheet",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        tabSheet.setVisible(!tabSheet.isVisible());
                    }
                });
        addComponent(toggleButton);
        addComponent(tabSheet);
    }
View Full Code Here

    private TabSheet fixedSizeTabSheet;
    private TabSheet autoWideTabSheet;

    @Override
    protected void setup() {
        fixedSizeTabSheet = new TabSheet();
        fixedSizeTabSheet.setHeight("200px");
        fixedSizeTabSheet.setWidth("400px");

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

                        @Override
                        public void buttonClick(ClickEvent event) {
                            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 + ")",
View Full Code Here

public class TabSheetFocusing extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        final TabSheet ts = new TabSheet();
        ts.setWidth("400px");
        ts.setHeight("200px");
        addComponent(ts);
        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

        mainLayout.setHeight("400px");
        mainLayout.addComponent(getTopMenu());

        CssLayout margin = new CssLayout();
        margin.setSizeFull();
        tabs = new TabSheet();
        tabs.setSizeFull();
        margin.addComponent(tabs);
        mainLayout.addComponent(margin);
        mainLayout.setExpandRatio(margin, 1);
View Full Code Here

        CheckBox closable = new CheckBox("Closable tabs");
        closable.setImmediate(true);
        l.addComponent(closable);

        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() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                Iterator<Component> it = ts.getComponentIterator();
                for (; it.hasNext();) {
                    Component c = it.next();
                    ts.getTab(c).setClosable(
                            (Boolean) event.getProperty().getValue());
                }
            }
        });
View Full Code Here

        return 2846;
    }

    @Override
    protected void setup() {
        final TabSheet tabSheet = new TabSheet();
        // Define date and locale so that it doesn't change for machine/time
        final SimpleDateFormat dateFormatter = new SimpleDateFormat(
                "EEE, yyyy-MMM-dd", Locale.ENGLISH);
        final Date date = new Date();
        date.setTime((long) 1000000000000.0);

        VerticalLayout layout1 = new VerticalLayout();
        layout1.setMargin(true);
        layout1.setSizeFull();
        panel1 = new Panel(
                "Panel initial caption (should also be tab caption)", layout1);
        panel1.setSizeFull();
        layout1.addComponent(new Label("This is a panel"));
        tabSheet.addTab(panel1);

        Button button = new Button("Update tab caption");
        button.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                tabSheet.getTab(panel1).setCaption(
                        "This is a new tab caption "
                                + dateFormatter.format(date));
            }
        });
View Full Code Here

    }

    @Override
    protected void setup() {

        TabSheet tabs = new TabSheet();
        tabs.setSizeFull();
        MyCustomComponent mcc = new MyCustomComponent();
        mcc.setSizeUndefined();

        // Doesn't work
        tabs.addTab(mcc, "Doesn't work (CustomComponent)", null);

        // Works:
        tabs.addTab(mcc.buildLayout(),
                "Works (no CustomComponent, same layout)", null);

        addComponent(tabs);
        getLayout().setSizeFull();
    }
View Full Code Here

                }
            }
            // if component is a tab sheet add two tabs for it
            if (comp instanceof TabSheet) {
                comp.setSizeUndefined();
                TabSheet tab = (TabSheet) comp;
                tab.addTab(new UndefWideLabel("TAB1"), "TAB1",
                        new ThemeResource(GLOBE_16_PNG));
                tab.addTab(new UndefWideLabel("TAB2"), "TAB2", null);
            }
            curLayout.addComponent(comp);
            mainLayout.addComponent(curLayout);
        }
        return mainLayout;
View Full Code Here

    }

    private Window createPopup() {
        Window w = new Window("Popup");
        TabSheet ts = new TabSheet();
        ol1 = new VerticalLayout();
        ol2 = new VerticalLayout();
        ol3 = new VerticalLayout();
        l1 = new Label("111");
        l2 = new Label("222");
        l3 = new Label("333");

        ol1.addComponent(l1);
        ol2.addComponent(l2);
        ol3.addComponent(l3);

        ts.addTab(ol1, "1", null);
        ts.addTab(ol2, "2", null);
        ts.addTab(ol3, "3", null);

        // l1.setVisible(false);
        // ts.setSelectedTab(l3);

        w.setContent(ts);
View Full Code Here

TOP

Related Classes of com.vaadin.ui.TabSheet$CloseHandler

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.