DataSetColumn.st
author sr
Fri, 13 Dec 2019 14:08:49 +0100
changeset 6195 bd5eb047338b
parent 6139 9d008b425719
child 6223 7cc3b7c3bfce
permissions -rw-r--r--
#BUGFIX by Stefan Reise do not cache #preferredExtent class: MenuPanel class definition comment/format in: #computePreferredExtent #menu: #openDelayed:afterSeconds: changed: #preferredExtent #preferredExtent: class: MenuPanel::Item comment/format in: #openDelayedSubmenu #openSubmenu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6139
9d008b425719 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6042
diff changeset
     1
"{ Encoding: utf8 }"
9d008b425719 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6042
diff changeset
     2
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     3
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     4
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     5
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     6
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     7
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    12
 hereby transferred.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    13
"
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1725
diff changeset
    14
"{ Package: 'stx:libwidg2' }"
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1725
diff changeset
    15
4821
b53364768c88 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4660
diff changeset
    16
"{ NameSpace: Smalltalk }"
b53364768c88 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4660
diff changeset
    17
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    18
Object subclass:#DataSetColumn
3775
ce35b13cd5bf code cleanup
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
    19
	instanceVariableNames:'columnNumber dataSet width description buttonExtent rendererType
ce35b13cd5bf code cleanup
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
    20
		backgroundColor foregroundColor rowSeparatorSelector
ce35b13cd5bf code cleanup
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
    21
		showColSeparator showRowSeparator columnAlignment label
ce35b13cd5bf code cleanup
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
    22
		containsText columnAdaptor descWidth descMinWidth
ce35b13cd5bf code cleanup
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
    23
		longStringCompression minValue maxValue'
ce35b13cd5bf code cleanup
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
    24
	classVariableNames:''
ce35b13cd5bf code cleanup
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
    25
	poolDictionaries:''
ce35b13cd5bf code cleanup
Claus Gittinger <cg@exept.de>
parents: 3771
diff changeset
    26
	category:'Views-DataSet'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    27
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    28
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    29
!DataSetColumn class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    30
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    31
copyright
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    32
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    33
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    34
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    35
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    36
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    37
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    38
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    39
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    40
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    41
 hereby transferred.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    42
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    43
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    44
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    45
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    46
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    47
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    48
documentation
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    49
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    50
    represent one single column description of a DataSetView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    51
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    52
    [Instance variables:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    53
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    54
        columnNumber    <Integer>               sequence number (into list of columns)
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    55
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    56
        dataSet         <DSVColumnView>         the view it belongs to
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    57
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    58
        width           <Integer>               width of column
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    59
2710
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
    60
        description     <DataSetColumnSpec>     the column description (a spec)
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    61
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    62
        buttonExtent    <Point>                 extent of drawable form
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    63
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    64
        rendererType    <Type>                  renderer type (cached value from
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    65
                                                the column specification).
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    66
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    67
        backgroundColor <Color or nil>          background color of all cells or nil
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    68
                                                (nil: use default background color).
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    69
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    70
        foregroundColor <Color or nil>          foreground color of all cells or nil
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    71
                                                (nil: use default foreground color).
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    72
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    73
        columnAlignment <Symbol>                align text/icon #left #right or #center
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    74
                                                in row (on default: #left).
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    75
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    76
        label           <label/icon or nil>     label resolved by the builder shown
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    77
                                                in the column description field.
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    78
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    79
        readSelector    <Symbol>                cached readSelector (from the spec)
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    80
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    81
        columnAdaptor   <nil or any>            if non-nil, that one is asked (via
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    82
                                                read-writeSelectors to extract a column
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    83
                                                from a row object.
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    84
                                                If nil, the row object is used itself.
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    85
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    86
        showColSeparator <Boolean>              true: vertical separators are enabled;
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    87
                                                separator between columns
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    88
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    89
        showRowSeparator <Boolean>              true: horizontal separators are enabled;
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    90
                                                separator between rows
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    91
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    92
        rowSeparatorSelector <Selector or nil>  access specific showRowSeparator state
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    93
                                                for a cell
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    94
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
    95
    [from description:]
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
    96
        fgSelector      <Selector or nil>       access specific foreground color for
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
    97
                                                a cell
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
    98
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
    99
        bgSelector      <Selector or nil>       access specific background color for
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   100
                                                a cell
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   101
1725
897453804fa8 made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
   102
        numberOfRowsProbedForColumnSize         the number of rows which are queries
897453804fa8 made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
   103
                                <Integer>       in order to compute the columns width.
897453804fa8 made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
   104
                                                (for scrollBar/col width computation)
5470
a51a268786e7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5466
diff changeset
   105
                                                Notice, if it's expensive to fetch rows
1725
897453804fa8 made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
   106
                                                (dataBase apps), this should be small.
897453804fa8 made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
   107
                                                Default:15
897453804fa8 made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
   108
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   109
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   110
    [author:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   111
        Claus Atzkern
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   112
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   113
    [see also:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   114
        DataSetColumnSpec
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   115
        DSVColumnView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   116
        DataSetView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   117
"
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   118
! !
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   119
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   120
!DataSetColumn class methodsFor:'utilities'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   121
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   122
shortenedStringFor:aString on:aGC maxWidth:maxWidth
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   123
    "common code to shorten a string; used in both the DSV label- and column Views,  
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   124
     if the string is too long for the column"
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   125
5465
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   126
    ^ self shortenedStringFor:aString on:aGC maxWidth:maxWidth shortenedAtLeft:false
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   127
!
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   128
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   129
shortenedStringFor:aString on:aGC maxWidth:maxWidth shortenedAtLeft:shortenedAtLeft
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   130
    "common code to shorten a string; used in both the DSV label- and column Views,  
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   131
     if the string is too long for the column"
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   132
2221
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   133
    |widthOf3Dots wRest shortenedLabel lUsed lMin lMax|
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   134
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   135
    aString isString ifFalse:[^ aString].
4234
63f563c5aca9 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4230
diff changeset
   136
    (aString widthOn:aGC) <= maxWidth ifTrue:[^ aString].
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   137
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   138
    widthOf3Dots := '...' widthOn:aGC.
2221
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   139
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   140
    lMin := 1.
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   141
    lMax := aString size.
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   142
    [ 
2221
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   143
        lUsed := (lMax + lMin) // 2.
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   144
        wRest := aString widthFrom:1 to:lUsed on:aGC.
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   145
        wRest > (maxWidth-widthOf3Dots) ifTrue:[
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   146
            lMax := lUsed - 1.
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   147
        ] ifFalse:[
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   148
            lMin := lUsed + 1.
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   149
        ].
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   150
        lMin < lMax
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   151
    ] whileTrue.
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   152
    shortenedLabel := aString copyFrom:1 to:lUsed.
19a1500f8113 write to a column no longer installs the
james
parents: 2211
diff changeset
   153
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   154
    shortenedLabel isEmpty ifTrue:[
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   155
        ((aString first asString , '..') widthOn:aGC) < maxWidth ifTrue:[
5465
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   156
            "/ only two dots and the first/last character
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   157
            shortenedAtLeft ifTrue:[
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   158
                ^ ('..',aString last asString)
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   159
            ].        
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   160
            ^ (aString first asString,'..')
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   161
        ]
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   162
    ].
5465
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   163
    shortenedAtLeft ifTrue:[
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   164
        ^ ('...',shortenedLabel).
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   165
    ].
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   166
    ^ (shortenedLabel,'...').
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   167
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   168
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   169
!DataSetColumn methodsFor:'accessing'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   170
3211
69cc92eb7a77 +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
   171
activeHelpText
69cc92eb7a77 +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
   172
    "get the active helpText or nil"
69cc92eb7a77 +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
   173
69cc92eb7a77 +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
   174
    |app key|
69cc92eb7a77 +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
   175
3869
20d5ddff9541 changed:
Claus Gittinger <cg@exept.de>
parents: 3856
diff changeset
   176
    ((key := description activeHelpKey) notEmptyOrNil 
3211
69cc92eb7a77 +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
   177
    and:[(app := dataSet application) notNil]) ifTrue:[
5673
d118ff306e7d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5640
diff changeset
   178
        ^ app helpTextForKey:key asSymbol.
3211
69cc92eb7a77 +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
   179
    ].
3218
Claus Gittinger <cg@exept.de>
parents: 3213
diff changeset
   180
    ^ nil
3211
69cc92eb7a77 +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
   181
69cc92eb7a77 +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
   182
    "Created: / 26-03-2007 / 13:39:11 / cg"
3218
Claus Gittinger <cg@exept.de>
parents: 3213
diff changeset
   183
    "Modified: / 26-03-2007 / 17:51:15 / cg"
3211
69cc92eb7a77 +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
   184
!
69cc92eb7a77 +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3210
diff changeset
   185
3522
3a173979096d allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   186
activeHelpTextForLabel
3a173979096d allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   187
    "get the active helpText for the label or nil"
3a173979096d allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   188
3a173979096d allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   189
    |app key|
3a173979096d allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   190
3869
20d5ddff9541 changed:
Claus Gittinger <cg@exept.de>
parents: 3856
diff changeset
   191
    ((key := description activeHelpKeyForLabel) notEmptyOrNil 
3522
3a173979096d allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   192
    and:[(app := dataSet application) notNil]) ifTrue:[
5673
d118ff306e7d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5640
diff changeset
   193
        ^ app helpTextForKey:key asSymbol.
3522
3a173979096d allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   194
    ].
3a173979096d allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   195
    ^ nil
3a173979096d allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   196
3a173979096d allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   197
    "Created: / 26-03-2007 / 13:39:11 / cg"
3a173979096d allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   198
    "Modified: / 26-03-2007 / 17:51:15 / cg"
3a173979096d allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   199
!
3a173979096d allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents: 3511
diff changeset
   200
3459
6d1feb9745b8 changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3448
diff changeset
   201
activeHelpTextForRow:rowNr
6d1feb9745b8 changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3448
diff changeset
   202
    "get the active helpText or nil"
6d1feb9745b8 changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3448
diff changeset
   203
6d1feb9745b8 changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3448
diff changeset
   204
    |app key|
6d1feb9745b8 changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3448
diff changeset
   205
3460
a2c21a2e959c changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3459
diff changeset
   206
    ((key := description activeHelpKey) notEmptyOrNil 
3459
6d1feb9745b8 changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3448
diff changeset
   207
    and:[(app := dataSet application) notNil]) ifTrue:[
5673
d118ff306e7d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5640
diff changeset
   208
        ^ app helpTextForKey:key asSymbol row:rowNr.
3459
6d1feb9745b8 changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3448
diff changeset
   209
    ].
6d1feb9745b8 changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3448
diff changeset
   210
    ^ nil
6d1feb9745b8 changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3448
diff changeset
   211
6d1feb9745b8 changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3448
diff changeset
   212
    "Created: / 26-03-2007 / 13:39:11 / cg"
6d1feb9745b8 changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3448
diff changeset
   213
    "Modified: / 26-03-2007 / 17:51:15 / cg"
6d1feb9745b8 changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3448
diff changeset
   214
!
6d1feb9745b8 changed #activeHelpTextForRow:
Stefan Vogel <sv@exept.de>
parents: 3448
diff changeset
   215
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   216
at:aRowNr
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   217
    "get the value of the cell at the row index, aRowNr"
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   218
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   219
    |row|
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   220
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   221
    row := dataSet at:aRowNr.
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   222
    ^ self extractColFromRow:row rowNr:aRowNr.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   223
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   224
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   225
at:aRowNr put:something
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   226
    "set the value of the cell at the row index, aRowNr"
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   227
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   228
    |row|
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   229
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   230
    row := dataSet at:aRowNr.
2419
e0121908fffe added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents: 2222
diff changeset
   231
    self storeCol:something inRow:row.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   232
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   233
1558
00b34d71898a columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   234
columnAdaptor
00b34d71898a columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   235
    ^ columnAdaptor
00b34d71898a columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   236
!
00b34d71898a columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   237
1712
5511cc404d6b accessor for columnAdapter (can now be a valueHolder)
ca
parents: 1592
diff changeset
   238
columnAdaptor:anAdapter
5511cc404d6b accessor for columnAdapter (can now be a valueHolder)
ca
parents: 1592
diff changeset
   239
    columnAdaptor := anAdapter.
5511cc404d6b accessor for columnAdapter (can now be a valueHolder)
ca
parents: 1592
diff changeset
   240
!
5511cc404d6b accessor for columnAdapter (can now be a valueHolder)
ca
parents: 1592
diff changeset
   241
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   242
columnNumber
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   243
    ^ columnNumber
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   244
!
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   245
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   246
description
2710
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
   247
    "returns the column spec
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   248
    "
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   249
    ^ description
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   250
!
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   251
5054
a660f11bc670 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
   252
doubleClickedSelector
a660f11bc670 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
   253
    ^ description doubleClickedSelector
a660f11bc670 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
   254
!
a660f11bc670 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
   255
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   256
label
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   257
    "get the label assigned to the column
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   258
    "
891
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   259
    ^ label
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   260
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   261
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   262
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   263
5466
5242bcfdb039 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5465
diff changeset
   264
longStringCompression
5242bcfdb039 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5465
diff changeset
   265
    ^ longStringCompression ? true
5242bcfdb039 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5465
diff changeset
   266
!
5242bcfdb039 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5465
diff changeset
   267
2419
e0121908fffe added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents: 2222
diff changeset
   268
longStringCompression:aBoolean
5466
5242bcfdb039 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5465
diff changeset
   269
    longStringCompression := aBoolean
5242bcfdb039 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5465
diff changeset
   270
!
5242bcfdb039 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5465
diff changeset
   271
5242bcfdb039 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5465
diff changeset
   272
longStringCompressionAtLeft
5242bcfdb039 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5465
diff changeset
   273
    ^ [description longStringCompressionAtLeft] on:Error do:[false]
2419
e0121908fffe added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents: 2222
diff changeset
   274
!
e0121908fffe added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents: 2222
diff changeset
   275
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   276
rendererType
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   277
    "returns my renderer type
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   278
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   279
    ^ rendererType
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   280
! !
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   281
5640
abd92bfe3252 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
   282
!DataSetColumn methodsFor:'accessing-color & font'!
1565
ca
parents: 1559
diff changeset
   283
ca
parents: 1559
diff changeset
   284
backgroundColor
ca
parents: 1559
diff changeset
   285
    "returns the background color or nil
ca
parents: 1559
diff changeset
   286
    "
2710
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
   287
    ^ backgroundColor == dataSet backgroundColor ifTrue:[nil] ifFalse:[backgroundColor]
1565
ca
parents: 1559
diff changeset
   288
!
ca
parents: 1559
diff changeset
   289
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   290
backgroundColor: aColor
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   291
    backgroundColor := aColor
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   292
!
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   293
1565
ca
parents: 1559
diff changeset
   294
backgroundColorAt:aRowNr
ca
parents: 1559
diff changeset
   295
    "returns the background color for a row at list index a rowNr
ca
parents: 1559
diff changeset
   296
    "
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   297
    description backgroundSelector notNil ifTrue:[
1565
ca
parents: 1559
diff changeset
   298
        ^ self backgroundColorFor:(dataSet at:aRowNr) at:aRowNr
ca
parents: 1559
diff changeset
   299
    ].
ca
parents: 1559
diff changeset
   300
    ^ backgroundColor
ca
parents: 1559
diff changeset
   301
!
ca
parents: 1559
diff changeset
   302
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   303
backgroundColorFor:aRow at:aRowNr     
2727
5cb5708a6982 No extra handling needed for LimitedPrecisionReal
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
   304
    "return the background color for a row at list index a rowNr"
5cb5708a6982 No extra handling needed for LimitedPrecisionReal
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
   305
3210
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   306
    "/ backgroundColor has already been fetched from description/dataSet (see #initialize)
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   307
    ^ self
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   308
        colorFor:aRow at:aRowNr 
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   309
        descriptionSelector:(description backgroundSelector) 
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   310
        descriptionColor:backgroundColor 
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   311
        dataSetDefaultColor:nil
1565
ca
parents: 1559
diff changeset
   312
3210
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   313
    "Modified: / 26-03-2007 / 13:27:19 / cg"
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   314
!
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   315
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   316
colorFor:aRow at:aRowNr descriptionSelector:descriptionSelector descriptionColor:descriptionColor dataSetDefaultColor:dataSetColor    
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   317
    "common code for returning a color for a row at list index a rowNr, asking both description and dataSet as fallBack"
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   318
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   319
    |clr|
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   320
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   321
    descriptionSelector notNil ifTrue:[
1924
634dd19b10bf allow use of a column adaptor for fg/bg colors
ca
parents: 1818
diff changeset
   322
        columnAdaptor notNil ifTrue:[
3210
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   323
            clr := columnAdaptor perform:descriptionSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet
1565
ca
parents: 1559
diff changeset
   324
        ] ifFalse:[
4660
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   325
            "/ Check if row-object responds to the color message...
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   326
            (aRow respondsTo: descriptionSelector) ifTrue:[
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   327
                clr := aRow perform:descriptionSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   328
            ] ifFalse:[ 
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   329
                "/ ...if not, send the message to the application model. This allows application models to
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   330
                "/ define visual aspects while data still could be extracted from the row-objects directly. 
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   331
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   332
                | app |
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   333
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   334
                app := dataSet application.
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   335
                app notNil ifTrue:[ 
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   336
                    clr := app perform:descriptionSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   337
                ].
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   338
            ].
1565
ca
parents: 1559
diff changeset
   339
        ].
3210
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   340
        clr notNil ifTrue:[
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   341
            (clr isColor or:[clr isImageOrForm]) ifTrue:[
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   342
                ^ clr
1928
2dcf8e62af64 debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents: 1924
diff changeset
   343
            ].
3210
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   344
            self error:'unexpected color (not a color or image)'.
1928
2dcf8e62af64 debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents: 1924
diff changeset
   345
        ]
1565
ca
parents: 1559
diff changeset
   346
    ].
3210
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   347
    ^ descriptionColor ? dataSetColor
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   348
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   349
    "Created: / 26-03-2007 / 13:05:24 / cg"
4660
985b9030eab6 When extracting color, send the color-message to the application itself it the
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4566
diff changeset
   350
    "Modified: / 23-09-2014 / 11:35:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1565
ca
parents: 1559
diff changeset
   351
!
ca
parents: 1559
diff changeset
   352
ca
parents: 1559
diff changeset
   353
foregroundColor
ca
parents: 1559
diff changeset
   354
    "returns the foreground color or nil
ca
parents: 1559
diff changeset
   355
    "
2710
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
   356
    ^ foregroundColor == dataSet foregroundColor ifTrue:[nil] ifFalse:[foregroundColor]
1565
ca
parents: 1559
diff changeset
   357
!
ca
parents: 1559
diff changeset
   358
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   359
foregroundColor: aColor
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   360
    foregroundColor := aColor
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   361
!
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   362
1565
ca
parents: 1559
diff changeset
   363
foregroundColorFor:aRow at:aRowNr
ca
parents: 1559
diff changeset
   364
    "returns the foreground color for a row at list index a rowNr
ca
parents: 1559
diff changeset
   365
    "
ca
parents: 1559
diff changeset
   366
3210
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   367
    "/ foregroundColor has already been fetched from description/dataSet (see #initialize)
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   368
    ^ self
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   369
        colorFor:aRow at:aRowNr 
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   370
        descriptionSelector:(description foregroundSelector) 
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   371
        descriptionColor:foregroundColor 
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   372
        dataSetDefaultColor:nil
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   373
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   374
    "Modified: / 26-03-2007 / 13:27:39 / cg"
2710
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
   375
!
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
   376
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
   377
selectedBackgroundColorFor:aRow at:aRowNr     
3210
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   378
    "returns the selected background color for a row at list index a rowNr"
2710
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
   379
3210
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   380
    ^ self
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   381
        colorFor:aRow at:aRowNr 
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   382
        descriptionSelector:(description selectedBackgroundSelector) 
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   383
        descriptionColor:(description selectedBackgroundColor) 
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   384
        dataSetDefaultColor:(dataSet selectionBackgroundColor)
3139
6ef356fd2303 new selectionHandling - buttonPress
ca
parents: 2897
diff changeset
   385
3210
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   386
    "Modified: / 26-03-2007 / 13:06:06 / cg"
2710
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
   387
!
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
   388
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
   389
selectedForegroundColorFor:aRow at:aRowNr     
3210
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   390
    "returns the selected foreground color for a row at list index a rowNr"
2710
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
   391
3210
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   392
    ^ self
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   393
        colorFor:aRow at:aRowNr 
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   394
        descriptionSelector:(description selectedForegroundSelector) 
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   395
        descriptionColor:(description selectedForegroundColor) 
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   396
        dataSetDefaultColor:(dataSet selectionForegroundColor)
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   397
d6e4a96f8597 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3139
diff changeset
   398
    "Modified: / 26-03-2007 / 13:05:31 / cg"
3990
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   399
!
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   400
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   401
selectedFrameColorFor:aRow at:aRowNr     
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   402
    "returns the selected frame color for a row at list index a rowNr"
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   403
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   404
    ^ self
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   405
        colorFor:aRow at:aRowNr 
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   406
        descriptionSelector:(description selectedBackgroundSelector) 
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   407
        descriptionColor:(description selectedBackgroundColor) 
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   408
        dataSetDefaultColor:(dataSet selectionFrameColor)
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   409
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   410
    "Created: / 20-01-2011 / 08:46:32 / cg"
1565
ca
parents: 1559
diff changeset
   411
! !
ca
parents: 1559
diff changeset
   412
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1725
diff changeset
   413
!DataSetColumn methodsFor:'accessing-dimension'!
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   414
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   415
minWidth
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   416
    "get the minimum width required by the column
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   417
    "
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   418
    descMinWidth notNil ifTrue:[
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   419
        ^ descMinWidth
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   420
    ].
4414
3ec865b931a3 class: DataSetColumn
ca
parents: 4335
diff changeset
   421
    descWidth isInteger ifTrue:[
3ec865b931a3 class: DataSetColumn
ca
parents: 4335
diff changeset
   422
        ^ descWidth
3ec865b931a3 class: DataSetColumn
ca
parents: 4335
diff changeset
   423
    ].
3ec865b931a3 class: DataSetColumn
ca
parents: 4335
diff changeset
   424
    ^ 0.
3ec865b931a3 class: DataSetColumn
ca
parents: 4335
diff changeset
   425
"/   width := nil.
3ec865b931a3 class: DataSetColumn
ca
parents: 4335
diff changeset
   426
"/  ^ self width
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   427
!
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   428
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   429
minimumRequiredWidth
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   430
    "returns the minimum required width
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   431
    "
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   432
    |minWidth|
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   433
1940
50cf5e9dea10 allow resizing less than label size
ca
parents: 1937
diff changeset
   434
    descMinWidth notNil ifTrue:[
50cf5e9dea10 allow resizing less than label size
ca
parents: 1937
diff changeset
   435
        minWidth := DSVLabelView tabSpacing max:2.
50cf5e9dea10 allow resizing less than label size
ca
parents: 1937
diff changeset
   436
      ^ minWidth // 2 + minWidth
50cf5e9dea10 allow resizing less than label size
ca
parents: 1937
diff changeset
   437
    ].
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   438
1940
50cf5e9dea10 allow resizing less than label size
ca
parents: 1937
diff changeset
   439
    minWidth := dataSet separatorSize + (2 * dataSet horizontalSpacing).
50cf5e9dea10 allow resizing less than label size
ca
parents: 1937
diff changeset
   440
  ^ minWidth + label preferredWidth.
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   441
!
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   442
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   443
setDescWidth:aWidth
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   444
    "set a fixed width
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   445
    "
1940
50cf5e9dea10 allow resizing less than label size
ca
parents: 1937
diff changeset
   446
    descMinWidth := 1.
50cf5e9dea10 allow resizing less than label size
ca
parents: 1937
diff changeset
   447
    descMinWidth := width := descWidth := self minimumRequiredWidth max:aWidth.
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   448
!
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   449
4414
3ec865b931a3 class: DataSetColumn
ca
parents: 4335
diff changeset
   450
setWidth:pixels
3ec865b931a3 class: DataSetColumn
ca
parents: 4335
diff changeset
   451
    width := pixels
3ec865b931a3 class: DataSetColumn
ca
parents: 4335
diff changeset
   452
!
3ec865b931a3 class: DataSetColumn
ca
parents: 4335
diff changeset
   453
5564
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   454
width
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   455
    "returns the width in pixels
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   456
     Warning:
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   457
        only the first numberOfRowsProbedForColumnSize are probed,
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   458
        in case the access is expensive (dataBase apps)
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   459
     If the descriptor defines a width, that is used, and the items
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   460
     are not probed at all."
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   461
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   462
    |max       "{ Class:SmallInteger }"
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   463
     listSize  "{ Class:SmallInteger }"|
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   464
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   465
    width notNil ifTrue:[^ width].              "/ already computed
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   466
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   467
    descMinWidth notNil ifTrue:[
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   468
        width := descMinWidth.
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   469
        ^ width
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   470
    ].
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   471
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   472
    (descWidth ~~ 0 and:[self hasRelativeWidth not "descWidth isLimitedPrecisionReal not"]) ifTrue:[
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   473
        width := descMinWidth := descWidth.
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   474
        ^ width
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   475
    ].
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   476
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   477
    width := (description minWidth ) max:(label preferredWidth).
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   478
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   479
    self hasRelativeWidth ifTrue:[
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   480
        width := width max:(descWidth * dataSet innerWidth) rounded.
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   481
        ^ width
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   482
    ].
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   483
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   484
    containsText ifTrue:[
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   485
        "/ take maximum numberOfRowsProbedForColumnSize entries to calculate the width;
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   486
        "/ can be resized later if necessary
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   487
        listSize := dataSet size.
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   488
        max := listSize min:description numberOfRowsProbedForColumnSize.
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   489
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   490
        max ~~ 0 ifTrue:[
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   491
            1 to:max do:[:rowNr| |row|
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   492
                row := dataSet at:rowNr.
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   493
                width := width max:(self widthOfLabel:(self shownValueForRow:row rowNr:rowNr))
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   494
            ].
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   495
            width := width max:(self widthOfLabel:(self shownValueForRow:(dataSet at:listSize) rowNr:listSize))
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   496
        ].
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   497
        description editorType ~~ #None ifTrue:[
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   498
            width := width + (dataSet font widthOn:dataSet device)
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   499
        ].
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   500
    ] ifFalse:[
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   501
        max := 1
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   502
    ].
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   503
    width := width + buttonExtent x + dataSet separatorSize + (2 * dataSet horizontalSpacing).
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   504
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   505
    max ~~ 0 ifTrue:[
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   506
        descMinWidth := width.
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   507
        description usePreferredWidth ifTrue:[
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   508
            descWidth := width
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   509
        ]
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   510
    ].
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   511
    ^ width
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   512
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   513
    "Modified: / 25.2.2000 / 14:29:16 / cg"
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   514
!
0a0945b07086 #BUGFIX by ca
ca
parents: 5561
diff changeset
   515
4566
19114315128c Fox for column resizing bug.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
   516
width: aWidth
19114315128c Fox for column resizing bug.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
   517
    self setWidth: aWidth
19114315128c Fox for column resizing bug.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
   518
19114315128c Fox for column resizing bug.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
   519
    "Created: / 11-04-2014 / 10:01:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   520
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   521
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   522
!DataSetColumn methodsFor:'drawing'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   523
3330
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   524
drawLabel:aLabelToDraw atX:xLeft y:yTop
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   525
    "draw aLabelToDraw; handle columnAlignment"
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   526
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   527
    |drawnLabel x space prevClip mustUndoClip cachedWidth
3330
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   528
     labelWidth leftPart leftShift indexOfFirstDigit indexOfFirstNonDigit|
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   529
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   530
    cachedWidth := self width.
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   531
    cachedWidth isNil ifTrue:[ ^ self ].
3330
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   532
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   533
    space := dataSet horizontalSpacing.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   534
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   535
    drawnLabel := aLabelToDraw.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   536
    labelWidth := drawnLabel widthOn:dataSet.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   537
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   538
    (longStringCompression ~~ false
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   539
     and:[ drawnLabel isString 
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   540
     and:[ labelWidth > cachedWidth]]) ifTrue:[
5466
5242bcfdb039 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5465
diff changeset
   541
        drawnLabel := self class shortenedStringFor:drawnLabel on:dataSet maxWidth:cachedWidth-space shortenedAtLeft:(self longStringCompressionAtLeft).
3330
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   542
        labelWidth := drawnLabel widthOn:dataSet.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   543
    ].
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   544
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   545
    columnAlignment == #left ifTrue:[
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   546
        x  := xLeft + space.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   547
    ] ifFalse:[
3675
e0e63070a210 support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents: 3674
diff changeset
   548
        (columnAlignment == #decimal
e0e63070a210 support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents: 3674
diff changeset
   549
        or:[ columnAlignment == #decimalRight ]) ifTrue:[
3330
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   550
            drawnLabel := drawnLabel asString.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   551
            (drawnLabel includes:$.) ifTrue:[
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   552
                leftPart := drawnLabel upTo:$..
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   553
            ] ifFalse:[
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   554
                leftPart := drawnLabel.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   555
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   556
                indexOfFirstDigit := drawnLabel findFirst:[:char | char isDigit].
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   557
                indexOfFirstDigit ~~ 0 ifTrue:[
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   558
                    indexOfFirstNonDigit := drawnLabel findFirst:[:char | char isDigit not] startingAt:indexOfFirstDigit+1.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   559
                    indexOfFirstNonDigit ~~ 0 ifTrue:[
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   560
                        leftPart := drawnLabel copyTo:indexOfFirstNonDigit-1.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   561
                    ].
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   562
                ].
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   563
            ].
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   564
            leftShift := leftPart widthOn:dataSet.
3675
e0e63070a210 support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents: 3674
diff changeset
   565
            columnAlignment == #decimalRight ifTrue:[
e0e63070a210 support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents: 3674
diff changeset
   566
                "/ decimal at the right
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   567
                x := cachedWidth - ('9999' widthOn:dataSet) - leftShift.
3675
e0e63070a210 support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents: 3674
diff changeset
   568
            ] ifFalse:[
e0e63070a210 support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents: 3674
diff changeset
   569
                "/ decimal at the middle
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   570
                x := (cachedWidth // 2) - leftShift.
3675
e0e63070a210 support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents: 3674
diff changeset
   571
            ].
3330
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   572
        ] ifFalse:[
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   573
            x := cachedWidth - labelWidth.
3330
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   574
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   575
            columnAlignment == #right ifTrue:[x := x - space]
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   576
                                     ifFalse:[x := x // 2].
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   577
        ].
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   578
    "/ cg: old code (did not right-align if string is larger than width
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   579
    "/        x := xLeft + (x max:0).
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   580
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   581
        "/ new code: always right-align.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   582
        x := xLeft + x.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   583
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   584
        "/ must clip left, if string is too large
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   585
        x < xLeft ifTrue:[
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   586
            "/ must clip ...
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   587
            prevClip := dataSet clippingBoundsOrNil.
3330
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   588
            mustUndoClip := true.
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   589
            dataSet clippingBounds:(Rectangle 
3330
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   590
                                left:xLeft top:yTop 
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   591
                                width:cachedWidth height:(drawnLabel heightOn:dataSet)).
3330
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   592
        ].
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   593
    ].
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   594
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   595
"/    drawnLabel isImageOrForm ifTrue:[
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   596
"/        y := yTop.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   597
"/    ] ifFalse:[
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   598
"/        y := (yTop + dataSet rowFontAscent)
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   599
"/    ].
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   600
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   601
"/    drawnLabel isString ifFalse:[
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   602
"/        y := yTop + (drawnLabel ascentOn:dataSet).
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   603
"/    ] ifTrue:[
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   604
"/        y := yTop + dataSet rowFontAscent
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   605
"/    ].
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   606
"/    drawnLabel displayOn:dataSet x:x y:y.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   607
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   608
    dataSet displayLabel:drawnLabel x:x y:yTop.
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   609
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   610
    mustUndoClip == true ifTrue:[
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   611
        dataSet clippingBounds:prevClip    
3330
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   612
    ].
5466
5242bcfdb039 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5465
diff changeset
   613
5242bcfdb039 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5465
diff changeset
   614
    "Modified: / 12-02-2017 / 12:39:48 / cg"
3330
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   615
!
f7fe85be360b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3325
diff changeset
   616
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   617
drawLabelsAtX:xLeft y:yTop h:h from:start to:stop
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   618
    "redraw labels from start to stop"
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   619
6042
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   620
    |fg y yT x hspace lblHg bg label row isSel cachedWidth lineColor minTopMargin|
3298
3408a7138374 Cache width during redraw. Should solve problems by setting width to nil
ab
parents: 3264
diff changeset
   621
6042
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   622
    minTopMargin := 4.
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   623
    
3990
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   624
    cachedWidth := self width.
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   625
    cachedWidth isNil ifTrue:[ ^ self ].
2578
13400c9f2b26 bugfix Windows: drawing selection background color
ca
parents: 2542
diff changeset
   626
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   627
    yT := yTop.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   628
    hspace := dataSet horizontalSpacing.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1092
diff changeset
   629
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   630
    start to:stop do:[:aRowNr|
3364
b7f6e426cd60 care for list change while drawing
Claus Gittinger <cg@exept.de>
parents: 3330
diff changeset
   631
        row := dataSet at:aRowNr ifAbsent:[^ self].
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   632
        y := yT.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   633
        x := xLeft.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   634
3990
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   635
        "/ GET BACKGROUND AND FOREGROUND-COLOR
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   636
        "/ ===================================
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   637
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   638
        isSel := dataSet isSelected:aRowNr inColumn:columnNumber.
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   639
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   640
        (isSel and:[description showSelectionHighLighted]) ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   641
            "/ SHOW SELECTED( MUST REDRAW BACKGROUND )
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   642
            "/ =======================================
2710
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
   643
            bg := self selectedBackgroundColorFor:row at:aRowNr.
fcfa161492ae added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
   644
            fg := self selectedForegroundColorFor:row at:aRowNr.
2578
13400c9f2b26 bugfix Windows: drawing selection background color
ca
parents: 2542
diff changeset
   645
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   646
            dataSet paint:bg.
3990
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   647
            dataSet fillRectangleX:x y:y width:cachedWidth height:h.
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   648
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   649
            dataSet hasRowSelection ifFalse:[
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   650
                lineColor := self selectedFrameColorFor:row at:aRowNr.
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   651
                lineColor notNil ifTrue:[
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   652
                    dataSet paint:lineColor.
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   653
                    dataSet displayRectangleX:x y:y width:cachedWidth height:h.
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   654
                ]
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   655
            ]
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   656
        ] ifFalse:[
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   657
            description backgroundSelector notNil ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   658
                "/ MUST REDRAW BACKGROUND
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   659
                "/ ======================
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   660
                bg := self backgroundColorFor:row at:aRowNr.
1565
ca
parents: 1559
diff changeset
   661
ca
parents: 1559
diff changeset
   662
                bg ~~ backgroundColor ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   663
                    bg := dataSet colorOnDevice:bg
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   664
                ].
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   665
                dataSet paint:bg.
3990
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   666
                dataSet fillRectangleX:x y:y width:cachedWidth height:h.
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   667
            ] ifFalse:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   668
                bg := backgroundColor
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   669
            ].
1100
376515452be4 support of all styles; windows and next
ca
parents: 1092
diff changeset
   670
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   671
            fg := self foregroundColorFor:row at:aRowNr.
1565
ca
parents: 1559
diff changeset
   672
ca
parents: 1559
diff changeset
   673
            fg ~~ foregroundColor ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   674
                fg := dataSet colorOnDevice:fg
1565
ca
parents: 1559
diff changeset
   675
            ].
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   676
        ].
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   677
3990
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   678
        "/ GET AND DRAW LABEL
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   679
        "/ ==================
2542
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   680
        (self isRowVisible:aRowNr) ifTrue:[
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   681
            rendererType == #rowSelector ifTrue:[
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   682
                isSel ifTrue:[
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   683
                    label := dataSet rowSelectorForm.
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   684
                    x  := x + hspace.
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   685
                ] ifFalse:[
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   686
                    label := nil
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   687
                ]
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   688
            ] ifFalse:[
2542
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   689
                (isSel and:[dataSet hasOpenEditor]) ifTrue:[
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   690
                    label := nil
6042
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   691
                ] ifFalse:[
2542
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   692
                    label := self shownValueForRow:row rowNr:aRowNr
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   693
                ]
1589
8bb71707b51a remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents: 1587
diff changeset
   694
            ].
2542
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   695
            label notNil ifTrue:[
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   696
                "/ care for a dark-colored label,
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   697
                "/ with a dark selection-bg color
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   698
                (isSel and:[label isString and:[label hasChangeOfEmphasis]]) ifTrue:[
4821
b53364768c88 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4660
diff changeset
   699
                    "/ take away the label's own color info
b53364768c88 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4660
diff changeset
   700
                    label := label copy emphasisAllRemove:#color.
2542
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   701
                ].
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   702
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   703
                lblHg := self heightOfLabel:label.
1589
8bb71707b51a remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents: 1587
diff changeset
   704
2542
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   705
                lblHg ~~ 0 ifTrue:[
6042
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   706
                    lblHg < (h - minTopMargin) ifTrue:[
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   707
                        y := y + ((h - lblHg) // 2).
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   708
                    ] ifFalse:[
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   709
                        y := y + minTopMargin.
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   710
                    ].    
2542
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   711
                    dataSet paint:fg on:bg.
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   712
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   713
                    (label isString and:[label includes:Character cr]) ifTrue:[
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   714
                        label := label asCollectionOfLines
3462
d2df3607bfb5 mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents: 3460
diff changeset
   715
                    ].
d2df3607bfb5 mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents: 3460
diff changeset
   716
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   717
                    (label isNonByteCollection) ifTrue:[
6042
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   718
                        |skipRest|
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   719
                        
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   720
                        "a collection of labels"
6042
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   721
                        skipRest := false.
2542
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   722
                        label do:[:el|
6042
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   723
                            |yNext|
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   724
                            
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   725
                            (el notNil and:[skipRest not]) ifTrue:[
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   726
                                yNext := y + (el heightOn:dataSet).
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   727
                                yNext >= (h-minTopMargin) ifTrue:[
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   728
                                    self drawLabel:'...' atX:x y:y-4.
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   729
                                    skipRest := true.
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   730
                                ] ifFalse:[    
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   731
                                    self drawLabel:el atX:x y:y.
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   732
                                    y := yNext.
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   733
                                ]
2542
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   734
                            ]
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   735
                        ]
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   736
                    ] ifFalse:[
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   737
                        "a single label"
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   738
                        self drawLabel:label atX:x y:y
2542
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   739
                    ].
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   740
                ]
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   741
            ].
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   742
        ].
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   743
        yT := yT + h
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   744
    ]
3990
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   745
a1ed686544e0 added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
   746
    "Modified: / 20-01-2011 / 08:50:18 / cg"
6042
65ee63cf658e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5839
diff changeset
   747
    "Modified: / 23-04-2019 / 20:04:00 / Claus Gittinger"
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   748
!
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   749
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   750
drawRendererInRow:rowNr x:xLeft y:y width:cellWidth value:cellValue
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   751
    (rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   752
        (self hasChoices:rowNr) ifTrue:[
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   753
            dataSet drawComboButtonAtX:xLeft y:y w:cellWidth
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   754
        ].
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   755
        ^ self
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   756
    ].
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   757
    rendererType == #CheckToggle ifTrue:[
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   758
        dataSet drawCheckToggleAtX:xLeft y:y w:cellWidth state:cellValue.
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   759
        ^ self
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   760
    ].
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   761
    rendererType == #RadioButton ifTrue:[
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   762
         dataSet drawRadioButtonAtX:xLeft y:y w:cellWidth state:cellValue.
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   763
        ^ self
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   764
    ].
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   765
!
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   766
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   767
drawSeparatorsAtX:xLeft y:yTop h:h from:start to:stop
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   768
    "redraw separators for cells between start and stop
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   769
    "
5465
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   770
    |cachedWidth is3D xL xR yB yT times|
3298
3408a7138374 Cache width during redraw. Should solve problems by setting width to nil
ab
parents: 3264
diff changeset
   771
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   772
    (showColSeparator or:[showRowSeparator]) ifFalse:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   773
        ^ self
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   774
    ].
5465
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   775
    cachedWidth := self width.
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   776
    cachedWidth isNil ifTrue:[ ^ self ].
3298
3408a7138374 Cache width during redraw. Should solve problems by setting width to nil
ab
parents: 3264
diff changeset
   777
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   778
    is3D := dataSet has3Dseparators.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   779
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   780
    is3D ifTrue:[dataSet paint:(dataSet separatorDarkColor)]
2638
f2b2ecc2c851 use user defined color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   781
        ifFalse:[dataSet paint:(dataSet separatorOneDColor)].
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   782
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   783
    times := stop - start + 1.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   784
    xL    := xLeft.
5465
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   785
    xR    := xL - 1 + cachedWidth.
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   786
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   787
    showRowSeparator ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   788
     "/ DRAW SEPARATORS AT BOTTOM( DARK COLOR )
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   789
     "/ =======================================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   790
        yB := yTop - 1 + h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   791
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   792
        rowSeparatorSelector isNil ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   793
            times timesRepeat:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   794
                dataSet displayLineFromX:xL y:yB toX:xR y:yB.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   795
                yB := yB + h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   796
            ]
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   797
        ] ifFalse:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   798
            start to:stop do:[:idx|
3240
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
   799
                (self hasRowSeparatorAt:idx) ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   800
                    dataSet displayLineFromX:xL y:yB toX:xR y:yB
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   801
                ].
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   802
                yB := yB + h.
3240
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
   803
            ].
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
   804
        ].
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   805
    ].
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   806
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   807
    showColSeparator ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   808
     "/ DRAW SEPARATORS AT RIGHT( DARK COLOR )
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   809
     "/ ======================================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   810
        yT := yTop.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   811
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   812
        times timesRepeat:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   813
            dataSet displayLineFromX:xR y:yT toX:xR y:(yT - 1 + h).
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   814
            yT := yT + h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   815
        ]
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   816
    ].
1089
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
   817
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   818
    is3D ifFalse:[
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   819
        ^ self
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   820
    ].
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   821
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   822
    dataSet paint:(dataSet separatorLightColor).
1040
c8e6a2ed7928 use the same background color for a selected rowSelector
ca
parents: 1007
diff changeset
   823
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   824
    (     columnNumber == 1
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   825
      or:[(dataSet columnDescriptorAt:(columnNumber - 1)) showColSeparator]
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   826
    ) ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   827
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   828
     "/ DRAW SEPARATORS AT LEFT( LIGHT COLOR )
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   829
     "/ ======================================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   830
        yT := yTop.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   831
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   832
        times timesRepeat:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   833
            dataSet displayLineFromX:xL y:yT toX:xL y:(yT - 1 + h).
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   834
            yT := yT + h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   835
        ].
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   836
    ] ifFalse:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   837
        xL := xL - 1
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   838
    ].
1092
bc003bc88972 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
   839
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   840
    showRowSeparator ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   841
     "/ DRAW SEPARATORS AT TOP( LIGHT COLOR )
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   842
     "/ =====================================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   843
        yT := yTop.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   844
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   845
        rowSeparatorSelector isNil ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   846
            times timesRepeat:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   847
                dataSet displayLineFromX:xL y:yT toX:xR y:yT.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   848
                yT := yT + h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   849
            ]
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   850
        ] ifFalse:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   851
         "/ CHECK WHETHER PREVIOUS ROW HAS A SEPARATOR AT BOTTOM
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   852
         "/ ====================================================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   853
            start to:stop do:[:idx|
3240
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
   854
                (idx == 1 or:[self hasRowSeparatorAt:(idx - 1)]) ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   855
                    dataSet displayLineFromX:xL y:yT toX:xR y:yT.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   856
                ].
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   857
                yT := yT + h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   858
            ]
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   859
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   860
    ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   861
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   862
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   863
invalidate
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   864
    "invalidate width of column; forces a recomputation
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   865
    "
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   866
    width := nil.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   867
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   868
!
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   869
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   870
redrawX:xLeft y:yTop h:h from:start to:stop
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   871
    "redraw all rows between start and stop"
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   872
5465
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   873
    |rH y cachedWidth|
3298
3408a7138374 Cache width during redraw. Should solve problems by setting width to nil
ab
parents: 3264
diff changeset
   874
5465
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   875
    cachedWidth := self width.
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   876
    cachedWidth isNil ifTrue:[ ^ self ].
3298
3408a7138374 Cache width during redraw. Should solve problems by setting width to nil
ab
parents: 3264
diff changeset
   877
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   878
    rH := dataSet rowHeight.
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   879
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   880
    description backgroundSelector isNil ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   881
        dataSet paint:backgroundColor.
5465
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   882
        dataSet fillRectangleX:xLeft y:yTop width:cachedWidth height:h
1115
7f3f4581c3d3 clear background
ca
parents: 1113
diff changeset
   883
    ].
7f3f4581c3d3 clear background
ca
parents: 1113
diff changeset
   884
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   885
    "/ DRAW CELLS: BACKGROUND/FOREGROUND/LABEL
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   886
    "/ =======================================
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   887
    self drawLabelsAtX:xLeft y:yTop h:rH from:start to:stop.
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   888
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   889
    "/ DRAW RENDERED INDICATORS
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   890
    "/ ========================
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   891
    rendererType notNil ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   892
        y := yTop.
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   893
        start to:stop do:[:rowNr|
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   894
            |state|
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   895
2542
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
   896
            (self isRowVisible:rowNr) ifTrue:[
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   897
                state := self at:rowNr.
5465
dae1032ae627 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   898
                self drawRendererInRow:rowNr x:xLeft y:y width:cachedWidth value:state.
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   899
            ].
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   900
            y := y + rH.
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   901
        ].
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   902
    ].
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   903
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   904
    "/ DRAW SEPARATORS
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   905
    "/ ===============
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   906
    self drawSeparatorsAtX:xLeft y:yTop h:rH from:start to:stop
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   907
!
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   908
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   909
shownValueForRow:aRowOrNil rowNr:aRowNr
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   910
    |aRow selector format value type choices translatedChoices idx converter|
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   911
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   912
    rendererType == #CheckToggle ifTrue:[
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   913
        ^ nil
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   914
    ].
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   915
    rendererType == #RadioButton ifTrue:[
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   916
        ^ nil
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
   917
    ].
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   918
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   919
    rendererType == #rowSelector ifTrue:[
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   920
        ^ nil
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   921
    ].
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   922
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   923
    aRow := aRowOrNil.
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   924
    aRowOrNil isNil ifTrue:[
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   925
        aRow := dataSet at:aRowNr.
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   926
    ].
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
   927
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   928
    selector := description printSelector.
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   929
    selector notNil ifTrue:[
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   930
        ^ aRow 
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   931
            perform:selector 
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   932
            withOptionalArgument:dataSet and:columnNumber and:aRowNr and:dataSet.
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   933
    ].
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   934
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   935
    value := self extractColFromRow:aRow rowNr:aRowNr.
2865
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
   936
    description translatedChoices notNil ifTrue:[
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
   937
        choices := self choicesFor:aRow at:aRowNr.
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
   938
        idx := choices indexOf:value.
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
   939
        idx ~~ 0 ifTrue:[
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
   940
            translatedChoices := self translatedChoicesFor:aRow at:aRowNr.
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
   941
            translatedChoices notNil ifTrue:[
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
   942
                value := translatedChoices at:idx.
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
   943
            ].
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
   944
        ].
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
   945
    ].
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   946
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   947
    selector := description formatSelector.
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   948
    selector notNil ifTrue:[
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   949
        format := aRow 
3674
384982192479 fix formatSelector
Stefan Vogel <sv@exept.de>
parents: 3522
diff changeset
   950
            perform:selector asSymbol
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   951
            withOptionalArgument:dataSet and:columnNumber and:aRowNr and:dataSet.
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   952
    ] ifFalse:[
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   953
        format := description formatString.
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   954
    ].
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   955
    format notNil ifTrue:[
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   956
"/ cannot remember what this was used for ...
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   957
"/        (idx := format indexOf:$.) ~~ 0 ifTrue:[
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   958
"/            idx := format size - idx
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   959
"/        ].
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   960
"/        format := '%0.', idx printString, 'f'.
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   961
3674
384982192479 fix formatSelector
Stefan Vogel <sv@exept.de>
parents: 3522
diff changeset
   962
        ^ value printStringFormat:format
3325
8d2a6394f01a added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   963
    ].
8d2a6394f01a added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   964
8d2a6394f01a added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   965
    type := description type.
8d2a6394f01a added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   966
    type ~~ #string ifTrue:[
8d2a6394f01a added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   967
        converter := TypeConverter new perform:type.
3920
4a1933e73efd changed: #shownValueForRow:rowNr:
Claus Gittinger <cg@exept.de>
parents: 3869
diff changeset
   968
        ^ converter getBlock value:value.
4a1933e73efd changed: #shownValueForRow:rowNr:
Claus Gittinger <cg@exept.de>
parents: 3869
diff changeset
   969
"/ cg: the code below is dangerous (tries to addDependent to Integers) !!
4a1933e73efd changed: #shownValueForRow:rowNr:
Claus Gittinger <cg@exept.de>
parents: 3869
diff changeset
   970
"/        converter model:value.
4a1933e73efd changed: #shownValueForRow:rowNr:
Claus Gittinger <cg@exept.de>
parents: 3869
diff changeset
   971
"/        ^ converter value.
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   972
    ].
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   973
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   974
    ^ value
3920
4a1933e73efd changed: #shownValueForRow:rowNr:
Claus Gittinger <cg@exept.de>
parents: 3869
diff changeset
   975
4a1933e73efd changed: #shownValueForRow:rowNr:
Claus Gittinger <cg@exept.de>
parents: 3869
diff changeset
   976
    "Modified: / 28-07-2010 / 20:42:51 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   977
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   978
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   979
!DataSetColumn methodsFor:'editing'!
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   980
3856
ef485acbfd81 added: #editorForRowAt:
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   981
editorForRowAt:aRowNr
ef485acbfd81 added: #editorForRowAt:
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   982
    "creates the editor for the row in a view and returns an editorAndModel, or nil"
3771
0640570dcd43 added: #specForEditorAt:
Claus Gittinger <cg@exept.de>
parents: 3767
diff changeset
   983
1268
37066c039eb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   984
    |val row|
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   985
3264
642d79a1b0d6 care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents: 3240
diff changeset
   986
    row := dataSet at:aRowNr ifAbsent:[^ nil].
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
   987
    val := self extractColFromRow:row rowNr:aRowNr.
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   988
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   989
    val isText ifTrue:[val := val string].
3856
ef485acbfd81 added: #editorForRowAt:
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   990
    ^ description editorOn:row at:aRowNr column:self value:val usingAdaptor:columnAdaptor.
3264
642d79a1b0d6 care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents: 3240
diff changeset
   991
642d79a1b0d6 care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents: 3240
diff changeset
   992
    "Modified: / 27-10-2007 / 10:26:15 / cg"
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   993
! !
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   994
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   995
!DataSetColumn methodsFor:'event handling'!
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   996
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   997
doesNotUnderstand:aMessage
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   998
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
   999
    (description respondsTo:(aMessage selector)) ifTrue:[
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1000
        ^ aMessage sendTo:description
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1001
    ].
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1002
    ^ super doesNotUnderstand:aMessage
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1003
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1004
! !
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1005
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1006
!DataSetColumn methodsFor:'grow & shrink'!
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1007
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1008
growWidth:n
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1009
    "grow the width for n pixels
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1010
    "
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1011
    width := self width + n.
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1012
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1013
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1014
! !
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1015
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1016
!DataSetColumn methodsFor:'initialization'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1017
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1018
on:aDSVColumnView description:aDescription columnNumber:aNumber label:aLabel
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1019
    "instance creation; set attributes dependent on the description
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1020
    "
1089
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
  1021
    columnNumber     := aNumber.
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
  1022
    dataSet          := aDSVColumnView.
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1023
    label            := aLabel.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1024
1089
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
  1025
    description      := aDescription.
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
  1026
    rendererType     := description rendererType.
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1027
    containsText     := (      rendererType ~~ #CheckToggle
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
  1028
                          and:[rendererType ~~ #RadioButton
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
  1029
                          and:[rendererType ~~ #rowSelector]]
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1030
                        ).
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  1031
    descWidth        := description width.
2424
576621beeacb Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents: 2420
diff changeset
  1032
    longStringCompression := description longStringCompression.
1526
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  1033
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  1034
    description usePreferredWidth ifTrue:[
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  1035
        descWidth := 0
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  1036
    ].
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  1037
1565
ca
parents: 1559
diff changeset
  1038
    width      := nil.
ca
parents: 1559
diff changeset
  1039
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1040
    minValue := description minValue.
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1041
    maxValue := description maxValue.
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1042
    rowSeparatorSelector := description rowSeparatorSelector.
1565
ca
parents: 1559
diff changeset
  1043
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1044
    showColSeparator := description showColSeparator.
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1045
    showRowSeparator := description showRowSeparator.
1089
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
  1046
    columnAdaptor    := dataSet columnAdaptor.
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
  1047
    buttonExtent     := 0 @ 0.
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
  1048
    columnAlignment  := #left.
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
  1049
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
  1050
    (backgroundColor := description backgroundColor) isNil ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
  1051
        backgroundColor := dataSet backgroundColor
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
  1052
    ] ifFalse:[
1480
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
  1053
        backgroundColor := backgroundColor onDevice:dataSet device
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
  1054
    ].
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1055
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1056
    (foregroundColor := description foregroundColor) isNil ifTrue:[
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1057
        foregroundColor := dataSet foregroundColor
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1058
    ] ifFalse:[
1480
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
  1059
        foregroundColor := foregroundColor onDevice:dataSet device
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
  1060
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1061
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1062
    rendererType == #CheckToggle ifTrue:[
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1063
        buttonExtent := dataSet checkToggleExtent.
2067
cda10b41aa0f use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
  1064
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1065
    ].
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
  1066
    rendererType == #RadioButton ifTrue:[
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
  1067
        buttonExtent := dataSet radioButtonExtent.
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
  1068
        ^ self
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
  1069
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1070
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1071
    rendererType == #rowSelector ifTrue:[
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
  1072
        buttonExtent := dataSet rowSelectorExtent.
2067
cda10b41aa0f use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
  1073
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1074
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1075
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1076
    (rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
  1077
        buttonExtent := dataSet comboButtonExtent.
883
0a790ad56286 add column justification
ca
parents: 882
diff changeset
  1078
    ] ifFalse:[
0a790ad56286 add column justification
ca
parents: 882
diff changeset
  1079
        columnAlignment := description columnAlignment
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1080
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1081
2444
e3488b6592cd refactored (do not overuse blocks)
penk
parents: 2443
diff changeset
  1082
    "Modified: / 25.2.2000 / 14:25:56 / cg"
2424
576621beeacb Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents: 2420
diff changeset
  1083
! !
576621beeacb Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents: 2420
diff changeset
  1084
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
  1085
!DataSetColumn methodsFor:'private'!
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
  1086
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  1087
extractColFromRow:aRow rowNr:rowNr
3320
18d61818a3d1 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3298
diff changeset
  1088
    |readSelector col numArgs|
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
  1089
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
  1090
    readSelector := description readSelector.
1226
877cadb5d798 allow for nil readSelector
Claus Gittinger <cg@exept.de>
parents: 1187
diff changeset
  1091
    readSelector isNil ifTrue:[^ nil].
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1092
2862
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1093
    readSelector isBlock ifTrue:[
5311
be1b4506b7ac #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5264
diff changeset
  1094
        "/ I don't use valueWithOptionalArgument:and:and:and: here, to make better use of inline caches...
6139
9d008b425719 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6042
diff changeset
  1095
        numArgs := readSelector argumentCount.
3320
18d61818a3d1 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3298
diff changeset
  1096
        numArgs == 0 ifTrue:[
2862
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1097
            ^ readSelector value
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1098
        ].
3320
18d61818a3d1 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3298
diff changeset
  1099
        numArgs == 1 ifTrue:[
2862
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1100
            ^ readSelector value:aRow
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1101
        ].
3320
18d61818a3d1 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3298
diff changeset
  1102
        numArgs == 2 ifTrue:[
2862
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1103
            ^ readSelector value:aRow value:columnNumber
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1104
        ].
3320
18d61818a3d1 code cleanup
Claus Gittinger <cg@exept.de>
parents: 3298
diff changeset
  1105
        numArgs == 3 ifTrue:[
2862
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1106
            ^ readSelector value:aRow value:columnNumber value:rowNr
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1107
        ].
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1108
        ^ readSelector value:aRow value:columnNumber value:rowNr value:dataSet
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1109
    ].
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1110
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1111
    columnAdaptor notNil ifTrue:[
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  1112
        ^ columnAdaptor perform:readSelector withOptionalArgument:aRow and:columnNumber and:rowNr and:dataSet
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1113
    ].
2635
a8add4698dea care for nil rows when extracting columns
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  1114
    aRow isNil ifTrue:[^ nil].
a8add4698dea care for nil rows when extracting columns
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  1115
4230
acf268d95fd0 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4151
diff changeset
  1116
    (aRow isDictionary) ifTrue:[
3724
f4726b172c16 allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents: 3675
diff changeset
  1117
        col := aRow at:readSelector
f4726b172c16 allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents: 3675
diff changeset
  1118
    ] ifFalse:[
f4726b172c16 allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents: 3675
diff changeset
  1119
        col := aRow perform:readSelector withOptionalArgument:columnNumber and:rowNr and:dataSet.
f4726b172c16 allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents: 3675
diff changeset
  1120
    ].
2444
e3488b6592cd refactored (do not overuse blocks)
penk
parents: 2443
diff changeset
  1121
    ^ col
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1122
!
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1123
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1124
storeCol:newValueArg inRow:aRow
2862
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1125
    |writeSelector numArgs newValue|
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1126
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1127
    writeSelector := description writeSelector.
1226
877cadb5d798 allow for nil readSelector
Claus Gittinger <cg@exept.de>
parents: 1187
diff changeset
  1128
    writeSelector isNil ifTrue:[^ aRow].
877cadb5d798 allow for nil readSelector
Claus Gittinger <cg@exept.de>
parents: 1187
diff changeset
  1129
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1130
    newValue := newValueArg.
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1131
    (newValue isNumber) ifTrue:[
2862
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1132
        minValue notNil ifTrue:[
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1133
            newValue < minValue ifTrue:[
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1134
               newValue := minValue
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1135
            ]
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1136
        ].
2862
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1137
        maxValue notNil ifTrue:[
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1138
            newValue > maxValue ifTrue:[
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1139
               newValue := maxValue
2693
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1140
            ]
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1141
        ].
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1142
    ].
c67e66b4e3e3 formatSelector + color accessors
werner
parents: 2638
diff changeset
  1143
6139
9d008b425719 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6042
diff changeset
  1144
    numArgs := writeSelector argumentCount.
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1145
2862
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1146
    writeSelector isBlock ifTrue:[
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1147
        numArgs == 2 ifTrue:[
2863
c0585cbcd922 argument order when using write-store-blocks
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  1148
            ^ writeSelector value:newValue value:aRow
2862
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1149
        ].
2863
c0585cbcd922 argument order when using write-store-blocks
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  1150
        ^ writeSelector value:newValue value:aRow value:columnNumber
2862
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1151
    ].
3279303eabd8 allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents: 2727
diff changeset
  1152
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1153
    columnAdaptor notNil ifTrue:[
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1154
        numArgs == 2 ifTrue:[
2419
e0121908fffe added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents: 2222
diff changeset
  1155
            columnAdaptor perform:writeSelector with:aRow with:newValue.
e0121908fffe added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents: 2222
diff changeset
  1156
            ^ self
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1157
        ].
2419
e0121908fffe added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents: 2222
diff changeset
  1158
        columnAdaptor perform:writeSelector with:aRow with:columnNumber with:newValue.
e0121908fffe added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents: 2222
diff changeset
  1159
        ^ self
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1160
    ].
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1161
4230
acf268d95fd0 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4151
diff changeset
  1162
    (aRow isDictionary) ifTrue:[
3724
f4726b172c16 allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents: 3675
diff changeset
  1163
        aRow at:writeSelector put:newValue
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1164
    ] ifFalse:[
3724
f4726b172c16 allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents: 3675
diff changeset
  1165
        numArgs == 1 ifTrue:[
f4726b172c16 allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents: 3675
diff changeset
  1166
            aRow perform:writeSelector with:newValue
f4726b172c16 allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents: 3675
diff changeset
  1167
        ] ifFalse:[
f4726b172c16 allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents: 3675
diff changeset
  1168
            aRow perform:writeSelector with:columnNumber with:newValue
f4726b172c16 allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents: 3675
diff changeset
  1169
        ]
1059
18f81ba4860d if there is a columnAdaptor,
tz
parents: 1043
diff changeset
  1170
    ].
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
  1171
! !
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
  1172
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1173
!DataSetColumn methodsFor:'queries'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1174
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1175
canResize
4117
b2eb0d2d0008 changed: #canResize - formatting
Stefan Vogel <sv@exept.de>
parents: 3992
diff changeset
  1176
    ^ containsText and:[descWidth == 0 or:[self hasRelativeWidth]]
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1177
!
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1178
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
  1179
canSelect:aRowNr
3448
ef7d76d6bcfd some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3364
diff changeset
  1180
    "returns true if the cell in column is selectable.
ef7d76d6bcfd some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3364
diff changeset
  1181
     (possibly calls the selectSelector, if any)"
ef7d76d6bcfd some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3364
diff changeset
  1182
2067
cda10b41aa0f use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
  1183
    |s row|
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
  1184
2067
cda10b41aa0f use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
  1185
    description canSelect ifFalse:[^ false].
cda10b41aa0f use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
  1186
    s := description selectSelector.
cda10b41aa0f use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
  1187
    s isNil ifTrue:[^ true].
cda10b41aa0f use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
  1188
3264
642d79a1b0d6 care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents: 3240
diff changeset
  1189
    row := dataSet at:aRowNr ifAbsent:[^ false].
2067
cda10b41aa0f use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
  1190
    columnAdaptor notNil ifTrue:[
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  1191
        ^ columnAdaptor perform:s withOptionalArgument:row and:columnNumber and:aRowNr and:dataSet
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
  1192
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
  1193
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  1194
    ^ row perform:s withOptionalArgument:columnNumber and:aRowNr and:dataSet
3264
642d79a1b0d6 care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents: 3240
diff changeset
  1195
642d79a1b0d6 care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents: 3240
diff changeset
  1196
    "Modified: / 27-10-2007 / 10:27:20 / cg"
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
  1197
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
  1198
2864
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1199
choicesFor:aRow at:aRowNr
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1200
    |choicesSelector|
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1201
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1202
    choicesSelector := description choices.
2897
1ff11b4ffed5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2865
diff changeset
  1203
    choicesSelector isNil ifTrue:[^ nil].
2864
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1204
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1205
    columnAdaptor notNil ifTrue:[
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1206
        ^ columnAdaptor perform:choicesSelector withOptionalArgument:aRow and:columnNumber and:aRowNr and:dataSet
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1207
    ].
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1208
    ^ aRow perform:choicesSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1209
!
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1210
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
  1211
containsText
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
  1212
    "returns true if text might exist
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
  1213
    "
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1214
    ^ containsText
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
  1215
!
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
  1216
2074
89565d366510 doubleClick and menu via columnAdaptor
martin
parents: 2067
diff changeset
  1217
doubleClickOn:aRowNr
2694
82289374e92e dblCLickOn: multi-args
werner
parents: 2693
diff changeset
  1218
    |sel row|
2074
89565d366510 doubleClick and menu via columnAdaptor
martin
parents: 2067
diff changeset
  1219
89565d366510 doubleClick and menu via columnAdaptor
martin
parents: 2067
diff changeset
  1220
    (sel := self doubleClickedSelector) notNil ifTrue:[
2694
82289374e92e dblCLickOn: multi-args
werner
parents: 2693
diff changeset
  1221
        row := dataSet at:aRowNr.
2074
89565d366510 doubleClick and menu via columnAdaptor
martin
parents: 2067
diff changeset
  1222
        columnAdaptor notNil ifTrue:[
2694
82289374e92e dblCLickOn: multi-args
werner
parents: 2693
diff changeset
  1223
            ^ columnAdaptor perform:sel withOptionalArgument:row and:columnNumber and:aRowNr and:dataSet
2074
89565d366510 doubleClick and menu via columnAdaptor
martin
parents: 2067
diff changeset
  1224
        ].
2694
82289374e92e dblCLickOn: multi-args
werner
parents: 2693
diff changeset
  1225
        ^ row perform:sel withOptionalArgument:columnNumber and:aRowNr and:dataSet
2074
89565d366510 doubleClick and menu via columnAdaptor
martin
parents: 2067
diff changeset
  1226
    ].
89565d366510 doubleClick and menu via columnAdaptor
martin
parents: 2067
diff changeset
  1227
!
89565d366510 doubleClick and menu via columnAdaptor
martin
parents: 2067
diff changeset
  1228
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
  1229
hasChoices:aRowNr
2864
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1230
    |row|
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1231
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1232
    row := dataSet at:aRowNr.
a2b8598dc659 fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1233
    ^ (self choicesFor:row at:aRowNr) notNil
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
  1234
!
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
  1235
1950
ps
parents: 1940
diff changeset
  1236
hasPotentialNonConstantBackground
ps
parents: 1940
diff changeset
  1237
    (backgroundColor notNil and:[backgroundColor isImageOrForm]) ifTrue:[^ true].
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
  1238
    description backgroundSelector notNil ifTrue:[^ true].
1950
ps
parents: 1940
diff changeset
  1239
    ^ false.
ps
parents: 1940
diff changeset
  1240
!
ps
parents: 1940
diff changeset
  1241
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  1242
hasRelativeWidth
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  1243
    "returns true if width is relative
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  1244
    "
4963
f6db5a9da095 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 4821
diff changeset
  1245
    ^ descWidth isInteger not. "/ descWidth isLimitedPrecisionReal 
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  1246
!
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  1247
3240
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1248
hasRowSeparatorAt:rowNumber
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1249
    |row bool|
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1250
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1251
    rowSeparatorSelector isNil ifTrue:[^ true ].
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1252
    row := dataSet at:rowNumber.
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1253
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1254
    columnAdaptor isNil ifTrue:[
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1255
        bool := row perform:rowSeparatorSelector.
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1256
    ] ifFalse:[
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1257
        bool := columnAdaptor perform:rowSeparatorSelector
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1258
                    withOptionalArgument:row and:columnNumber and:rowNumber and:dataSet.
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1259
    ].
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1260
    ^ bool ~~ false
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1261
!
2afa6e06b634 bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents: 3218
diff changeset
  1262
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1263
heightOfHighestRow
1725
897453804fa8 made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
  1264
    "returns the height of the highest row in pixels.
897453804fa8 made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
  1265
     Warning: 
897453804fa8 made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
  1266
        only the first numberOfRowsProbedForColumnSize are probed,
897453804fa8 made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
  1267
        in case the access is expensive (dataBase apps)
3992
184aff1e22bc changed:
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  1268
     If the descriptor defines a height, that is used, and the items are not probed at all.
4331
7c89cfb5b3a4 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  1269
     If the descriptor's height is -1 or #fontHeight, that is used.
4332
601cf68cb5a4 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  1270
     If the descriptor's height is #heightOfFirstRow, only the first columns height is probed.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1271
    "
4331
7c89cfb5b3a4 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  1272
    |h end bE editorType row1|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1273
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1274
    (h := description height) == 0 ifTrue:[
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1275
        containsText ifTrue:[
5839
c97a4a9153f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5673
diff changeset
  1276
            "/ search first non-empty drawable object
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
  1277
            end := description numberOfRowsProbedForColumnSize min:dataSet size.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1278
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  1279
            1 to:end do:[:rowNr| |row|
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  1280
                row := dataSet at:rowNr.
2444
e3488b6592cd refactored (do not overuse blocks)
penk
parents: 2443
diff changeset
  1281
                h := h max:(self heightOfLabel:(self shownValueForRow:row rowNr:rowNr))
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1282
            ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1283
        ]
3992
184aff1e22bc changed:
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  1284
    ] ifFalse:[
4332
601cf68cb5a4 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  1285
        ((h == #heightOfFirstRow) or:[ h == #askFirst]) ifTrue:[
4335
5c5fd7a5565b class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4332
diff changeset
  1286
            h := 0.
5c5fd7a5565b class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4332
diff changeset
  1287
            containsText ifTrue:[
5c5fd7a5565b class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4332
diff changeset
  1288
                row1 := dataSet at:1.
5c5fd7a5565b class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4332
diff changeset
  1289
                row1 notNil ifTrue:[
5c5fd7a5565b class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4332
diff changeset
  1290
                    h := self heightOfLabel:(self shownValueForRow:row1 rowNr:1)
5c5fd7a5565b class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4332
diff changeset
  1291
                ]
5c5fd7a5565b class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4332
diff changeset
  1292
            ].
4331
7c89cfb5b3a4 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  1293
        ] ifFalse:[
7c89cfb5b3a4 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  1294
            (h == #fontHeight or:[ h isNumber and:[h < 0] ]) ifTrue:[
7c89cfb5b3a4 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  1295
                h := dataSet font heightOn:dataSet device.
4335
5c5fd7a5565b class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4332
diff changeset
  1296
            ] ifFalse:[
5601
fd6296176c88 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  1297
                h isNumber ifFalse:[
fd6296176c88 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  1298
                    h := 0
fd6296176c88 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  1299
                ].
4331
7c89cfb5b3a4 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  1300
            ].
3992
184aff1e22bc changed:
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  1301
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1302
    ].
3992
184aff1e22bc changed:
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  1303
1559
1e7f30057e22 care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  1304
    (bE := buttonExtent y) = 0 ifTrue:[
3505
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
  1305
        editorType := description editorType.
f5964848f894 refactored;
Claus Gittinger <cg@exept.de>
parents: 3462
diff changeset
  1306
        (editorType == #ComboList or:[ editorType  == #ComboBox]) ifTrue:[
1559
1e7f30057e22 care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  1307
            bE := dataSet comboButtonExtent y.
1e7f30057e22 care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  1308
        ].
1e7f30057e22 care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  1309
    ].
1e7f30057e22 care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  1310
    ^ h max:bE
1725
897453804fa8 made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
  1311
5601
fd6296176c88 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  1312
    "Modified: / 13-09-2017 / 15:44:36 / cg"
5839
c97a4a9153f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5673
diff changeset
  1313
    "Modified (format): / 29-07-2018 / 09:51:43 / Claus Gittinger"
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1314
!
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1315
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1316
heightOfLabel:aLabel
3462
d2df3607bfb5 mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents: 3460
diff changeset
  1317
    "returns the height of the label"
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1318
4332
601cf68cb5a4 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  1319
    |h font|
3992
184aff1e22bc changed:
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  1320
3462
d2df3607bfb5 mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents: 3460
diff changeset
  1321
    aLabel isNil ifTrue:[ ^ 0 ].
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1322
    aLabel isImageOrForm ifTrue:[ 
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1323
        ^ aLabel heightOn:dataSet
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1324
    ].
5264
18e38a656dcf #BUGFIX by Maren
matilk
parents: 5205
diff changeset
  1325
5205
586b40171cfe #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5054
diff changeset
  1326
    font := dataSet deviceFont.
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1327
    h := description height.
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1328
    (h == #fontHeight or:[h isNumber and:[h < 0]]) ifTrue:[
4332
601cf68cb5a4 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  1329
        ^ font height
3992
184aff1e22bc changed:
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  1330
    ].
184aff1e22bc changed:
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  1331
5205
586b40171cfe #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5054
diff changeset
  1332
    aLabel isString ifTrue:[
3462
d2df3607bfb5 mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents: 3460
diff changeset
  1333
        "/ if multiple lines - count 'em
d2df3607bfb5 mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents: 3460
diff changeset
  1334
        (aLabel includes:Character cr) ifTrue:[
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1335
            ^ aLabel asStringCollection 
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1336
                inject:0 into:[:sumH :line | sumH + (line heightOn:dataSet)]
3462
d2df3607bfb5 mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents: 3460
diff changeset
  1337
        ].
4332
601cf68cb5a4 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  1338
        ^ font heightOf:aLabel
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1339
    ].
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1340
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1341
    aLabel isSequenceable ifTrue:[
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1342
        ^ aLabel inject:0 into:[:sumH :line | sumH + (line heightOn:dataSet)].
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1343
    ].
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1344
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1345
    ^ aLabel 
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1346
            perform:#heightOn: 
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1347
            with:dataSet 
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1348
            ifNotUnderstood:[aLabel displayString heightOn:dataSet].
3992
184aff1e22bc changed:
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  1349
184aff1e22bc changed:
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  1350
    "Modified: / 20-01-2011 / 18:03:38 / cg"
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1351
!
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1352
1937
1eb0ed685b71 enable/disable resizeability
ca
parents: 1928
diff changeset
  1353
isResizeable
1eb0ed685b71 enable/disable resizeability
ca
parents: 1928
diff changeset
  1354
    "returns true if the row is resizeable
1eb0ed685b71 enable/disable resizeability
ca
parents: 1928
diff changeset
  1355
    "
1eb0ed685b71 enable/disable resizeability
ca
parents: 1928
diff changeset
  1356
    ^ description isResizeable
1eb0ed685b71 enable/disable resizeability
ca
parents: 1928
diff changeset
  1357
!
1eb0ed685b71 enable/disable resizeability
ca
parents: 1928
diff changeset
  1358
2542
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
  1359
isRowVisible:rowNr
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
  1360
    ^ description rowIsVisible:(dataSet at:rowNr)
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
  1361
!
fc78c87abbd2 +visibilitySelector
penk
parents: 2502
diff changeset
  1362
3767
72bb638a96e2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  1363
isSortable
72bb638a96e2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  1364
    ^ description isSortable
72bb638a96e2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  1365
!
72bb638a96e2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  1366
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1367
showColSeparator
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1368
    "returns true if column separator is on
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1369
    "
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
  1370
    ^ showColSeparator
1133
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
  1371
!
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
  1372
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
  1373
showSelectionHighLighted
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
  1374
    "returns true if selection is highLighted
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
  1375
    "
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
  1376
    ^ description showSelectionHighLighted ~~ false
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1377
!
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1378
2865
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
  1379
translatedChoicesFor:aRow at:aRowNr
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
  1380
    |translatedChoicesSelector|
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
  1381
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
  1382
    translatedChoicesSelector := description translatedChoices.
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
  1383
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
  1384
    columnAdaptor notNil ifTrue:[
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
  1385
        ^ columnAdaptor perform:translatedChoicesSelector withOptionalArgument:aRow and:columnNumber and:aRowNr and:dataSet
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
  1386
    ].
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
  1387
    ^ aRow perform:translatedChoicesSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
  1388
!
688eb125fe89 added xlatedChoices
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
  1389
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1390
widthOfLabel:aLabel
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1391
    "returns the width of the label"
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1392
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1393
    aLabel isNil ifTrue:[ ^ 0 ].
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1394
    (aLabel isString or:[aLabel isImageOrForm]) ifTrue:[
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1395
        ^ aLabel widthOn:dataSet
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1396
    ].
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1397
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1398
    aLabel isSequenceable ifTrue:[
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1399
        ^ aLabel inject:0 into:[:sumW :line | sumW max:(line widthOn:dataSet)].
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1400
    ].
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1401
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1402
    ^ aLabel 
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1403
        perform:#widthOn: with:dataSet 
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1404
        ifNotUnderstood:[aLabel displayString widthOn:dataSet].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1405
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1406
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1407
!DataSetColumn methodsFor:'searching'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1408
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1409
findRowNrStartingWithChar:aChar start:start stop:stop
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1410
    "find the first row starting at start to stop, which drawable label
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1411
     starts with the character, aChar. The index of the detected row is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1412
     returned or if no row is found 0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1413
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1414
    |char|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1415
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1416
    containsText ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1417
        char  := aChar asLowercase.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1418
2211
f14db8e094b9 pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  1419
        start to:stop do:[:eachNr| |row lbl|
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2635
diff changeset
  1420
            (dataSet isRowSelectable:eachNr) ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2635
diff changeset
  1421
                row := dataSet at:eachNr.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2635
diff changeset
  1422
                lbl := self shownValueForRow:row rowNr:eachNr.
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1423
5348
cc2400eba609 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5311
diff changeset
  1424
                lbl isNonByteCollection ifTrue:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2635
diff changeset
  1425
                    lbl := lbl at:1 ifAbsent:nil
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2635
diff changeset
  1426
                ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1427
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2635
diff changeset
  1428
                (lbl respondsTo:#string) ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2635
diff changeset
  1429
                    lbl := lbl string.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2635
diff changeset
  1430
                    (lbl size ~~ 0 and:[(lbl at:1) asLowercase == char]) ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2635
diff changeset
  1431
                        ^ eachNr
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2635
diff changeset
  1432
                    ]
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2635
diff changeset
  1433
                ] ifFalse:[
4248
dc2031ba7c52 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4234
diff changeset
  1434
                    lbl notNil ifTrue:[ ^ 0 ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2635
diff changeset
  1435
                ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2635
diff changeset
  1436
            ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1437
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1438
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1439
    ^ 0
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1440
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1441
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1442
!DataSetColumn class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1443
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1444
version
4821
b53364768c88 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4660
diff changeset
  1445
    ^ '$Header$'
3767
72bb638a96e2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  1446
!
72bb638a96e2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  1447
72bb638a96e2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  1448
version_CVS
4821
b53364768c88 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4660
diff changeset
  1449
    ^ '$Header$'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1450
! !
4230
acf268d95fd0 class: DataSetColumn
Claus Gittinger <cg@exept.de>
parents: 4151
diff changeset
  1451