Reflection of several identical layout

Hi, everybody.

I need to create a page in the browser with some fields automatically. Namely-parsing the JSON scheme, to create fields in the browser that the person could enter data in fields, and I would collect them then back in JSON. The problem came, where not waited. There is some array of nodes parameters (specific fields are displayed depending on the ComboBox value). Nodes should be able to expand (by pressing + the ComboBox and corresponding fields are added) and delete individual elements (x button). When I try to add fields with different ComboBox values everything looks good.

But if you try to create two pde or topaz fields, only one layout will be displayed on the screen. Is it possible to somehow create a layout stencil automatically and create new elements from it (the type of PDE and topaz fields are not known in advance and their content depends on the json schema). I will be glad to any offered working variant.

I use vaadin 8 + apache tomcat v7.0

17920234.png
17920237.png

One thing that could be the cause here is the fact that a Vaadin Component instance cannot be shown at multiple places. If you are somehow trying to re-use the first pde-layout for the second time that pde is selected, this will be the cause of your problem. You should always create new Instances each time a certain component should be shown multiple times.
If you do that already, ignore this comment.

Yes, that’s the problem. Is it possible to somehow create a layout template with components on which copies would be created?

this principle applies to all components. layouts are components, but input fields are too. So you not only have to recreate the layout but also the inputs they contain. If by copies you mean [clones]
(https://stackoverflow.com/a/16346442/3441504) then I really don’t know, I haven’t tried that out. And I know enough about cloning Objects to know that its a complicated topic with all the deep-copy and shallow-copy repercussions.
I would suggest you just create the second layout from scratch again just like the first.

I was hoping to avoid it, but it seems to be the only way. Thanks