Task views behavior with tabbed mode add-on

Jmix 2.7.1, when opening views from the main menu,

jmix.tabmod.multiple-open (default value False)

is working in a way that if a user opens the same view from the menu, it closes the already opened view instance and opens the new instance instead.

When opening task views from My tasks, this behavior is not followed; one can open many copies of the same task.
I would like to somehow replicate the default behavior of tabbed mode views - only 1 instance of the same view, for the task views.

I played a bit and was able to make a service that maintains the list of opened task ids. When a task is opened, it adds the task id to the list, and when it is closed, it removes it from the list. With this, I can detect when the same task is being opened again and block that.

I would, however, like to use the platform mechanism if it exists (the same one from the main menu), where is it? And also to close the existing and open the new instance.

How to best achieve this?

Thanks

Hi,

The default logic is implemented by the io.jmix.tabbedmode.Views#closeSameView method. You can override the Views bean and provide the custom one according to your needs.

Regards,
Gleb

Thank you dear Gleb,

I settled with adding
@io.jmix.tabbedmode.view.MultipleOpen(false)
annottaion to my overriden InputDialogTaskProcessForm and start form, and also overriding InputDialogProcessFormViewCreator
to use tabbed mode way
tabbedModeViews.open(jmixUI, openingContext);
instead of ViewNavigators.
That way, the annotation determines if eventually closeSameView would be used.

This is working very well - to make this perfect for Jmix, how to test if tab mode addon is installed? then
InputDialogProcessFormViewCreator can be adapted to use io.jmix.tabbedmode.Views or ViewNavigators depending on that…

Kind regards,
Mladen

I was too happy, but there is still a problem - now, only one BPM InputDialogProcessFormView can be opened - when I open different tasks from the MyTask view, the newly opened task replaces the already opened different task in the same tab.
My problem is not having multiple tabs open for the same task.