Package com.vaadin.ui

Examples of com.vaadin.ui.TabSheet$CloseHandler


    @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() {
View Full Code Here


public class TabsheetMinimalClosableTabs extends TestBase {

    @Override
    protected void setup() {
        TabSheet ts = new TabSheet();
        for (int tab = 0; tab < 5; tab++) {
            String tabCaption = "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);
        addComponent(ts);
    }
View Full Code Here

        return null;
    }

    @Override
    protected void setup() {
        TabSheet ts1 = createTabsheet();
        ts1.setHeight("100px");
        TabSheet ts2 = createTabsheet();
        ts2.setHeight("100px");
        ts2.setWidth("400px");

        addComponent(ts1);
        addComponent(ts2);
    }
View Full Code Here

        addComponent(ts1);
        addComponent(ts2);
    }

    private TabSheet createTabsheet() {
        TabSheet tabsheet = new TabSheet();
        tabsheet.setSizeUndefined();

        Component[] tab = new Component[3];
        tab[0] = new Label("This is tab 1");
        tab[0].setIcon(new ThemeResource("../runo/icons/32/folder-add.png"));
        tab[0].setCaption("tab number 1");
        tab[1] = new TextField("This is tab 2", "Contents of tab 2 textfield");
        tab[2] = new Label("This is tab 3");
        tab[2].setIcon(new ThemeResource("../runo/icons/16/folder-add.png"));
        tab[2].setCaption("tab number 3");

        for (Component c : tab) {
            tabsheet.addTab(c);
            tabsheet.getTab(c).setIconAlternateText(
                    "iconalt" + tabsheet.getComponentCount());
        }

        return tabsheet;
    }
View Full Code Here

public class TabGetAndReplaceComponent extends TestBase {

    @Override
    protected void setup() {
        final TabSheet tabs = new TabSheet();

        tabs.addTab(new Label("Content 1"), "Content 1", null);
        tabs.addTab(new Label("Content 2"), "Content 2", null);
        tabs.addTab(new Label("Content 3"), "Content 3", null);
        tabs.addTab(new Label("Content 4"), "Content 4", null);
        tabs.addTab(new Label("Content 5"), "Content 5", null);
        addComponent(tabs);

        Button replace2 = new Button("Replace Content 2",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        Iterator<Component> iter = tabs.getComponentIterator();
                        iter.next();

                        Component content2 = iter.next();
                        Tab tab = tabs.getTab(content2);

                        // Replace content
                        tabs.replaceComponent(tab.getComponent(), new Label(
                                "Replacement 2"));

                    }
                });
        addComponent(replace2);
View Full Code Here

        Button b = new Button("Wrap main layout in a TabSheet");
        b.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                TabSheet tabsheet = new TabSheet();
                ComponentContainer mainParent = (ComponentContainer) mainLayout
                        .getParent();
                mainParent.replaceComponent(mainLayout, tabsheet);
                tabsheet.addTab(mainLayout, "Default tab");
            }
        });
        mainLayout.addComponent(b);
    }
View Full Code Here

            @Override
            public void buttonClick(final ClickEvent event) {
                main.hideTabs(!main.areTabsHidden());
            }
        }));
        sub = new TabSheet();
        sub.addTab(newPage(21), "Page 21");
        sub.addTab(newPage(22), "Page 22");
        main = new TabSheet();
        main.addTab(newPage(1), "Page 1");
        main.addTab(sub, "Page 2 (TabSheet)");
        main.addTab(newPage(3), "Page 3");
        addComponent(main);
    }
View Full Code Here

        return null;
    }

    @Override
    protected void setup() {
        tabSheet = new TabSheet();
        tabSheet.setId("tabsheet");
        addComponent(tabSheet);
    }
View Full Code Here

public class TabsheetShouldUpdateHeight extends TestBase {

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

        final Component tab2;

        tabsInner.addTab(tab2 = getLayoutWithComponents(6, "tab2"), "Tab 2");
        tabsInner.addTab(getLayoutWithComponents(8, "tab3"), "Tab 3");

        tabsOuter.addTab(tabsInner, "Inner tabs");
        tabsOuter.addTab(getLayoutWithComponents(10, "tab1"), "Tab 1");

        final Button btnSwitch = new Button("switch to Tab2",
                new Button.ClickListener() {

                    @Override
                    public void buttonClick(final ClickEvent inEvent) {
                        tabsOuter.setSelectedTab(tabsInner);
                        tabsInner.setSelectedTab(tab2);
                    }
                });

        addComponent(tabsOuter);
        addComponent(btnSwitch);
View Full Code Here

public class SplitPanelWithMinimumAndMaximum extends TestBase {

    @Override
    protected void setup() {
        TabSheet tabs = new TabSheet();

        VerticalLayout horizontalSplitsLayout = new VerticalLayout();
        horizontalSplitsLayout.setCaption("Horizontal splits");

        HorizontalSplitPanel percentagePositionWithPercentageLimitsHorizontal = new HorizontalSplitPanel();
        percentagePositionWithPercentageLimitsHorizontal.setMinSplitPosition(
                10, Sizeable.UNITS_PERCENTAGE);
        percentagePositionWithPercentageLimitsHorizontal.setMaxSplitPosition(
                80, Sizeable.UNITS_PERCENTAGE);
        percentagePositionWithPercentageLimitsHorizontal
                .setFirstComponent(new Label("Min 10 % - 50 % position"));
        percentagePositionWithPercentageLimitsHorizontal
                .setSecondComponent(new Label("Max 80 %"));
        percentagePositionWithPercentageLimitsHorizontal.setSplitPosition(50,
                Sizeable.UNITS_PERCENTAGE);
        horizontalSplitsLayout
                .addComponent(percentagePositionWithPercentageLimitsHorizontal);

        HorizontalSplitPanel pixelPositionWithPercentageLimitsHorizontal = new HorizontalSplitPanel();
        pixelPositionWithPercentageLimitsHorizontal.setMinSplitPosition(10,
                Sizeable.UNITS_PERCENTAGE);
        pixelPositionWithPercentageLimitsHorizontal.setMaxSplitPosition(80,
                Sizeable.UNITS_PERCENTAGE);
        pixelPositionWithPercentageLimitsHorizontal
                .setFirstComponent(new Label("Min 10 % - 400 px position"));
        pixelPositionWithPercentageLimitsHorizontal
                .setSecondComponent(new Label("Max 80 %"));
        pixelPositionWithPercentageLimitsHorizontal.setSplitPosition(400,
                Sizeable.UNITS_PIXELS);
        horizontalSplitsLayout
                .addComponent(pixelPositionWithPercentageLimitsHorizontal);

        HorizontalSplitPanel pixelPositionWithPixelLimitsHorizontal = new HorizontalSplitPanel();
        pixelPositionWithPixelLimitsHorizontal.setMinSplitPosition(100,
                Sizeable.UNITS_PIXELS);
        pixelPositionWithPixelLimitsHorizontal.setMaxSplitPosition(550,
                Sizeable.UNITS_PIXELS);
        pixelPositionWithPixelLimitsHorizontal.setFirstComponent(new Label(
                "Min 100 px - 400 px position"));
        pixelPositionWithPixelLimitsHorizontal.setSecondComponent(new Label(
                "Max 550 px"));
        pixelPositionWithPixelLimitsHorizontal.setSplitPosition(400,
                Sizeable.UNITS_PIXELS);
        horizontalSplitsLayout
                .addComponent(pixelPositionWithPixelLimitsHorizontal);

        HorizontalSplitPanel percentagePositionWithPixelLimitsHorizontal = new HorizontalSplitPanel();
        percentagePositionWithPixelLimitsHorizontal.setMinSplitPosition(100,
                Sizeable.UNITS_PIXELS);
        percentagePositionWithPixelLimitsHorizontal.setMaxSplitPosition(550,
                Sizeable.UNITS_PIXELS);
        percentagePositionWithPixelLimitsHorizontal
                .setFirstComponent(new Label("Min 100 px - 30 % position"));
        percentagePositionWithPixelLimitsHorizontal
                .setSecondComponent(new Label("Max 550 px"));
        percentagePositionWithPixelLimitsHorizontal.setSplitPosition(30,
                Sizeable.UNITS_PERCENTAGE);
        horizontalSplitsLayout
                .addComponent(percentagePositionWithPixelLimitsHorizontal);

        HorizontalSplitPanel percentagePositionWithPercentageLimitsHorizontalResersed = new HorizontalSplitPanel();
        percentagePositionWithPercentageLimitsHorizontalResersed
                .setMinSplitPosition(10, Sizeable.UNITS_PERCENTAGE);
        percentagePositionWithPercentageLimitsHorizontalResersed
                .setMaxSplitPosition(80, Sizeable.UNITS_PERCENTAGE);
        percentagePositionWithPercentageLimitsHorizontalResersed
                .setFirstComponent(new Label(
                        "Max 80 % - Reversed 50 % position"));
        percentagePositionWithPercentageLimitsHorizontalResersed
                .setSecondComponent(new Label("Min 10 %"));
        percentagePositionWithPercentageLimitsHorizontalResersed
                .setSplitPosition(50, Sizeable.UNITS_PERCENTAGE, true);
        horizontalSplitsLayout
                .addComponent(percentagePositionWithPercentageLimitsHorizontalResersed);

        HorizontalSplitPanel pixelPositionWithPercentageLimitsHorizontalResersed = new HorizontalSplitPanel();
        pixelPositionWithPercentageLimitsHorizontalResersed
                .setMinSplitPosition(10, Sizeable.UNITS_PERCENTAGE);
        pixelPositionWithPercentageLimitsHorizontalResersed
                .setMaxSplitPosition(80, Sizeable.UNITS_PERCENTAGE);
        pixelPositionWithPercentageLimitsHorizontalResersed
                .setFirstComponent(new Label(
                        "Max 80 % - Reversed 400 px position"));
        pixelPositionWithPercentageLimitsHorizontalResersed
                .setSecondComponent(new Label("Min 10 %"));
        pixelPositionWithPercentageLimitsHorizontalResersed.setSplitPosition(
                400, Sizeable.UNITS_PIXELS, true);
        horizontalSplitsLayout
                .addComponent(pixelPositionWithPercentageLimitsHorizontalResersed);

        HorizontalSplitPanel pixelPositionWithPixelLimitsHorizontalResersed = new HorizontalSplitPanel();
        pixelPositionWithPixelLimitsHorizontalResersed.setMinSplitPosition(100,
                Sizeable.UNITS_PIXELS);
        pixelPositionWithPixelLimitsHorizontalResersed.setMaxSplitPosition(550,
                Sizeable.UNITS_PIXELS);
        pixelPositionWithPixelLimitsHorizontalResersed
                .setFirstComponent(new Label(
                        "Max 550 px - Reversed 400 px position"));
        pixelPositionWithPixelLimitsHorizontalResersed
                .setSecondComponent(new Label("Min 100 px"));
        pixelPositionWithPixelLimitsHorizontalResersed.setSplitPosition(400,
                Sizeable.UNITS_PIXELS, true);
        horizontalSplitsLayout
                .addComponent(pixelPositionWithPixelLimitsHorizontalResersed);

        HorizontalSplitPanel percentagePositionWithPixelLimitsHorizontalResersed = new HorizontalSplitPanel();
        percentagePositionWithPixelLimitsHorizontalResersed
                .setMinSplitPosition(100, Sizeable.UNITS_PIXELS);
        percentagePositionWithPixelLimitsHorizontalResersed
                .setMaxSplitPosition(550, Sizeable.UNITS_PIXELS);
        percentagePositionWithPixelLimitsHorizontalResersed
                .setFirstComponent(new Label(
                        "Max 550 px - Reversed 30 % position"));
        percentagePositionWithPixelLimitsHorizontalResersed
                .setSecondComponent(new Label("Min 100 px"));
        percentagePositionWithPixelLimitsHorizontalResersed.setSplitPosition(
                30, Sizeable.UNITS_PERCENTAGE, true);
        horizontalSplitsLayout
                .addComponent(percentagePositionWithPixelLimitsHorizontalResersed);

        horizontalSplitsLayout.setSizeFull();
        tabs.addComponent(horizontalSplitsLayout);

        HorizontalLayout verticalSplitsLayout = new HorizontalLayout();
        verticalSplitsLayout.setCaption("Vertical splits");

        VerticalSplitPanel percentagePositionWithPercentageLimitsVertical = new VerticalSplitPanel();
        percentagePositionWithPercentageLimitsVertical.setMinSplitPosition(10,
                Sizeable.UNITS_PERCENTAGE);
        percentagePositionWithPercentageLimitsVertical.setMaxSplitPosition(80,
                Sizeable.UNITS_PERCENTAGE);
        percentagePositionWithPercentageLimitsVertical
                .setFirstComponent(new Label("Min 10 % - 50 % position"));
        percentagePositionWithPercentageLimitsVertical
                .setSecondComponent(new Label("Max 80 %"));
        percentagePositionWithPercentageLimitsVertical.setSplitPosition(50,
                Sizeable.UNITS_PERCENTAGE);
        verticalSplitsLayout
                .addComponent(percentagePositionWithPercentageLimitsVertical);

        VerticalSplitPanel pixelPositionWithPercentageLimitsVertical = new VerticalSplitPanel();
        pixelPositionWithPercentageLimitsVertical.setMinSplitPosition(10,
                Sizeable.UNITS_PERCENTAGE);
        pixelPositionWithPercentageLimitsVertical.setMaxSplitPosition(80,
                Sizeable.UNITS_PERCENTAGE);
        pixelPositionWithPercentageLimitsVertical.setFirstComponent(new Label(
                "Min 10 % - 400 px position"));
        pixelPositionWithPercentageLimitsVertical.setSecondComponent(new Label(
                "Max 80 %"));
        pixelPositionWithPercentageLimitsVertical.setSplitPosition(400,
                Sizeable.UNITS_PIXELS);
        verticalSplitsLayout
                .addComponent(pixelPositionWithPercentageLimitsVertical);

        VerticalSplitPanel pixelPositionWithPixelLimitsVertical = new VerticalSplitPanel();
        pixelPositionWithPixelLimitsVertical.setMinSplitPosition(100,
                Sizeable.UNITS_PIXELS);
        pixelPositionWithPixelLimitsVertical.setMaxSplitPosition(450,
                Sizeable.UNITS_PIXELS);
        pixelPositionWithPixelLimitsVertical.setFirstComponent(new Label(
                "Min 100 px - 400 px position"));
        pixelPositionWithPixelLimitsVertical.setSecondComponent(new Label(
                "Max 450 px"));
        pixelPositionWithPixelLimitsVertical.setSplitPosition(400,
                Sizeable.UNITS_PIXELS);
        verticalSplitsLayout.addComponent(pixelPositionWithPixelLimitsVertical);

        VerticalSplitPanel percentagePositionWithPixelLimitsVertical = new VerticalSplitPanel();
        percentagePositionWithPixelLimitsVertical.setMinSplitPosition(100,
                Sizeable.UNITS_PIXELS);
        percentagePositionWithPixelLimitsVertical.setMaxSplitPosition(450,
                Sizeable.UNITS_PIXELS);
        percentagePositionWithPixelLimitsVertical.setFirstComponent(new Label(
                "Min 100 px - 30 % position"));
        percentagePositionWithPixelLimitsVertical.setSecondComponent(new Label(
                "Max 450 px"));
        percentagePositionWithPixelLimitsVertical.setSplitPosition(30,
                Sizeable.UNITS_PERCENTAGE);
        verticalSplitsLayout
                .addComponent(percentagePositionWithPixelLimitsVertical);

        VerticalSplitPanel percentagePositionWithPercentageLimitsVerticalReversed = new VerticalSplitPanel();
        percentagePositionWithPercentageLimitsVerticalReversed
                .setMinSplitPosition(10, Sizeable.UNITS_PERCENTAGE);
        percentagePositionWithPercentageLimitsVerticalReversed
                .setMaxSplitPosition(80, Sizeable.UNITS_PERCENTAGE);
        percentagePositionWithPercentageLimitsVerticalReversed
                .setFirstComponent(new Label(
                        "Max 80 % - Reversed 50 % position"));
        percentagePositionWithPercentageLimitsVerticalReversed
                .setSecondComponent(new Label("Min 10 %"));
        percentagePositionWithPercentageLimitsVerticalReversed
                .setSplitPosition(50, Sizeable.UNITS_PERCENTAGE, true);
        verticalSplitsLayout
                .addComponent(percentagePositionWithPercentageLimitsVerticalReversed);

        VerticalSplitPanel pixelPositionWithPercentageLimitsVerticalReversed = new VerticalSplitPanel();
        pixelPositionWithPercentageLimitsVerticalReversed.setMinSplitPosition(
                10, Sizeable.UNITS_PERCENTAGE);
        pixelPositionWithPercentageLimitsVerticalReversed.setMaxSplitPosition(
                80, Sizeable.UNITS_PERCENTAGE);
        pixelPositionWithPercentageLimitsVerticalReversed
                .setFirstComponent(new Label(
                        "Max 80 % - Reversed 400 px position"));
        pixelPositionWithPercentageLimitsVerticalReversed
                .setSecondComponent(new Label("Min 10 %"));
        pixelPositionWithPercentageLimitsVerticalReversed.setSplitPosition(400,
                Sizeable.UNITS_PIXELS, true);
        verticalSplitsLayout
                .addComponent(pixelPositionWithPercentageLimitsVerticalReversed);

        VerticalSplitPanel pixelPositionWithPixelLimitsVerticalReversed = new VerticalSplitPanel();
        pixelPositionWithPixelLimitsVerticalReversed.setMinSplitPosition(100,
                Sizeable.UNITS_PIXELS);
        pixelPositionWithPixelLimitsVerticalReversed.setMaxSplitPosition(400,
                Sizeable.UNITS_PIXELS);
        pixelPositionWithPixelLimitsVerticalReversed
                .setFirstComponent(new Label(
                        "Max 400 px - Reversed 300 px position"));
        pixelPositionWithPixelLimitsVerticalReversed
                .setSecondComponent(new Label("Min 100 px"));
        pixelPositionWithPixelLimitsVerticalReversed.setSplitPosition(300,
                Sizeable.UNITS_PIXELS, true);
        verticalSplitsLayout
                .addComponent(pixelPositionWithPixelLimitsVerticalReversed);

        VerticalSplitPanel percentagePositionWithPixelLimitsVerticalReversed = new VerticalSplitPanel();
        percentagePositionWithPixelLimitsVerticalReversed.setMinSplitPosition(
                100, Sizeable.UNITS_PIXELS);
        percentagePositionWithPixelLimitsVerticalReversed.setMaxSplitPosition(
                400, Sizeable.UNITS_PIXELS);
        percentagePositionWithPixelLimitsVerticalReversed
                .setFirstComponent(new Label(
                        "Max 400 px - Reversed 30 % position"));
        percentagePositionWithPixelLimitsVerticalReversed
                .setSecondComponent(new Label("Min 100 px"));
        percentagePositionWithPixelLimitsVerticalReversed.setSplitPosition(30,
                Sizeable.UNITS_PERCENTAGE, true);
        verticalSplitsLayout
                .addComponent(percentagePositionWithPixelLimitsVerticalReversed);

        tabs.addComponent(verticalSplitsLayout);
        verticalSplitsLayout.setSizeFull();

        final VerticalLayout togglableSplitPanelLayout = new VerticalLayout();
        togglableSplitPanelLayout.setCaption("Togglable minimum/maximum");

        final HorizontalSplitPanel togglableSplitPanel = new HorizontalSplitPanel();
        togglableSplitPanel.setMinSplitPosition(10, Sizeable.UNITS_PERCENTAGE);
        togglableSplitPanel.setMaxSplitPosition(80, Sizeable.UNITS_PERCENTAGE);
        togglableSplitPanel.setFirstComponent(new Label(
                "Min 10 % - 50 % position"));
        togglableSplitPanel.setSecondComponent(new Label("Max 80 %"));
        togglableSplitPanel.setSplitPosition(50, Sizeable.UNITS_PERCENTAGE);
        togglableSplitPanel.setHeight("250px");
        togglableSplitPanelLayout.addComponent(togglableSplitPanel);

        final HorizontalLayout buttonLayout = new HorizontalLayout();

        Button disableMinimum = new Button("Disable min limit",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        togglableSplitPanel.setMinSplitPosition(0,
                                Sizeable.UNITS_PERCENTAGE);

                    }
                });
        Button enableMinimum = new Button("Enable min limit",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        togglableSplitPanel.setMinSplitPosition(10,
                                Sizeable.UNITS_PERCENTAGE);

                    }
                });
        Button disableMaximum = new Button("Disable max limit",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        togglableSplitPanel.setMaxSplitPosition(100,
                                Sizeable.UNITS_PERCENTAGE);

                    }
                });
        Button enableMaximum = new Button("Enable max limit",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        togglableSplitPanel.setMaxSplitPosition(80,
                                Sizeable.UNITS_PERCENTAGE);

                    }
                });
        buttonLayout.addComponent(disableMinimum);
        buttonLayout.addComponent(enableMinimum);
        buttonLayout.addComponent(disableMaximum);
        buttonLayout.addComponent(enableMaximum);

        togglableSplitPanelLayout.addComponent(buttonLayout);
        tabs.addComponent(togglableSplitPanelLayout);

        addComponent(tabs);
        tabs.setHeight("550px");
        tabs.setWidth("600px");
        getLayout().setSizeFull();
    }
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.