Home | Trees | Indices | Help |
|
---|
|
1 # Copyright 2006 James Tauber and contributors 2 # Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net> 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 from pyjamas import Factory 16 from pyjamas import DOM 17 18 from pyjamas.ui.Widget import Widget 192185 8623 """ use this method, due to list changing as it's being iterated. 24 also, it's possible to use this method even 25 """ 26 children = [] 27 for child in self.__iter__(): 28 children.append(child) 29 30 for child in children: 31 self.remove(child)32 36 4042 return len(self.getChildren())4345 return self.getChildren()[index]4648 return self.getWidget(index)4951 self.add(child)5254 return self.getChildren().index(child)55 5860 """ Insert (or optionally replace) the widget at the given index 61 with a new one 62 """ 63 existing = self.getWidget(index) 64 if existing is not None: 65 self.remove(existing) 66 self.insert(widget, index)6769 return self.add(widget)7072 return self.setWidget(index, widget)7375 return self.getWidget(index)7678 return len(self.getChildren())79 8292108 109 110 Factory.registerClass('pyjamas.ui.Panel', 'Panel', Panel) 11194 if widget.getParent() is not self: 95 raise Exception("widget %s is not a child of this panel %s" % \ 96 (str(widget), str(self))) 97 element = widget.getElement() 98 widget.setParent(None) 99 parentElement = DOM.getParent(element) 100 if parentElement is not None: 101 DOM.removeChild(parentElement, element)102104 if container is not None: 105 widget.removeFromParent() 106 DOM.appendChild(container, widget.getElement()) 107 widget.setParent(self)
Home | Trees | Indices | Help |
|
---|
http://epydoc.sourceforge.net |