use of com.haulmont.cuba.gui.settings.Settings in project cuba by cuba-platform.
the class DesktopTabSheet method initLazyTab.
protected void initLazyTab(JComponent tab) {
LazyTabInfo lti = null;
for (LazyTabInfo lazyTabInfo : lazyTabs) {
if (lazyTabInfo.getTabComponent() == tab) {
lti = lazyTabInfo;
break;
}
}
if (lti == null) {
// already initialized
return;
}
if (!lti.getTab().isEnabled()) {
return;
}
lazyTabs.remove(lti);
lti.loader.createComponent();
Component lazyContent = lti.loader.getResultComponent();
lazyContent.setWidth("100%");
lti.tabContent.add(lazyContent);
lti.tabContent.expand(lazyContent, "", "");
lazyContent.setParent(this);
lti.loader.loadComponent();
if (lazyContent instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
((DesktopAbstractComponent) lazyContent).setParentEnabled(false);
}
final Window window = ComponentsHelper.getWindow(DesktopTabSheet.this);
if (window != null) {
ComponentsHelper.walkComponents(lti.tabContent, (component, name) -> {
if (component instanceof HasSettings) {
Settings settings = window.getSettings();
if (settings != null) {
Element e = settings.get(name);
((HasSettings) component).applySettings(e);
}
}
});
lti.getTab().setLazyInitialized(true);
}
}
Aggregations