use of com.haulmont.cuba.gui.components.ScreenComponentDescriptor in project cuba by cuba-platform.
the class ScreensHelper method getScreenComponents.
public List<ScreenComponentDescriptor> getScreenComponents(String screenId) {
String key = getScreenComponentsCacheKey(screenId, userSessionSource.getLocale());
List<ScreenComponentDescriptor> screenComponents = screenComponentsCache.get(key);
if (screenComponents != null) {
return screenComponents;
}
List<ScreenComponentDescriptor> components = new ArrayList<>();
WindowInfo windowInfo = windowConfig.findWindowInfo(screenId);
if (windowInfo != null) {
String template = windowInfo.getTemplate();
try {
Element layoutElement = getRootLayoutElement(template);
if (layoutElement != null) {
findScreenComponents(components, null, layoutElement);
}
} catch (FileNotFoundException e) {
log.error("Can't obtain screen's root layout: ", e);
}
}
components = ImmutableList.copyOf(components);
cacheScreenComponents(key, components);
return components;
}
use of com.haulmont.cuba.gui.components.ScreenComponentDescriptor in project cuba by cuba-platform.
the class ScreensHelper method findScreenComponents.
public void findScreenComponents(List<ScreenComponentDescriptor> components, @Nullable ScreenComponentDescriptor parent, Element root) {
List<Element> elements = isFrame(root) ? getFrameElements(root) : root.elements();
for (Element element : elements) {
if (isComponentElement(element)) {
// noinspection IncorrectCreateEntity
ScreenComponentDescriptor descriptor = new ScreenComponentDescriptor(element, parent);
components.add(descriptor);
findScreenComponents(components, descriptor, element);
}
}
}
Aggregations