简体   繁体   中英

How to create Vaadin flow MprRouteAdapter for registered Vaadin 8 view with parameterized constructor?

I have the following code snippet in Vaadin 8 to navigate to ShipmentView. The shipment view is registered with two parameter constructor:

navigator.addView("shipment", new ShipmentView("name", "shipmentId"));
navigator.navigateTo("shipment");

During the migration process, we decide to migrate ShipmentView later and use MprRouteAdapter first.

if the view does not require the two parameter constructor, we can have the following adapter and navigate with code UI.getCurrent().navigate(ShipmentViewRoute .class)).

@Route(value = "shipment", layout = MainLayout.class)
public class ShipmentViewRoute extends MprRouteAdapter<ShipmentView>  {

    public ShipmentViewRoute () {
        this.setSizeFull();
    }
}

With the two parameter "name"and "shipmentId", how can I create the Adapter?

Thanks you in advance.

我认为最直接的方法就是在构造函数中对这些参数进行硬编码(或者在旧代码中初始化导航器时从任何地方获取它们)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM