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 18 from ComplexPanel import ComplexPanel 1921126 127 Factory.registerClass('pyjamas.ui.CellPanel', CellPanel) 12823 element = None 24 if kwargs.has_key('Element'): 25 element = kwargs.pop('Element') 26 if element is None: 27 element = DOM.createTable() 28 self.table = element 29 self.setElement(self.table) 30 self.body = DOM.createTBody() 31 self.spacing = None 32 self.padding = None 33 DOM.appendChild(self.table, self.body) 34 35 ComplexPanel.__init__(self, **kwargs)36 39 42 45 49 53 56 5961 td = self.getWidgetTd(widget) 62 if td is None: 63 return None 64 return DOM.getAttribute(td, "align")6567 td = self.getWidgetTd(widget) 68 if td is None: 69 return None 70 return DOM.getStyleAttribute(td, "verticalAlign")71 7678 if width is None or width == "": 79 DOM.removeAttribute(self.table, "border") 80 else: 81 DOM.setAttribute(self.table, "border", "%d" % width)8284 td = DOM.getParent(widget.getElement()) 85 if height is None: 86 DOM.removeAttribute(td, "height") 87 else: 88 DOM.setAttribute(td, "height", height)8991 td = self.getWidgetTd(widget) 92 if td is not None: 93 if align is None: 94 DOM.removeAttribute(td, "align") 95 else: 96 DOM.setAttribute(td, "align", align)9799 td = self.getWidgetTd(widget) 100 if td is not None: 101 if align is None: 102 DOM.setStyleAttribute(td, "verticalAlign", "") 103 else: 104 DOM.setStyleAttribute(td, "verticalAlign", align)105107 td = DOM.getParent(widget.getElement()) 108 if width is None: 109 DOM.removeAttribute(td, "width") 110 else: 111 DOM.setAttribute(td, "width", width)112114 self.spacing = spacing 115 if spacing is None: 116 DOM.removeAttribute(self.table, "cellSpacing") 117 else: 118 DOM.setAttribute(self.table, "cellSpacing", str(spacing))119121 self.padding = padding 122 if padding is None: 123 DOM.removeAttribute(self.table, "cellPadding") 124 else: 125 DOM.setAttribute(self.table, "cellPadding", str(padding))
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jun 16 12:42:35 2010 | http://epydoc.sourceforge.net |