1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 -class RenderInfo(object):
18 """Class for fetching render information from the client side widgets.
19
20 @author: jouni@vaadin.com
21 @author: Richard Lincoln
22 """
23
24 @classmethod
25 - def get(cls, c, cb, *props):
26 """Initiate a request to get the render information for a given component.
27
28 The information can be for example the exact pixel size and position, the
29 font size, visibility, margin, padding or border of the component in the
30 browser. See possible values from the {@link CssProperty} enumerable.
31
32 The information will be delivered asynchronously from the client, and
33 passed as a parameter to the callback method.
34
35 You can limit the amount of properties transmitted over the connection by
36 passing the desired property names as the last parameter for the method.
37
38 @param c:
39 The component whose render information you wish to get.
40 @param cb:
41 The callback object which will receive the information when it
42 is available.
43 @param props:
44 Optional. The list of CSS properties you wish to get from the
45 client (limit the amount of transferred data). You can pass
46 any type of objects here, the C{__str__()} method
47 will be used to convert them to actual property names.
48 Preferably use the L{CssProperty} enumerable for feasible values.
49 """
50 if c.getApplication() is None:
51 raise ValueError('The component must be attached to the application before you try to get it\'s RenderInfo')
52
53 from muntjac.addon.csstools.render_info_fetcher \
54 import RenderInfoFetcher
55
56 fetcher = RenderInfoFetcher(c, cb, *props)
57 c.getApplication().getMainWindow().addWindow(fetcher)
58
59
62
63
65 return self._props[str(prop)]
66
69 """The callback interface for RenderInformation requests.
70
71 @author: jouni@vaadin.com
72 @author: Richard Lincoln
73 """
74
76 """This method is called when a RenderInfo request is returned from the
77 client and the RenderInfo for that request is available.
78
79 @param info:
80 The RenderInfo object for the request, containing the
81 requested properties (or all possible properties if no
82 specific properties were requested).
83 """
84 raise NotImplementedError
85