DataSetColumn.st
author Claus Gittinger <cg@exept.de>
Fri, 24 Sep 1999 14:51:23 +0200
changeset 1558 00b34d71898a
parent 1526 a5dbe699323f
child 1559 1e7f30057e22
permissions -rw-r--r--
columnAdaptor also used when retrieving a ComboBoxes list.
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
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    12
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    13
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    14
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    15
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    16
Object subclass:#DataSetColumn
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
    17
	instanceVariableNames:'columnNumber dataSet width description buttonExtent shownValue
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
    18
		rendererType backgroundColor rowSeparatorSelector
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
    19
		showColSeparator showRowSeparator foregroundColor fgSelector
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
    20
		bgSelector columnAlignment label readSelector containsText
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
    21
		numArgsToReadSelector columnAdaptor descWidth descMinWidth'
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
    22
	classVariableNames:''
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    23
	poolDictionaries:''
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    24
	category:'Views-DataSet'
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    25
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    26
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    27
!DataSetColumn class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    28
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    29
copyright
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    30
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    31
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    32
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    33
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    34
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    35
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    36
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    37
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    38
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    39
 hereby transferred.
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
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    45
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    46
documentation
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    47
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    48
    represent one single column description of a DataSetView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    49
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    50
    [Instance variables:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    51
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    52
        columnNumber    <Integer>               sequence number (into list of columns)
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    53
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    54
        dataSet         <DSVColumnView>         the view it belongs to
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    55
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    56
        width           <Integer>               width of column
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
        description     <DataSetColumnSpec>     the column description
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    59
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    60
        buttonExtent    <Point>                 extent of drawable form
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    61
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    62
        rendererType    <Type>                  renderer type (cached value from
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    63
                                                the column specification).
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    64
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    65
        backgroundColor <Color or nil>          background color of all cells or nil
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    66
                                                (nil: use default background color).
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    67
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    68
        foregroundColor <Color or nil>          foreground color of all cells or nil
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    69
                                                (nil: use default foreground color).
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    70
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    71
        fgSelector      <Selector or nil>       access specific foreground color for
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    72
                                                a cell
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    73
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    74
        bgSelector      <Selector or nil>       access specific background color for
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    75
                                                a cell
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    76
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    77
        columnAlignment <Symbol>                align text/icon #left #right or #center
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    78
                                                in row (on default: #left).
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    79
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    80
        label           <label/icon or nil>     label resolved by the builder shown
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    81
                                                in the column description field.
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
    82
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    83
        readSelector    <Symbol>                cached readSelector (from the spec)
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    84
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    85
        numArgsToReadSelector <Integer>         number of arguments to the readSelector
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    86
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    87
        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
    88
                                                read-writeSelectors to extract a column
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    89
                                                from a row object.
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    90
                                                If nil, the row object is used itself.
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
    91
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    92
        showColSeparator <Boolean>              true: vertical separators are enabled;
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    93
                                                separator between columns
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    94
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    95
        showRowSeparator <Boolean>              true: horizontal separators are enabled;
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    96
                                                separator between rows
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    97
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    98
        rowSeparatorSelector <Selector or nil>  access specific showRowSeparator state
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
    99
                                                for a cell
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   100
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   101
    [author:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   102
        Claus Atzkern
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   103
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   104
    [see also:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   105
        DataSetColumnSpec
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   106
        DSVColumnView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   107
        DataSetView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   108
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   109
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   110
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   111
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   112
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   113
!DataSetColumn methodsFor:'accessing'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   114
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   115
at:aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   116
    "get the value of the raw at an index, aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   117
    "
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   118
    ^ self extractColFromRow:(dataSet at:aRowNr).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   119
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   120
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   121
at:aRowNr put:something
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   122
    "set the value of the raw at an index, aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   123
    "
1059
18f81ba4860d if there is a columnAdaptor,
tz
parents: 1043
diff changeset
   124
    |row newRow|
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   125
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   126
    row := dataSet at:aRowNr.
1059
18f81ba4860d if there is a columnAdaptor,
tz
parents: 1043
diff changeset
   127
    newRow := self storeCol:something inRow:row.
18f81ba4860d if there is a columnAdaptor,
tz
parents: 1043
diff changeset
   128
    newRow ~~ row ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   129
        dataSet listAt:aRowNr put:newRow.
1059
18f81ba4860d if there is a columnAdaptor,
tz
parents: 1043
diff changeset
   130
    ]
1065
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   131
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   132
    "Modified: / 7.8.1998 / 22:17:27 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   133
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   134
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   135
backgroundColor
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   136
    "returns the background color or nil
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   137
    "
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   138
    ^ backgroundColor == dataSet backgroundColor ifTrue:[nil]
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   139
                                                ifFalse:[backgroundColor]
1133
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   140
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   141
!
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   142
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   143
backgroundColorFor:aRowNr
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   144
    |bg|
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   145
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   146
    bgSelector notNil ifTrue:[
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   147
        (bg := (dataSet at:aRowNr) perform:bgSelector) notNil ifTrue:[
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   148
            ^ bg
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   149
        ]
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   150
    ].
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   151
    ^ backgroundColor
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   152
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   153
!
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   154
1558
00b34d71898a columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   155
columnAdaptor
00b34d71898a columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   156
    ^ columnAdaptor
00b34d71898a columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   157
!
00b34d71898a columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   158
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   159
description
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   160
    "returns the column description
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   161
    "
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   162
    ^ description
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   163
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   164
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   165
!
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   166
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   167
foregroundColor
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   168
    "returns the foreground color or nil
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   169
    "
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   170
    ^ foregroundColor == dataSet foregroundColor ifTrue:[nil]
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   171
                                                ifFalse:[foregroundColor]
1133
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   172
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   173
!
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   174
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   175
label
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   176
    "get the label assigned to the column
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   177
    "
891
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   178
    ^ label
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   179
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   180
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   181
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   182
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   183
rendererType
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   184
    "returns my renderer type
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   185
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   186
    ^ rendererType
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   187
! !
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   188
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   189
!DataSetColumn methodsFor:'accessing dimension'!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   190
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   191
minWidth
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   192
    "get the minimum width required by the column
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   193
    "
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   194
    descMinWidth notNil ifTrue:[
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   195
        ^ descMinWidth
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   196
    ].
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   197
    width := nil.
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   198
  ^ self width
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   199
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   200
!
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   201
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   202
minimumRequiredWidth
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   203
    "returns the minimum required width
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   204
    "
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   205
    |minWidth|
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   206
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   207
    minWidth := dataSet separatorSize 
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   208
             + (2 * dataSet horizontalSpacing)
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   209
             + label preferredWidth.
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   210
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   211
    ^ minWidth
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   212
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   213
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   214
!
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   215
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   216
setDescWidth:aWidth
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   217
    "set a fixed width
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   218
    "
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   219
    |minWidth|
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   220
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   221
    minWidth     := self minimumRequiredWidth.
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   222
    descWidth    := aWidth max:minWidth.
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   223
    descMinWidth := width := descWidth.
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   224
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   225
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   226
!
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   227
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   228
width
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   229
    "returns the width in pixels
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   230
    "
1526
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   231
    |max  "{ Class:SmallInteger }"
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   232
     lsz  "{ Class:SmallInteger }"|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   233
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   234
    width notNil ifTrue:[^ width].              "/ already computed
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   235
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   236
    descMinWidth notNil ifTrue:[
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   237
        width := descMinWidth.
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   238
      ^ width
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   239
    ].
1482
b703fd600f73 support of relative values
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
   240
1493
045378a0c25e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   241
    (descWidth ~~ 0 and:[descWidth isReal not]) ifTrue:[
045378a0c25e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   242
        width := descMinWidth := descWidth.
045378a0c25e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   243
      ^ width
045378a0c25e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   244
    ].
045378a0c25e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   245
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   246
    width := description minWidth max:(label preferredWidth).
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   247
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   248
    descWidth isReal ifTrue:[
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   249
        width := width max:(descWidth * dataSet width) rounded.
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   250
      ^ width
1482
b703fd600f73 support of relative values
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
   251
    ].
b703fd600f73 support of relative values
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
   252
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   253
    containsText ifTrue:[
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   254
        "/ take maximum 5 entries to calculate the width;
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   255
        "/ can be resized later if neccessary
1526
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   256
        lsz := dataSet size.
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   257
        max := 5 min:dataSet size.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   258
1526
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   259
        max ~~ 0 ifTrue:[
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   260
            1 to:max do:[:i|
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   261
                width := width max:(self widthOfLabel:(shownValue value:(dataSet at:i)))
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   262
            ].
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   263
            width := width max:(self widthOfLabel:(shownValue value:(dataSet at:lsz)))
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   264
        ].
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   265
        description editorType ~~ #None ifTrue:[
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   266
            width := width + (dataSet font widthOn:dataSet device)
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   267
        ].
1493
045378a0c25e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   268
    ] ifFalse:[
045378a0c25e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   269
        max := 1
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   270
    ].
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   271
    width := width + buttonExtent x + dataSet separatorSize + (2 * dataSet horizontalSpacing).
1493
045378a0c25e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   272
045378a0c25e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   273
    max ~~ 0 ifTrue:[
1526
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   274
        descMinWidth := width.
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   275
        description usePreferredWidth ifTrue:[
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   276
            descWidth := width
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   277
        ]
1493
045378a0c25e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   278
    ].
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   279
  ^ width
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   280
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   281
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   282
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   283
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   284
!DataSetColumn methodsFor:'drawing'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   285
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   286
drawLabel:aLabel atX:xLeft y:yTop
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   287
    "redraw label
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   288
    "
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   289
    |x space|
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   290
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   291
    space := dataSet horizontalSpacing.
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   292
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   293
    columnAlignment == #left ifTrue:[
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   294
        x  := xLeft + space.
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   295
    ] ifFalse:[
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   296
        x := width - (aLabel widthOn:dataSet).
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   297
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   298
        columnAlignment == #right ifTrue:[x := x - space]
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   299
                                 ifFalse:[x := x // 2].
1447
aaebe212f08a drawLabel:aLabel atX:xLeft y:yTop
ah
parents: 1268
diff changeset
   300
        x := xLeft + (x max:0).
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   301
    ].
1447
aaebe212f08a drawLabel:aLabel atX:xLeft y:yTop
ah
parents: 1268
diff changeset
   302
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   303
    aLabel isImageOrForm ifTrue:[
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   304
        aLabel displayOn:dataSet x:x y:yTop.
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   305
      ^ self
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   306
    ].
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   307
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   308
    aLabel displayOn:dataSet x:x y:(yTop + dataSet rowFontAscent)
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   309
!
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   310
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   311
drawLabelsAtX:xLeft y:yTop h:h from:start to:stop
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   312
    "redraw labels from start to stop
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   313
    "
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   314
    |fg bg label row isSel
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   315
     y       "{ Class:SmallInteger }"
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   316
     yT      "{ Class:SmallInteger }"
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   317
     x       "{ Class:SmallInteger }"
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   318
     hspace  "{ Class:SmallInteger }"
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   319
     ascent  "{ Class:SmallInteger }"
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   320
     lblHg   "{ Class:SmallInteger }"
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   321
    |
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   322
    yT := yTop.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   323
    ascent := dataSet rowFontAscent.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   324
    hspace := dataSet horizontalSpacing.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1092
diff changeset
   325
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   326
    start to:stop do:[:anIndex|
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   327
        row := dataSet at:anIndex.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   328
        y := yT.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   329
        x := xLeft.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   330
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   331
     "/ GET BACKGROUND AND FOREGROUND-COLOR
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   332
     "/ ===================================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   333
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   334
        isSel := dataSet isSelected:anIndex inColumn:columnNumber.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   335
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   336
        isSel ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   337
            (      description editorType ~~ #None
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   338
              and:[dataSet selectedColIndex == columnNumber]
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   339
            ) ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   340
                isSel := false
1115
7f3f4581c3d3 clear background
ca
parents: 1113
diff changeset
   341
            ]
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   342
        ].
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   343
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   344
        (isSel and:[description showSelectionHighLighted]) ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   345
            "/ SHOW SELECTED( MUST REDRAW BACKGROUND )
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   346
            "/ =======================================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   347
            fg := dataSet hgLgFgColor.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   348
            bg := dataSet hgLgBgColor.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   349
            dataSet paint:bg.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   350
            dataSet fillRectangleX:x y:y width:width height:h.
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   351
        ] ifFalse:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   352
            bgSelector notNil ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   353
                "/ MUST REDRAW BACKGROUND
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   354
                "/ ======================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   355
                (bg := row perform:bgSelector) notNil ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   356
                    bg := dataSet colorOnDevice:bg
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   357
                ] ifFalse:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   358
                    bg := backgroundColor
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   359
                ].
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   360
                dataSet paint:bg.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   361
                dataSet fillRectangleX:x y:y width:width height:h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   362
            ] ifFalse:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   363
                bg := backgroundColor
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   364
            ].
1100
376515452be4 support of all styles; windows and next
ca
parents: 1092
diff changeset
   365
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   366
            (fgSelector notNil and:[(fg := row perform:fgSelector) notNil]) ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   367
                fg := dataSet colorOnDevice:fg
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   368
            ] ifFalse:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   369
                fg := foregroundColor
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   370
            ]
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   371
        ].
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   372
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   373
     "/ GET AND DRAW LABEL
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   374
     "/ ==================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   375
        rendererType == #rowSelector ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   376
            isSel ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   377
                label := dataSet rowSelectorForm.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   378
                x  := x + hspace.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   379
            ] ifFalse:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   380
                label := nil
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   381
            ]
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   382
        ] ifFalse:[
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   383
            (isSel and:[dataSet hasOpenEditor]) ifTrue:[
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   384
                label := nil
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   385
            ]  ifFalse:[
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   386
                label := shownValue value:row
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   387
            ]
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   388
        ].
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   389
        label notNil ifTrue:[
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   390
            lblHg := self heightOfLabel:label.
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   391
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   392
            lblHg ~~ 0 ifTrue:[
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   393
                y := y + (h - lblHg // 2).
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   394
                dataSet paint:fg on:bg.
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   395
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   396
                (label isSequenceable and:[label isString not]) ifFalse:[
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   397
                    self drawLabel:label atX:x y:y
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   398
                ] ifTrue:[
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   399
                    label do:[:el|
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   400
                        el notNil ifTrue:[
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   401
                            self drawLabel:el atX:x y:y.
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   402
                            y := y + (el heightOn:dataSet).
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   403
                        ]
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   404
                    ]
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   405
                ].
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   406
            ]
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   407
        ].
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   408
        yT := yT + h
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   409
    ]
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   410
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   411
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   412
!
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   413
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   414
drawSeparatorsAtX:xLeft y:yTop h:h from:start to:stop
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   415
    "redraw separators for cells between start and stop
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   416
    "
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   417
    |is3D
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   418
     xL    "{ Class:SmallInteger }"
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   419
     xR    "{ Class:SmallInteger }"
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   420
     yB    "{ Class:SmallInteger }"
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   421
     yT    "{ Class:SmallInteger }"
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   422
     times "{ Class:SmallInteger }"
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   423
    |
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   424
    (showColSeparator or:[showRowSeparator]) ifFalse:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   425
        ^ self
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   426
    ].
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   427
    is3D := dataSet has3Dseparators.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   428
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   429
    is3D ifTrue:[dataSet paint:(dataSet separatorDarkColor)]
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   430
        ifFalse:[dataSet paint:(dataSet foregroundColor)].
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   431
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   432
    times := stop - start + 1.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   433
    xL    := xLeft.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   434
    xR    := xL - 1 + width.
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   435
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   436
    showRowSeparator ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   437
     "/ DRAW SEPARATORS AT BOTTOM( DARK COLOR )
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   438
     "/ =======================================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   439
        yB := yTop - 1 + h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   440
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   441
        rowSeparatorSelector isNil ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   442
            times timesRepeat:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   443
                dataSet displayLineFromX:xL y:yB toX:xR y:yB.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   444
                yB := yB + h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   445
            ]
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   446
        ] ifFalse:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   447
            start to:stop do:[:idx|
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   448
                ((dataSet at:idx) perform:rowSeparatorSelector) ~~ false ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   449
                    dataSet displayLineFromX:xL y:yB toX:xR y:yB
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   450
                ].
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   451
                yB := yB + h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   452
            ]
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   453
        ]
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   454
    ].
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   455
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   456
    showColSeparator ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   457
     "/ DRAW SEPARATORS AT RIGHT( DARK COLOR )
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   458
     "/ ======================================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   459
        yT := yTop.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   460
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   461
        times timesRepeat:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   462
            dataSet displayLineFromX:xR y:yT toX:xR y:(yT - 1 + h).
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   463
            yT := yT + h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   464
        ]
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   465
    ].
1089
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
   466
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   467
    is3D ifFalse:[
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   468
        ^ self
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   469
    ].
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   470
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   471
    dataSet paint:(dataSet separatorLightColor).
1040
c8e6a2ed7928 use the same background color for a selected rowSelector
ca
parents: 1007
diff changeset
   472
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   473
    (     columnNumber == 1
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   474
      or:[(dataSet columnAt:(columnNumber - 1)) showColSeparator]
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   475
    ) ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   476
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   477
     "/ DRAW SEPARATORS AT LEFT( LIGHT COLOR )
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   478
     "/ ======================================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   479
        yT := yTop.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   480
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   481
        times timesRepeat:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   482
            dataSet displayLineFromX:xL y:yT toX:xL y:(yT - 1 + h).
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   483
            yT := yT + h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   484
        ].
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   485
    ] ifFalse:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   486
        xL := xL - 1
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   487
    ].
1092
bc003bc88972 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
   488
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   489
    showRowSeparator ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   490
     "/ DRAW SEPARATORS AT TOP( LIGHT COLOR )
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   491
     "/ =====================================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   492
        yT := yTop.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   493
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   494
        rowSeparatorSelector isNil ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   495
            times timesRepeat:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   496
                dataSet displayLineFromX:xL y:yT toX:xR y:yT.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   497
                yT := yT + h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   498
            ]
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   499
        ] ifFalse:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   500
         "/ CHECK WHETHER PREVIOUS ROW HAS A SEPARATOR AT BOTTOM
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   501
         "/ ====================================================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   502
            start to:stop do:[:idx|
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   503
                (    idx == 1
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   504
                  or:[((dataSet at:(idx - 1)) perform:rowSeparatorSelector) ~~ false]
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   505
                ) ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   506
                    dataSet displayLineFromX:xL y:yT toX:xR y:yT.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   507
                ].
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   508
                yT := yT + h.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   509
            ]
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   510
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   511
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   512
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   513
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   514
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   515
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   516
invalidate
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   517
    "invalidate width of column; forces a recomputation
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   518
    "
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   519
    width := nil.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   520
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   521
!
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   522
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   523
redrawX:xLeft y:yTop h:h from:start to:stop
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   524
    "redraw rows between start and stop
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   525
    "
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   526
    |rH "{ Class:SmallInteger }"
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   527
     y  "{ Class:SmallInteger }"
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   528
    |
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   529
    rH := dataSet rowHeight.
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   530
1115
7f3f4581c3d3 clear background
ca
parents: 1113
diff changeset
   531
    bgSelector isNil ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   532
        dataSet paint:backgroundColor.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   533
        dataSet fillRectangleX:xLeft y:yTop width:width height:h
1115
7f3f4581c3d3 clear background
ca
parents: 1113
diff changeset
   534
    ].
7f3f4581c3d3 clear background
ca
parents: 1113
diff changeset
   535
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   536
 "/ DRAW CELLS: BACKGROUND/FOREGROUND/LABEL
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   537
 "/ =======================================
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   538
    self drawLabelsAtX:xLeft y:yTop h:rH from:start to:stop.
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   539
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   540
 "/ DRAW INDICATORS
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   541
 "/ ===============
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   542
    (rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   543
        y := yTop.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   544
        start to:stop do:[:i|
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   545
            (self hasChoices:i) ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   546
                dataSet drawComboButtonAtX:xLeft y:y w:width
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   547
            ].
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   548
            y := y + rH.
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   549
        ]
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   550
    ] ifFalse:[
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   551
        rendererType == #CheckToggle ifTrue:[
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   552
            y := yTop.
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   553
            start to:stop do:[:i|
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   554
                dataSet drawCheckToggleAtX:xLeft y:y w:width
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   555
                                    state:(self extractColFromRow:(dataSet at:i)).
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   556
                y := y + rH.
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   557
            ]
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   558
        ]
1088
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   559
    ].
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   560
c2e474a7d0f2 add some comment
ca
parents: 1065
diff changeset
   561
 "/ DRAW SEPARATORS
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   562
 "/ ===============
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   563
    self drawSeparatorsAtX:xLeft y:yTop h:rH from:start to:stop
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   564
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   565
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   566
!DataSetColumn methodsFor:'editing'!
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   567
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   568
editorAt:aRowNr
1268
37066c039eb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   569
    |val row|
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   570
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   571
    row := (dataSet at:aRowNr).
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   572
    val := self extractColFromRow:row.
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   573
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   574
    val isText ifTrue:[val := val string].
1558
00b34d71898a columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   575
    ^ description editorOn:row column:self value:val.
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   576
! !
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   577
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   578
!DataSetColumn methodsFor:'event handling'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   579
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   580
doesNotUnderstand:aMessage
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   581
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   582
    (description respondsTo:(aMessage selector)) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   583
        ^ aMessage sendTo:description
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   584
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   585
    ^ super doesNotUnderstand:aMessage
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   586
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   587
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   588
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   589
!DataSetColumn methodsFor:'grow & degrow'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   590
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   591
growWidth:n
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   592
    "grow the width for n pixels
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   593
    "
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   594
    width := self width + n.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   595
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   596
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   597
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   598
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   599
!DataSetColumn methodsFor:'initialization'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   600
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   601
on:aDSVColumnView description:aDescription columnNumber:aNumber label:aLabel
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   602
    "instance creation; set attributes dependent on the description
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   603
    "
1268
37066c039eb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   604
    |device selector format idx type args|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   605
1089
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
   606
    columnNumber     := aNumber.
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
   607
    dataSet          := aDSVColumnView.
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   608
    label            := aLabel.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   609
1089
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
   610
    description      := aDescription.
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
   611
    rendererType     := description rendererType.
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   612
    containsText     := (      rendererType ~~ #CheckToggle
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   613
                          and:[rendererType ~~ #rowSelector]
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   614
                        ).
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   615
    descWidth        := description width.
1526
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   616
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   617
    description usePreferredWidth ifTrue:[
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   618
        descWidth := 0
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   619
    ].
a5dbe699323f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
   620
1089
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
   621
    width            := nil.
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
   622
    device           := dataSet device.
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   623
    shownValue       := [:aRow| nil ].
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   624
    rowSeparatorSelector := description rowSeparatorSelector.
1089
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
   625
    fgSelector       := description foregroundSelector.
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
   626
    bgSelector       := description backgroundSelector.
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   627
    showColSeparator := description showColSeparator.
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   628
    showRowSeparator := description showRowSeparator.
1089
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
   629
    columnAdaptor    := dataSet columnAdaptor.
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
   630
    buttonExtent     := 0 @ 0.
931865a72ba7 make life easier to add new renderer
ca
parents: 1088
diff changeset
   631
    columnAlignment  := #left.
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   632
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   633
    (readSelector := description readSelector) notNil ifTrue:[
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   634
        numArgsToReadSelector := readSelector numArgs.
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   635
    ] ifFalse:[
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   636
        numArgsToReadSelector := 0
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   637
    ].
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   638
1132
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   639
    (backgroundColor := description backgroundColor) isNil ifTrue:[
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   640
        backgroundColor := dataSet backgroundColor
ce5f367af894 redraw changed for: separators and labels
ca
parents: 1115
diff changeset
   641
    ] ifFalse:[
1480
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   642
        backgroundColor := backgroundColor onDevice:dataSet device
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   643
    ].
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   644
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   645
    (foregroundColor := description foregroundColor) isNil ifTrue:[
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   646
        foregroundColor := dataSet foregroundColor
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   647
    ] ifFalse:[
1480
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   648
        foregroundColor := foregroundColor onDevice:dataSet device
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   649
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   650
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   651
    rendererType == #CheckToggle ifTrue:[
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   652
        buttonExtent := dataSet checkToggleExtent.
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   653
      ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   654
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   655
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   656
    rendererType == #rowSelector ifTrue:[
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   657
        buttonExtent := dataSet rowSelectorExtent.
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   658
      ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   659
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   660
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   661
    (rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   662
        buttonExtent := dataSet comboButtonExtent.
883
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   663
    ] ifFalse:[
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   664
        columnAlignment := description columnAlignment
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   665
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   666
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   667
    selector := description printSelector.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   668
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   669
    selector notNil ifTrue:[
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   670
        args := selector numArgs.
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   671
        args == 0 ifTrue:[
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   672
            shownValue := [:aRow| aRow perform:selector ]
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   673
        ] ifFalse:[
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   674
            args == 1 ifTrue:[
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   675
                shownValue := [:aRow| aRow perform:selector with:dataSet ]
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   676
            ] ifFalse:[
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   677
                shownValue := [:aRow| aRow perform:selector with:dataSet with:columnNumber ]
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   678
            ]
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   679
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   680
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   681
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   682
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   683
    (     (format := description formatString) notNil
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   684
     and:[(type   := description type) == #number or:[type == #numberOrNil]]
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   685
    ) ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   686
        "/ has a format string for number (supports only floats)
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   687
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   688
        (idx := format indexOf:$.) ~~ 0 ifTrue:[
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   689
            idx := format size - idx
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   690
        ].
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   691
        format := '%0.', idx printString, 'f'.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   692
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   693
        shownValue := [:aRow||n|
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   694
            n := self extractColFromRow:aRow.
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   695
            n isReal ifTrue:[n := n asFloat printfPrintString:format].
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   696
            n
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   697
        ]
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   698
    ] ifFalse:[         "/ default: no format string
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   699
        shownValue := [:aRow| self extractColFromRow:aRow ]
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   700
    ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   701
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   702
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   703
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   704
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   705
!DataSetColumn methodsFor:'private'!
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   706
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   707
extractColFromRow:aRow
1226
877cadb5d798 allow for nil readSelector
Claus Gittinger <cg@exept.de>
parents: 1187
diff changeset
   708
    readSelector isNil ifTrue:[^ nil].
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   709
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   710
    columnAdaptor notNil ifTrue:[
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   711
        numArgsToReadSelector == 1 ifTrue:[
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   712
            ^ columnAdaptor perform:readSelector with:aRow
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   713
        ].
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   714
        ^ columnAdaptor perform:readSelector with:aRow with:columnNumber
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   715
    ].
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   716
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   717
    numArgsToReadSelector == 0 ifTrue:[
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   718
        ^ aRow perform:readSelector
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   719
    ].
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   720
    ^ aRow perform:readSelector with:columnNumber
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   721
!
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   722
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   723
storeCol:newValue inRow:aRow
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   724
    |writeSelector numArgs|
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   725
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   726
    writeSelector := description writeSelector.
1226
877cadb5d798 allow for nil readSelector
Claus Gittinger <cg@exept.de>
parents: 1187
diff changeset
   727
    writeSelector isNil ifTrue:[^ aRow].
877cadb5d798 allow for nil readSelector
Claus Gittinger <cg@exept.de>
parents: 1187
diff changeset
   728
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   729
    numArgs := writeSelector numArgs.
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   730
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   731
    columnAdaptor notNil ifTrue:[
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   732
        numArgs == 2 ifTrue:[
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   733
            ^ columnAdaptor perform:writeSelector with:aRow with:newValue
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   734
        ].
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   735
        ^ columnAdaptor perform:writeSelector with:aRow with:columnNumber with:newValue
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   736
    ].
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   737
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   738
    numArgs == 1 ifTrue:[
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   739
        aRow perform:writeSelector with:newValue
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   740
    ] ifFalse:[
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   741
        aRow perform:writeSelector with:columnNumber with:newValue
1059
18f81ba4860d if there is a columnAdaptor,
tz
parents: 1043
diff changeset
   742
    ].
18f81ba4860d if there is a columnAdaptor,
tz
parents: 1043
diff changeset
   743
    ^ aRow
1007
4ea1ecf23596 added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   744
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   745
! !
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   746
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   747
!DataSetColumn methodsFor:'queries'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   748
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   749
canResize
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   750
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   751
    containsText ifTrue:[
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   752
        ^ descWidth == 0 or:[descWidth isReal]
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   753
    ].
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   754
    ^ false
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   755
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   756
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   757
!
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
   758
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   759
canSelect:aRowNr
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   760
    "returns true if cell in column is selectable
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   761
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   762
    |s|
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   763
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   764
    description canSelect ifTrue:[
1065
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   765
        (s := description selectSelector) notNil ifTrue:[
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   766
            columnAdaptor notNil ifTrue:[
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   767
                s numArgs == 2 ifTrue:[
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   768
                    ^ columnAdaptor perform:s with:(dataSet at:aRowNr) with:columnNumber
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   769
                ].
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   770
                ^ columnAdaptor perform:s with:(dataSet at:aRowNr)
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   771
            ].
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   772
            s numArgs == 1 ifTrue:[
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   773
                ^ (dataSet at:aRowNr) perform:s with:columnNumber
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   774
            ].
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   775
            ^ (dataSet at:aRowNr) perform:s
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   776
        ].
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   777
        ^ true
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   778
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   779
    ^ false
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   780
1065
332afeb89d6b modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents: 1059
diff changeset
   781
    "Modified: / 7.8.1998 / 22:49:20 / cg"
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   782
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   783
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   784
containsText
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   785
    "returns true if text might exist
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   786
    "
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   787
    ^ containsText
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   788
!
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   789
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   790
hasChoices:aRowNr
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   791
    ^ (description choicesFor:(dataSet at:aRowNr)) notNil
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   792
!
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   793
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   794
hasRelativeWidth
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   795
    "returns true if width is relative
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   796
    "
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   797
    ^ descWidth isReal
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   798
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   799
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   800
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   801
!
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
   802
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   803
heightOfHighestRow
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   804
    "returns the height of the highest row in pixels
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   805
    "
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   806
    |h end|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   807
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   808
    (h := description height) == 0 ifTrue:[
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   809
        containsText ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   810
            "/ search first none empty drawable object
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   811
            end := 5 min:dataSet size.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   812
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   813
            1 to:end do:[:i|
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   814
                h := h max:(self heightOfLabel:(shownValue value:(dataSet at:i)))
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   815
            ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   816
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   817
    ].
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   818
    ^ h max:(buttonExtent y)
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   819
!
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   820
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   821
heightOfLabel:aLabel
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   822
    "returns the height of the label
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   823
    "
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   824
    |h|
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   825
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   826
    (aLabel isString or:[aLabel isImageOrForm]) ifTrue:[
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   827
        ^ aLabel heightOn:dataSet
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   828
    ].
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   829
    aLabel isNil ifTrue:[ ^ 0 ].
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   830
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   831
    aLabel isSequenceable ifFalse:[
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   832
        ^  aLabel perform:#heightOn: with:dataSet ifNotUnderstood:[
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   833
                aLabel displayString heightOn:dataSet
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   834
           ]
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   835
    ].
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   836
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   837
    h := 0.
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   838
    aLabel do:[:el|h := h + (el heightOn:dataSet)].
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   839
  ^ h
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   840
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   841
!
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   842
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   843
showColSeparator
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   844
    "returns true if column separator is on
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   845
    "
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   846
    ^ showColSeparator
1133
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   847
!
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   848
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   849
showSelectionHighLighted
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   850
    "returns true if selection is highLighted
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   851
    "
619b0afc557a checkin from browser
ca
parents: 1132
diff changeset
   852
    ^ description showSelectionHighLighted ~~ false
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   853
!
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   854
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   855
widthOfLabel:aLabel
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   856
    "returns the width of the label
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   857
    "
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   858
    |w|
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   859
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   860
    (aLabel isString or:[aLabel isImageOrForm]) ifTrue:[
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   861
        ^ aLabel widthOn:dataSet
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   862
    ].
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   863
    aLabel isNil ifTrue:[ ^ 0 ].
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   864
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   865
    aLabel isSequenceable ifFalse:[
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   866
        ^  aLabel perform:#widthOn: with:dataSet ifNotUnderstood:[
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   867
                aLabel displayString widthOn:dataSet
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   868
           ]
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   869
    ].
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   870
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   871
    w := 0.
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   872
    aLabel do:[:el|w := w max:(el widthOn:dataSet)].
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   873
  ^ w
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   874
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   875
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   876
!DataSetColumn methodsFor:'searching'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   877
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   878
findRowNrStartingWithChar:aChar start:start stop:stop
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   879
    "find the first row starting at start to stop, which drawable label
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   880
     starts with the character, aChar. The index of the detected row is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   881
     returned or if no row is found 0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   882
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   883
    |char|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   884
1496
78d702c6c614 bugFix:
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   885
    containsText ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   886
        char  := aChar asLowercase.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   887
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   888
        start to:stop do:[:aRowNr| |lbl|
1147
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   889
            lbl := shownValue value:(dataSet at:aRowNr).
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   890
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   891
            (lbl isSequenceable and:[lbl isString not]) ifTrue:[
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   892
                lbl := lbl at:1 ifAbsent:nil
2d0b9fc2422c new feature:
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   893
            ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   894
1113
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   895
            (lbl respondsTo:#string) ifTrue:[
6b0513d33566 add new functionality
ca
parents: 1100
diff changeset
   896
                lbl := lbl string.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   897
                (lbl size ~~ 0 and:[(lbl at:1) asLowercase == char]) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   898
                    ^ aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   899
                ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   900
            ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   901
                lbl isNil ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   902
                    ^ 0
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   903
                ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   904
            ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   905
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   906
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   907
    ^ 0
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   908
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   909
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   910
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   911
!DataSetColumn class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   912
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   913
version
1558
00b34d71898a columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents: 1526
diff changeset
   914
    ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.52 1999-09-24 12:51:23 cg Exp $'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   915
! !