0
|
1 |
"{ Package: 'stx:goodies/xmlsuite/xsl-fo' }"
|
|
2 |
|
|
3 |
"{ NameSpace: FO }"
|
|
4 |
|
|
5 |
VisualElement subclass:#Table
|
|
6 |
instanceVariableNames:'colWidths'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'FO-fo:table'
|
|
10 |
!
|
|
11 |
|
|
12 |
|
|
13 |
!Table class methodsFor:'accessing'!
|
|
14 |
|
|
15 |
localName
|
|
16 |
"Superclass says that I am responsible to implement this method"
|
|
17 |
|
|
18 |
^'table'
|
|
19 |
|
|
20 |
"Created: / 07-04-2007 / 16:39:36 / janfrog"
|
|
21 |
! !
|
|
22 |
|
|
23 |
!Table methodsFor:'accessing - dimensions'!
|
|
24 |
|
|
25 |
maxCellHeight
|
|
26 |
^ (self foChildNodes inject:0
|
|
27 |
into:[:maxHeight :tableRow | maxHeight max:tableRow preferredHeight ])
|
|
28 |
|
|
29 |
"Created: / 08-04-2007 / 01:02:04 / janfrog"
|
|
30 |
!
|
|
31 |
|
|
32 |
maxCellWidth
|
|
33 |
^ (self foChildNodes inject:0
|
|
34 |
into:[:maxWidth :tableRow |
|
|
35 |
maxWidth max:(tableRow foChildNodes inject:0
|
|
36 |
into:[:maxWidth :tableCell | maxWidth max:tableCell preferredWidth ])
|
|
37 |
])
|
|
38 |
|
|
39 |
"Created: / 08-04-2007 / 01:01:39 / janfrog"
|
|
40 |
!
|
|
41 |
|
|
42 |
preferredHeight
|
|
43 |
|
|
44 |
self tableLayout = 'matrix' ifTrue:
|
|
45 |
[^self preferredHeightForMatrixLayout]
|
|
46 |
|
|
47 |
"Created: / 08-04-2007 / 00:56:50 / janfrog"
|
|
48 |
!
|
|
49 |
|
|
50 |
preferredHeightForMatrixLayout
|
|
51 |
^self foChildNodes size * self maxCellHeight
|
|
52 |
|
|
53 |
"Modified: / 09-04-2007 / 09:55:18 / janfrog"
|
|
54 |
!
|
|
55 |
|
|
56 |
preferredWidth
|
|
57 |
|
|
58 |
self tableLayout = 'matrix' ifTrue:
|
|
59 |
[^self preferredWidthForMatrixLayout]
|
|
60 |
|
|
61 |
"Created: / 08-04-2007 / 00:56:36 / janfrog"
|
|
62 |
!
|
|
63 |
|
|
64 |
preferredWidthForMatrixLayout
|
|
65 |
^self foChildNodes foChildNodes size * self maxCellWidth.
|
|
66 |
|
|
67 |
"Created: / 08-04-2007 / 00:56:50 / janfrog"
|
|
68 |
"Modified: / 09-04-2007 / 09:55:22 / janfrog"
|
|
69 |
! !
|
|
70 |
|
|
71 |
!Table methodsFor:'accessing - layout'!
|
|
72 |
|
|
73 |
tableLayout
|
|
74 |
|
|
75 |
^self
|
|
76 |
getStringProperty:'table-layout'
|
|
77 |
ifAbsent:['fixed']
|
|
78 |
|
|
79 |
"Created: / 07-04-2007 / 16:37:51 / janfrog"
|
|
80 |
! !
|
|
81 |
|
|
82 |
!Table methodsFor:'layout computation'!
|
|
83 |
|
|
84 |
layoutChildren
|
|
85 |
|
|
86 |
self tableLayout = 'matrix' ifTrue:
|
|
87 |
[^self layoutChildrenForMatrixLayout].
|
|
88 |
|
|
89 |
self error:'Unsupported layout type: ',self tableLayout
|
|
90 |
|
|
91 |
"Created: / 08-04-2007 / 00:49:57 / janfrog"
|
|
92 |
!
|
|
93 |
|
|
94 |
layoutChildrenForMatrixLayout
|
|
95 |
|
|
96 |
| cellExtent |
|
|
97 |
cellExtent := self maxCellWidth @ self maxCellHeight.
|
|
98 |
self foChildNodes keysAndValuesDo:[:y :row|
|
|
99 |
row
|
|
100 |
origin: cellExtent * (0 @ (y - 1));
|
|
101 |
extent: cellExtent * (row foChildNodes size @ 1).
|
|
102 |
row foChildNodes keysAndValuesDo:[:x :cell|
|
|
103 |
cell
|
|
104 |
origin: cellExtent * ((x - 1)@0);
|
|
105 |
extent: cellExtent;
|
|
106 |
layoutChildren]]
|
|
107 |
|
|
108 |
"Created: / 08-04-2007 / 00:53:52 / janfrog"
|
|
109 |
"Modified: / 09-04-2007 / 10:28:01 / janfrog"
|
|
110 |
! !
|
|
111 |
|
|
112 |
!Table methodsFor:'rendering'!
|
|
113 |
|
|
114 |
acceptRenderer:arg
|
|
115 |
"Superclass says that I am responsible to implement this method"
|
|
116 |
|
|
117 |
arg renderTable: self
|
|
118 |
|
|
119 |
"Created: / 07-04-2007 / 16:39:36 / janfrog"
|
|
120 |
"Modified: / 08-04-2007 / 00:44:59 / janfrog"
|
|
121 |
! !
|
|
122 |
|
|
123 |
!Table class methodsFor:'documentation'!
|
|
124 |
|
|
125 |
version
|
|
126 |
^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/xsl-fo/FO__Table.st,v 1.1 2007-04-13 15:38:38 vranyj1 Exp $'
|
|
127 |
! !
|