use of io.jmix.ui.xml.layout.ComponentLoader in project jmix by jmix-framework.
the class TabSheetLoader method createComponent.
@Override
public void createComponent() {
resultComponent = createComponentInternal();
loadId(resultComponent, element);
LayoutLoader layoutLoader = getLayoutLoader();
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 = layoutLoader.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);
}
}
use of io.jmix.ui.xml.layout.ComponentLoader in project jmix by jmix-framework.
the class JpqlFilterLoader method createValueComponent.
@SuppressWarnings("rawtypes")
@Override
protected Component createValueComponent(List<Element> elements) {
return elements.stream().filter(valueComponentElement -> !"condition".equals(valueComponentElement.getName())).map(valueComponentElement -> {
ComponentLoader valueComponentLoader = getLayoutLoader().createComponent(valueComponentElement);
valueComponentLoader.loadComponent();
return valueComponentLoader.getResultComponent();
}).findFirst().orElseGet(this::generateValueComponent);
}
use of io.jmix.ui.xml.layout.ComponentLoader in project jmix by jmix-framework.
the class LayoutLoader method initLoader.
protected ComponentLoader initLoader(Element element, Class<? extends ComponentLoader> loaderClass) {
ComponentLoader loader;
Constructor<? extends ComponentLoader> constructor;
try {
constructor = loaderClass.getConstructor();
} catch (NoSuchMethodException e) {
throw new GuiDevelopmentException("Unable to get constructor for loader: " + e, context);
}
try {
loader = constructor.newInstance();
} catch (InvocationTargetException | IllegalAccessException | InstantiationException e) {
throw new GuiDevelopmentException("Loader instantiation error: " + e, context);
}
loader.setApplicationContext(applicationContext);
loader.setEnvironment(environment);
loader.setContext(context);
loader.setLayoutLoaderConfig(config);
loader.setLoaderResolver(loaderResolver);
loader.setLoaderSupport(loaderSupport);
loader.setFactory(factory);
loader.setElement(element);
return loader;
}
use of io.jmix.ui.xml.layout.ComponentLoader in project jmix by jmix-framework.
the class CompositeComponentLayoutLoader method initLoader.
protected ComponentLoader initLoader(Element element, Class<? extends ComponentLoader> loaderClass) {
ComponentLoader loader;
Constructor<? extends ComponentLoader> constructor;
try {
constructor = loaderClass.getConstructor();
} catch (NoSuchMethodException e) {
throw new GuiDevelopmentException("Unable to get constructor for loader: " + e, context);
}
try {
loader = constructor.newInstance();
} catch (InvocationTargetException | IllegalAccessException | InstantiationException e) {
throw new GuiDevelopmentException("Loader instantiation error: " + e, context);
}
loader.setApplicationContext(applicationContext);
loader.setContext(context);
loader.setLoaderResolver(loaderResolver);
loader.setLoaderSupport(loaderSupport);
loader.setFactory(factory);
loader.setElement(element);
return loader;
}
use of io.jmix.ui.xml.layout.ComponentLoader in project jmix by jmix-framework.
the class CompositeComponentLayoutLoader method createComponent.
public Component createComponent(Element element) {
ComponentLoader loader = getLoader(element);
loader.createComponent();
loader.loadComponent();
return loader.getResultComponent();
}
Aggregations