Example usage for com.vaadin.ui TabSheet TabSheet

List of usage examples for com.vaadin.ui TabSheet TabSheet

Introduction

In this page you can find the example usage for com.vaadin.ui TabSheet TabSheet.

Prototype

public TabSheet() 

Source Link

Document

Constructs a new TabSheet.

Usage

From source file:br.com.anteros.mobileserver.app.form.TableForm.java

License:Apache License

private void createPageControl() {
    pageControl = new TabSheet();
    pageControl.setWidth("100%");
    pageControl.setHeight("180px");
    pageControl.addTab(layoutFields, "Campos");
    pageControl.addTab(layoutParameters, "Parmetros");
    pageControl.addListener(this);
}

From source file:cb_server.SettingsWindow.java

License:Open Source License

private void fillContent() {

    if (Settingscontent != null) {
        content.removeComponent(Settingscontent);
        Settingscontent = null;//  w w  w.  ja v a  2 s .co  m
    }

    Settingscontent = new VerticalLayout();
    content.addComponent(Settingscontent);

    InetAddress addr;
    QRCode code = null;
    try {
        addr = InetAddress.getLocalHost();

        //Getting IPAddress of localhost - getHostAddress return IP Address
        // in textual format
        String ipAddress = addr.getHostAddress();

        ipAddress = "";
        // Network Interfaces nach IPv4 Adressen durchsuchen
        try {
            Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
            for (NetworkInterface netint : Collections.list(nets)) {
                Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
                for (InetAddress inetAddress : Collections.list(inetAddresses)) {
                    if (inetAddress.isLoopbackAddress())
                        continue;
                    if (inetAddress instanceof Inet4Address) {
                        System.out.println("InetAddress: " + inetAddress);
                        if (ipAddress.length() > 0) {
                            ipAddress += ";";
                        }
                        ipAddress += inetAddress;
                    }
                }
            }

        } catch (SocketException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        code = new QRCode();
        code.setWidth(150, Unit.PIXELS);
        code.setHeight(150, Unit.PIXELS);
        code.setValue(ipAddress);

    } catch (UnknownHostException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    TabSheet tabSheet = new TabSheet();
    tabSheet.setWidth(100, Unit.PERCENTAGE);
    tabSheet.setHeight(100, Unit.PERCENTAGE);
    Settingscontent.addComponent(tabSheet);

    VerticalLayout lay = new VerticalLayout();

    // add Lang Spinner

    langSpinner = new ComboBox();
    langSpinner.setCaption("select Lang");

    for (Lang lang : Translation.GetLangs(SettingsClass.LanguagePath.getValue())) {
        langSpinner.addItem(lang.Name);
        langSpinner.setItemCaption(lang.Name, lang.Name);
    }

    langSpinner.setValue(Translation.getLangId());
    langSpinner.setNullSelectionAllowed(false);
    lay.addComponent(langSpinner);

    lay.addComponent(code);
    SettingsLinearLayoutPanel info = new SettingsLinearLayoutPanel();

    info.setContent(lay, 400);

    tabSheet.addTab(info, "Info");

    // Categorie List zusammen stellen

    if (Categorys == null) {
        Categorys = new ArrayList<SettingCategory>();
    }

    Categorys.clear();
    SettingCategory[] tmp = SettingCategory.values();
    for (SettingCategory item : tmp) {
        if (item != SettingCategory.Button) {
            Categorys.add(item);
        }

    }

    Iterator<SettingCategory> iteratorCat = Categorys.iterator();
    if (iteratorCat != null && iteratorCat.hasNext()) {

        ArrayList<SettingBase<?>> SortedSettingList = new ArrayList<SettingBase<?>>();

        for (Iterator<SettingBase<?>> it = Config.settings.iterator(); it.hasNext();) {
            SettingBase<?> setting = it.next();

            if (setting.getModus() != SettingModus.Never
                    && (setting.getUsage() == SettingUsage.ALL || setting.getUsage() == SettingUsage.CBS)) {
                SortedSettingList.add(setting);
            }
        }

        do {
            int position = 0;

            SettingCategory cat = iteratorCat.next();

            // add Cat eintrge

            lay = new VerticalLayout();
            int entryCount = 0;

            if (cat == SettingCategory.Login) {
                final Component view = getLogInButton(position++);
                lay.addComponent(view);
            }

            // int layoutHeight = 0;
            for (Iterator<SettingBase<?>> it = SortedSettingList.iterator(); it.hasNext();) {
                SettingBase<?> settingItem = it.next();
                if (settingItem.getCategory().name().equals(cat.name())) {

                    if ((settingItem.getModus() == SettingModus.Normal)
                            && (settingItem.getModus() != SettingModus.Never)) {

                        final Component view = getView(settingItem, position++);

                        if (view == null)
                            continue;

                        lay.addComponent(view);
                        entryCount++;
                        Config.settings.indexOf(settingItem);

                    }

                }
            }

            if (entryCount > 0) {

                SettingsLinearLayoutPanel catPanel = new SettingsLinearLayoutPanel();

                catPanel.setContent(lay, 400);

                tabSheet.addTab(catPanel, cat.name());

                //               addControlToLinearLayout(lay, 100);

            }

        } while (iteratorCat.hasNext());

    }

}

From source file:ch.vorburger.vaadin.designer.samplescreen.SampleFixedScreenComponent.java

License:Apache License

@AutoGenerated
private TabSheet buildTabSheet() {
    // common part: create layout
    tabSheet = new TabSheet();
    tabSheet.setImmediate(true);// ww w.  j  a  va 2 s  . c  o  m
    tabSheet.setWidth("100.0%");
    tabSheet.setHeight("100.0%");

    // absoluteLayout
    absoluteLayout = buildAbsoluteLayout();
    tabSheet.addTab(absoluteLayout, "Tab1", null);

    //      // table_1
    //      table_1 = new Table();
    //      table_1.setImmediate(false);
    //      table_1.setWidth("-1px");
    //      table_1.setHeight("100.0%");
    //      table_1.setContainerDataSource(ExampleUtil.getISO3166Container());
    //      table_1.setColumnHeaders(new String[] { "Country", "Code", "Icon file" });
    //      tabSheet.addTab(table_1, "Tab2", null);

    return tabSheet;
}

From source file:co.edu.icesi.academ.client.perfiles.propietario.PanelAsignarRolEvaluador.java

License:Open Source License

@AutoGenerated
private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);//from  www .  jav a  2 s. co  m
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");

    // top-level component properties
    setWidth("100.0%");
    setHeight("100.0%");

    // btnGuardar
    btnGuardar = new Button();
    btnGuardar.setCaption("Guardar");
    btnGuardar.setImmediate(true);
    btnGuardar.setWidth("-1px");
    btnGuardar.setHeight("-1px");
    mainLayout.addComponent(btnGuardar, "top:20.0px;left:10.0px;");

    // lblEvaluadores
    lblEvaluadores = new Label();
    lblEvaluadores.setImmediate(false);
    lblEvaluadores.setWidth("-1px");
    lblEvaluadores.setHeight("-1px");
    lblEvaluadores.setValue("Evaluadores:");
    mainLayout.addComponent(lblEvaluadores, "top:80.0px;left:30.0px;");

    // btnAgregar
    btnAgregar = new Button();
    btnAgregar.setCaption(">");
    btnAgregar.setImmediate(true);
    btnAgregar.setWidth("-1px");
    btnAgregar.setHeight("-1px");
    mainLayout.addComponent(btnAgregar, "top:160.0px;left:204.0px;");

    // btnRemover
    btnRemover = new Button();
    btnRemover.setCaption("<");
    btnRemover.setImmediate(true);
    btnRemover.setWidth("-1px");
    btnRemover.setHeight("-1px");
    mainLayout.addComponent(btnRemover, "top:234.0px;left:204.0px;");

    // lblRoles
    lblRoles = new Label();
    lblRoles.setImmediate(false);
    lblRoles.setWidth("-1px");
    lblRoles.setHeight("-1px");
    lblRoles.setValue("Roles:");
    mainLayout.addComponent(lblRoles, "top:80.0px;left:280.0px;");

    // tstRoles
    tstRoles = new TabSheet();
    tstRoles.setImmediate(false);
    tstRoles.setWidth("410px");
    tstRoles.setHeight("246px");
    mainLayout.addComponent(tstRoles, "top:114.0px;left:280.0px;");

    // lstEvaluadores
    lstEvaluadores = new ListSelect();
    lstEvaluadores.setImmediate(false);
    lstEvaluadores.setWidth("140px");
    lstEvaluadores.setHeight("246px");
    mainLayout.addComponent(lstEvaluadores, "top:114.0px;left:20.0px;");

    return mainLayout;
}

From source file:com.anphat.customer.ui.CustomerContactForm.java

private void buildTabSheet() {
    tabContact = new TabSheet();
    tabContact.setHeight(100.0f, Unit.PERCENTAGE);
    tabContact.addStyleName(ValoTheme.TABSHEET_FRAMED);
    tabContact.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
    root.addComponent(tabContact);/*  www  .j a  v  a2  s.c om*/
}

From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java

License:Apache License

Panel windows() {
    Panel p = new Panel("Dialogs");
    VerticalLayout content = new VerticalLayout() {
        final Window win = new Window("Window Caption");
        String prevHeight = "300px";
        boolean footerVisible = true;
        boolean autoHeight = false;
        boolean tabsVisible = false;
        boolean toolbarVisible = false;
        boolean footerToolbar = false;
        boolean toolbarLayout = false;
        String toolbarStyle = null;

        VerticalLayout windowContent() {
            VerticalLayout root = new VerticalLayout();

            if (toolbarVisible) {
                MenuBar menuBar = MenuBars.getToolBar();
                menuBar.setSizeUndefined();
                menuBar.setStyleName(toolbarStyle);
                Component toolbar = menuBar;
                if (toolbarLayout) {
                    menuBar.setWidth(null);
                    HorizontalLayout toolbarLayout = new HorizontalLayout();
                    toolbarLayout.setWidth("100%");
                    toolbarLayout.setSpacing(true);
                    Label label = new Label("Tools");
                    label.setSizeUndefined();
                    toolbarLayout.addComponents(label, menuBar);
                    toolbarLayout.setExpandRatio(menuBar, 1);
                    toolbarLayout.setComponentAlignment(menuBar, Alignment.TOP_RIGHT);
                    toolbar = toolbarLayout;
                }/*from  w ww.j  a va  2s . c  o m*/
                toolbar.addStyleName("v-window-top-toolbar");
                root.addComponent(toolbar);
            }

            Component content = null;

            if (tabsVisible) {
                TabSheet tabs = new TabSheet();
                tabs.setSizeFull();
                VerticalLayout l = new VerticalLayout();
                l.addComponent(new Label(
                        "<h2>Subtitle</h2><p>Normal type for plain text. Etiam at risus et justo dignissim congue. Phasellus laoreet lorem vel dolor tempus vehicula.</p><p>Quisque ut dolor gravida, placerat libero vel, euismod. Etiam habebis sem dicantur magna mollis euismod. Nihil hic munitissimus habendi senatus locus, nihil horum? Curabitur est gravida et libero vitae dictum. Ullamco laboris nisi ut aliquid ex ea commodi consequat. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</p>",
                        ContentMode.HTML));
                l.setMargin(true);
                tabs.addTab(l, "Selected");
                tabs.addTab(new Label("&nbsp;", ContentMode.HTML), "Another");
                tabs.addTab(new Label("&nbsp;", ContentMode.HTML), "One more");
                tabs.addStyleName("padded-tabbar");
                tabs.addSelectedTabChangeListener(new SelectedTabChangeListener() {
                    @Override
                    public void selectedTabChange(final SelectedTabChangeEvent event) {
                        try {
                            Thread.sleep(600);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                });
                content = tabs;
            } else if (!autoHeight) {
                Panel p = new Panel();
                p.setSizeFull();
                p.addStyleName("borderless");
                if (!toolbarVisible || !toolbarLayout) {
                    p.addStyleName("scroll-divider");
                }
                VerticalLayout l = new VerticalLayout();
                l.addComponent(new Label(
                        "<h2>Subtitle</h2><p>Normal type for plain text. Etiam at risus et justo dignissim congue. Phasellus laoreet lorem vel dolor tempus vehicula.</p><p>Quisque ut dolor gravida, placerat libero vel, euismod. Etiam habebis sem dicantur magna mollis euismod. Nihil hic munitissimus habendi senatus locus, nihil horum? Curabitur est gravida et libero vitae dictum. Ullamco laboris nisi ut aliquid ex ea commodi consequat. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</p>",
                        ContentMode.HTML));
                l.setMargin(true);
                p.setContent(l);
                content = p;
            } else {
                content = new Label(
                        "<h2>Subtitle</h2><p>Normal type for plain text. Etiam at risus et justo dignissim congue. Phasellus laoreet lorem vel dolor tempus vehicula.</p><p>Quisque ut dolor gravida, placerat libero vel, euismod. Etiam habebis sem dicantur magna mollis euismod. Nihil hic munitissimus habendi senatus locus, nihil horum? Curabitur est gravida et libero vitae dictum. Ullamco laboris nisi ut aliquid ex ea commodi consequat. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</p>",
                        ContentMode.HTML);
                root.setMargin(true);
            }

            root.addComponent(content);

            if (footerVisible) {
                HorizontalLayout footer = new HorizontalLayout();
                footer.setWidth("100%");
                footer.setSpacing(true);
                footer.addStyleName("v-window-bottom-toolbar");

                Label footerText = new Label("Footer text");
                footerText.setSizeUndefined();

                Button ok = new Button("OK");
                ok.addStyleName("primary");

                Button cancel = new Button("Cancel");

                footer.addComponents(footerText, ok, cancel);
                footer.setExpandRatio(footerText, 1);

                if (footerToolbar) {
                    MenuBar menuBar = MenuBars.getToolBar();
                    menuBar.setStyleName(toolbarStyle);
                    menuBar.setWidth(null);
                    footer.removeAllComponents();
                    footer.addComponent(menuBar);
                }

                root.addComponent(footer);
            }

            if (!autoHeight) {
                root.setSizeFull();
                root.setExpandRatio(content, 1);
            }

            return root;
        }

        {
            setSpacing(true);
            setMargin(true);
            win.setWidth("380px");
            win.setHeight(prevHeight);
            win.setClosable(false);
            win.setResizable(false);
            win.setContent(windowContent());
            win.setCloseShortcut(KeyCode.ESCAPE, null);

            Command optionsCommand = new Command() {
                @Override
                public void menuSelected(final MenuItem selectedItem) {
                    if (selectedItem.getText().equals("Footer")) {
                        footerVisible = selectedItem.isChecked();
                    }
                    if (selectedItem.getText().equals("Auto Height")) {
                        autoHeight = selectedItem.isChecked();
                        if (!autoHeight) {
                            win.setHeight(prevHeight);
                        } else {
                            prevHeight = win.getHeight() + win.getHeightUnits().toString();
                            win.setHeight(null);
                        }
                    }
                    if (selectedItem.getText().equals("Tabs")) {
                        tabsVisible = selectedItem.isChecked();
                    }

                    if (selectedItem.getText().equals("Top")) {
                        toolbarVisible = selectedItem.isChecked();
                    }

                    if (selectedItem.getText().equals("Footer")) {
                        footerToolbar = selectedItem.isChecked();
                    }

                    if (selectedItem.getText().equals("Top layout")) {
                        toolbarLayout = selectedItem.isChecked();
                    }

                    if (selectedItem.getText().equals("Borderless")) {
                        toolbarStyle = selectedItem.isChecked() ? "borderless" : null;
                    }

                    win.setContent(windowContent());
                }
            };

            MenuBar options = new MenuBar();
            options.setCaption("Content");
            options.addItem("Auto Height", optionsCommand).setCheckable(true);
            options.addItem("Tabs", optionsCommand).setCheckable(true);
            MenuItem option = options.addItem("Footer", optionsCommand);
            option.setCheckable(true);
            option.setChecked(true);
            options.addStyleName("small");
            addComponent(options);

            options = new MenuBar();
            options.setCaption("Toolbars");
            options.addItem("Footer", optionsCommand).setCheckable(true);
            options.addItem("Top", optionsCommand).setCheckable(true);
            options.addItem("Top layout", optionsCommand).setCheckable(true);
            options.addItem("Borderless", optionsCommand).setCheckable(true);
            options.addStyleName("small");
            addComponent(options);

            Command optionsCommand2 = new Command() {
                @Override
                public void menuSelected(final MenuItem selectedItem) {
                    if (selectedItem.getText().equals("Caption")) {
                        win.setCaption(selectedItem.isChecked() ? "Window Caption" : null);
                    } else if (selectedItem.getText().equals("Closable")) {
                        win.setClosable(selectedItem.isChecked());
                    } else if (selectedItem.getText().equals("Resizable")) {
                        win.setResizable(selectedItem.isChecked());
                    } else if (selectedItem.getText().equals("Modal")) {
                        win.setModal(selectedItem.isChecked());
                    }
                }
            };

            options = new MenuBar();
            options.setCaption("Options");
            MenuItem caption = options.addItem("Caption", optionsCommand2);
            caption.setCheckable(true);
            caption.setChecked(true);
            options.addItem("Closable", optionsCommand2).setCheckable(true);
            options.addItem("Resizable", optionsCommand2).setCheckable(true);
            options.addItem("Modal", optionsCommand2).setCheckable(true);
            options.addStyleName("small");
            addComponent(options);

            final Button show = new Button("Open Window", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    getUI().addWindow(win);
                    win.center();
                    win.focus();
                    event.getButton().setEnabled(false);
                }
            });
            show.addStyleName("primary");
            addComponent(show);

            final CheckBox hidden = new CheckBox("Hidden");
            hidden.addValueChangeListener(new ValueChangeListener() {
                @Override
                public void valueChange(final ValueChangeEvent event) {
                    win.setVisible(!hidden.getValue());
                }
            });
            addComponent(hidden);

            win.addCloseListener(new CloseListener() {
                @Override
                public void windowClose(final CloseEvent e) {
                    show.setEnabled(true);
                }
            });
        }
    };
    p.setContent(content);
    return p;

}

From source file:com.cavisson.gui.dashboard.components.controls.Tabsheets.java

License:Apache License

static TabSheet getTabSheet(boolean caption, String style, boolean closable, boolean scrolling, boolean icon,
        boolean disable) {
    TestIcon testIcon = new TestIcon(60);

    TabSheet ts = new TabSheet();
    ts.addStyleName(style);//from   w w  w .jav a  2s . c  o  m
    StringGenerator sg = new StringGenerator();

    for (int i = 1; i <= (scrolling ? 10 : 3); i++) {
        String tabcaption = caption ? sg.nextString(true) + " " + sg.nextString(false) : null;

        VerticalLayout content = new VerticalLayout();
        content.setMargin(true);
        content.setSpacing(true);
        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
        public void selectedTabChange(SelectedTabChangeEvent event) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    });

    return ts;
}

From source file:com.cerebro.provevaadin.FirstTime.java

public FirstTime() {

    this.setMargin(true);

    TabSheet tabsheet = new TabSheet();
    this.addComponent(tabsheet);
    tabsheet.addTab(new Configurazione(), "Database MySQL");
    tabsheet.addTab(new ConfigurazioneSMTP(), "Server SMTP");

    Button logout = new Button("Esci");
    this.addComponent(logout);
    logout.addClickListener((Button.ClickEvent e) -> {
        //            logger.info("Esco dall'applicazione");
        //            logger.info("Pulsante: " + e.toString());
        SecurityUtils.getSubject().logout();
        UI.getCurrent().getSession().close();
        UI.getCurrent().getPage().setLocation("");
    });/* w  ww.  j  av  a 2 s. c om*/
    this.addComponent(logout);

}

From source file:com.dungnv.streetfood.view.ArticleLink.java

private void init() {

    setLocale(VaadinSession.getCurrent().getLocale());

    VerticalLayout vLayout = new VerticalLayout();

    tabSheet = new TabSheet();
    tabSheet.setStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS);
    tabSheet.setSizeFull();/*from ww w. j a v a2 s.  co  m*/
    vLayout.addComponent(tabSheet);

    // DishArticle
    tuiDish = new TwinColumnUI("name");
    tuiDish.setLeftLabelCaption(BundleUtils.getLanguage("lbl.dish.avaiable.list"));
    tuiDish.setRightLabelCaption(BundleUtils.getLanguage("lbl.dish.selected.list"));
    tabSheet.addTab(tuiDish, BundleUtils.getLanguage("lbl.article.dishArticle.tab"));

    // RestaurantArticle
    tuiRestaurant = new TwinColumnUI("name");
    tuiRestaurant.setLeftLabelCaption(BundleUtils.getLanguage("lbl.restaurant.avaiable.list"));
    tuiRestaurant.setRightLabelCaption(BundleUtils.getLanguage("lbl.restaurant.selected.list"));
    tabSheet.addTab(tuiRestaurant, BundleUtils.getLanguage("lbl.article.restaurantArticle.tab"));

    setContent(tabSheet);
}

From source file:com.dungnv.streetfood.view.CategoryLink.java

private void init() {

    setLocale(VaadinSession.getCurrent().getLocale());
    tabSheet = new TabSheet();
    tabSheet.setStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS);
    tabSheet.setSizeFull();//from   ww w  .  j a  va  2  s.  c o  m

    VerticalLayout vLayout = new VerticalLayout();

    tuiDish = new TwinColumnUI("name");
    tuiDish.setLeftLabelCaption(BundleUtils.getLanguage("lbl.dish.avaiable.list"));
    tuiDish.setRightLabelCaption(BundleUtils.getLanguage("lbl.dish.selected.list"));
    vLayout.addComponent(tuiDish);

    lsDishLeft = tuiDish.getMsLeft().getLsItem();
    lsDishRight = tuiDish.getMsRight().getLsItem();
    HorizontalLayout hlButtonFooter = new HorizontalLayout();
    hlButtonFooter.setSpacing(true);
    hlButtonFooter.setMargin(true);
    vLayout.addComponent(hlButtonFooter);
    vLayout.setComponentAlignment(hlButtonFooter, Alignment.BOTTOM_RIGHT);

    btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN);
    hlButtonFooter.addComponent(btnCancel);

    tabSheet.addTab(vLayout, BundleUtils.getLanguage("lbl.category.categoryDish.tab"));
    setContent(tabSheet);
}