Search in sources :

Example 1 with DashboardWidget

use of io.jmix.dashboardsui.annotation.DashboardWidget in project jmix by jmix-framework.

the class WidgetRepositoryImpl method initializeWidgets.

protected void initializeWidgets() {
    widgetTypeInfos = new ArrayList<>();
    for (WindowInfo windowInfo : windowConfig.getWindows()) {
        if (StringUtils.isNotBlank(windowInfo.getTemplate())) {
            Class clazz = windowInfo.getControllerClass();
            if (clazz.isAnnotationPresent(DashboardWidget.class)) {
                DashboardWidget widgetAnnotation = (DashboardWidget) clazz.getAnnotation(DashboardWidget.class);
                String editFragmentId = widgetAnnotation.editFragmentId();
                if (StringUtils.isNotBlank(editFragmentId) && !windowConfig.hasWindow(editFragmentId)) {
                    log.error("Unable to find {} edit screen in screen config for widget {}", editFragmentId, widgetAnnotation.name());
                    throw new IllegalArgumentException(String.format("Unable to find %s edit screen in screen config for widget %s", editFragmentId, widgetAnnotation.name()));
                }
                widgetTypeInfos.add(new WidgetTypeInfo(widgetAnnotation.name(), windowInfo.getId(), editFragmentId));
            }
        }
    }
}
Also used : DashboardWidget(io.jmix.dashboardsui.annotation.DashboardWidget) WidgetTypeInfo(io.jmix.dashboardsui.repository.WidgetTypeInfo) WindowInfo(io.jmix.ui.WindowInfo)

Aggregations

DashboardWidget (io.jmix.dashboardsui.annotation.DashboardWidget)1 WidgetTypeInfo (io.jmix.dashboardsui.repository.WidgetTypeInfo)1 WindowInfo (io.jmix.ui.WindowInfo)1