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 DOM 16 from pyjamas import Factory 17 from pyjamas.ui import InnerHTML 18 19 from ComplexPanel import ComplexPanel 20 21 HTMLPanel_sUid = 024 try: 25 element_tagname = element.nodeName # DOM.getAttribute(element, "nodeName") 26 element_tagname = str(element_tagname).lower() 27 except: 28 element_tagname = None 29 if element_tagname is not None and element_tagname == tagname: 30 return [element] 31 32 res = [] 33 child = DOM.getFirstChild(element) 34 while child is not None: 35 for el in getElementsByTagName(child, tagname): 36 res.append(el) 37 child = DOM.getNextSibling(child) 38 39 return res4042 try: 43 element_id = DOM.getAttribute(element, "id") 44 except: 45 element_id = None 46 if element_id is not None and element_id == id: 47 return element 48 49 child = DOM.getFirstChild(element) 50 while child is not None: 51 ret = getElementById(child, id) 52 if ret is not None: 53 return ret 54 child = DOM.getNextSibling(child) 55 56 return None5788 89 Factory.registerClass('pyjamas.ui.HTMLPanel', HTMLPanel) 9061 # NOTE! don't set a default style on this panel, because the 62 # HTML might expect to have one already. 63 #if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-HTMLPanel" 64 if html: kwargs['HTML'] = html 65 if kwargs.has_key('Element'): 66 element = kwargs.pop('Element') 67 else: 68 element = DOM.createDiv() 69 self.setElement(element) 70 ComplexPanel.__init__(self, **kwargs)7173 element = getElementById(self.getElement(), id) 74 if element is None: 75 # throw new NoSuchElementException() 76 return 77 ComplexPanel.add(self, widget, element)78 81 82 @staticmethod
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jun 16 12:42:29 2010 | http://epydoc.sourceforge.net |