PageRenderTime 51ms CodeModel.GetById 30ms app.highlight 3ms RepoModel.GetById 17ms app.codeStats 0ms

/pyjs/tests/test006.py

http://pyjamas.googlecode.com/
Python | 42 lines | 25 code | 17 blank | 0 comment | 1 complexity | 248678bf9377bd71a058f07023537966 MD5 | raw file
 1import DOM
 2
 3class UIObject:
 4
 5    def getElement(self):
 6        return self.element
 7
 8    def setElement(self, element):
 9        self.element = element
10
11    def setStyleName(self, style):
12        DOM.setAttribute(self.element, "className", style)
13
14
15class Widget(UIObject):
16
17    def setParent(self, parent):
18        self.parent = parent
19
20
21class FocusWidget(Widget):
22
23    def __init__(self, element):
24        self.setElement(element)
25
26
27class ButtonBase(FocusWidget):
28
29    def __init__(self, element):
30        FocusWidget.__init__(self, element)
31
32    def setHTML(self, html):
33        DOM.setInnerHTML(self.getElement(), html)
34    
35
36class Button(ButtonBase):
37
38    def __init__(self, html=None):
39        ButtonBase.__init__(self, DOM.createButton())
40        self.setStyleName("gwt-Button")
41        if html:
42            self.setHTML(html)