15 |
15 |
16 Object subclass:#DataSetColumn |
16 Object subclass:#DataSetColumn |
17 instanceVariableNames:'columnNumber dataSet labelExtent minWidth width description form |
17 instanceVariableNames:'columnNumber dataSet labelExtent minWidth width description form |
18 buttonInset buttonExtent textInset drawableAction toggleExtent |
18 buttonInset buttonExtent textInset drawableAction toggleExtent |
19 rendererType backgroundColor foregroundColor fgSelector |
19 rendererType backgroundColor foregroundColor fgSelector |
20 bgSelector columnAlignment' |
20 bgSelector columnAlignment label' |
21 classVariableNames:'' |
21 classVariableNames:'' |
22 poolDictionaries:'' |
22 poolDictionaries:'' |
23 category:'Views-DataSet' |
23 category:'Views-DataSet' |
24 ! |
24 ! |
25 |
25 |
462 !DataSetColumn methodsFor:'initialization'! |
462 !DataSetColumn methodsFor:'initialization'! |
463 |
463 |
464 on:aDSVColumnView description:aDescription columnNumber:aNumber |
464 on:aDSVColumnView description:aDescription columnNumber:aNumber |
465 "instance creation; set attributes dependent on the description |
465 "instance creation; set attributes dependent on the description |
466 " |
466 " |
467 |device selector format idx type oldFont newFont label| |
467 |device selector format idx type oldFont newFont| |
468 |
468 |
469 columnNumber := aNumber. |
469 columnNumber := aNumber. |
470 dataSet := aDSVColumnView. |
470 dataSet := aDSVColumnView. |
471 description := aDescription. |
471 description := aDescription. |
472 rendererType := description rendererType. |
472 rendererType := description rendererType. |
487 foregroundColor notNil ifTrue:[ |
487 foregroundColor notNil ifTrue:[ |
488 foregroundColor := foregroundColor on:dataSet device |
488 foregroundColor := foregroundColor on:dataSet device |
489 ]. |
489 ]. |
490 |
490 |
491 oldFont := nil. |
491 oldFont := nil. |
492 label := description rawLabel. |
492 label := self resolveLabelWithBuilder:(dataSet builder). |
493 |
493 |
494 (label respondsTo:#string) ifTrue:[ |
494 (label respondsTo:#string) ifTrue:[ |
495 "/ |
495 "/ |
496 "/ must set the font to accumulate the real extent of a string label |
496 "/ must set the font to accumulate the real extent of a string label |
497 "/ |
497 "/ |
518 buttonExtent := dataSet checkToggleExtent. |
518 buttonExtent := dataSet checkToggleExtent. |
519 ^ self |
519 ^ self |
520 ]. |
520 ]. |
521 |
521 |
522 rendererType == #rowSelector ifTrue:[ |
522 rendererType == #rowSelector ifTrue:[ |
523 form := dataSet rowSelectorForm. |
523 form := dataSet rowSelectorForm. |
524 buttonExtent := dataSet rowSelectorExtent. |
524 buttonExtent := dataSet rowSelectorExtent. |
525 ^ self |
525 ^ self |
526 ]. |
526 ]. |
527 |
527 |
528 (rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
528 (rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
557 ] ifFalse:[ "/ default: no format string |
557 ] ifFalse:[ "/ default: no format string |
558 drawableAction := [:aRow| description row:aRow at:columnNumber ] |
558 drawableAction := [:aRow| description row:aRow at:columnNumber ] |
559 ] |
559 ] |
560 |
560 |
561 |
561 |
|
562 ! |
|
563 |
|
564 resolveLabelInBuilder:aBuilder |
|
565 |label appl| |
|
566 |
|
567 aBuilder isNil ifTrue:[ |
|
568 ^ description rawLabel |
|
569 ]. |
|
570 |
|
571 (label := description label) isString ifTrue:[ |
|
572 description labelIsImage ifTrue:[ |
|
573 aBuilder isEditing ifTrue:[ |
|
574 label := nil |
|
575 ] ifFalse:[ |
|
576 label := aBuilder labelFor:(label asSymbol) |
|
577 ]. |
|
578 ^ label ? description class defaultIcon |
|
579 ]. |
|
580 description translateLabel == true ifTrue:[ |
|
581 (appl := aBuilder application) notNil ifTrue:[ |
|
582 ^ (appl resources string:label) ? label |
|
583 ] |
|
584 ] |
|
585 ]. |
|
586 ^ label |
|
587 ! |
|
588 |
|
589 resolveLabelWithBuilder:aBuilder |
|
590 |label appl| |
|
591 |
|
592 aBuilder isNil ifTrue:[ |
|
593 ^ description rawLabel |
|
594 ]. |
|
595 |
|
596 (label := description label) isString ifTrue:[ |
|
597 description labelIsImage ifTrue:[ |
|
598 aBuilder isEditing ifTrue:[ |
|
599 label := nil |
|
600 ] ifFalse:[ |
|
601 label := aBuilder labelFor:(label asSymbol) |
|
602 ]. |
|
603 ^ label ? description class defaultIcon |
|
604 ]. |
|
605 description translateLabel == true ifTrue:[ |
|
606 (appl := aBuilder application) notNil ifTrue:[ |
|
607 ^ (appl resources string:label) ? label |
|
608 ] |
|
609 ] |
|
610 ]. |
|
611 ^ label |
562 ! ! |
612 ! ! |
563 |
613 |
564 !DataSetColumn methodsFor:'private'! |
614 !DataSetColumn methodsFor:'private'! |
565 |
615 |
566 drawableAt:aRowNr |
616 drawableAt:aRowNr |