DataSetColumn.st
changeset 4332 601cf68cb5a4
parent 4331 7c89cfb5b3a4
child 4335 5c5fd7a5565b
equal deleted inserted replaced
4331:7c89cfb5b3a4 4332:601cf68cb5a4
  1184      Warning: 
  1184      Warning: 
  1185         only the first numberOfRowsProbedForColumnSize are probed,
  1185         only the first numberOfRowsProbedForColumnSize are probed,
  1186         in case the access is expensive (dataBase apps)
  1186         in case the access is expensive (dataBase apps)
  1187      If the descriptor defines a height, that is used, and the items are not probed at all.
  1187      If the descriptor defines a height, that is used, and the items are not probed at all.
  1188      If the descriptor's height is -1 or #fontHeight, that is used.
  1188      If the descriptor's height is -1 or #fontHeight, that is used.
  1189      If the descriptor's height is #askFirst, only the first columns height is probed.
  1189      If the descriptor's height is #heightOfFirstRow, only the first columns height is probed.
  1190     "
  1190     "
  1191     |h end bE editorType row1|
  1191     |h end bE editorType row1|
  1192 
  1192 
  1193     (h := description height) == 0 ifTrue:[
  1193     (h := description height) == 0 ifTrue:[
  1194         containsText ifTrue:[
  1194         containsText ifTrue:[
  1199                 row := dataSet at:rowNr.
  1199                 row := dataSet at:rowNr.
  1200                 h := h max:(self heightOfLabel:(self shownValueForRow:row rowNr:rowNr))
  1200                 h := h max:(self heightOfLabel:(self shownValueForRow:row rowNr:rowNr))
  1201             ]
  1201             ]
  1202         ]
  1202         ]
  1203     ] ifFalse:[
  1203     ] ifFalse:[
  1204         ((h == #first) or:[ h == #askFirst]) ifTrue:[
  1204         ((h == #heightOfFirstRow) or:[ h == #askFirst]) ifTrue:[
  1205             row1 := dataSet at:1.
  1205             row1 := dataSet at:1.
  1206             h := self heightOfLabel:(self shownValueForRow:row1 rowNr:1)
  1206             h := self heightOfLabel:(self shownValueForRow:row1 rowNr:1)
  1207         ] ifFalse:[
  1207         ] ifFalse:[
  1208             (h == #fontHeight or:[ h isNumber and:[h < 0] ]) ifTrue:[
  1208             (h == #fontHeight or:[ h isNumber and:[h < 0] ]) ifTrue:[
  1209                 h := dataSet font heightOn:dataSet device.
  1209                 h := dataSet font heightOn:dataSet device.
  1223 !
  1223 !
  1224 
  1224 
  1225 heightOfLabel:aLabel
  1225 heightOfLabel:aLabel
  1226     "returns the height of the label"
  1226     "returns the height of the label"
  1227 
  1227 
  1228     |h|
  1228     |h font|
  1229 
  1229 
  1230     aLabel isNil ifTrue:[ ^ 0 ].
  1230     aLabel isNil ifTrue:[ ^ 0 ].
       
  1231     font := dataSet font onDevice:dataSet device.
  1231 
  1232 
  1232     ((h := description height) == #fontHeight or:[ h isNumber and:[h < 0] ]) ifTrue:[
  1233     ((h := description height) == #fontHeight or:[ h isNumber and:[h < 0] ]) ifTrue:[
  1233         ^ dataSet font heightOn:dataSet device
  1234         ^ font height
  1234     ].
  1235     ].
  1235 
  1236 
  1236     (aLabel isString) ifTrue:[
  1237     (aLabel isString) ifTrue:[
  1237         "/ if multiple lines - count 'em
  1238         "/ if multiple lines - count 'em
  1238         (aLabel includes:Character cr) ifTrue:[
  1239         (aLabel includes:Character cr) ifTrue:[
  1239             ^ aLabel asStringCollection inject:0 into:[:sumH :line | sumH + (line heightOn:dataSet)]
  1240             ^ aLabel asStringCollection inject:0 into:[:sumH :line | sumH + (line heightOn:dataSet)]
  1240         ].
  1241         ].
  1241         ^ aLabel heightOn:dataSet
  1242         ^ font heightOf:aLabel
  1242     ].
  1243     ].
  1243     (aLabel isImageOrForm) ifTrue:[
  1244     (aLabel isImageOrForm) ifTrue:[
  1244         ^ aLabel heightOn:dataSet
  1245         ^ font heightOf:aLabel
  1245     ].
  1246     ].
  1246 
  1247 
  1247     aLabel isSequenceable ifFalse:[
  1248     aLabel isSequenceable ifFalse:[
  1248         ^ aLabel 
  1249         ^ aLabel 
  1249                 perform:#heightOn: 
  1250                 perform:#heightOn: 
  1350 ! !
  1351 ! !
  1351 
  1352 
  1352 !DataSetColumn class methodsFor:'documentation'!
  1353 !DataSetColumn class methodsFor:'documentation'!
  1353 
  1354 
  1354 version
  1355 version
  1355     ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.140 2013-08-23 09:29:49 cg Exp $'
  1356     ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.141 2013-08-23 10:05:53 cg Exp $'
  1356 !
  1357 !
  1357 
  1358 
  1358 version_CVS
  1359 version_CVS
  1359     ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.140 2013-08-23 09:29:49 cg Exp $'
  1360     ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.141 2013-08-23 10:05:53 cg Exp $'
  1360 ! !
  1361 ! !
  1361 
  1362