49 [see also:] |
49 [see also:] |
50 UIPainter |
50 UIPainter |
51 UILayoutTool |
51 UILayoutTool |
52 UIHelpTool |
52 UIHelpTool |
53 " |
53 " |
|
54 ! ! |
|
55 |
|
56 !UISpecificationTool class methodsFor:'help specs'! |
|
57 |
|
58 helpSpec |
|
59 "return a dictionary filled with helpKey -> helptext associations. |
|
60 These are used by the activeHelp tool. |
|
61 " |
|
62 ^ super helpSpec addPairsFrom:#( |
|
63 |
|
64 #maxChars |
|
65 'set the maximum number of |
|
66 characters that are allowed |
|
67 in the editfield.' |
|
68 |
|
69 #id |
|
70 'enter the name of the field here. |
|
71 This ID can be used by the application |
|
72 to access components, using #componentAt:<key>' |
|
73 |
|
74 ) |
54 ! ! |
75 ! ! |
55 |
76 |
56 !UISpecificationTool class methodsFor:'interface specs'! |
77 !UISpecificationTool class methodsFor:'interface specs'! |
57 |
78 |
58 windowSpec |
79 windowSpec |
92 ) |
113 ) |
93 ! ! |
114 ! ! |
94 |
115 |
95 !UISpecificationTool methodsFor:'accessing'! |
116 !UISpecificationTool methodsFor:'accessing'! |
96 |
117 |
|
118 specification |
|
119 "gets current edit specification |
|
120 " |
|
121 ^ specification |
|
122 |
|
123 |
|
124 ! |
|
125 |
|
126 specification:aSpec |
|
127 "sets current edit specification |
|
128 " |
|
129 aSpec isNil ifTrue:[ |
|
130 specChannel := nil. |
|
131 specification := nil. |
|
132 aspects := nil. |
|
133 ] ifFalse:[ |
|
134 specification class == aSpec class ifTrue:[ |
|
135 specification := aSpec. |
|
136 ^ specChannel value:specification. |
|
137 ]. |
|
138 specification := aSpec. |
|
139 aspects := IdentityDictionary new. |
|
140 specChannel := specification asValue. |
|
141 specification class addBindingsTo:aspects for:specification channel:specChannel. |
|
142 aspects do:[:el| el addDependent:self ]. |
|
143 ]. |
|
144 |
|
145 selection notNil ifTrue:[ |
|
146 (builder componentAt:#Frame) destroySubViews. |
|
147 selection := nil. |
|
148 ]. |
|
149 ! ! |
|
150 |
|
151 !UISpecificationTool methodsFor:'accessing channels'! |
|
152 |
97 modifiedHolder:aValueHolder |
153 modifiedHolder:aValueHolder |
98 "set the value holder set to true in case of modifying attributes |
154 "set the value holder set to true in case of modifying attributes |
99 " |
155 " |
100 modifiedHolder notNil ifTrue:[ |
156 modifiedHolder notNil ifTrue:[ |
101 modifiedHolder removeDependent:self. |
157 modifiedHolder removeDependent:self. |
103 |
159 |
104 (modifiedHolder := aValueHolder) notNil ifTrue:[ |
160 (modifiedHolder := aValueHolder) notNil ifTrue:[ |
105 modifiedHolder addDependent:self. |
161 modifiedHolder addDependent:self. |
106 ]. |
162 ]. |
107 |
163 |
108 ! |
164 ! ! |
|
165 |
|
166 !UISpecificationTool methodsFor:'bindings'! |
|
167 |
|
168 aspectFor:aKey |
|
169 "returns aspect for a key or nil |
|
170 " |
|
171 aspects notNil ifTrue:[ |
|
172 ^ aspects at:aKey ifAbsent:nil |
|
173 ]. |
|
174 ^ super aspectFor:aKey |
|
175 |
|
176 ! ! |
|
177 |
|
178 !UISpecificationTool methodsFor:'change & update'! |
109 |
179 |
110 update |
180 update |
111 "reload specification |
181 "reload specification |
112 " |
182 " |
113 specChannel notNil ifTrue:[ |
183 specChannel notNil ifTrue:[ |
114 specChannel value:specEdited. |
184 specChannel value:specification. |
115 ] |
185 ] |
116 |
186 |
117 |
187 |
118 ! ! |
188 ! |
119 |
|
120 !UISpecificationTool methodsFor:'bindings'! |
|
121 |
|
122 aspectFor:aKey |
|
123 "returns aspect for a key or nil |
|
124 " |
|
125 aspects notNil ifTrue:[ |
|
126 ^ aspects at:aKey ifAbsent:nil |
|
127 ]. |
|
128 ^ super aspectFor:aKey |
|
129 |
|
130 ! |
|
131 |
|
132 specEdited |
|
133 "gets current edit specification |
|
134 " |
|
135 ^ specEdited |
|
136 |
|
137 |
|
138 ! |
|
139 |
|
140 specEdited:aSpec |
|
141 "sets current edit specification |
|
142 " |
|
143 aSpec isNil ifTrue:[ |
|
144 specChannel := nil. |
|
145 specEdited := nil. |
|
146 aspects := nil. |
|
147 ] ifFalse:[ |
|
148 specEdited class == aSpec class ifTrue:[ |
|
149 specEdited := aSpec. |
|
150 ^ specChannel value:specEdited. |
|
151 ]. |
|
152 specEdited := aSpec. |
|
153 aspects := IdentityDictionary new. |
|
154 specChannel := specEdited asValue. |
|
155 specEdited class addBindingsTo:aspects for:specEdited channel:specChannel. |
|
156 aspects do:[:el| el addDependent:self ]. |
|
157 ]. |
|
158 |
|
159 specClass notNil ifTrue:[ |
|
160 (builder componentAt:#Frame) destroySubViews. |
|
161 specClass := nil. |
|
162 ]. |
|
163 ! ! |
|
164 |
|
165 !UISpecificationTool methodsFor:'change & update'! |
|
166 |
189 |
167 update:something with:someArgument from:someone |
190 update:something with:someArgument from:someone |
168 "any attribute changed its state in the current specification |
191 "any attribute changed its state in the current specification |
169 " |
192 " |
170 someone ~~ modifiedHolder ifTrue:[ |
193 someone ~~ modifiedHolder ifTrue:[ |
177 ! ! |
200 ! ! |
178 |
201 |
179 !UISpecificationTool methodsFor:'selection'! |
202 !UISpecificationTool methodsFor:'selection'! |
180 |
203 |
181 selection:something |
204 selection:something |
|
205 "selection changed |
|
206 " |
182 |slices idx spec frame| |
207 |slices idx spec frame| |
183 |
208 |
184 specEdited notNil ifTrue:[ |
209 specification notNil ifTrue:[ |
185 slices := specEdited class slices. |
210 slices := specification class slices. |
186 idx:= slices findFirst:[:aSlice| aSlice first = something ]. |
211 idx:= slices findFirst:[:aSlice| aSlice first = something ]. |
187 |
212 |
188 idx ~~ 0 ifTrue:[ |
213 idx ~~ 0 ifTrue:[ |
189 spec := specEdited class perform:((slices at:idx) last). |
214 spec := specification class perform:((slices at:idx) last). |
190 ]. |
215 ]. |
191 ]. |
216 ]. |
192 |
217 |
193 spec ~= specClass ifTrue:[ |
218 spec ~= selection ifTrue:[ |
194 frame := builder componentAt:#Frame. |
219 frame := builder componentAt:#Frame. |
195 frame destroySubViews. |
220 frame destroySubViews. |
196 |
221 |
197 spec notNil ifTrue:[ |
222 spec notNil ifTrue:[ |
198 builder buildFromSpec:spec in:frame. |
223 builder buildFromSpec:spec in:frame. |
199 frame allViewBackground:(frame viewBackground). |
224 frame allViewBackground:(frame viewBackground). |
200 frame realizeAllSubViews. |
225 frame realizeAllSubViews. |
201 ] |
226 ] |
202 ]. |
227 ]. |
203 specClass := spec. |
228 selection := spec. |
204 ! ! |
229 ! ! |
205 |
230 |
206 !UISpecificationTool class methodsFor:'documentation'! |
231 !UISpecificationTool class methodsFor:'documentation'! |
207 |
232 |
208 version |
233 version |