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.kani.Application.java

License:Apache License

private void loadProtectedResources() {
    String applicationTitle = getMessage("title");
    main = new Window(applicationTitle);
    mainLayout = (VerticalLayout) main.getContent();
    mainLayout.setMargin(false);//from w  w w .  j  av  a  2 s.c om
    mainLayout.setStyleName("blue");
    setMainWindow(main);

    mainLayout.setSizeFull();
    mainLayout.addComponent(getMenu());

    HorizontalLayout header = new HorizontalLayout();

    header.addComponent(getHeader());
    header.addComponent(getToolbar());
    mainLayout.addComponent(header);

    CssLayout margin = new CssLayout();
    margin.setMargin(false, true, true, true);
    margin.setSizeFull();
    tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    margin.addComponent(tabSheet);
    mainLayout.addComponent(margin);
    mainLayout.setExpandRatio(margin, 1);

    for (String viewKey : views.keySet()) {
        Object view = views.get(viewKey);
        String viewName = getMessage(viewKey, "title");
        Method createMethod;
        try {
            createMethod = view.getClass().getMethod("create", org.kani.Application.class);
            Component viewContent = (Component) createMethod.invoke(view, this);

            String viewIconPath = getMessage(viewKey, "icon");
            Resource viewIcon = new ClassResource(viewIconPath, this);

            tabSheet.addTab(viewContent, viewName, viewIcon);
        } catch (Exception e) {
            logger.log(Level.SEVERE, String.format("Could not initialize view %s", viewKey), e);
        }
    }
}

From source file:org.lunifera.example.vaadin.databinding.DatabindingDemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    VaadinObservables.getRealm(getUI());

    CssLayout layout = new CssLayout();
    layout.setSizeFull();/*from  w  w  w  .ja v  a 2  s  . c o m*/
    setContent(layout);

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();
    tabsheet.addTab(new ValueBindings(), "Value bindings");
    tabsheet.addTab(new SelectionBindings(), "Selection bindings");
    tabsheet.addTab(new LocaleBindings(), "Locales combo");
    try {
        tabsheet.addTab(new ECViewVerticalLayout(), "ECView Vertical");
        tabsheet.addTab(new ECViewHorizontalLayout(), "ECView Horizontal");
        tabsheet.addTab(new ECViewGridLayout(), "ECView Gridlayout");
        tabsheet.addTab(new ECViewTabSheet(), "ECView Tabsheet");
        tabsheet.addTab(new ECViewDatabinding(), "ECView Bindings");
    } catch (ContextException e) {
        e.printStackTrace();
    }
    layout.addComponent(tabsheet);
}

From source file:org.lunifera.example.vaadin.ecview.ECViewDemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    setStyleName(Reindeer.LAYOUT_BLACK);

    VaadinObservables.getRealm(getUI());

    CssLayout layout = new CssLayout();
    layout.setSizeFull();/*from w  ww  . jav a  2s.  c  o m*/
    setContent(layout);

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();
    try {
        // tabsheet.addTab(new ECViewVerticalLayout(), "ECView Vertical");
        // tabsheet.addTab(new ECViewHorizontalLayout(),
        // "ECView Horizontal");
        // tabsheet.addTab(new ECViewGridLayout(), "ECView Gridlayout");
        // tabsheet.addTab(new ECViewTabSheet(), "ECView Tabsheet");
        // tabsheet.addTab(new ECViewDatabinding(), "ECView Bindings");
        // tabsheet.addTab(new ECViewEntityGenerator(),
        // "ECView Entity Generator");
        // tabsheet.addTab(new ECViewDtoGenerator(),
        // "ECView Dto Generator");
        tabsheet.addTab(new ECViewMasterDetail(), "ECView Master Detail");
    } catch (ContextException e) {
        e.printStackTrace();
    }
    layout.addComponent(tabsheet);
}

From source file:org.lunifera.examples.kwiee.erp.module.core.presentation.web.vaadin.ui.KwieeUINavigator.java

License:Open Source License

@Override
public void init(VaadinRequest request) {

    // initialize push
    ///* w  w w. j a v  a 2s . c  o m*/
    pusher = new ICEPush();
    pusher.extend(this);

    // prepare UI
    //
    GridLayout root = new GridLayout(8, 8);
    root.setStyleName(Reindeer.LAYOUT_BLUE);
    root.addStyleName("kwiee");
    root.setSizeFull();
    root.setMargin(new MarginInfo(false, true, true, true));
    root.setSpacing(false);
    setContent(root);

    root.setRowExpandRatio(0, 0.7f);
    root.setRowExpandRatio(1, 1.0f);
    root.setRowExpandRatio(2, 1.0f);
    root.setRowExpandRatio(3, 1.0f);
    root.setRowExpandRatio(4, 1.0f);
    root.setRowExpandRatio(5, 1.0f);
    root.setRowExpandRatio(6, 1.0f);
    root.setRowExpandRatio(7, 0.4f);

    // Create top frame
    topFrame = new HorizontalLayout();
    topFrame.addStyleName("k-topframe");
    topFrame.setMargin(true);
    topFrame.setSpacing(true);
    topFrame.setSizeFull();
    root.addComponent(topFrame, 1, 0, 7, 0);

    // Create top frame
    navFrame = new CssLayout();
    navFrame.addStyleName("k-navframe");
    navFrame.setSizeFull();
    root.addComponent(navFrame, 0, 1, 0, 6);

    // Create main frame
    mainFrame = new CssLayout();
    mainFrame.setSizeFull();
    root.addComponent(mainFrame, 1, 1, 7, 6);
    tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    mainFrame.addComponent(tabSheet);

    // task table
    createTasksTable();

    // Create bottom frame
    bottomFrame = new CssLayout();
    bottomFrame.addStyleName("k-bottomframe");
    bottomFrame.setSizeFull();
    root.addComponent(bottomFrame, 0, 7, 7, 7);

    initialized = true;

    // attach the pending modules
    //
    synchronized (this) {
        for (IUIModule module : pendingModules) {
            attachModule(module);
        }
        pendingModules.clear();
    }

}

From source file:org.lunifera.examples.runtime.web.ecp.uimodel.presentation.vaadin.UiModelDemoUI.java

License:Open Source License

@Override
public void init(VaadinRequest request) {
    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);/*from w w  w . j  a v  a  2s. co  m*/
    content.setSizeFull();

    TabSheet sheet = new TabSheet();
    sheet.setSizeFull();
    content.addComponent(sheet);
    setContent(content);

    // add all examples
    //
    sheet.addTab(new GridLayoutFactory().createComponent(), "GridLayout");
    sheet.addTab(new HorizontalLayoutFactory().createComponent(), "HorizontalLayout");
    sheet.addTab(new VerticalLayoutFactory().createComponent(), "VerticalLayout");
}

From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.TabSheetPresentation.java

License:Open Source License

@Override
public ComponentContainer doCreateWidget(Object parent) {
    if (componentBase == null) {
        componentBase = new CssLayout();
        componentBase.setSizeFull();/*from  ww w.  ja v a2s.c  o  m*/
        componentBase.addStyleName(CSS_CLASS_CONTROL_BASE);
        if (modelAccess.isCssIdValid()) {
            componentBase.setId(modelAccess.getCssID());
        } else {
            componentBase.setId(getEditpart().getId());
        }

        associateWidget(componentBase, modelAccess.yLayout);

        tabSheet = new TabSheet();
        componentBase.addComponent(tabSheet);

        associateWidget(tabSheet, modelAccess.yLayout);

        if (modelAccess.isCssClassValid()) {
            tabSheet.addStyleName(modelAccess.getCssClass());
        } else {
            tabSheet.addStyleName(CSS_CLASS_CONTROL);
        }

        renderTabs(false);
    }

    return componentBase;
}

From source file:org.metawidget.vaadin.ui.layout.TabSheetLayoutDecorator.java

License:LGPL

@Override
protected ComponentContainer createSectionWidget(ComponentContainer previousSectionWidget, String section,
        Map<String, String> attributes, ComponentContainer container, VaadinMetawidget metawidget) {

    TabSheet tabSheet;// w w  w.  j  a  v a  2 s  .  c  om

    // Whole new tabbed pane?

    if (previousSectionWidget == null) {

        tabSheet = new TabSheet();
        tabSheet.setWidth("100%");

        // Add to parent container

        Map<String, String> tabbedPaneAttributes = CollectionUtils.newHashMap();
        tabbedPaneAttributes.put(LABEL, "");
        tabbedPaneAttributes.put(LARGE, TRUE);
        getDelegate().layoutWidget(tabSheet, PROPERTY, tabbedPaneAttributes, container, metawidget);
    } else {
        tabSheet = (TabSheet) previousSectionWidget.getParent();
    }

    // New tab

    Panel tabPanel = new Panel();

    // Tab name (possibly localized)

    String localizedSection = metawidget.getLocalizedKey(StringUtils.camelCase(section));

    if (localizedSection == null) {
        localizedSection = section;
    }

    tabSheet.addTab(tabPanel, localizedSection, null);

    return tabPanel;
}

From source file:org.openeos.vaadin.main.internal.MainApplication.java

License:Apache License

@Override
public void init() {
    // TODO Make better implementation, not literal
    if (notificationManager == null) {
        throw new IllegalStateException();
    }/*from   www. j  a va 2 s.c o m*/
    if (applicationLifecycleManager == null) {
        throw new IllegalStateException();
    }
    logger.info("Initializing Main Application");

    // setTheme(Reindeer.THEME_NAME);
    // setTheme(Runo.THEME_NAME);
    // setTheme("demo");
    setTheme("uno");

    main = new Window("Dynamic Vaadin OSGi Demo");
    mainLayout = (VerticalLayout) main.getContent();
    mainLayout.setMargin(false);
    //mainLayout.setStyleName(Reindeer.L "blue");
    setMainWindow(main);

    mainLayout.setSizeFull();
    mainLayout.addComponent(getMenu());

    mainLayout.addComponent(getHeader());

    CssLayout margin = new CssLayout();
    margin.setMargin(false, true, true, true);
    margin.setSizeFull();
    tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    tabSheet.setCloseHandler(closeHandler);
    margin.addComponent(tabSheet);
    mainLayout.addComponent(margin);
    mainLayout.setExpandRatio(margin, 1);

    for (IVaadinMenuContributor contributor : menuContributorsList) {
        contributor.contribute(menubar, this);
    }

    if (getContext() != null) {
        getContext().addTransactionListener(this);
    }

    initialized = true;

    applicationLifecycleManager.init(this);
}

From source file:org.opennms.features.pluginmgr.vaadin.pluginmanager.PluginManagerUIMainPanel.java

License:Apache License

@AutoGenerated
private TabSheet buildFeaturesTabSheet_1() {
    // common part: create layout
    featuresTabSheet_1 = new TabSheet();
    featuresTabSheet_1.setCaption("Plugin Settings");
    featuresTabSheet_1.setImmediate(true);
    featuresTabSheet_1.setWidth("100.0%");
    featuresTabSheet_1.setHeight("-1px");

    // installedPluginsTab
    installedPluginsTab = buildInstalledPluginsTab();
    featuresTabSheet_1.addTab(installedPluginsTab, "Installed Plugins", null);

    // pluginsManifestTab
    pluginsManifestTab = buildPluginsManifestTab();
    featuresTabSheet_1.addTab(pluginsManifestTab, "Plugins Manifest", null);

    // availablePluginsTab
    availablePluginsTab = buildAvailablePluginsTab();
    featuresTabSheet_1.addTab(availablePluginsTab, "Available Plugins", null);

    // installedLicencesTab
    installedLicencesTab = buildInstalledLicencesTab();
    featuresTabSheet_1.addTab(installedLicencesTab, "Installed Licences", null);

    // addLicenceTab
    addLicenceTab = buildAddLicenceTab();
    featuresTabSheet_1.addTab(addLicenceTab, "Add Licence", null);

    return featuresTabSheet_1;
}

From source file:org.opennms.features.topology.app.internal.TopologyUI.java

License:Open Source License

/**
 * Gets a {@link TabSheet} view for all widgets in this manager.
 * //  w  w w . ja v  a 2s .  c  o m
 * @return TabSheet
 */
private Component getTabSheet(WidgetManager manager, WidgetContext widgetContext) {
    // Use an absolute layout for the bottom panel
    AbsoluteLayout bottomLayout = new AbsoluteLayout();
    bottomLayout.setSizeFull();

    tabSheet = new TabSheet();
    tabSheet.setSizeFull();

    for (IViewContribution viewContrib : manager.getWidgets()) {
        // Create a new view instance
        final Component view = viewContrib.getView(m_applicationContext, widgetContext);
        try {
            m_graphContainer.getSelectionManager().addSelectionListener((SelectionListener) view);
        } catch (ClassCastException e) {
        }
        try {
            ((SelectionNotifier) view).addSelectionListener(m_graphContainer.getSelectionManager());
        } catch (ClassCastException e) {
        }

        // Icon can be null
        tabSheet.addTab(view, viewContrib.getTitle(), viewContrib.getIcon());

        // If the component supports the HasExtraComponents interface, then add the extra 
        // components to the tab bar
        try {
            Component[] extras = ((HasExtraComponents) view).getExtraComponents();
            if (extras != null && extras.length > 0) {
                // For any extra controls, add a horizontal layout that will float
                // on top of the right side of the tab panel
                final HorizontalLayout extraControls = new HorizontalLayout();
                extraControls.setHeight(32, Unit.PIXELS);
                extraControls.setSpacing(true);

                // Add the extra controls to the layout
                for (Component component : extras) {
                    extraControls.addComponent(component);
                    extraControls.setComponentAlignment(component, Alignment.MIDDLE_RIGHT);
                }

                // Add a TabSheet.SelectedTabChangeListener to show or hide the extra controls
                tabSheet.addSelectedTabChangeListener(new SelectedTabChangeListener() {
                    private static final long serialVersionUID = 6370347645872323830L;

                    @Override
                    public void selectedTabChange(SelectedTabChangeEvent event) {
                        final TabSheet source = (TabSheet) event.getSource();
                        if (source == tabSheet) {
                            // Bizarrely enough, getSelectedTab() returns the contained
                            // Component, not the Tab itself.
                            //
                            // If the first tab was selected...
                            if (source.getSelectedTab() == view) {
                                extraControls.setVisible(true);
                            } else {
                                extraControls.setVisible(false);
                            }
                        }
                    }
                });

                // Place the extra controls on the absolute layout
                bottomLayout.addComponent(extraControls, "top:0px;right:5px;z-index:100");
            }
        } catch (ClassCastException e) {
        }
        view.setSizeFull();
    }

    // Add the tabsheet to the layout
    bottomLayout.addComponent(tabSheet, "top: 0; left: 0; bottom: 0; right: 0;");

    return bottomLayout;
}