Embedding custom components with custom components

56 views
Skip to first unread message

bryn ryans

unread,
Mar 1, 2012, 9:01:06 PM3/1/12
to google-we...@googlegroups.com

I have a series of custom components constructed using uibinder. The custom components can embed other custom components also built using uibinder. The components render perfectly but custom components which require events to be sunk are not getting sunk. This is because the components extend composite which does not implement HasWidgets. To get around this, the custom components implement there own attach/detach methods which delegate to onattach/ondetach to sink the events. If the composite has children it calls the attach/detach methods for those children. I tried to use the same mechanism as complex panel but gave up because the orphan method call the setParent method on widget which is package protected.

So! I'd rather not do what I have done, so the question is, is there anything in GWT 2.5 (or beyond) which will do this for me. i.e. can I at some point in the future, create custom components using uibinder, which can embed other custom components which also use uibinder and have onattach/ondetach called on the children to sink the events.

JoseM

unread,
Mar 2, 2012, 12:44:28 AM3/2/12
to google-we...@googlegroups.com
What if you just implement HasWidgets and pass those method calls on down to the root panel of your UiBinder which can be an HTMLPanel.

bryn ryans

unread,
Mar 6, 2012, 8:50:54 PM3/6/12
to google-we...@googlegroups.com

Tried that but what I felt that if I am to do that it should do the same as complex panel. Unfortunately it can't as ComplexPanel calls method orphan which calls package protected methods on Widget. As my classes do not reside in the same package Widget I cannot call that method (I would rather not hack the package name or do some magic with JSNI to achieve this). 

I have my own mechanism which allows me to sink events in my embedded components and its working well. What I am trying to find out is if GWT 2.5. (or future release) will support embedding of uibinder components within other uibinder components? Be great if there is a plan as I can get rid of my own mechanism.

Thomas Broyer

unread,
Mar 7, 2012, 6:10:59 AM3/7/12
to google-we...@googlegroups.com

On Wednesday, March 7, 2012 2:50:54 AM UTC+1, bryn ryans wrote:

Tried that but what I felt that if I am to do that it should do the same as complex panel. Unfortunately it can't as ComplexPanel calls method orphan which calls package protected methods on Widget. As my classes do not reside in the same package Widget I cannot call that method (I would rather not hack the package name or do some magic with JSNI to achieve this). 

I have my own mechanism which allows me to sink events in my embedded components and its working well. What I am trying to find out is if GWT 2.5. (or future release) will support embedding of uibinder components within other uibinder components? Be great if there is a plan as I can get rid of my own mechanism.

There's no such thing as a "UiBinder component", there are widgets (or UiObjects, or whatever actually) that internally make use of UiBinder, and there are widgets that can contain other widgets (either by implementing HasWidgets or using @UiChild methods).

I don't know what you're trying to do but there must be a simpler way of doing it.
Reply all
Reply to author
Forward
0 new messages