1 """
2 * Copyright 2007 Google Inc.
3 # Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http:#www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 """
17
18
19 from pyjamas import DOM
20
21 from pyjamas.ui import Event
22 from pyjamas.ui import Focus
23
24 """*
25 * Base class for RichText platform implementations. The default version
26 * simply creates a text area with no rich text support.
27 *
28 * This is not currently used by any user-agent, but will provide a
29 * <textarea> fallback in the event a future browser fails to implement
30 * rich text editing.
31 """
33
35 self.elem = self.createElement()
36
37
38 - def getElement(self):
40
41
43 return DOM.getElementProperty(self.elem, "value")
44
45
47 return DOM.getElementProperty(self.elem, "value")
48
49
50 - def initElement(self):
52
53
56
57
60
61
62 - def setHTML(self, html):
63 DOM.setElementProperty(self.elem, "value", html)
64
65
66 - def setText(self, text):
67 DOM.setElementProperty(self.elem, "value", text)
68
69
70 - def uninitElement(self):
72
73
74 - def setFocus(self, focused):
75 if (focused):
76 Focus.focus(self.getElement())
77 else:
78 Focus.blur(self.getElement())
79
80 - def createElement(self):
82
83
84 - def hookEvents(self):
88
89
91 print "onElementInitialized"
92 self.hookEvents()
93
94 - def setCssStyling(self):
96