If you are loading the ui dynamically, then you need to let the UI loader have a way of instantiating your widget, it can't magically create widgets it doesn't know anything about.
So you either do that by reimplementing createWidget() or, I think, by providing a widget plugin.
Cheers,
_
Bookmarks