webBrowserTools jmix 2.0

how can I replace this statement with jmix 2.0

webBrowserTools.showWebPage(path, ParamsMap.of(“target”, “_self”));

Hi!

You can use the com.vaadin.flow.component.page.Page class API.

Something like that:

  • com.vaadin.flow.component.page.Page#open(java.lang.String)
  • com.vaadin.flow.component.page.Page#open(java.lang.String, java.lang.String)

You can also use UI.getCurrent().getPage() to access the current page.

Also consider using the anchor component if it suits you.

Regards,
Dmitriy

you could give an example

Sure :grinning:

XML descriptor:

        <button id="button" text="Open google" icon="GOOGLE_PLUS"/>

View controller:

    @Subscribe("button")
    protected void onButtonClick(final ClickEvent<JmixButton> event) {
        UI.getCurrent().getPage().open("http://google.com", "_blank");
    }
1 Like