How to renders vaadin components inside custom widgets on client side?

Hi All

I am trying to create a client-side widget and inside the widget , i m attaching the vaadin component (Calendar) and but that vaadin component is not working inside the my widget. I am able to see component in browser and but browser events like click not working for it.

Client side code // UpdatefromUIDL
Iterator <?>itr = uidl.getChildIterator();

final UIDL drawerUIDL = uidl.getChildUIDL(0); // Getting the vaadin component from UIDL
final Paintable paintable = client.getPaintable(drawerUIDL);
widgetCopyOfPaintable = (Widget) paintable;
paintable.updateFromUIDL(drawerUIDL, client); // call updateUIDL on vaadin component
parentDiv.appendChild(widgetCopyOfPaintable.getElement()); // attached it to widget.

Server Side code - // inside the paintContent method
PopupDateField datetime = new PopupDateField(“Please select the starting time:”);
datetime.paint(target); // Painting the calendar component

Can anybody help me where i m wrong in the code?
Also, please tell me how VerticalLayout renders different vaadin components and handle there events?

~Suri

Please help.

~Surender Singh