54 formInset <Integer> top inset of a form |
54 formInset <Integer> top inset of a form |
55 textInset <Integer> top inset of a string |
55 textInset <Integer> top inset of a string |
56 form <Form> a form drawn when a cell is unselected |
56 form <Form> a form drawn when a cell is unselected |
57 form2 <Form> a second form (used by Toggle off). |
57 form2 <Form> a second form (used by Toggle off). |
58 label <misc> cellLabel on device |
58 label <misc> cellLabel on device |
59 writeSelector <Selector> to write back a value |
|
60 |
59 |
61 [author:] |
60 [author:] |
62 Claus Atzkern |
61 Claus Atzkern |
63 |
62 |
64 [see also:] |
63 [see also:] |
73 !DataSetColumn methodsFor:'accessing'! |
72 !DataSetColumn methodsFor:'accessing'! |
74 |
73 |
75 at:aRowNr |
74 at:aRowNr |
76 "get the value of the raw at an index, aRowNr |
75 "get the value of the raw at an index, aRowNr |
77 " |
76 " |
78 ^ (dataSet at:aRowNr) perform:(description readSelector) |
77 ^ description row:(dataSet at:aRowNr) at:columnNumber |
79 ! |
78 ! |
80 |
79 |
81 at:aRowNr put:something |
80 at:aRowNr put:something |
82 "set the value of the raw at an index, aRowNr |
81 "set the value of the raw at an index, aRowNr |
83 " |
82 " |
84 writeSelector notNil ifTrue:[ |
83 description row:(dataSet at:aRowNr) at:columnNumber put:something |
85 (dataSet at:aRowNr) perform:writeSelector with:something |
|
86 ] |
|
87 ! |
84 ! |
88 |
85 |
89 backgroundColor |
86 backgroundColor |
90 ^ backgroundColor |
87 ^ backgroundColor |
91 ! |
88 ! |
344 " |
341 " |
345 minWidth := width := nil. |
342 minWidth := width := nil. |
346 |
343 |
347 ! ! |
344 ! ! |
348 |
345 |
|
346 !DataSetColumn methodsFor:'editing'! |
|
347 |
|
348 editorAt:aRowNr in:aView with:fg bg:bg |
|
349 |
|
350 ^ description editorOn:(dataSet at:aRowNr) |
|
351 value:(self at:aRowNr) |
|
352 in:aView |
|
353 with:fg |
|
354 bg:bg. |
|
355 |
|
356 |
|
357 ! ! |
|
358 |
349 !DataSetColumn methodsFor:'event handling'! |
359 !DataSetColumn methodsFor:'event handling'! |
350 |
360 |
351 doesNotUnderstand:aMessage |
361 doesNotUnderstand:aMessage |
352 |
362 |
353 (description respondsTo:(aMessage selector)) ifTrue:[ |
363 (description respondsTo:(aMessage selector)) ifTrue:[ |
427 !DataSetColumn methodsFor:'initialization'! |
437 !DataSetColumn methodsFor:'initialization'! |
428 |
438 |
429 on:aDSVColumnView description:aDescription columnNumber:aNumber |
439 on:aDSVColumnView description:aDescription columnNumber:aNumber |
430 "instance creation; set attributes dependent on the description |
440 "instance creation; set attributes dependent on the description |
431 " |
441 " |
432 |rendererType device selector formatStr idx| |
442 |rendererType device selector format idx type| |
433 |
443 |
434 columnNumber := aNumber. |
444 columnNumber := aNumber. |
435 dataSet := aDSVColumnView. |
445 dataSet := aDSVColumnView. |
436 description := aDescription. |
446 description := aDescription. |
437 rendererType := description rendererType. |
447 rendererType := description rendererType. |
438 form := width := form2 := nil. |
448 form := width := form2 := nil. |
439 device := dataSet device. |
449 device := dataSet device. |
440 label := description rawLabel. |
450 label := description rawLabel. |
441 drawableAction := nil. |
451 drawableAction := nil. |
442 writeSelector := description writeSelector. |
|
443 backgroundColor := description backgroundColor. |
452 backgroundColor := description backgroundColor. |
444 foregroundColor := description foregroundColor. |
453 foregroundColor := description foregroundColor. |
445 |
454 |
446 backgroundColor notNil ifTrue:[ |
455 backgroundColor notNil ifTrue:[ |
447 backgroundColor := backgroundColor on:aDSVColumnView device |
456 backgroundColor := backgroundColor on:aDSVColumnView device |
471 |
480 |
472 selector := description printSelector. |
481 selector := description printSelector. |
473 |
482 |
474 selector notNil ifTrue:[ |
483 selector notNil ifTrue:[ |
475 drawableAction := [:aRowNr| |
484 drawableAction := [:aRowNr| |
476 (dataSet list at:aRowNr) perform:selector with:dataSet |
485 (dataSet at:aRowNr) perform:selector with:dataSet |
477 ]. |
486 ]. |
478 ^ self |
487 ^ self |
479 ]. |
488 ]. |
480 |
489 |
481 selector := description readSelector. |
490 ( (format := description formatString) notNil |
482 formatStr := description formatString. |
491 and:[(type := description type) == #number or:[type == #numberOrNil]] |
483 |
492 ) ifTrue:[ |
484 (formatStr notNil and:[description type == #number]) ifTrue:[ |
|
485 |
|
486 "/ has a format string for number (supports only floats) |
493 "/ has a format string for number (supports only floats) |
487 |
494 |
488 (idx := formatStr indexOf:$.) ~~ 0 ifTrue:[ |
495 (idx := format indexOf:$.) ~~ 0 ifTrue:[ |
489 idx := formatStr size - idx |
496 idx := format size - idx |
490 ]. |
497 ]. |
491 formatStr := '%0.', idx printString, 'f'. |
498 format := '%0.', idx printString, 'f'. |
492 |
499 |
493 drawableAction := [:aRowNr||num| |
500 drawableAction := [:aRowNr||num| |
494 num := (dataSet list at:aRowNr) perform:selector. |
501 (num := self at:aRowNr) isReal ifTrue:[ |
495 |
502 num := num asFloat printfPrintString:format. |
496 num isReal ifTrue:[ |
|
497 num := num asFloat printfPrintString:formatStr. |
|
498 ]. |
503 ]. |
499 num |
504 num |
500 ]. |
505 ] |
501 ^ self |
506 ] ifFalse:[ "/ default: no format string |
502 ]. |
507 drawableAction := [:aRowNr| self at:aRowNr ] |
503 |
508 ] |
504 "/ default: no format string |
|
505 |
|
506 drawableAction := [:aRowNr| |
|
507 (dataSet list at:aRowNr) perform:selector |
|
508 ]. |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
509 |
525 |
510 |
526 ! ! |
511 ! ! |
527 |
512 |
528 !DataSetColumn methodsFor:'queries'! |
513 !DataSetColumn methodsFor:'queries'! |