setCompositionRoot() method in Customomponents

Hi. I am new in Vaadin.

I am just reading and fallowing what is in book of vaadin 7.
I made an example in page 82 (4.3.4. Differentiaing Between Event Sources).

It works fine, but I can not get the concept of setComposition method.
What is the exactly setComposition() do?

I already read docs, but it does not helped for me.
Thanks for your kind answer in advanced :smiley:

Have a good day!
-Juneyoung

setCompositionRootprotected void setCompositionRoot(Component compositionRoot)Sets the compositions root.

The composition root must be set to non-null value before the component can be used. The composition root can only be set once.

Parameters:
compositionRoot - the root of the composition component tree.

“Composition Root” is a content of your custom component. In that case a custom component is a container of your “composition”.

Thanks for your kind answer, Anatoly.
So could I assume that “setCompositionRoot()” is similar version of “setContent()” for CustomComponent?

  • Juneyoung

the setCompositionRoot method looks like the setContent method for Panel.

setCompositionRoot is now deprecated… can any one help for the replacement?