Example usage for com.vaadin.ui ComponentContainer getParent

List of usage examples for com.vaadin.ui ComponentContainer getParent

Introduction

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

Prototype

@Override
public HasComponents getParent();

Source Link

Document

Gets the parent component of the component.

Usage

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;//from  w w  w .java 2s  . co  m

    // 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;
}