1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """Defines a component with two lists: left side for available items
17 and right side for selected items."""
18
19 from muntjac.ui.abstract_select import AbstractSelect
20
21 from muntjac.terminal.gwt.client.ui.v_twin_col_select import VTwinColSelect
22
23
25 """Multiselect component with two lists: left side for available items
26 and right side for selected items.
27 """
28
29 CLIENT_WIDGET = None
30
32 """
33 @param args: tuple of the form
34 - ()
35 - (caption)
36 - (caption, dataSource)
37 - (caption, options)
38 """
39 self._columns = 0
40 self._rows = 0
41 self._leftColumnCaption = None
42 self._rightColumnCaption = None
43
44 super(TwinColSelect, self).__init__(*args)
45
46
48 """Sets the number of columns in the editor. If the number of columns
49 is set 0, the actual number of displayed columns is determined
50 implicitly by the adapter.
51
52 The number of columns overrides the value set by setWidth. Only if
53 columns are set to 0 (default) the width set using
54 L{setWidth} or L{setWidth} is used.
55
56 @param columns: the number of columns to set.
57 """
58 if columns < 0:
59 columns = 0
60 if self._columns != columns:
61 self._columns = columns
62 self.requestRepaint()
63
64
67
68
71
72
74 """Sets the number of rows in the editor. If the number of rows is set
75 to 0, the actual number of displayed rows is determined implicitly by
76 the adapter.
77
78 If a height if set (using L{setHeight} or L{setHeight}) it overrides
79 the number of rows. Leave the height undefined to use this method. This
80 is the opposite of how L{setColumns} work.
81
82 @param rows: the number of rows to set.
83 """
84 if rows < 0:
85 rows = 0
86 if self._rows != rows:
87 self._rows = rows
88 self.requestRepaint()
89
90
91 - def paintContent(self, target):
92 target.addAttribute('type', 'twincol')
93
94
95 if self._columns != 0:
96 target.addAttribute('cols', self._columns)
97
98
99 if self._rows != 0:
100 target.addAttribute('rows', self._rows)
101
102
103 lc = self.getLeftColumnCaption()
104 rc = self.getRightColumnCaption()
105 if lc is not None:
106 target.addAttribute(VTwinColSelect.ATTRIBUTE_LEFT_CAPTION, lc)
107
108 if rc is not None:
109 target.addAttribute(VTwinColSelect.ATTRIBUTE_RIGHT_CAPTION, rc)
110
111 super(TwinColSelect, self).paintContent(target)
112
113
115 """Sets the text shown above the right column.
116
117 @param rightColumnCaption: The text to show
118 """
119 self._rightColumnCaption = rightColumnCaption
120 self.requestRepaint()
121
122
124 """Returns the text shown above the right column.
125
126 @return: The text shown or null if not set.
127 """
128 return self._rightColumnCaption
129
130
132 """Sets the text shown above the left column.
133
134 @param leftColumnCaption: The text to show
135 """
136 self._leftColumnCaption = leftColumnCaption
137 self.requestRepaint()
138
139
141 """Returns the text shown above the left column.
142
143 @return: The text shown or null if not set.
144 """
145 return self._leftColumnCaption
146