|
1 " |
|
2 COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
|
3 All Rights Reserved |
|
4 |
|
5 This software is furnished under a license and may be used |
|
6 only in accordance with the terms of that license and with the |
|
7 inclusion of the above copyright notice. This software may not |
|
8 be provided or otherwise made available to, or used by, any |
|
9 other person. No title to or ownership of the software is |
|
10 hereby transferred. |
|
11 " |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 ApplicationModel subclass:#DataSetBuilder |
|
18 instanceVariableNames:'className superclassName hasChanged columnView columns |
|
19 selectedColumnIndex tabSelectionIndex aspects isModified' |
|
20 classVariableNames:'Number' |
|
21 poolDictionaries:'' |
|
22 category:'Interface-UIPainter' |
|
23 ! |
|
24 |
|
25 !DataSetBuilder class methodsFor:'documentation'! |
|
26 |
|
27 copyright |
|
28 " |
|
29 COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
|
30 All Rights Reserved |
|
31 |
|
32 This software is furnished under a license and may be used |
|
33 only in accordance with the terms of that license and with the |
|
34 inclusion of the above copyright notice. This software may not |
|
35 be provided or otherwise made available to, or used by, any |
|
36 other person. No title to or ownership of the software is |
|
37 hereby transferred. |
|
38 " |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 ! |
|
44 |
|
45 documentation |
|
46 " |
|
47 create and modify or inspect dataset columns; used by UIPainter (DataSetColumnSpec) |
|
48 |
|
49 [see also:] |
|
50 DataSetColumnSpec |
|
51 DataSetSpec |
|
52 DataSetView |
|
53 DataSetColumn |
|
54 |
|
55 [author:] |
|
56 Claus Atzkern |
|
57 " |
|
58 |
|
59 ! ! |
|
60 |
|
61 !DataSetBuilder class methodsFor:'columns specs'! |
|
62 |
|
63 basicsEditSpec |
|
64 "this window spec was automatically generated by the ST/X UIPainter" |
|
65 |
|
66 "do not manually edit this - the painter/builder may not be able to |
|
67 handle the specification if its corrupted." |
|
68 |
|
69 " |
|
70 UIPainter new openOnClass:DataSetBuilder andSelector:#basicsEditSpec |
|
71 DataSetBuilder new openInterface:#basicsEditSpec |
|
72 " |
|
73 |
|
74 <resource: #canvas> |
|
75 |
|
76 ^ |
|
77 |
|
78 #(#FullSpec |
|
79 #'window:' |
|
80 #(#WindowSpec |
|
81 #'name:' 'DataSet Basic' |
|
82 #'layout:' #(#LayoutFrame 197 0 172 0 485 0 427 0) |
|
83 #'label:' 'DataSet Basic' |
|
84 #'min:' #(#Point 10 10) |
|
85 #'max:' #(#Point 1280 1024) |
|
86 #'bounds:' #(#Rectangle 197 172 486 428) |
|
87 ) |
|
88 #'component:' |
|
89 #(#SpecCollection |
|
90 #'collection:' |
|
91 #( |
|
92 #(#LabelSpec |
|
93 #'name:' 'labelLabel' |
|
94 #'layout:' #(#AlignmentOrigin 84 0 29 0 1 0.5) |
|
95 #'label:' 'Label:' |
|
96 #'adjust:' #right |
|
97 #'resizeForLabel:' true |
|
98 ) |
|
99 #(#InputFieldSpec |
|
100 #'name:' 'labelField' |
|
101 #'layout:' #(#LayoutFrame 86 0 20 0 -12 1.0 40 0) |
|
102 #'model:' #label |
|
103 ) |
|
104 #(#FramedBoxSpec |
|
105 #'name:' 'typesFrame' |
|
106 #'layout:' #(#LayoutFrame 0 0.0 51 0 0 1.0 131 0) |
|
107 #'component:' |
|
108 #(#SpecCollection |
|
109 #'collection:' |
|
110 #( |
|
111 #(#LabelSpec |
|
112 #'name:' 'rendererLabel' |
|
113 #'layout:' #(#AlignmentOrigin 84 0 26 0 1 0.5) |
|
114 #'label:' 'Renderer:' |
|
115 #'resizeForLabel:' true |
|
116 ) |
|
117 #(#ComboListSpec |
|
118 #'name:' 'rendererField' |
|
119 #'layout:' #(#LayoutFrame 86 0 16 0 17 1.0 36 0) |
|
120 #'model:' #rendererType |
|
121 #'comboList:' #rendererTypeList |
|
122 #'useIndex:' false |
|
123 ) |
|
124 #(#LabelSpec |
|
125 #'name:' 'editorLabel' |
|
126 #'layout:' #(#AlignmentOrigin 84 0 50 0 1 0.5) |
|
127 #'label:' 'Editor:' |
|
128 #'resizeForLabel:' true |
|
129 ) |
|
130 #(#ComboBoxSpec |
|
131 #'name:' 'editorField' |
|
132 #'layout:' #(#LayoutFrame 86 0 41 0 17 1.0 61 0) |
|
133 #'model:' #editorType |
|
134 #'type:' #symbolOrNil |
|
135 #'comboList:' #editorTypeList |
|
136 #'useIndex:' false |
|
137 ) |
|
138 ) |
|
139 ) |
|
140 #'label:' 'Types:' |
|
141 #'labelPosition:' #topLeft |
|
142 ) |
|
143 #(#FramedBoxSpec |
|
144 #'name:' 'selectorsFrame' |
|
145 #'layout:' #(#LayoutFrame 0 0.0 143 0 0 1.0 245 0) |
|
146 #'component:' |
|
147 #(#SpecCollection |
|
148 #'collection:' |
|
149 #( |
|
150 #(#LabelSpec |
|
151 #'name:' 'readLabel' |
|
152 #'layout:' #(#AlignmentOrigin 84 0 25 0 1 0.5) |
|
153 #'label:' 'Read:' |
|
154 #'adjust:' #right |
|
155 #'resizeForLabel:' true |
|
156 ) |
|
157 #(#InputFieldSpec |
|
158 #'name:' 'readSelector' |
|
159 #'layout:' #(#LayoutFrame 86 0 16 0 17 1.0 36 0) |
|
160 #'model:' #readSelector |
|
161 #'type:' #symbolOrNil |
|
162 ) |
|
163 #(#LabelSpec |
|
164 #'name:' 'menuLabel' |
|
165 #'layout:' #(#AlignmentOrigin 84 0 51 0 1 0.5) |
|
166 #'label:' 'Menu:' |
|
167 #'adjust:' #right |
|
168 #'resizeForLabel:' true |
|
169 ) |
|
170 #(#InputFieldSpec |
|
171 #'name:' 'menuField' |
|
172 #'layout:' #(#LayoutFrame 86 0 41 0 17 1.0 61 0) |
|
173 #'model:' #menu |
|
174 #'type:' #symbolOrNil |
|
175 ) |
|
176 #(#LabelSpec |
|
177 #'name:' 'printLabel' |
|
178 #'layout:' #(#AlignmentOrigin 84 0 75 0 1 0.5) |
|
179 #'label:' 'Print:' |
|
180 #'adjust:' #right |
|
181 #'resizeForLabel:' true |
|
182 ) |
|
183 #(#InputFieldSpec |
|
184 #'name:' 'printSelector' |
|
185 #'layout:' #(#LayoutFrame 86 0 66 0 17 1.0 86 0) |
|
186 #'model:' #printSelector |
|
187 #'type:' #symbolOrNil |
|
188 ) |
|
189 ) |
|
190 ) |
|
191 #'label:' 'Selectors:' |
|
192 #'labelPosition:' #topLeft |
|
193 ) |
|
194 ) |
|
195 ) |
|
196 ) |
|
197 ! |
|
198 |
|
199 detailsEditSpec |
|
200 "this window spec was automatically generated by the ST/X UIPainter" |
|
201 |
|
202 "do not manually edit this - the painter/builder may not be able to |
|
203 handle the specification if its corrupted." |
|
204 |
|
205 " |
|
206 UIPainter new openOnClass:DataSetBuilder andSelector:#detailsEditSpec |
|
207 DataSetBuilder new openInterface:#detailsEditSpec |
|
208 " |
|
209 |
|
210 <resource: #canvas> |
|
211 |
|
212 ^ |
|
213 |
|
214 #(#FullSpec |
|
215 #'window:' |
|
216 #(#WindowSpec |
|
217 #'name:' 'DataSet Details' |
|
218 #'layout:' #(#LayoutFrame 197 0 172 0 487 0 385 0) |
|
219 #'label:' 'DataSet Details' |
|
220 #'min:' #(#Point 10 10) |
|
221 #'max:' #(#Point 1280 1024) |
|
222 #'bounds:' #(#Rectangle 197 172 488 386) |
|
223 ) |
|
224 #'component:' |
|
225 #(#SpecCollection |
|
226 #'collection:' |
|
227 #( |
|
228 #(#LabelSpec |
|
229 #'name:' 'textDescription' |
|
230 #'layout:' #(#Point 10 15) |
|
231 #'label:' 'Text Description:' |
|
232 #'resizeForLabel:' true |
|
233 ) |
|
234 #(#LabelSpec |
|
235 #'name:' 'formatLabel' |
|
236 #'layout:' #(#AlignmentOrigin 83 0 47 0 1 0.5) |
|
237 #'label:' 'Format:' |
|
238 #'resizeForLabel:' true |
|
239 ) |
|
240 #(#InputFieldSpec |
|
241 #'name:' 'formatField' |
|
242 #'layout:' #(#LayoutFrame 87 0 37 0 -19 1.0 59 0) |
|
243 #'model:' #formatString |
|
244 ) |
|
245 #(#LabelSpec |
|
246 #'name:' 'inpFieldDescription' |
|
247 #'layout:' #(#Point 10 80) |
|
248 #'label:' 'InputField Description:' |
|
249 #'resizeForLabel:' true |
|
250 ) |
|
251 #(#LabelSpec |
|
252 #'name:' 'typeLabel' |
|
253 #'layout:' #(#AlignmentOrigin 83 0 111 0 1 0.5) |
|
254 #'label:' 'Type:' |
|
255 #'resizeForLabel:' true |
|
256 ) |
|
257 #(#ComboListSpec |
|
258 #'name:' 'typeCombo' |
|
259 #'layout:' #(#LayoutFrame 87 0 102 0 289 0 122 0) |
|
260 #'model:' #type |
|
261 #'comboList:' #typeList |
|
262 #'useIndex:' false |
|
263 ) |
|
264 #(#LabelSpec |
|
265 #'name:' 'sizeLabel' |
|
266 #'layout:' #(#AlignmentOrigin 83 0 136 0 1 0.5) |
|
267 #'label:' 'Size:' |
|
268 #'resizeForLabel:' true |
|
269 ) |
|
270 #(#InputFieldSpec |
|
271 #'name:' 'sizeField' |
|
272 #'layout:' #(#LayoutFrame 87 0 126 0 -19 1.0 148 0) |
|
273 #'model:' #size |
|
274 #'type:' #numberOrNil |
|
275 ) |
|
276 #(#LabelSpec |
|
277 #'name:' 'choicesLabel' |
|
278 #'layout:' #(#Point 10 165) |
|
279 #'label:' 'Choices:' |
|
280 #'resizeForLabel:' true |
|
281 ) |
|
282 #(#LabelSpec |
|
283 #'name:' 'selectorLabel' |
|
284 #'layout:' #(#AlignmentOrigin 83 0 198 0 1 0.5) |
|
285 #'label:' 'Selector:' |
|
286 #'resizeForLabel:' true |
|
287 ) |
|
288 #(#InputFieldSpec |
|
289 #'name:' 'choiceField' |
|
290 #'layout:' #(#LayoutFrame 87 0 188 0 -19 1.0 210 0) |
|
291 #'model:' #choices |
|
292 #'type:' #symbolOrNil |
|
293 ) |
|
294 ) |
|
295 ) |
|
296 ) |
|
297 ! |
|
298 |
|
299 dimensionEditSpec |
|
300 "this window spec was automatically generated by the ST/X UIPainter" |
|
301 |
|
302 "do not manually edit this - the painter/builder may not be able to |
|
303 handle the specification if its corrupted." |
|
304 |
|
305 " |
|
306 UIPainter new openOnClass:DataSetBuilder andSelector:#dimensionEditSpec |
|
307 DataSetBuilder new openInterface:#dimensionEditSpec |
|
308 " |
|
309 |
|
310 <resource: #canvas> |
|
311 |
|
312 ^ |
|
313 |
|
314 #(#FullSpec |
|
315 #'window:' |
|
316 #(#WindowSpec |
|
317 #'name:' 'DataSet Dimension' |
|
318 #'layout:' #(#LayoutFrame 197 0 172 0 487 0 385 0) |
|
319 #'label:' 'DataSet Dimension' |
|
320 #'min:' #(#Point 10 10) |
|
321 #'max:' #(#Point 1280 1024) |
|
322 #'bounds:' #(#Rectangle 197 172 488 386) |
|
323 ) |
|
324 #'component:' |
|
325 #(#SpecCollection |
|
326 #'collection:' |
|
327 #( |
|
328 #(#FramedBoxSpec |
|
329 #'name:' 'columnWidthFrame' |
|
330 #'layout:' #(#LayoutFrame 0 0.0 20 0 0 1.0 107 0) |
|
331 #'component:' |
|
332 #(#SpecCollection |
|
333 #'collection:' |
|
334 #( |
|
335 #(#LabelSpec |
|
336 #'name:' 'widthLabel' |
|
337 #'layout:' #(#AlignmentOrigin 68 0.0 27 0 1 0.5) |
|
338 #'label:' 'width:' |
|
339 #'resizeForLabel:' true |
|
340 ) |
|
341 #(#InputFieldSpec |
|
342 #'name:' 'widthField' |
|
343 #'layout:' #(#LayoutFrame 70 0 17 0 0 1.0 39 0) |
|
344 #'model:' #width |
|
345 #'type:' #numberOrNil |
|
346 ) |
|
347 #(#LabelSpec |
|
348 #'name:' 'minWidthLabel' |
|
349 #'layout:' #(#AlignmentOrigin 68 0.0 56 0 1 0.5) |
|
350 #'label:' 'minWidth:' |
|
351 #'resizeForLabel:' true |
|
352 ) |
|
353 #(#InputFieldSpec |
|
354 #'name:' 'minWidthField' |
|
355 #'layout:' #(#LayoutFrame 70 0 46 0 0 1.0 68 0) |
|
356 #'model:' #minWidth |
|
357 #'type:' #numberOrNil |
|
358 ) |
|
359 ) |
|
360 ) |
|
361 #'label:' 'Column Width:' |
|
362 #'labelPosition:' #topLeft |
|
363 ) |
|
364 #(#FramedBoxSpec |
|
365 #'name:' 'rowHeightFrame' |
|
366 #'layout:' #(#LayoutFrame 0 0.0 134 0 0 1.0 194 0) |
|
367 #'component:' |
|
368 #(#SpecCollection |
|
369 #'collection:' |
|
370 #( |
|
371 #(#LabelSpec |
|
372 #'name:' 'heightLabel' |
|
373 #'layout:' #(#AlignmentOrigin 68 0.0 29 0 1 0.5) |
|
374 #'label:' 'height:' |
|
375 #'resizeForLabel:' true |
|
376 ) |
|
377 #(#InputFieldSpec |
|
378 #'name:' 'heightField' |
|
379 #'layout:' #(#LayoutFrame 70 0 19 0 0 1.0 41 0) |
|
380 #'model:' #height |
|
381 #'type:' #numberOrNil |
|
382 ) |
|
383 ) |
|
384 ) |
|
385 #'label:' 'Row Height:' |
|
386 #'labelPosition:' #topLeft |
|
387 ) |
|
388 ) |
|
389 ) |
|
390 ) |
|
391 ! |
|
392 |
|
393 miscEditSpec |
|
394 "this window spec was automatically generated by the ST/X UIPainter" |
|
395 |
|
396 "do not manually edit this - the painter/builder may not be able to |
|
397 handle the specification if its corrupted." |
|
398 |
|
399 " |
|
400 UIPainter new openOnClass:DataSetBuilder andSelector:#miscEditSpec |
|
401 DataSetBuilder new openInterface:#miscEditSpec |
|
402 " |
|
403 |
|
404 <resource: #canvas> |
|
405 |
|
406 ^ |
|
407 |
|
408 #(#FullSpec |
|
409 #'window:' |
|
410 #(#WindowSpec |
|
411 #'name:' 'DataSet Misc' |
|
412 #'layout:' #(#LayoutFrame 197 0 172 0 487 0 385 0) |
|
413 #'label:' 'DataSet Misc' |
|
414 #'min:' #(#Point 10 10) |
|
415 #'max:' #(#Point 1280 1024) |
|
416 #'bounds:' #(#Rectangle 197 172 488 386) |
|
417 ) |
|
418 #'component:' |
|
419 #(#SpecCollection |
|
420 #'collection:' |
|
421 #( |
|
422 #(#CheckBoxSpec |
|
423 #'name:' 'canSelect' |
|
424 #'layout:' #(#Point 17 21) |
|
425 #'model:' #canSelect |
|
426 #'label:' 'Is Selectable' |
|
427 ) |
|
428 #(#LabelSpec |
|
429 #'name:' 'separatorsLabel' |
|
430 #'layout:' #(#AlignmentOrigin 84 0 154 0 1 0.5) |
|
431 #'label:' 'Separators:' |
|
432 #'resizeForLabel:' true |
|
433 ) |
|
434 #(#CheckBoxSpec |
|
435 #'name:' 'showRowSeparator' |
|
436 #'layout:' #(#AlignmentOrigin 86 0 156 0 0 0.5) |
|
437 #'model:' #showRowSeparator |
|
438 #'label:' 'Show Row-Separator' |
|
439 ) |
|
440 #(#CheckBoxSpec |
|
441 #'name:' 'showColSeparator' |
|
442 #'layout:' #(#AlignmentOrigin 86 0 182 0 0 0.5) |
|
443 #'model:' #showColSeparator |
|
444 #'label:' 'Show Column-Separator' |
|
445 ) |
|
446 ) |
|
447 ) |
|
448 ) |
|
449 ! ! |
|
450 |
|
451 !DataSetBuilder class methodsFor:'images'! |
|
452 |
|
453 iconCreateItem |
|
454 ^ MenuEditor iconCreateItem |
|
455 |
|
456 |
|
457 ! ! |
|
458 |
|
459 !DataSetBuilder class methodsFor:'interface specs'! |
|
460 |
|
461 defineClassNameSpec |
|
462 "this window spec was automatically generated by the ST/X UIPainter" |
|
463 |
|
464 "do not manually edit this - the painter/builder may not be able to |
|
465 handle the specification if its corrupted." |
|
466 |
|
467 " |
|
468 UIPainter new openOnClass:DataSetBuilder andSelector:#defineClassNameSpec |
|
469 DataSetBuilder new openInterface:#defineClassNameSpec |
|
470 " |
|
471 |
|
472 <resource: #canvas> |
|
473 |
|
474 ^ |
|
475 |
|
476 #(#FullSpec |
|
477 #'window:' |
|
478 #(#WindowSpec |
|
479 #'name:' 'Class Definition' |
|
480 #'layout:' #(#LayoutFrame 76 0 249 0 401 0 378 0) |
|
481 #'label:' 'Class Definition' |
|
482 #'min:' #(#Point 10 10) |
|
483 #'max:' #(#Point 1152 900) |
|
484 #'bounds:' #(#Rectangle 76 249 402 379) |
|
485 ) |
|
486 #'component:' |
|
487 #(#SpecCollection |
|
488 #'collection:' |
|
489 #( |
|
490 #(#LabelSpec |
|
491 #'name:' 'classLabel' |
|
492 #'layout:' #(#AlignmentOrigin 50 0.11 50 0 1 0.5) |
|
493 #'label:' 'class:' |
|
494 #'adjust:' #right |
|
495 #'resizeForLabel:' true |
|
496 ) |
|
497 #(#LabelSpec |
|
498 #'name:' 'superClassLabel' |
|
499 #'layout:' #(#AlignmentOrigin 50 0.11 77 0 1 0.5) |
|
500 #'label:' 'superclass:' |
|
501 #'adjust:' #right |
|
502 #'resizeForLabel:' true |
|
503 ) |
|
504 #(#LabelSpec |
|
505 #'name:' 'topLabel' |
|
506 #'layout:' #(#Point 2 10) |
|
507 #'label:' 'class for code:' |
|
508 #'adjust:' #left |
|
509 #'resizeForLabel:' true |
|
510 ) |
|
511 #(#InputFieldSpec |
|
512 #'name:' 'classNameField' |
|
513 #'layout:' #(#LayoutFrame 51 0.11 39 0 -2 1.0 61 0) |
|
514 #'tabable:' true |
|
515 #'model:' #classNameChannel |
|
516 ) |
|
517 #(#HorizontalPanelViewSpec |
|
518 #'name:' 'commitPanel' |
|
519 #'layout:' #(#LayoutFrame 2 0.0 -30 1.0 -2 1.0 -2 1.0) |
|
520 #'component:' |
|
521 #(#SpecCollection |
|
522 #'collection:' |
|
523 #( |
|
524 #(#ActionButtonSpec |
|
525 #'name:' 'button1' |
|
526 #'label:' 'cancel' |
|
527 #'tabable:' true |
|
528 #'model:' #cancel |
|
529 #'extent:' #(#Point 156 22) |
|
530 ) |
|
531 #(#ActionButtonSpec |
|
532 #'name:' 'button2' |
|
533 #'label:' 'ok' |
|
534 #'tabable:' true |
|
535 #'isDefault:' true |
|
536 #'model:' #accept |
|
537 #'extent:' #(#Point 157 22) |
|
538 ) |
|
539 ) |
|
540 ) |
|
541 #'horizontalLayout:' #fitSpace |
|
542 #'verticalLayout:' #fitSpace |
|
543 #'horizontalSpace:' 3 |
|
544 #'verticalSpace:' 3 |
|
545 ) |
|
546 #(#InputFieldSpec |
|
547 #'name:' 'inputField1' |
|
548 #'layout:' #(#LayoutFrame 51 0.11 67 0 -2 1.0 89 0) |
|
549 #'tabable:' true |
|
550 #'model:' #superclassNameChannel |
|
551 ) |
|
552 ) |
|
553 ) |
|
554 ) |
|
555 ! |
|
556 |
|
557 slices |
|
558 ^ #( (Basics basicsEditSpec) |
|
559 (Details detailsEditSpec) |
|
560 (Misc miscEditSpec) |
|
561 (Dimension dimensionEditSpec) |
|
562 ) |
|
563 ! |
|
564 |
|
565 windowSpec |
|
566 "this window spec was automatically generated by the ST/X UIPainter" |
|
567 |
|
568 "do not manually edit this - the painter/builder may not be able to |
|
569 handle the specification if its corrupted." |
|
570 |
|
571 " |
|
572 UIPainter new openOnClass:DataSetBuilder andSelector:#windowSpec |
|
573 DataSetBuilder new openInterface:#windowSpec |
|
574 " |
|
575 "DataSetBuilder open" |
|
576 |
|
577 <resource: #canvas> |
|
578 |
|
579 ^ |
|
580 |
|
581 #(#FullSpec |
|
582 #'window:' |
|
583 #(#WindowSpec |
|
584 #'name:' 'unnamed canvas' |
|
585 #'layout:' #(#LayoutFrame 197 0 172 0 668 0 512 0) |
|
586 #'label:' 'unnamed canvas' |
|
587 #'min:' #(#Point 10 10) |
|
588 #'max:' #(#Point 1152 900) |
|
589 #'bounds:' #(#Rectangle 197 172 669 513) |
|
590 ) |
|
591 #'component:' |
|
592 #(#SpecCollection |
|
593 #'collection:' |
|
594 #( |
|
595 #(#MenuPanelSpec |
|
596 #'name:' 'mainMenu' |
|
597 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 25 0) |
|
598 #'menu:' #mainMenu |
|
599 ) |
|
600 #(#VariableHorizontalPanelSpec |
|
601 #'name:' 'VariablePanel' |
|
602 #'layout:' #(#LayoutFrame 0 0.0 25 0.0 0 1.0 0 1.0) |
|
603 #'component:' |
|
604 #(#SpecCollection |
|
605 #'collection:' |
|
606 #( |
|
607 #(#ViewSpec |
|
608 #'name:' 'labelsView' |
|
609 #'component:' |
|
610 #(#SpecCollection |
|
611 #'collection:' |
|
612 #( |
|
613 #(#MenuPanelSpec |
|
614 #'name:' 'subMenu' |
|
615 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 35 0) |
|
616 #'menu:' #subMenu |
|
617 ) |
|
618 #(#SequenceViewSpec |
|
619 #'name:' 'columnView' |
|
620 #'layout:' #(#LayoutFrame 0 0.0 35 0.0 0 1.0 0 1.0) |
|
621 #'model:' #selectedColumnModel |
|
622 #'menu:' #columnMenu |
|
623 #'hasVerticalScrollBar:' true |
|
624 #'useIndex:' true |
|
625 #'sequenceList:' #seqList |
|
626 ) |
|
627 ) |
|
628 ) |
|
629 ) |
|
630 #(#ViewSpec |
|
631 #'name:' 'specView' |
|
632 #'component:' |
|
633 #(#SpecCollection |
|
634 #'collection:' |
|
635 #( |
|
636 #(#TabViewSpec |
|
637 #'name:' 'tabView' |
|
638 #'layout:' #(#LayoutFrame 0 0.0 0 0 0 1.0 35 0) |
|
639 #'model:' #tabModel |
|
640 #'menu:' #tabList |
|
641 #'useIndex:' true |
|
642 ) |
|
643 #(#SubCanvasSpec |
|
644 #'name:' 'specCanvas' |
|
645 #'layout:' #(#LayoutFrame 0 0.0 35 0.0 0 1.0 -30 1.0) |
|
646 #'specHolder:' #specChannel |
|
647 ) |
|
648 #(#HorizontalPanelViewSpec |
|
649 #'name:' 'modifyPanel' |
|
650 #'layout:' #(#LayoutFrame 0 0.0 -30 1.0 0 1.0 0 1.0) |
|
651 #'component:' |
|
652 #(#SpecCollection |
|
653 #'collection:' |
|
654 #( |
|
655 #(#ActionButtonSpec |
|
656 #'name:' 'cancelButton' |
|
657 #'label:' 'cancel' |
|
658 #'model:' #cancel |
|
659 #'enableChannel:' #modifiedChannel |
|
660 #'extent:' #(#Point 150 24) |
|
661 ) |
|
662 #(#ActionButtonSpec |
|
663 #'name:' 'acceptButton' |
|
664 #'label:' 'ok' |
|
665 #'model:' #accept |
|
666 #'enableChannel:' #modifiedChannel |
|
667 #'extent:' #(#Point 151 24) |
|
668 ) |
|
669 ) |
|
670 ) |
|
671 #'horizontalLayout:' #fitSpace |
|
672 #'verticalLayout:' #fitSpace |
|
673 #'horizontalSpace:' 3 |
|
674 #'verticalSpace:' 3 |
|
675 ) |
|
676 ) |
|
677 ) |
|
678 #'borderWidth:' 1 |
|
679 ) |
|
680 ) |
|
681 ) |
|
682 #'handles:' #(#Any 0.334746 1.0) |
|
683 ) |
|
684 ) |
|
685 ) |
|
686 ) |
|
687 ! ! |
|
688 |
|
689 !DataSetBuilder class methodsFor:'menu specs'! |
|
690 |
|
691 columnMenu |
|
692 "this window spec was automatically generated by the ST/X MenuEditor" |
|
693 |
|
694 "do not manually edit this - the builder may not be able to |
|
695 handle the specification if its corrupted." |
|
696 |
|
697 " |
|
698 MenuEditor new openOnClass:DataSetBuilder andSelector:#columnMenu |
|
699 (Menu new fromLiteralArrayEncoding:(DataSetBuilder columnMenu)) startUp |
|
700 " |
|
701 |
|
702 <resource: #menu> |
|
703 |
|
704 ^ |
|
705 |
|
706 #(#Menu |
|
707 |
|
708 #( |
|
709 #(#MenuItem |
|
710 #'label:' 'cut' |
|
711 #'value:' #doCutColumn |
|
712 ) |
|
713 ) nil |
|
714 nil |
|
715 ) |
|
716 ! |
|
717 |
|
718 mainMenu |
|
719 "this window spec was automatically generated by the ST/X MenuEditor" |
|
720 |
|
721 "do not manually edit this - the builder may not be able to |
|
722 handle the specification if its corrupted." |
|
723 |
|
724 " |
|
725 MenuEditor new openOnClass:DataSetBuilder andSelector:#mainMenu |
|
726 (Menu new fromLiteralArrayEncoding:(DataSetBuilder mainMenu)) startUp |
|
727 " |
|
728 |
|
729 <resource: #menu> |
|
730 |
|
731 ^ |
|
732 |
|
733 #(#Menu |
|
734 |
|
735 #( |
|
736 #(#MenuItem |
|
737 #'label:' 'file' |
|
738 #'submenu:' |
|
739 #(#Menu |
|
740 |
|
741 #( |
|
742 #(#MenuItem |
|
743 #'label:' 'close' |
|
744 #'value:' #closeRequest |
|
745 ) |
|
746 ) nil |
|
747 nil |
|
748 ) |
|
749 ) |
|
750 #(#MenuItem |
|
751 #'label:' 'code' |
|
752 #'submenu:' |
|
753 #(#Menu |
|
754 |
|
755 #( |
|
756 #(#MenuItem |
|
757 #'label:' 'class' |
|
758 #'value:' #doDefineClass |
|
759 ) |
|
760 #(#MenuItem |
|
761 #'label:' 'generate code' |
|
762 #'value:' #doGenerateCode |
|
763 ) |
|
764 #(#MenuItem |
|
765 #'label:' '-' |
|
766 ) |
|
767 #(#MenuItem |
|
768 #'label:' 'browse class' |
|
769 #'value:' #doBrowseClass |
|
770 ) |
|
771 ) nil |
|
772 nil |
|
773 ) |
|
774 ) |
|
775 ) nil |
|
776 nil |
|
777 ) |
|
778 ! |
|
779 |
|
780 subMenu |
|
781 "this window spec was automatically generated by the ST/X MenuEditor" |
|
782 |
|
783 "do not manually edit this - the builder may not be able to |
|
784 handle the specification if its corrupted." |
|
785 |
|
786 " |
|
787 MenuEditor new openOnClass:DataSetBuilder andSelector:#subMenu |
|
788 (Menu new fromLiteralArrayEncoding:(DataSetBuilder subMenu)) startUp |
|
789 " |
|
790 |
|
791 <resource: #menu> |
|
792 |
|
793 ^ |
|
794 |
|
795 #(#Menu |
|
796 |
|
797 #( |
|
798 #(#MenuItem |
|
799 #'label:' 'createColumn' |
|
800 #'value:' #doCreateColumn |
|
801 #'enabled:' #isNotModified |
|
802 #'labelImage:' #(#ResourceRetriever #MenuEditor #iconCreateItem) |
|
803 ) |
|
804 #(#MenuItem |
|
805 #'label:' '-' |
|
806 ) |
|
807 #(#MenuItem |
|
808 #'label:' '' |
|
809 ) |
|
810 #(#MenuItem |
|
811 #'label:' '-' |
|
812 ) |
|
813 #(#MenuItem |
|
814 #'label:' 'stepUp' |
|
815 #'value:' #'doMoveColumn:' |
|
816 #'enabled:' #isNotModified |
|
817 #'argument:' #up |
|
818 #'labelImage:' #(#ResourceRetriever #UIPainter #iconStepUp) |
|
819 ) |
|
820 #(#MenuItem |
|
821 #'label:' '-' |
|
822 ) |
|
823 #(#MenuItem |
|
824 #'label:' 'stepDown' |
|
825 #'value:' #'doMoveColumn:' |
|
826 #'enabled:' #notModified |
|
827 #'argument:' #down |
|
828 #'labelImage:' #(#ResourceRetriever #UIPainter #iconStepDown) |
|
829 ) |
|
830 #(#MenuItem |
|
831 #'label:' '-' |
|
832 ) |
|
833 ) nil |
|
834 nil |
|
835 ) |
|
836 ! ! |
|
837 |
|
838 !DataSetBuilder methodsFor:'accessing'! |
|
839 |
|
840 className |
|
841 ^ (Smalltalk resolveName:className inClass:self class) notNil ifTrue:[className] ifFalse:[nil] |
|
842 ! |
|
843 |
|
844 className:aClassName |
|
845 |cls| |
|
846 |
|
847 superclassName := nil. |
|
848 |
|
849 (className := aClassName) notNil ifTrue:[ |
|
850 (cls := self resolveClassNamed) notNil ifTrue:[ |
|
851 superclassName := cls superclass name asString. |
|
852 ] ifFalse:[ |
|
853 superclassName := 'Object' |
|
854 ] |
|
855 ] |
|
856 ! |
|
857 |
|
858 columns |
|
859 "returns list of columns |
|
860 " |
|
861 ^ columns |
|
862 ! |
|
863 |
|
864 columns:aListOfColumns fromView:aColumnView |
|
865 "setup columns from a column view |
|
866 " |
|
867 |list| |
|
868 |
|
869 columnView := aColumnView. |
|
870 columns := OrderedCollection new. |
|
871 list := self seqList. |
|
872 hasChanged := false. |
|
873 |
|
874 list removeAll. |
|
875 |
|
876 aListOfColumns size ~~ 0 ifTrue:[ |
|
877 aListOfColumns do:[:aCol| |
|
878 columns add:(aCol copy). |
|
879 aCol rendererType == #rowSelector ifFalse:[list add:(aCol label)] |
|
880 ifTrue:[list add:'Row Selector']. |
|
881 ] |
|
882 ]. |
|
883 ! ! |
|
884 |
|
885 !DataSetBuilder methodsFor:'accessing menu'! |
|
886 |
|
887 columnMenu |
|
888 "this window spec was automatically generated by the UI Builder" |
|
889 |
|
890 ^ self class columnMenu |
|
891 |
|
892 |
|
893 ! |
|
894 |
|
895 doBrowseClass |
|
896 |cls| |
|
897 |
|
898 (cls := self resolveClassNamed) notNil ifTrue:[ |
|
899 SystemBrowser openInClass:cls |
|
900 ] ifFalse:[ |
|
901 self information:'no class yet'. |
|
902 ]. |
|
903 |
|
904 |
|
905 |
|
906 ! |
|
907 |
|
908 doCreateColumn |
|
909 "create a new column after selected column or at left (nothing selected) |
|
910 " |
|
911 |label list| |
|
912 |
|
913 list := self seqList. |
|
914 label := 'column ', list size printString. |
|
915 columns add:(DataSetColumnSpec label:label selector:#ToBeDefined) afterIndex:selectedColumnIndex. |
|
916 self seqList add:label afterIndex:selectedColumnIndex. |
|
917 hasChanged := true. |
|
918 |
|
919 self modified ifFalse:[ |
|
920 self selectedColumnModel value:(selectedColumnIndex + 1) |
|
921 ]. |
|
922 self updateColumnView. |
|
923 |
|
924 ! |
|
925 |
|
926 doCutColumn |
|
927 "remove selected column |
|
928 " |
|
929 |idx| |
|
930 |
|
931 (idx := selectedColumnIndex) ~~ 0 ifTrue:[ |
|
932 self selectedColumnModel value:0. |
|
933 self seqList removeIndex:idx. |
|
934 ]. |
|
935 ! |
|
936 |
|
937 doDefineClass |
|
938 "launch a dialog to define class and superclass |
|
939 " |
|
940 |aspects cls oldClass oldSuper| |
|
941 |
|
942 aspects := IdentityDictionary new. |
|
943 oldClass := className. |
|
944 oldSuper := superclassName. |
|
945 |
|
946 [true] whileTrue:[ |
|
947 className notNil ifTrue:[ |
|
948 (cls := self resolveClassNamed) notNil ifTrue:[ |
|
949 superclassName := cls superclass name asString. |
|
950 ]. |
|
951 aspects at:#classNameChannel put:className asValue |
|
952 ] ifFalse:[ |
|
953 aspects at:#classNameChannel put:'DSVRow' asValue |
|
954 ]. |
|
955 |
|
956 superclassName notNil ifTrue:[ |
|
957 aspects at:#superclassNameChannel put:superclassName asValue |
|
958 ] ifFalse:[ |
|
959 aspects at:#superclassNameChannel put:'Object' asValue |
|
960 ]. |
|
961 |
|
962 (self openDialogInterface:#defineClassNameSpec withBindings:aspects) ifFalse:[ |
|
963 className := oldClass. |
|
964 superclassName := oldSuper. |
|
965 ^ self |
|
966 ]. |
|
967 className := ((aspects at:#classNameChannel) value) withoutSeparators. |
|
968 superclassName := ((aspects at:#superclassNameChannel) value) withoutSeparators. |
|
969 |
|
970 className size == 0 ifTrue:[ |
|
971 className := nil. |
|
972 self information:'no valid className'. |
|
973 ] ifFalse:[ |
|
974 cls := self resolveClassNamed. |
|
975 |
|
976 cls notNil ifTrue:[ |
|
977 cls := cls superclass name asString |
|
978 ]. |
|
979 |
|
980 superclassName size == 0 ifTrue:[ |
|
981 cls notNil ifTrue:[ |
|
982 superclassName := cls |
|
983 ] ifFalse:[ |
|
984 superclassName := 'Object' |
|
985 ]. |
|
986 self information:( 'set superclassName' ). |
|
987 ] ifFalse:[ |
|
988 (cls isNil or:[superclassName = cls]) ifTrue:[ |
|
989 hasChanged := true. |
|
990 ^ self |
|
991 ]. |
|
992 self information:('a global named ' , className , ' exists,\' , |
|
993 'but is not a subclass of ' , superclassName, '.\\' , |
|
994 'Check and try again if that is not what you want.') withCRs. |
|
995 |
|
996 superclassName := cls. |
|
997 ] |
|
998 ] |
|
999 ] |
|
1000 ! |
|
1001 |
|
1002 doGenerateCode |
|
1003 |cls superclass| |
|
1004 |
|
1005 className isNil ifTrue:[ |
|
1006 ^ self information:'no class defined' |
|
1007 ]. |
|
1008 cls := self resolveClassNamed. |
|
1009 |
|
1010 cls isNil ifTrue:[ |
|
1011 superclass := Smalltalk resolveName:superclassName inClass:self class. |
|
1012 |
|
1013 superclass isNil ifTrue:[ |
|
1014 ^ self information:'no superclass defined' |
|
1015 ]. |
|
1016 (self confirm:'create ' , className , ' ?') ifFalse:[ |
|
1017 ^ self |
|
1018 ]. |
|
1019 cls := superclass subclass:(className asSymbol) |
|
1020 instanceVariableNames:'' |
|
1021 classVariableNames:'' |
|
1022 poolDictionaries:'' |
|
1023 category:'Applications'. |
|
1024 ]. |
|
1025 |
|
1026 self generateChoicesIn:cls. |
|
1027 self generateMenuIn:cls. |
|
1028 self generatePrintSelectorIn:cls. |
|
1029 self generateReadSelectorIn:cls. |
|
1030 self generateWriteSelectorIn:cls. |
|
1031 ! |
|
1032 |
|
1033 doMoveColumn:upOrDown |
|
1034 "move selected column up or down |
|
1035 " |
|
1036 |idx list label col size| |
|
1037 |
|
1038 (idx := selectedColumnIndex) == 0 ifTrue:[ |
|
1039 ^ self |
|
1040 ]. |
|
1041 list := self seqList. |
|
1042 size := list size. |
|
1043 |
|
1044 size == 1 ifTrue:[ |
|
1045 ^ self |
|
1046 ]. |
|
1047 hasChanged := true. |
|
1048 selectedColumnIndex := 0. |
|
1049 label := list at:idx. |
|
1050 col := columns at:idx. |
|
1051 list removeIndex:idx. |
|
1052 columns removeIndex:idx. |
|
1053 |
|
1054 upOrDown == #up ifTrue:[ |
|
1055 idx == 1 ifTrue:[idx := size] |
|
1056 ifFalse:[idx := idx - 1] |
|
1057 ] ifFalse:[ |
|
1058 idx == size ifTrue:[idx := 1] |
|
1059 ifFalse:[idx := idx + 1] |
|
1060 ]. |
|
1061 columns add:col beforeIndex:idx. |
|
1062 list add:label beforeIndex:idx. |
|
1063 self selectedColumnModel value:idx. |
|
1064 self updateColumnView. |
|
1065 ! |
|
1066 |
|
1067 mainMenu |
|
1068 "this window spec was automatically generated by the UI Builder" |
|
1069 |
|
1070 ^ self class mainMenu |
|
1071 |
|
1072 |
|
1073 ! |
|
1074 |
|
1075 subMenu |
|
1076 "this window spec was automatically generated by the UI Builder" |
|
1077 |
|
1078 ^ self class subMenu |
|
1079 |
|
1080 |
|
1081 ! ! |
|
1082 |
|
1083 !DataSetBuilder methodsFor:'actions'! |
|
1084 |
|
1085 accept |
|
1086 "accept changes made |
|
1087 " |
|
1088 |column type| |
|
1089 |
|
1090 self modifiedChannel value == false ifTrue:[ |
|
1091 ^ self |
|
1092 ]. |
|
1093 isModified := true. |
|
1094 |
|
1095 (column := self selectedColumn) isNil ifTrue:[ |
|
1096 ^ self cancel |
|
1097 ]. |
|
1098 |
|
1099 type := (aspects at:#rendererType) value. |
|
1100 |
|
1101 type == #rowSelector ifTrue:[ |
|
1102 #( label width minWidth editorType choices readSelector printSelector |
|
1103 formatString type size height canSelect |
|
1104 ) do:[:aKey| (aspects at:aKey) value:nil ]. |
|
1105 ]. |
|
1106 |
|
1107 aspects keysAndValuesDo:[:aKey :aModel| |
|
1108 column perform:(aKey , ':') asSymbol with:(aModel value) |
|
1109 ]. |
|
1110 self seqList at:selectedColumnIndex put:((aspects at:#label) value). |
|
1111 self updateColumnView. |
|
1112 self cancel |
|
1113 ! |
|
1114 |
|
1115 cancel |
|
1116 "remove all changes and reload selected column |
|
1117 " |
|
1118 |column| |
|
1119 |
|
1120 isModified := true. |
|
1121 (column := self selectedColumn) isNil ifTrue:[ |
|
1122 self tabModel value:0. |
|
1123 ] ifFalse:[ |
|
1124 aspects keysAndValuesDo:[:aKey :aModel| |
|
1125 aModel value:(column perform:aKey) |
|
1126 ]. |
|
1127 tabSelectionIndex == 0 ifTrue:[self tabModel value:1]. |
|
1128 ]. |
|
1129 self modifiedChannel value:false. |
|
1130 self isNotModified value:true. |
|
1131 isModified := false. |
|
1132 ! ! |
|
1133 |
|
1134 !DataSetBuilder methodsFor:'aspects'! |
|
1135 |
|
1136 aspectFor:aKey |
|
1137 "returns aspect for a key or nil |
|
1138 " |
|
1139 ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ] |
|
1140 |
|
1141 |
|
1142 ! |
|
1143 |
|
1144 editorTypeList |
|
1145 "generate list of supported editor types |
|
1146 " |
|
1147 |list| |
|
1148 |
|
1149 (list := builder bindingAt:#editorTypeList) isNil ifTrue:[ |
|
1150 list := OrderedCollection new. |
|
1151 DataSetColumnSpec slices do:[:aSlice||type| |
|
1152 type := aSlice at:1. |
|
1153 (list includes:type) ifFalse:[list add:type]. |
|
1154 ]. |
|
1155 builder aspectAt:#editorTypeList put:list. |
|
1156 |
|
1157 ]. |
|
1158 ^ list |
|
1159 ! |
|
1160 |
|
1161 isNotModified |
|
1162 "returns a boolean value holder which is set to true if something is modified |
|
1163 and not accepted |
|
1164 " |
|
1165 ^ builder valueAspectFor:#isNotModified initialValue:true |
|
1166 |
|
1167 |
|
1168 |
|
1169 ! |
|
1170 |
|
1171 modifiedChannel |
|
1172 "returns a boolean value holder which is set to true if something is modified |
|
1173 and not accepted |
|
1174 " |
|
1175 ^ builder booleanValueAspectFor:#modifiedChannel |
|
1176 |
|
1177 |
|
1178 |
|
1179 ! |
|
1180 |
|
1181 rendererTypeList |
|
1182 "generate list of supported renderer types |
|
1183 " |
|
1184 |list| |
|
1185 |
|
1186 (list := builder bindingAt:#rendererTypeList) isNil ifTrue:[ |
|
1187 list := OrderedCollection new. |
|
1188 DataSetColumnSpec slices do:[:aSlice||type| |
|
1189 type := aSlice at:2. |
|
1190 (list includes:type) ifFalse:[list add:type]. |
|
1191 ]. |
|
1192 builder aspectAt:#rendererTypeList put:list. |
|
1193 |
|
1194 ]. |
|
1195 ^ list |
|
1196 ! |
|
1197 |
|
1198 selectedColumnModel |
|
1199 "automatically generated by UIPainter ..." |
|
1200 |
|
1201 |holder| |
|
1202 |
|
1203 (holder := builder bindingAt:#selectedColumnModel) isNil ifTrue:[ |
|
1204 holder := AspectAdaptor new subject:self; forAspect:#selectedColumnIndex. |
|
1205 builder aspectAt:#selectedColumnModel put:holder. |
|
1206 ]. |
|
1207 ^ holder |
|
1208 ! |
|
1209 |
|
1210 seqList |
|
1211 "automatically generated by UIPainter ..." |
|
1212 |
|
1213 |list| |
|
1214 |
|
1215 (list := builder bindingAt:#seqList) isNil ifTrue:[ |
|
1216 builder aspectAt:#seqList put:(list := List new). |
|
1217 ]. |
|
1218 ^ list |
|
1219 ! |
|
1220 |
|
1221 specChannel |
|
1222 "automatically generated by UIPainter ..." |
|
1223 |
|
1224 |holder| |
|
1225 |
|
1226 (holder := builder bindingAt:#specChannel) isNil ifTrue:[ |
|
1227 builder aspectAt:#specChannel put:(holder := ValueHolder new). |
|
1228 ]. |
|
1229 ^ holder |
|
1230 ! |
|
1231 |
|
1232 tabList |
|
1233 "automatically generated by UIPainter ..." |
|
1234 |
|
1235 ^ self class slices collect:[:aSlice| aSlice first ] |
|
1236 |
|
1237 ! |
|
1238 |
|
1239 tabModel |
|
1240 "returns a value holder which keeps the index of the current selected tab or 0 |
|
1241 " |
|
1242 |holder| |
|
1243 |
|
1244 (holder := builder bindingAt:#tabModel) isNil ifTrue:[ |
|
1245 holder := AspectAdaptor new subject:self; forAspect:#tabSelectionIndex. |
|
1246 builder aspectAt:#tabModel put:holder. |
|
1247 ]. |
|
1248 ^ holder |
|
1249 ! |
|
1250 |
|
1251 typeList |
|
1252 "automatically generated by UIPainter ..." |
|
1253 |
|
1254 ^ #( string password number numberOrNil symbolOrNil ) |
|
1255 ! ! |
|
1256 |
|
1257 !DataSetBuilder methodsFor:'change & update'! |
|
1258 |
|
1259 update:something with:aParameter from:someObject |
|
1260 "one of my aspects has changed; update modified channel |
|
1261 " |
|
1262 isModified ifFalse:[ |
|
1263 isModified := hasChanged := true. |
|
1264 self modifiedChannel value:true. |
|
1265 self isNotModified value:false. |
|
1266 ] |
|
1267 ! ! |
|
1268 |
|
1269 !DataSetBuilder methodsFor:'code generation'! |
|
1270 |
|
1271 compile:aCode forClass:aClass inCategory:aCategory |
|
1272 "compile method for class in a category |
|
1273 " |
|
1274 ByteCodeCompiler compile:aCode withCRs forClass:aClass inCategory:aCategory |
|
1275 ! |
|
1276 |
|
1277 generateChoicesIn:aClass |
|
1278 "generate code for #choices |
|
1279 " |
|
1280 |sel catg code| |
|
1281 |
|
1282 catg := 'accessing choices' asSymbol. |
|
1283 code := '\' |
|
1284 , ' "automatically generated by DataSetBuilder ..."\' |
|
1285 , '\' |
|
1286 , ' "get choices for visual editor; (a list of labels)\' |
|
1287 , '\' |
|
1288 , ' ^ nil' |
|
1289 . |
|
1290 |
|
1291 columns do:[:aColumn| |
|
1292 ( aColumn canSelect |
|
1293 and:[aColumn rendererType ~~ #rowSelector |
|
1294 and:[(sel := aColumn choices) notNil |
|
1295 and:[(aClass implements:sel) not]]] |
|
1296 ) ifTrue:[ |
|
1297 self compile:(sel asString, code) forClass:aClass inCategory:catg |
|
1298 ] |
|
1299 ] |
|
1300 ! |
|
1301 |
|
1302 generateMenuIn:aClass |
|
1303 "generate code for #menu |
|
1304 " |
|
1305 |sel catg code| |
|
1306 |
|
1307 catg := 'accessing menus' asSymbol. |
|
1308 code := '\' |
|
1309 , ' "automatically generated by DataSetBuilder ..."\' |
|
1310 , '\' |
|
1311 , ' "get middleButton menu for selected cell in column"\' |
|
1312 , '\' |
|
1313 , ' ^ nil' |
|
1314 . |
|
1315 |
|
1316 columns do:[:aColumn| |
|
1317 ( aColumn canSelect |
|
1318 and:[(sel := aColumn menu) notNil |
|
1319 and:[(aClass implements:sel) not]] |
|
1320 ) ifTrue:[ |
|
1321 self compile:(sel asString, code) forClass:aClass inCategory:catg |
|
1322 ] |
|
1323 ] |
|
1324 ! |
|
1325 |
|
1326 generatePrintSelectorIn:aClass |
|
1327 "generate code for #printSelector |
|
1328 " |
|
1329 |sel catg code| |
|
1330 |
|
1331 catg := 'accessing printSelector' asSymbol. |
|
1332 code := 'aGC\' |
|
1333 , ' "automatically generated by DataSetBuilder ..."\' |
|
1334 , '\' |
|
1335 , ' "get drawable image or text on a gc"\' |
|
1336 , '\' |
|
1337 , ' ^ nil' |
|
1338 . |
|
1339 |
|
1340 columns do:[:aColumn| |
|
1341 ( aColumn rendererType ~~ #rowSelector |
|
1342 and:[(sel := aColumn printSelector) notNil |
|
1343 and:[(aClass implements:sel) not]] |
|
1344 ) ifTrue:[ |
|
1345 self compile:(sel asString, code) forClass:aClass inCategory:catg |
|
1346 ] |
|
1347 ] |
|
1348 ! |
|
1349 |
|
1350 generateReadSelectorIn:aClass |
|
1351 "generate code for #readSelector |
|
1352 " |
|
1353 |sel catg code bCode| |
|
1354 |
|
1355 catg := 'accessing readSelector' asSymbol. |
|
1356 code := '\' |
|
1357 , ' "automatically generated by DataSetBuilder ..."\' |
|
1358 , '\' |
|
1359 , ' "get value"\' |
|
1360 , '\' |
|
1361 . |
|
1362 |
|
1363 columns do:[:aColumn| |
|
1364 ( aColumn rendererType ~~ #rowSelector |
|
1365 and:[(sel := aColumn readSelector) notNil |
|
1366 and:[(aClass implements:sel) not]] |
|
1367 ) ifTrue:[ |
|
1368 (aColumn printSelector isNil or:[aColumn canSelect]) ifTrue:[ |
|
1369 bCode := sel asString, code. |
|
1370 aColumn rendererType == #CheckToggle ifFalse:[ |
|
1371 bCode := bCode, ' ^ nil' |
|
1372 ] ifTrue:[ |
|
1373 bCode := bCode, ' ^ true' |
|
1374 ]. |
|
1375 self compile:bCode forClass:aClass inCategory:catg |
|
1376 ] |
|
1377 ] |
|
1378 ] |
|
1379 ! |
|
1380 |
|
1381 generateWriteSelectorIn:aClass |
|
1382 "generate code for #writeSelector |
|
1383 " |
|
1384 |sel catg code| |
|
1385 |
|
1386 catg := 'accessing writeSelector' asSymbol. |
|
1387 code := 'aValue\' |
|
1388 , ' "automatically generated by DataSetBuilder ..."\' |
|
1389 , '\' |
|
1390 , ' "set value"\' |
|
1391 . |
|
1392 |
|
1393 columns do:[:aColumn| |
|
1394 ( (sel := aColumn writeSelector) notNil |
|
1395 and:[(aClass implements:sel) not] |
|
1396 ) ifTrue:[ |
|
1397 self compile:(sel asString, code) forClass:aClass inCategory:catg |
|
1398 ] |
|
1399 ] |
|
1400 ! ! |
|
1401 |
|
1402 !DataSetBuilder methodsFor:'initialization'! |
|
1403 |
|
1404 initialize |
|
1405 "setup aspects used by column description specifications |
|
1406 " |
|
1407 |holder| |
|
1408 |
|
1409 super initialize. |
|
1410 selectedColumnIndex := 0. |
|
1411 tabSelectionIndex := 0. |
|
1412 columns := OrderedCollection new. |
|
1413 aspects := IdentityDictionary new. |
|
1414 hasChanged := false. |
|
1415 isModified := false. |
|
1416 |
|
1417 #( |
|
1418 label |
|
1419 canSelect |
|
1420 choices |
|
1421 editorType |
|
1422 formatString |
|
1423 size |
|
1424 type |
|
1425 width |
|
1426 minWidth |
|
1427 height |
|
1428 menu |
|
1429 printSelector |
|
1430 readSelector |
|
1431 rendererType |
|
1432 showColSeparator |
|
1433 showRowSeparator |
|
1434 |
|
1435 ) do:[:aKey| |
|
1436 aspects at:aKey put:(holder := ValueHolder new). |
|
1437 holder addDependent:self. |
|
1438 ]. |
|
1439 |
|
1440 ! ! |
|
1441 |
|
1442 !DataSetBuilder methodsFor:'private'! |
|
1443 |
|
1444 resolveClassNamed |
|
1445 "returns current class or nil |
|
1446 " |
|
1447 ^ Smalltalk resolveName:className inClass:self class. |
|
1448 |
|
1449 ! |
|
1450 |
|
1451 updateColumnView |
|
1452 "update column view from column descriptions |
|
1453 " |
|
1454 columnView notNil ifTrue:[ |
|
1455 columnView columnDescriptors:columns. |
|
1456 ]. |
|
1457 ! ! |
|
1458 |
|
1459 !DataSetBuilder methodsFor:'queries'! |
|
1460 |
|
1461 hasChanged |
|
1462 "returns true if changes are done to the original column description |
|
1463 " |
|
1464 ^ hasChanged |
|
1465 ! |
|
1466 |
|
1467 modified |
|
1468 "returns true if current specification is modified |
|
1469 " |
|
1470 ^ self modifiedChannel value |
|
1471 ! ! |
|
1472 |
|
1473 !DataSetBuilder methodsFor:'selection'! |
|
1474 |
|
1475 selectedColumn |
|
1476 "returns selected column or nil |
|
1477 " |
|
1478 ^ selectedColumnIndex == 0 ifFalse:[columns at:selectedColumnIndex] |
|
1479 ifTrue:[nil] |
|
1480 ! |
|
1481 |
|
1482 selectedColumnIndex |
|
1483 "returns selected column index or 0 |
|
1484 " |
|
1485 ^ selectedColumnIndex |
|
1486 ! |
|
1487 |
|
1488 selectedColumnIndex:something |
|
1489 "change selected column and update specifications |
|
1490 " |
|
1491 something == selectedColumnIndex ifFalse:[ |
|
1492 selectedColumnIndex := something ? 0. |
|
1493 self cancel. |
|
1494 ]. |
|
1495 |
|
1496 ! |
|
1497 |
|
1498 tabSelectionIndex |
|
1499 "returns selected tab index or 0 |
|
1500 " |
|
1501 ^ tabSelectionIndex |
|
1502 ! |
|
1503 |
|
1504 tabSelectionIndex:something |
|
1505 "change selected tab and set corresponding specification |
|
1506 " |
|
1507 |specSelector| |
|
1508 |
|
1509 something == tabSelectionIndex ifTrue:[ |
|
1510 ^ self |
|
1511 ]. |
|
1512 self selectedColumn isNil ifTrue:[ |
|
1513 tabSelectionIndex == 0 ifTrue:[^ self ]. |
|
1514 tabSelectionIndex := 0 |
|
1515 ] ifFalse:[ |
|
1516 (tabSelectionIndex := something) ~~ 0 ifTrue:[ |
|
1517 specSelector := (self class slices at:tabSelectionIndex) last. |
|
1518 ] |
|
1519 ]. |
|
1520 self specChannel value:specSelector |
|
1521 |
|
1522 |
|
1523 ! ! |
|
1524 |
|
1525 !DataSetBuilder class methodsFor:'documentation'! |
|
1526 |
|
1527 version |
|
1528 ^ '$Header$' |
|
1529 ! ! |