@@ -0,0 +1,3093 @@
+%22%22%22 Pyjamas UI BuilderPanel: takes a PyJsGlade builder spec and adds widgets%0A    requested using the methods just like in any other Panel class.%0A%0ACopyright (C) 2010 Luke Kenneth Casson Leighton %3Clkcl@lkcl.net%3E%0A%0AThe purpose of this class is to be able to set up a Panel of any type%0Athat can be dynamically created using Builder, and then add child widgets%0Aonce again by their name as specified in the Builder spec file.%0A%0AThis class therefore has all of the usual Panel functions (add,%0Aremove, insert, __iter__, getWidget) as well as those required%0Afor it to be instantiable via Builder itself (!) such as%0AaddIndexedItem, getIndex and getIndexedChild.%0A%0A%22%22%22%0A%0Afrom pyjamas.ui.BuilderWidget import BuilderWidget%0A%0Aclass BuilderPanel(BuilderWidget):%0A%0A    def add(self, child_instance_name, **args, **kwargs):%0A        %22%22%22 versatile adding-function, copes with:%0A            HTMLPanel.add(widget, id)%0A            HTMLTable.add(item, row, col)%0A            HorizontalPanel.add(item)%0A            VerticalPanel.add(item)%0A            VerticalSplitPanel.add(item)%0A            HorizontalSplitPanel.add(item)%0A            DeckPanel.add(item)%0A            TabPanel.add(item)%0A            DockPanel.add(widget, direction)%0A            StackPanel.add(widget, stackText, asHTML)%0A            AbsolutePanel.add(widget, left, top)%0A            FlowPanel.add(widget)%0A        %22%22%22%0A        widget = self.b.createInstance(child_instance_name)%0A        self.widget.add(widget, *args, **kwargs)%0A%0A    def insert(self, child_instance_name, **args, **kwargs):%0A        widget = self.b.createInstance(child_instance_name)%0A        self.widget.insert(widget, *args, **kwargs)%0A%0A    def remove(self, widget, *args, **kwargs):%0A        %22%22%22 versatile removing-function, copes with:%0A            HTMLPanel.remove(widget) # if it had one%0A            HTMLTable.remove(item)%0A            HorizontalPanel.remove(item)%0A            VerticalPanel.remove(item)%0A            VerticalSplitPanel.remove(item) # if it had one%0A            HorizontalSplitPanel.remove(item) # if it had one%0A            DeckPanel.remove(item)%0A            TabPanel.remove(item)%0A            DockPanel.remove(item)%0A            StackPanel.remove(item, index=None)%0A            AbsolutePanel.remove(item)%0A            FlowPanel.add(widget)%0A        %22%22%22%0A        self.widget.remove(widget, *args, **kwargs)%0A%0A    def __iter__(self):%0A        return self.b.__iter__()%0A%0A    def getChildren(self):%0A        return self.b.getChildren()%0A%0A    def addIndexedItem(self, index, instance_name):%0A        widget = self.b.createInstance(child_instance_name)%0A        self.widget.addIndexedItem(index, widget)%0A%0A    def getIndex(self, *args):%0A        return self.widget.getIndex(*args)%0A%0A    def getIndexedChild(self, *args):%0A        return self.widget.getIndexedChild(*args)%0A%0A    def getWidget(self, *args):%0A        return self.widget.getWidget(*args)%0A%0A    def getWidgetCount(self):%0A        return self.widget.getWidgetCount()%0A%0A    def getWidgetIndex(self, *args):%0A        return self.widget.getWidgetIndex(*args)%0A%0A    def setWidgetPosition(self, *args):%0A        return self.widget.setWidgetPosition(*args)%0A%0A

add BuilderPanel which shouuld be useable to add widgets by Builder-instance-name