Hi! Have you ever wondered how to write a widget that contains other widgets but you don't want to extend Panel because Panel implements HasWidgets? HasWidgets forces you to implement the ability to remove child widgets via Iterator.remove() and remove() directly. But your child widgets are completely managed by your parent widget and should not be removable.
Such a container widget is currently only possible by extending Panel and then wrapping a Composite around the subclass just to hide the HasWidgets methods. But it can be much simpler. We introduce a new UI base class that provides the well-known adopt() and orphan() methods of Panel but does not implement HasWidgets. This base class also provides methods to call Widget.onAttach() and onDetach(). Enter the Container. A Container should provide methods to call setParent(), onAttach(), and onDetach(), which are package-private and protected, respectively, and Container should take over the adopt() and orphan() methods from Panel. This would make Panel merely a semi-abstract implementation of HasWidgets. Please take a look a this document: http://docs.google.com/View?docID=dgf5d73j_17c99djxgc To attach or detach children you have to call attachChild() and detachChild() or one of the convenience methods for collections. For a more detailed explanation read this thread: http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse_thread/thread/cdee97b882979020 I also opened an issue and attached a patch. If you like to try this out check out the GWT 1.5.1 source and apply the patch. If you only like to try out Container you can create a package "com.google.gwt.user.client.ui" in your project and copy the source into Container.java. http://code.google.com/p/google-web-toolkit/issues/detail?id=2810 Now I would like to hear what you think of this enhancement. Do you think you have any use for this? Is there something you would rather change? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
