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