1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """Defines a component container, which shows the subcomponents in the order
17 of their addition in specified orientation."""
18
19 from warnings import warn
20
21 from muntjac.ui.abstract_ordered_layout import AbstractOrderedLayout
22
23
25 """Ordered layout.
26
27 C{OrderedLayout} is a component container, which shows the
28 subcomponents in the order of their addition in specified orientation.
29
30 @author: Vaadin Ltd.
31 @author: Richard Lincoln
32 @version: 1.1.2
33 @deprecated: Replaced by VerticalLayout/HorizontalLayout. For type checking
34 please not that VerticalLayout/HorizontalLayout do not extend
35 OrderedLayout but AbstractOrderedLayout (which also
36 OrderedLayout extends).
37 """
38
39 CLIENT_WIDGET = None
40
41
42 ORIENTATION_VERTICAL = 0
43
44
45 ORIENTATION_HORIZONTAL = 1
46
47
49 """Creates a new ordered layout. The order of the layout defaults to
50 C{ORIENTATION_VERTICAL}.
51
52 @param orientation: the Orientation of the layout.
53 @deprecated: Use VerticalLayout/HorizontalLayout instead.
54 """
55 warn('use VerticalLayout/HorizontalLayout instead', DeprecationWarning)
56
57 super(OrderedLayout, self).__init__()
58
59
60 self._orientation = None
61
62 if orientation is None:
63 orientation = self.ORIENTATION_VERTICAL
64
65 self._orientation = orientation
66 if orientation == self.ORIENTATION_VERTICAL:
67 self.setWidth(100, self.UNITS_PERCENTAGE)
68
69
71 """Gets the orientation of the container.
72
73 @return: the Value of property orientation.
74 """
75 return self._orientation
76
77
79 """Sets the orientation of this OrderedLayout. This method should only
80 be used before initial paint.
81
82 @param orientation:
83 the New value of property orientation.
84 @deprecated: Use VerticalLayout/HorizontalLayout or define orientation
85 in constructor instead
86 """
87
88 if (orientation < self.ORIENTATION_VERTICAL
89 or orientation > self.ORIENTATION_HORIZONTAL):
90 raise ValueError()
91
92 self._orientation = orientation
93 if needsRepaint:
94 self.requestRepaint()
95
96
97 - def paintContent(self, target):
98 super(OrderedLayout, self).paintContent(target)
99
100
101 if self._orientation == self.ORIENTATION_HORIZONTAL:
102 target.addAttribute('orientation', 'horizontal')
103