xsl-fo/trunk/FO__Element.st
changeset 0 5057afe1ec87
equal deleted inserted replaced
-1:000000000000 0:5057afe1ec87
       
     1 "{ Package: 'stx:goodies/xmlsuite/xsl-fo' }"
       
     2 
       
     3 "{ NameSpace: FO }"
       
     4 
       
     5 XMLv2::Element subclass:#Element
       
     6 	instanceVariableNames:''
       
     7 	classVariableNames:''
       
     8 	poolDictionaries:''
       
     9 	category:'FO'
       
    10 !
       
    11 
       
    12 
       
    13 !Element class methodsFor:'accessing'!
       
    14 
       
    15 allElementClasses
       
    16 
       
    17     ^self allSubclasses select:[:e|e isAbstract not]
       
    18 
       
    19     "Created: / 07-04-2007 / 09:55:56 / janfrog"
       
    20 !
       
    21 
       
    22 isAbstract
       
    23 
       
    24     ^self == FO::Element
       
    25 
       
    26     "Created: / 07-04-2007 / 09:54:32 / janfrog"
       
    27 !
       
    28 
       
    29 localName
       
    30 
       
    31     ^self subclassResponsibility
       
    32 
       
    33     "Created: / 07-04-2007 / 09:54:14 / janfrog"
       
    34 ! !
       
    35 
       
    36 !Element methodsFor:'DOM3 interface - extensions'!
       
    37 
       
    38 appendBlock
       
    39 
       
    40     | block |
       
    41 
       
    42     self appendChild:(block := self ownerDocument createElement: 'block' ns: self namespaceURI).
       
    43     ^block
       
    44 
       
    45     "Created: / 09-04-2007 / 10:42:41 / janfrog"
       
    46 !
       
    47 
       
    48 appendText: aString
       
    49 
       
    50     ^self appendChild:(self ownerDocument createTextNode: aString)
       
    51 
       
    52     "Created: / 07-04-2007 / 10:02:47 / janfrog"
       
    53 ! !
       
    54 
       
    55 !Element methodsFor:'accessing - properties'!
       
    56 
       
    57 getCompositeProperty:localName ifAbsent: aBlock
       
    58 
       
    59     ^((self getProperty: localName ifAbsent:[^aBlock value])
       
    60         tokensBasedOn:Character space) reject:[:e|e isEmpty]
       
    61 
       
    62     "Created: / 07-04-2007 / 16:42:30 / janfrog"
       
    63 !
       
    64 
       
    65 getDimensionProperty:localName ifAbsent: aBlock
       
    66 
       
    67     ^(Unit fromString: (self getStringProperty: localName ifAbsent:[^aBlock value]))
       
    68         inPixels value
       
    69 
       
    70     "Created: / 07-04-2007 / 16:18:53 / janfrog"
       
    71     "Modified: / 07-04-2007 / 23:03:16 / janfrog"
       
    72 !
       
    73 
       
    74 getFirstCompositeProperty:localName ifAbsent: aBlock
       
    75 
       
    76     ^(self getCompositeProperty: localName ifAbsent: aBlock) first
       
    77 
       
    78     "Created: / 07-04-2007 / 16:55:00 / janfrog"
       
    79 !
       
    80 
       
    81 getIntegerProperty:localName ifAbsent: aBlock
       
    82 
       
    83     ^(self getProperty: localName ifAbsent:[^aBlock value])
       
    84         asInteger
       
    85 
       
    86     "Created: / 07-04-2007 / 10:50:52 / janfrog"
       
    87 !
       
    88 
       
    89 getProperty:localName ifAbsent: aBlock
       
    90 
       
    91     ^(attributes getValueByURI:self namespaceURI localName:localName)
       
    92         ifNil:aBlock
       
    93 
       
    94     "Created: / 07-04-2007 / 10:48:43 / janfrog"
       
    95 !
       
    96 
       
    97 getSecondCompositeProperty:localName ifAbsent: aBlock
       
    98 
       
    99     ^(self getCompositeProperty: localName ifAbsent: aBlock) second
       
   100 
       
   101     "Created: / 07-04-2007 / 16:55:06 / janfrog"
       
   102 !
       
   103 
       
   104 getStringProperty:localName ifAbsent: aBlock
       
   105 
       
   106     ^self getProperty: localName ifAbsent:aBlock
       
   107 
       
   108     "Created: / 07-04-2007 / 10:52:08 / janfrog"
       
   109 !
       
   110 
       
   111 getThirdCompositeProperty:localName ifAbsent: aBlock
       
   112 
       
   113     ^(self getCompositeProperty: localName ifAbsent: aBlock) third
       
   114 
       
   115     "Created: / 07-04-2007 / 16:55:15 / janfrog"
       
   116 ! !
       
   117 
       
   118 !Element methodsFor:'children'!
       
   119 
       
   120 foChildNodes
       
   121 
       
   122     ^self childNodes select:[:child|child isKindOf:FO::Element]
       
   123 
       
   124     "Created: / 07-04-2007 / 15:18:06 / janfrog"
       
   125 ! !
       
   126 
       
   127 !Element methodsFor:'children hooks'!
       
   128 
       
   129 onInsertChild: childNode before: refNode
       
   130 
       
   131     self ownerDocument 
       
   132             changed:#hierarchy
       
   133             with: childNode
       
   134             "/from: self
       
   135 
       
   136     "Created: / 07-04-2007 / 11:12:09 / janfrog"
       
   137 ! !
       
   138 
       
   139 !Element methodsFor:'rendering'!
       
   140 
       
   141 acceptRenderer: aRenderer
       
   142 
       
   143     ^self subclassResponsibility
       
   144 
       
   145     "Created: / 07-04-2007 / 10:33:13 / janfrog"
       
   146 ! !
       
   147 
       
   148 !Element methodsFor:'testing'!
       
   149 
       
   150 isBlockLike
       
   151 
       
   152     ^false
       
   153 
       
   154     "Created: / 07-04-2007 / 14:29:54 / janfrog"
       
   155 ! !
       
   156 
       
   157 !Element class methodsFor:'documentation'!
       
   158 
       
   159 version
       
   160     ^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/xsl-fo/FO__Element.st,v 1.1 2007-04-13 15:39:25 vranyj1 Exp $'
       
   161 ! !