Example usage for com.vaadin.ui TabSheet addTab

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

Introduction

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

Prototype

public Tab addTab(Component component, int position) 

Source Link

Document

Adds a new tab into TabSheet.

Usage

From source file:cb_server.SettingsWindow.java

License:Open Source License

private void fillContent() {

    if (Settingscontent != null) {
        content.removeComponent(Settingscontent);
        Settingscontent = null;/*from   w ww. jav  a2 s  .c om*/
    }

    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: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  av a2 s  .com
                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 www  .  j a  v  a2  s  .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("");
    });//from  w  w  w  .  ja  va 2  s.c o  m
    this.addComponent(logout);

}

From source file:com.esofthead.mycollab.module.project.view.task.TaskAddPopup.java

License:Open Source License

public TaskAddPopup(final TaskDisplayComponent taskDisplayComp, final TaskList taskList) {

    final VerticalLayout taskLayout = new VerticalLayout();
    taskLayout.addStyleName("taskadd-popup");

    final VerticalLayout popupHeader = new VerticalLayout();
    popupHeader.setWidth("100%");
    popupHeader.setMargin(true);//w  ww .j ava2  s.  co  m
    popupHeader.addStyleName("popup-header");

    final Label titleLbl = new Label(AppContext.getMessage(TaskI18nEnum.DIALOG_NEW_TASK_TITLE));
    titleLbl.addStyleName("bold");
    popupHeader.addComponent(titleLbl);
    taskLayout.addComponent(popupHeader);

    this.task = new SimpleTask();
    TabSheet taskContainer = new TabSheet();
    final TaskInputForm taskInputForm = new TaskInputForm();
    taskInputForm.setWidth("100%");
    taskContainer.addTab(taskInputForm, AppContext.getMessage(GenericI18Enum.WINDOW_INFORMATION_TITLE));

    this.taskNoteComponent = new TaskNoteLayout();
    taskContainer.addTab(this.taskNoteComponent, AppContext.getMessage(TaskI18nEnum.FORM_NOTES_ATTACHMENT));

    taskLayout.addComponent(taskContainer);

    final MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true);
    controlsLayout.addStyleName("popup-footer");

    final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    taskDisplayComp.closeTaskAdd();
                }
            });

    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);

    final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    if (taskInputForm.validateForm()) {
                        final ProjectTaskService taskService = ApplicationContextUtil
                                .getSpringBean(ProjectTaskService.class);

                        task.setTasklistid(taskList.getId());
                        task.setProjectid(CurrentProjectVariables.getProjectId());
                        task.setSaccountid(AppContext.getAccountId());
                        task.setNotes(taskNoteComponent.getNote());

                        taskService.saveWithSession(task, AppContext.getUsername());
                        taskNoteComponent.saveContentsToRepo(task.getId());
                        taskDisplayComp.saveTaskSuccess(task);
                        taskDisplayComp.closeTaskAdd();
                    }
                }
            });
    saveBtn.setIcon(FontAwesome.SAVE);
    saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    controlsLayout.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER);

    taskLayout.addComponent(controlsLayout);
    taskLayout.setComponentAlignment(controlsLayout, Alignment.MIDDLE_RIGHT);

    this.setCompositionRoot(taskLayout);
}

From source file:com.expressui.core.view.util.CodePopup.java

License:Open Source License

/**
 * Opens popup for given classes.// w  w w .j a v a  2s .  c o m
 *
 * @param classes classes for displaying related source code and Javadoc. If
 *                class is within com.expressui.core or com.expressui.domain,
 *                then Javadoc is displayed, otherwise source code.
 */
public void open(Class... classes) {

    Window codeWindow = new Window();
    codeWindow.addStyleName("code-popup");
    codeWindow.setPositionX(20);
    codeWindow.setPositionY(40);
    codeWindow.setWidth("90%");
    codeWindow.setHeight("90%");

    TabSheet codePopupTabSheet = new TabSheet();
    String id = StringUtil.generateDebugId("e", this, codePopupTabSheet, "codePopupTabSheet");
    codePopupTabSheet.setDebugId(id);

    codePopupTabSheet.setSizeFull();
    codeWindow.addComponent(codePopupTabSheet);

    String windowCaption = "";
    Set<String> shownUrls = new HashSet<String>();
    for (Class clazz : classes) {
        String tabCaption;
        String url;
        if (clazz.getName().startsWith("com.expressui.core")
                || clazz.getName().startsWith("com.expressui.domain")) {
            url = applicationProperties.getDocUrl(clazz);
            if (shownUrls.contains(url))
                continue;
            tabCaption = clazz.getSimpleName() + " API";
            Embedded embedded = getEmbeddedDoc(url);
            codePopupTabSheet.addTab(embedded, tabCaption);
        } else {
            url = applicationProperties.getCodeUrl(clazz);
            if (shownUrls.contains(url))
                continue;
            tabCaption = clazz.getSimpleName() + ".java";
            String code = getCodeContents(url);
            Label label = new CodeLabel(code);
            codePopupTabSheet.addTab(label, tabCaption);
        }
        shownUrls.add(url);
        if (windowCaption.length() > 0)
            windowCaption += ", ";

        windowCaption += tabCaption;
    }

    codeWindow.setCaption(windowCaption);
    MainApplication.getInstance().getMainWindow().addWindow(codeWindow);
}

From source file:com.foc.vaadin.gui.windows.AddTabWindow.java

License:Apache License

public AddTabWindow(final TabSheet tabSheet, final VerticalLayout addTabLayout) {
    super("Add New Tab");
    setModal(true);/*from  w  ww.  j  a  v a  2 s.  com*/
    setWidth("264px");
    setHeight("272px");

    layout = new VerticalLayout();
    buttonsLayout = new HorizontalLayout();
    optionsLayout = new VerticalLayout();
    seperateLayout = new VerticalLayout();

    tabName = new TextField();
    tabNameWrapper = new FVWrapperLayout(tabName, "Tab Name:", width);
    layoutHeight = new TextField();
    heightWrapper = new FVWrapperLayout(layoutHeight, "Height:", width);
    layoutWidth = new TextField();
    widthWrapper = new FVWrapperLayout(layoutWidth, "Width:", width);
    innerLayout = new ComboBox();
    innerLayoutWrapper = new FVWrapperLayout(innerLayout, "Layout Type:", width);

    for (int i = 0; i < layoutTypes.length; i++) {
        innerLayout.addItem(layoutTypes[i]);
    }

    innerLayout.setImmediate(true);
    innerLayout.setNullSelectionAllowed(false);
    innerLayout.setValue(layoutTypes[0]);

    innerLayout.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            String layoutType = event.getProperty().toString();

            if (layoutType.equals(FXML.TAG_GRID_LAYOUT)) {
                layoutCols = new TextField();
                colsWrapper = new FVWrapperLayout(layoutCols, "Columns:", width);
                layoutRows = new TextField();
                rowsWrapper = new FVWrapperLayout(layoutRows, "Rows:", width);

                optionsLayout.addComponent(colsWrapper);
                optionsLayout.addComponent(rowsWrapper);

                setHeight("350px");

            } else {

                if (layoutCols != null) {
                    optionsLayout.removeComponent(colsWrapper);
                    layoutCols = null;
                    colsWrapper = null;
                }

                if (layoutRows != null) {
                    optionsLayout.removeComponent(rowsWrapper);
                    layoutRows = null;
                    rowsWrapper = null;
                }

                setHeight("272px");
            }
        }
    });

    create = new Button("Create");
    cancel = new Button("Cancel");

    cancel.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });

    create.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            String layoutType = innerLayout.getValue().toString();

            AttributesImpl attributes = new AttributesImpl();

            attributes.addAttribute("", "name", "name", "CDATA", "null");
            attributes.addAttribute("", "height", "height", "CDATA",
                    layoutHeight.getValue().toString().isEmpty() ? "-1px"
                            : layoutHeight.getValue().toString() + "px");
            attributes.addAttribute("", "width", "width", "CDATA",
                    layoutWidth.getValue().toString().isEmpty() ? "-1px"
                            : layoutWidth.getValue().toString() + "px");

            if (layoutType.equals(FXML.TAG_ABSOLUTE_LAYOUT)) {
                selectedLayout = new FVAbsoluteLayout(attributes);
            } else if (layoutType.equals(FXML.TAG_VERTICAL_LAYOUT)) {
                selectedLayout = new FVVerticalLayout(attributes);
            } else if (layoutType.equals(FXML.TAG_HORIZONTAL_LAYOUT)) {
                selectedLayout = new FVHorizontalLayout(attributes);
            } else {

                attributes.addAttribute("", "rows", "rows", "CDATA", layoutRows.getValue().toString());
                attributes.addAttribute("", "cols", "cols", "CDATA", layoutCols.getValue().toString());

                selectedLayout = new FVGridLayout(attributes);
            }

            tabSheet.removeTab(tabSheet.getTab(addTabLayout));
            tabSheet.addTab((Component) selectedLayout, tabName.getValue().toString());
            tabSheet.addTab(addTabLayout, "+");
            close();
        }
    });

    optionsLayout.setSpacing(true);
    optionsLayout.addComponent(widthWrapper);
    optionsLayout.addComponent(heightWrapper);

    seperateLayout.setHeight("25px");

    buttonsLayout.setSpacing(true);
    buttonsLayout.addComponent(create);
    buttonsLayout.addComponent(cancel);

    layout.setSpacing(true);
    layout.addComponent(tabNameWrapper);
    layout.addComponent(innerLayoutWrapper);
    layout.addComponent(optionsLayout);
    layout.addComponent(seperateLayout);
    layout.addComponent(buttonsLayout);

    layout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_CENTER);

    setContent(layout);
}

From source file:com.hris.payroll.PayrollUI.java

private void getPayrollTab() {
    TabSheet tab = new TabSheet();
    tab.setSizeFull();//from   w ww. j  av  a  2  s  .c  o  m

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    v.addComponent(ledger);
    tab.addTab(v, "Payroll Ledger");

    v = new VerticalLayout();
    v.setSizeFull();
    tab.addTab(v, "Payroll Register");

    v = new VerticalLayout();
    v.setSizeFull();
    v.addComponent(tm);
    tab.addTab(v, "13th Month");

    v = new VerticalLayout();
    v.setSizeFull();
    v.addComponent(al);
    tab.addTab(v, "Alpha List");

    v = new VerticalLayout();
    v.setSizeFull();
    v.addComponent(reportUI);
    tab.addTab(v, "Reports");

    addComponent(tab);
}

From source file:com.logviewer.ui.dialog.LastMinute.java

License:Open Source License

private void addTab(final TabSheet panelContent, final String content, final String name) {
    panelContent.addTab(new Panel(new TailView(content) {
        {/*from  www.  java 2  s  . c  o m*/
            setStyleName("logcontent");
        }
    }) {
        {
            setSizeFull();
        }
    }, name);
}

From source file:com.lst.deploymentautomation.vaadin.popup.TodoDetails.java

License:Open Source License

@Override
public void attach() {
    super.attach();

    LspsUI ui = (LspsUI) getUI();//from  w  w w  .j a v  a2s . c om
    setCaption(ui.getMessage("todo.detailsTitle"));

    TabSheet tabs = new TabSheet();
    tabs.setSizeFull();
    tabs.addTab(createTodoInfo(ui), ui.getMessage("todo.header"));
    tabs.addTab(createProcessInfo(ui), ui.getMessage("process.header"));
    setContent(tabs);

    //      Button close = new Button("Close", new Button.ClickListener() {
    //            // inline click-listener
    //            public void buttonClick(ClickEvent event) {
    //                // close the window by removing it from the parent window
    //                (subwindow.getParent()).removeWindow(subwindow);
    //            }
    //        });
    //        // The components added to the window are actually added to the window's
    //        // layout; you can use either. Alignments are set using the layout
    //        layout.addComponent(close);
    //        layout.setComponentAlignment(close, Alignment.TOP_RIGHT);

}