WIndowManger deprecated

HI,

Is it possible to re-do the WindowManger code into imported Cuba 7 application (from Cuba 6)?

 @Override
    public void ready() {
    super.ready();
   openWindow("crm$Transaction.browse", WindowManager.OpenType.THIS_TAB);
        mainMenu.getMenuItems()
                .forEach(this::addStyleNameRecursive);
    }

I tried to use

@Inject
private ScreenBuilders screenBuilders;

(but I don’t know which method I have to choose).

Hi, the equivalent is:

screenBuilders.screen(this)
          .withScreenId("crm$Transaction.browse") // or better use .withScreenClass
          .withLaunchMode(OpenMode.THIS_TAB)
          .build()
          .show();

You can even skip build() if you do not need additional preparations:

screenBuilders.screen(this)
                .withScreenClass(TransactionBrowse.class)
                .withLaunchMode(OpenMode.THIS_TAB)
                .show();
1 Like

Thank you very much! It works perfectly.
For me is not quite clear what “build” does?
Seems to have the same behaviour (with or without build). What means additional preparations?

.build() returns an instance of Screen so that you can call some methods of this particular screen’s API before showing it.

TransactionBrowse transactionBrowse = ScrescreenBuilders.screen(this)
                .withScreenClass(TransactionBrowse.class)
                .withLaunchMode(OpenMode.THIS_TAB)
                .build();

transactionBrowse.setSomething();
transactionBrowse.show()

Ok. Now is clear.
Thank you!