I have made a custom component which needs some values to be passed to the client side components constructor so it can initialize the client side component correctly. How do I do that?
Apparently the widgetset creates the instance of the client side component so I would need to pass the widgetset the parameters? I have tried adding the parameters as variables to the painttarget in the server side components paintContent(…) method but the UIDL which the widgetset gets does not contain these variables.
The client side component embeds a flash component in the constructor which needs the component dimensions and other parameters to render correctly.
The problem is that if I add the embedded flash in the first updateFromUIDL then I get a not so nice looking resizing/blinking of the component when the embedded is added. If I could pass parameters to the constructor I would not have that problem and the component would look nice from the start.
Strange - it should not make a difference if you add the component in constructor or in first updatefromuidl. Both should be invoked in the same ajax-response cycle. How about adding some temporary size for the component? Are you sure that you initialize flash only once?
Hmm, maybe could try that and see what happens. It could also be that the flash does the initialization twice so I will have to get back to you on that one once I checked that
I am now curious though, from where does the UIDL the widgetset originate? Is it something that Vaadin handles internally and I should leave alone or can I influence it in any way?
Have taken a look at the coverflow example? The problem I had with it was that some of the parameters needed in the flash object (such as colors) wasn’t sent to the client side before the first updateFromUIDL call. I solved the problem by withholding the creation of the object-tag until I had received the required parameters. After I’d received everything I needed, then I could initialize the flash object.
Moving all the flash stuff out from the constructor like in the Coverflow example and adding it later seems to have worked, or at least the blinking is not so bad any more. So thank you guys, you made my life a bit easier