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:org.vaadin.spinkit.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    TabSheet tabSheet = new TabSheet();
    tabSheet.setSizeFull();/*w ww .j  a va2 s . co m*/
    tabSheet.addStyleName(ValoTheme.TABSHEET_CENTERED_TABS);
    tabSheet.addTab(spinnersContainer()).setCaption("Spinners");
    tabSheet.addTab(spinnerSizesContainer()).setCaption("Sizes");
    tabSheet.addTab(spinnersContainer("greenspin")).setCaption("Themed Spinners");
    tabSheet.addTab(new RichText().withMarkDown(getClass().getResourceAsStream("source.md")))
            .setCaption("Source code");
    //layout.addComponent(tabSheet);
    //layout.expand(tabSheet);
    RichText info = new RichText().withMarkDown(getClass().getResourceAsStream("about.md"));

    MVerticalLayout layout = new MVerticalLayout().withMargin(true).with(info).expand(tabSheet).withFullHeight()
            .withFullWidth();

    //layout.setExpandRatio(info, 1);
    //layout.setExpandRatio(tabSheet, 4);

    setContent(layout);
}

From source file:org.ws13.vaadin.osgi.dm.app.ModuleDemoApp.java

License:Apache License

@Override
public void init() {
    tabs = new TabSheet();
    tabs.setSizeFull();/*from w  w w.ja  v  a 2  s .  c  om*/

    for (Module module : moduleService.getModules()) {
        tabs.addTab(module.createComponent(), module.getName(), null);
    }

    setMainWindow(new Window("Module Demo Application", tabs));

    System.out.println("ModuleDemoApp: Application initializing, adding module service listener");
    moduleService.addListener(this);
}

From source file:pl.exsio.frameset.vaadin.module.management.frames.FrameDetails.java

License:Open Source License

private VerticalLayout getFrameForm(EntityItem<VaadinFrame> item) {

    VerticalLayout formWrapper = new VerticalLayout();
    formWrapper.addComponent(/*from  w ww.ja v  a 2 s .  c  o  m*/
            new Label(t("core.management.frames.edition.title") + ": " + t(item.getEntity().getTitle())));
    TabSheet tabs = new TabSheet();

    final BasicFrameDataForm basicData = new BasicFrameDataForm(item);
    final SecurityPermissionsForm permissions = this.createSecurityPermissionsForm(item);
    if (this.security.canWrite()) {
        tabs.addTab(new VerticalLayout() {
            {
                addComponent(basicData.init());
                setMargin(true);
            }
        }, t("core.management.frames.tab.basic_data"));
    }
    if (this.security.canAdminister()) {
        tabs.addTab(new VerticalLayout() {
            {
                addComponent(permissions.init());
                setMargin(true);
            }
        }, t("core.management.frames.tab.security"));
    }
    formWrapper.addComponent(tabs);
    formWrapper.setSpacing(true);
    return formWrapper;

}

From source file:pl.exsio.frameset.vaadin.ui.support.component.data.form.TabbedForm.java

License:Open Source License

public void init(Map<String, Set<String>> config) {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*w  w  w .  j  a  va  2s. c  om*/
    this.setLayout(layout);
    this.tabs = new TabSheet();
    this.tabs.setSizeFull();
    this.getLayout().addComponent(this.tabs);
    this.config = config;
    this.tabsMap = new HashMap<>();
    this.propertiesMap = new HashMap<>();
    this.setSizeFull();
    this.initTabs();
}

From source file:pl.exsio.plupload.examples.ui.PluploadExamplesUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {

    final VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSpacing(true);/*from   w w  w.java  2  s . c  o m*/
    mainLayout.setMargin(true);
    this.setSizeFull();

    TabSheet container = new TabSheet();
    container.addTab(new Home(), "Home");
    container.addTab(new SimpleUploaderExample(), "Simple \"Plupload\"");
    container.addTab(new AdvancedUploaderExample(), "Advanced \"Plupload\"");
    container.addTab(new SimpleUploadManagerExample(), "Simple \"PluploadManager\"");
    container.addTab(new UploadManagerWithFileFilterExample(),
            "\"PluploadManager\" with file filter and drop zone");
    container.addTab(new UploadManagerWithImageResizeExample(), "\"PluploadManager\" with image resize");
    container.addTab(new FileUploaderFieldExample(), "\"PluploadField\" with File value");
    container.addTab(new ValidationByteArrayUploaderFieldExample(),
            "\"PluploadField\" with byte[] value and form validation");

    mainLayout.addComponent(container);
    container.setSizeFull();
    mainLayout.setSizeFull();

    this.setContent(mainLayout);

}

From source file:qbic.vaadincomponents.MaxQuantComponent.java

License:Open Source License

public MaxQuantComponent(final MaxQuantModel model, WorkflowViewController wfController) {
    // model/*from   w  ww.  j  a  v  a  2s .co  m*/
    this.model = model;
    controller = wfController;

    // view
    VerticalLayout mainLayout = new VerticalLayout();
    // mainLayout.setSpacing(true);
    tabs = new TabSheet();

    // http://141.61.102.17/maxquant_doku/doku.php?id=maxquant:manual:beginner
    // Filter for raw Files

    rawFiles = new SelectFileComponent(RAW_FILES_CAPTION, RAW_FILES_INFO, AVAILABLE_FILES_CAPTION,
            SELECTED_FILES_CAPTION, model.getDatasetBeans(), model.getRawFilesBeans());

    rawFiles.getDestination().setEditorEnabled(true);
    rawFiles.getDestination().getColumn("experiment").setEditable(false);
    rawFiles.getDestination().getColumn("file").setEditable(false);
    rawFiles.getDestination().setImmediate(true);

    tabs.addTab(rawFiles);
    groupSpecificParameterComponent = new GroupSpecificParameterComponent();
    tabs.addTab(groupSpecificParameterComponent);
    tabs.addTab(globalParameters());

    mainLayout.addComponent(tabs);

    start = new Button(BUTTON_START_CAPTION);
    mainLayout.addComponent(start);
    mainLayout.setWidth("100%");
    this.setCompositionRoot(mainLayout);

    // controller
    setLogic();
    bindGlobalParameters();
}

From source file:qdbtools.main.QuserdbtoolsUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/* ww  w. ja  v  a  2s . c o  m*/
    setContent(layout);

    options = new TabSheet();

    this.config = readConfig();
    tmpFolder = config.getTmpFolder();
    LDAPConfig ldapConfig = readLdapConfig();// TODO

    // establish connection to the OpenBIS API
    if (!isDevelopment() || !testMode) {
        try {
            this.openbis = new OpenBisClient(config.getOpenbisUser(), config.getOpenbisPass(),
                    config.getOpenbisURL());
            this.openbis.login();
        } catch (Exception e) {
            // success = false;
            // logger.error(
            // "User \"" + userID + "\" could not connect to openBIS and has been informed of this.");
            // layout.addComponent(new Label(
            // "Data Management System could not be reached. Please try again later or contact us."));
        }
    }
    if (isDevelopment() && testMode) {
        logger.error("No connection to openBIS. Trying mock version for testing.");
        this.openbis = new OpenBisClientMock("", "", "");
        layout.addComponent(new Label(
                "openBIS could not be reached. Resuming with mock version. Some options might be non-functional. Reload to retry."));
    }

    dbControl = new DBManager(config);

    initTabs();

    layout.addComponent(options);
}

From source file:ro.zg.netcell.vaadin.action.UserActionListHandler.java

License:Apache License

@Override
public void handle(final ActionContext actionContext) throws Exception {
    ComponentContainer displayArea = actionContext.getTargetContainer();
    displayArea.removeAllComponents();// ww w .j  a va 2s  .  co m

    UserActionList ual = (UserActionList) actionContext.getUserAction();
    final OpenGroupsApplication app = actionContext.getApp();
    final Entity entity = actionContext.getEntity();

    final TabSheet actionsTabSheet = new TabSheet();
    actionsTabSheet.addStyleName(Reindeer.TABSHEET_MINIMAL);
    //   actionsTabSheet.addStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE);
    actionsTabSheet.addStyleName(OpenGroupsStyles.USER_ACTIONS_TABSHEET);
    //   final CssLayout contentArea = new CssLayout();
    //   contentArea.setWidth("100%");
    //   contentArea.setStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE);
    //   displayArea.addComponent(contentArea);

    /* add listener */
    actionsTabSheet.addListener(new SelectedTabChangeListener() {

        @Override
        public void selectedTabChange(SelectedTabChangeEvent event) {
            TabSheet tabSheet = event.getTabSheet();

            AbstractComponentContainer selectedTabContent = (AbstractComponentContainer) tabSheet
                    .getSelectedTab();
            UserAction ua = (UserAction) selectedTabContent.getData();
            if (entity != null) {
                Deque<String> desiredActionsQueue = entity.getState().getDesiredActionTabsQueue();
                /*
                 * if a desired action exists, it will be set afterwards, otherwise allow the first action from the
                 * list to be selected by default
                 */
                if (desiredActionsQueue.size() != 0) {
                    String nextAction = desiredActionsQueue.peek();
                    if (nextAction.equals(ua.getActionName())) {
                        /* remove action from the queue */
                        desiredActionsQueue.remove();
                    } else {
                        /*
                         * if this action does not match with the next desired action, do nothing
                         */
                        return;
                    }
                } else {
                    entity.getState().resetPageInfo();
                }
            }

            if (ua instanceof UserActionList) {
                //          selectedTabContent.removeStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE);
                //          contentArea.setWidth("100%");
                //          contentArea.setMargin(false);
                //          selectedTabContent.setMargin(false);

                ua.executeHandler(entity, app, selectedTabContent, false, actionContext);

            } else {
                //          selectedTabContent.addStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE);
                //          contentArea.setWidth("99.5%");
                //          contentArea.setMargin(true);
                //          selectedTabContent.setMargin(true);
                //          selectedTabContent.setWidth("100%");
                if (entity != null) {
                    entity.getState().setCurrentTabAction(ua);
                    entity.getState().setCurrentTabActionContainer(selectedTabContent);
                    entity.getState().setCurrentActionsPath(ua.getFullActionPath());
                    //         entity.getState().getDesiredActionTabsQueue().clear();
                    //         entity.getState().resetPageInfoForCurrentAction();
                    actionContext.getWindow().setFragmentToEntity(entity);
                }
                ua.executeHandler(entity, app, selectedTabContent, false, actionContext);

            }

        }
    });
    /* add the tabsheet to the target component */

    //   List<String> currentUserTypes = getCurrentUserTypes(entity, app);
    Map<String, ComponentContainer> actionPathContainers = new HashMap<String, ComponentContainer>();
    List<UserAction> actionsList = new ArrayList<UserAction>(ual.getActions().values());
    for (UserAction cua : actionsList) {

        /* display only the actions that the user is allowed to see */
        //       if (!cua.allowRead(currentUserTypes)) {
        if (!cua.isVisible(actionContext)) {
            continue;
        }

        CssLayout tabContent = new CssLayout();
        if (cua instanceof UserActionList) {
            //      tabContent.setMargin(false);
            //      contentArea.setMargin(false);
            //      tabContent.addStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE);
            //      tabContent.setWidth("100%");

        } else {
            //      tabContent.addStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE);
            tabContent.setMargin(true);
            //      contentArea.addStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE);
            //      contentArea.setMargin(true);
        }
        tabContent.addStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE);
        actionPathContainers.put(cua.getActionName(), tabContent);
        tabContent.setData(cua);
        actionsTabSheet.addTab(tabContent, cua.getDisplayName(), null);
    }

    displayArea.addComponent(actionsTabSheet);
    if (entity != null) {
        Deque<String> desiredActionsQueue = entity.getState().getDesiredActionTabsQueue();

        if (desiredActionsQueue.size() != 0) {
            // System.out.println("desired actions: " +
            // entity.getState().getDesiredActionsPath());
            // System.out.println("full url: "+app.getFullUrl());
            /* select the tab specified by the next desired action */
            actionsTabSheet.setSelectedTab(actionPathContainers.get(desiredActionsQueue.peek()));
        }
    }
}

From source file:ro.zg.open_groups.gui.TabSheetWrapper.java

License:Apache License

private void initialize() {
    ts = new TabSheet();
    ts.addStyleName(Reindeer.TABSHEET_MINIMAL);
    displayArea = new VerticalLayout();

    ts.addListener(new SelectedTabChangeListener() {

        @Override/*  w  w  w.  j a v a  2 s  .c o m*/
        public void selectedTabChange(SelectedTabChangeEvent event) {
            onNewTabSelected();
        }
    });

    ts.addListener(new ComponentDetachListener() {

        @Override
        public void componentDetachedFromContainer(ComponentDetachEvent event) {
            onTabClosed(event.getDetachedComponent());
        }
    });

    addComponent(ts);
    addComponent(displayArea);
}

From source file:roart.client.MyVaadinUI.java

@Override
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    VerticalLayout searchTab = null, controlPanelTab = null;

    com.vaadin.server.Page.getCurrent().setTitle("Aether disk search engine by Roar Throns");

    layout.setMargin(true);/*from  w  w  w  .  j a va  2  s  . c o  m*/
    setContent(layout);

    getSession().setAttribute("addr", request.getRemoteAddr());
    getSession().setAttribute(Constants.USER, Constants.NONE);
    initVars();

    HorizontalLayout topLine = new HorizontalLayout();
    Label topTitle = new Label("Aether disk search engine");
    topTitle.setWidth("90%");
    topLine.addComponent(topTitle);
    topLine.setHeight("10%");
    topLine.setWidth("100%");
    boolean doauthenticate = (boolean) getSession().getAttribute("authenticate");
    statLabel = new Label("", ContentMode.PREFORMATTED);
    statLabel.setWidth("50%");
    topLine.addComponent(statLabel);
    if (doauthenticate) {
        Button login = getLoginButton();
        Button logout = getLogoutButton();
        topLine.addComponent(login);
        topLine.addComponent(logout);
        getSession().setAttribute("login", login);
        getSession().setAttribute("logout", logout);
    }
    layout.addComponent(topLine);

    tabsheet = new TabSheet();
    tabsheet.setHeight("80%");
    layout.addComponent(tabsheet);
    // Create the first tab
    searchTab = getSearchTab();
    getSession().setAttribute("search", searchTab);
    // This tab gets its caption from the component caption
    controlPanelTab = getControlPanelTab();
    getSession().setAttribute("controlpanel", controlPanelTab);

    tabsheet.addTab(searchTab);
    // This tab gets its caption from the component caption
    tabsheet.addTab(controlPanelTab);
    //tabsheet.addTab(statTab);

    /*
    tabsheet.addTab(miscTab);
    tabsheet.addTab(comicsTab);
    tabsheet.addTab(trainingTab);
    */

    HorizontalLayout bottomLine = new HorizontalLayout();
    bottomLine.setHeight("10%");
    bottomLine.setWidth("90%");
    Label nodeLabel = new Label("Node " + ControlService.nodename);
    bottomLine.addComponent(nodeLabel);
    Label dbLabel = new Label("Db type " + roart.util.Prop.getProp().getProperty(ConfigConstants.DB));
    //dbLabel.setWidth("30%");
    bottomLine.addComponent(dbLabel);
    Label idxLabel = new Label("Index type " + roart.util.Prop.getProp().getProperty(ConfigConstants.INDEX));
    //idxLabel.setWidth("30%");
    bottomLine.addComponent(idxLabel);
    Label licenseLabel = new Label("Affero GPL");
    //licenseLabel.setWidth("30%");
    bottomLine.addComponent(licenseLabel);
    //bottomLine.setComponentAlignment(licenseLabel, Alignment.BOTTOM_RIGHT);
    layout.addComponent(bottomLine);
    setVisibilities();
}