GetComponent

Hi. in Vaadin 8 we can use getComponentIndex(ComponentName) and addComponent(CompnoentName, index)

But in Vaadin 10 there are no such functions. What alternatives? How can i get components index and add component with index?

Hi.
Starting with Vaadin version 12.0.x you have high level API in HasComponents:
addComponentAsFirst(Component component) and
addComponentAtIndex(int index, Component component)

Now, for Vaadin 10.0.x, you can try to use the low level API from Element:
insertChild(int index, Element… children) and
setChild(int index, Element… children)

Hope this helps.

Silvan Eugen Lincan:
Hi.
Starting with Vaadin version 12.0.x you have high level API in HasComponents:
addComponentAsFirst(Component component) and
addComponentAtIndex(int index, Component component)

Now, for Vaadin 10.0.x, you can try to use the low level API from Element:
insertChild(int index, Element… children) and
setChild(int index, Element… children)

Hope this helps.

Thanks for reply.

But what differences between them?

Silvan Eugen Lincan:
Hi.
Starting with Vaadin version 12.0.x you have high level API in HasComponents:
addComponentAsFirst(Component component) and
addComponentAtIndex(int index, Component component)

Now, for Vaadin 10.0.x, you can try to use the low level API from Element:
insertChild(int index, Element… children) and
setChild(int index, Element… children)

Hope this helps.

And one more question - will Vaadin 12 suppport all what in Vaadin 10?

Can i just copy and paste my classes from Vaadin 10 project to Vaadin 12 project or it can give some errors?

JavaVaadin Vaadinjava:

Silvan Eugen Lincan:
Hi.
Starting with Vaadin version 12.0.x you have high level API in HasComponents:
addComponentAsFirst(Component component) and
addComponentAtIndex(int index, Component component)

Now, for Vaadin 10.0.x, you can try to use the low level API from Element:
insertChild(int index, Element… children) and
setChild(int index, Element… children)

Hope this helps.

And one more question - will Vaadin 12 suppport all what in Vaadin 10?

Can i just copy and paste my classes from Vaadin 10 project to Vaadin 12 project or it can give some errors?

I checked it and it wokrs with no errors :slight_smile:

Thank you for advicing me 12th version

Welcome.
If you managed to migrate your application from Vaadin 10.0.x to 12.0.x with no errors, I would even go to 13.0.x as this is already released, with more features.
You will also be closer to 14.0.x which will be LTS.

Silvan Eugen Lincan:
Welcome.
If you managed to migrate your application from Vaadin 10.0.x to 12.0.x with no errors, I would even go to 13.0.x as this is already released, with more features.
You will also be closer to 14.0.x which will be LTS.

Good, thanks!

I would be happy if you could answer to this question also:
https://vaadin.com/forum/thread/17550432/drag-and-drop-error