CellTree DOES support dynamic data.
You can use an AsyncDataProvider if you want to support lazy loading or the hierarchy is not known before hand.
Also there is a showcase example showing the use of dynamic data which can be found here.
The use of all the if (value instanceof SomeClass)
is necessary if you want to use different Cells
for each tree level (see showcase example).
If Child1
and Child1_2
are of the same type and are supposed to be rendered in the same way, you can use a different approach.
Instead of checking if the object is a specific class you could check a field in the object which tells you about to which level in the tree it belongs or if your objects are linked together via references (i.e. child object has a reference to it's parent) you can also make use of this information to create your TreeViewModel