Screen cannot be overrided

Hi Team,

I found the screen overriding mechanism does not work sometimes.

Through exploring the source code, I found a possible cause is loading for WindowInfo does not consider the dependencies between Jmix modules.
As a workaround ,I extended the WindowConfig class and override the registerScreen method like following:

@Override
    protected void registerScreen(String id, WindowInfo windowInfo) {
        if(screens.containsKey(id)){
            WindowInfo existingWindowInfo = screens.get(id);
            JmixModuleDescriptor module1 = inferJmixModule(windowInfo);
            JmixModuleDescriptor module2 = inferJmixModule(existingWindowInfo);
            if (module1!=null&&module2!=null){
                if (!module1.dependsOn(module2)){
                    return;
                }
            }
        }
        super.registerScreen(id, windowInfo);
    }

This will work fine.

Please check if there is a bug.

Regards,
Ray

Hi,

Could you please describe a test case when screen overriding doesn’t work?

Regards,
Gleb

Hi Gleb,
Let me describe my case:

A Jmix composite project with three sub-projects .
The names of sub-project are xxAddon,xxAddonUi and demo . xxAddonUi depends on xxAddon, demo depends on xxAddonUi-starter and xxAddon-starter. xxAddon and xxAddonUi are Jmix single module addon project, demo is Jmix single module application project.

In xxAddonUi project, I created a screen controller that override UserInAppNotificationBrowseScreen screen in Jmix Notification addon through Studio. Meanwhile I specified that xxAddonUi depends on Jmix Notification addon in Spring Configuration class of xxAddonUi module like following:

@JmixModule(dependsOn = {UiConfiguration.class, NotificationsUiConfiguration.class})

If run the demo application now , the UserInAppNotificationBrowseScreen can’t be overrided.

Regards,
Ray

Sorry for a long reply. Unfortunately, I can’t reproduce the problem. Could you please attache a small demo project that reproduces the problem?

Regards,
Gleb

Hi @gorelov ,
Which version you used? I used 1.2.3.

Same version

Hi @gorelov,

I tried to create a simple project for reproducing the issue. But I encountered a new problem when creating a “Override” screen.
See following screenshot.
image

I wanted to create a screen in xyzui project to override the UserInAppNotificationBrowseScreen screen in Notifications add-on , but cannot see the UserInAppNotificationBrowseScreen screen in the Override screen: list.
I attached my test project. Please take a look.

archive.zip (271.5 KB)

Thank you for reporting the problem, I’ve created a GitHub issue.

Regards,
Gleb

1 Like