1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """Defines an interface implemented by all classes that can be painted."""
17
18 from muntjac.util import IEventListener, EventObject
19
20
22 """Interface implemented by all classes that can be painted. Classes
23 implementing this interface know how to output themselves to a UIDL
24 stream and that way describing to the terminal how it should be displayed
25 in the UI.
26
27 @author: Vaadin Ltd.
28 @author: Richard Lincoln
29 @version: 1.1.2
30 """
31
33 """Paints the IPaintable into a UIDL stream. This method creates the
34 UIDL sequence describing it and outputs it to the given UIDL stream.
35
36 It is called when the contents of the component should be painted in
37 response to the component first being shown or having been altered so
38 that its visual representation is changed.
39
40 @param target:
41 the target UIDL stream where the component should paint
42 itself to.
43 @raise PaintException:
44 if the paint operation failed.
45 """
46 raise NotImplementedError
47
48
50 """Requests that the paintable should be repainted as soon as
51 possible."""
52 raise NotImplementedError
53
54
56 """Adds an unique id for component that get's transferred to terminal
57 for testing purposes. Keeping identifiers unique throughout the
58 Application instance is on programmers responsibility.
59
60 Note, that with the current terminal implementation the identifier
61 cannot be changed while the component is visible. This means that the
62 identifier should be set before the component is painted for the first
63 time and kept the same while visible in the client.
64
65 @param idd:
66 A short (< 20 chars) alphanumeric id
67 """
68 raise NotImplementedError
69
70
72 """Get's currently set debug identifier
73
74 @return: current debug id, null if not set
75 """
76 raise NotImplementedError
77
78
80 """Adds repaint request listener. In order to assure that no repaint
81 requests are missed, the new repaint listener should paint the
82 paintable right after adding itself as listener.
83
84 @param listener:
85 the listener to be added.
86 """
87 if (isinstance(listener, IRepaintRequestListener) and
88 (iface is None or iface == IRepaintRequestListener)):
89 raise NotImplementedError
90
91
92 - def addCallback(self, callback, eventType=None, *args):
93 if eventType is None:
94 eventType = callback._eventType
95
96 if eventType == RepaintRequestEvent:
97 raise NotImplementedError
98
99
101 """Removes repaint request listener.
102
103 @param listener:
104 the listener to be removed.
105 """
106 if iface == IRepaintRequestListener:
107 raise NotImplementedError
108 else:
109 super(IPaintable, self).removeListener(listener, iface)
110
111
113 if eventType is None:
114 eventType = callback._eventType
115
116 if eventType == RepaintRequestEvent:
117 raise NotImplementedError
118
119
121 """Request sending of repaint events on any further visible changes.
122 Normally the paintable only send up to one repaint request for
123 listeners after paint as the paintable as the paintable assumes that
124 the listeners already know about the repaint need. This method resets
125 the assumtion. Paint implicitly does the assumtion reset functionality
126 implemented by this method.
127
128 This method is normally used only by the terminals to note paintables
129 about implicit repaints (painting the component without actually
130 invoking paint method).
131 """
132 raise NotImplementedError
133
134
136 """Repaint request event is thrown when the paintable needs to be
137 repainted. This is typically done when the C{paint} method
138 would return dissimilar UIDL from the previous call of the method.
139 """
140
142 """Constructs a new event.
143
144 @param source:
145 the paintable needing repaint.
146 """
147 super(RepaintRequestEvent, self).__init__(source)
148
149
151 """Gets the paintable needing repainting.
152
153 @return: IPaintable for which the C{paint} method will return
154 dissimilar UIDL from the previous call of the method.
155 """
156 return self.getSource()
157
158
160 """Listens repaint requests. The C{repaintRequested} method is
161 called when the paintable needs to be repainted. This is typically done
162 when the C{paint} method would return dissimilar UIDL from the
163 previous call of the method.
164 """
165
167 """Receives repaint request events.
168
169 @param event:
170 the repaint request event specifying the paintable source.
171 """
172 raise NotImplementedError
173