Search in sources :

Example 11 with ComponentLoader

use of com.haulmont.cuba.gui.xml.layout.ComponentLoader in project cuba by cuba-platform.

the class TabSheetLoader method createComponent.

@Override
public void createComponent() {
    resultComponent = (TabSheet) factory.createComponent(TabSheet.NAME);
    loadId(resultComponent, element);
    // noinspection unchecked
    List<Element> tabElements = element.elements("tab");
    for (Element tabElement : tabElements) {
        final String name = tabElement.attributeValue("id");
        boolean lazy = Boolean.parseBoolean(tabElement.attributeValue("lazy"));
        ComponentLoader tabComponentLoader = getLoader(tabElement, TabComponentLoader.class);
        TabSheet.Tab tab;
        if (lazy) {
            tab = resultComponent.addLazyTab(name, tabElement, tabComponentLoader);
        } else {
            tabComponentLoader.createComponent();
            Component tabComponent = tabComponentLoader.getResultComponent();
            tab = resultComponent.addTab(name, tabComponent);
            pendingLoadComponents.add(tabComponentLoader);
        }
        pendingLoadTabs.put(tabElement, tab);
    }
}
Also used : TabSheet(com.haulmont.cuba.gui.components.TabSheet) Element(org.dom4j.Element) Component(com.haulmont.cuba.gui.components.Component) ComponentLoader(com.haulmont.cuba.gui.xml.layout.ComponentLoader)

Aggregations

ComponentLoader (com.haulmont.cuba.gui.xml.layout.ComponentLoader)11 Element (org.dom4j.Element)9 LayoutLoader (com.haulmont.cuba.gui.xml.layout.LayoutLoader)7 GuiDevelopmentException (com.haulmont.cuba.gui.GuiDevelopmentException)4 Component (com.haulmont.cuba.gui.components.Component)3 DsContext (com.haulmont.cuba.gui.data.DsContext)2 UIPerformanceLogger (com.haulmont.cuba.gui.logging.UIPerformanceLogger)2 ComponentLoaderContext (com.haulmont.cuba.gui.xml.layout.loaders.ComponentLoaderContext)2 StopWatch (org.perf4j.StopWatch)2 Slf4JStopWatch (org.perf4j.slf4j.Slf4JStopWatch)2 Strings (com.google.common.base.Strings)1 Iterables (com.google.common.collect.Iterables)1 Dom4j (com.haulmont.bali.util.Dom4j)1 Preconditions.checkNotNullArgument (com.haulmont.bali.util.Preconditions.checkNotNullArgument)1 MetaClass (com.haulmont.chile.core.model.MetaClass)1 MetaProperty (com.haulmont.chile.core.model.MetaProperty)1 MetaPropertyPath (com.haulmont.chile.core.model.MetaPropertyPath)1 DynamicAttributesUtils (com.haulmont.cuba.core.app.dynamicattributes.DynamicAttributesUtils)1 CategoryAttribute (com.haulmont.cuba.core.entity.CategoryAttribute)1 AppBeans (com.haulmont.cuba.core.global.AppBeans)1