File: text_ylist2.svg

package info (click to toggle)
batik 1.16%2Bdfsg-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 29,180 kB
  • sloc: java: 191,940; xml: 19,062; javascript: 1,276; sh: 85; makefile: 5
file content (151 lines) | stat: -rw-r--r-- 6,624 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN" "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd" >
<!--

   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

--><!--      ======================================================================      -->
<!--      Modification of a x attributes                                        -->
<!--                                                                                  -->
<!--      @author nicolas.socheleau@bitflash.com                                      -->
<!--      @version $Id: text_ylist2.svg 1733420 2016-03-03 07:41:59Z gadams $      -->
<!--      ======================================================================      -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css"      ?>

<svg width="450" viewBox="0 0 450 500" height="500" id="body">
   <title>&lt;text&gt; y attribute &apos;onload&apos;</title>
  <style type="text/css"><![CDATA[
        .test { fill:orange; font-size:16 }
        .testshadow { fill:#bbb; font-size:16  }
  ]]></style>
  <defs>
     <text id="myText">SVGLengthList</text>
  </defs>
  <text x="50%" y="45" class="title">&lt;text&gt; getY() in &apos;onload&apos;
  </text>
  <script type="text/ecmascript"><![CDATA[    
        function getNumberOfItems(evt) 
        {        
           var elt = evt.target;        
           nb = elt.getY().getBaseVal().getNumberOfItems();        
           var text = elt.getOwnerDocument().getElementById('test1_text');        
           text.getFirstChild().appendData(" "+nb+" y");    
        }

        function insertItemBefore(evt,fromIndex,index) 
        {        
           var elt = evt.target;        
           lengthProvider = elt.getOwnerDocument().getElementById('test1');
           l = lengthProvider.getY().getBaseVal().getItem(fromIndex);
           nb = elt.getY().getBaseVal().insertItemBefore(l,index);        
           var text = elt.getOwnerDocument().getElementById('test4_text');        
           text.getFirstChild().appendData(" ("+nb.getValueAsString()+")");    
        }
        function replaceItem(evt,fromIndex,index) 
        {        
           var elt = evt.target;        
           lengthProvider = elt.getOwnerDocument().getElementById('test1');
           l = lengthProvider.getY().getBaseVal().getItem(fromIndex);
           nb = elt.getY().getBaseVal().replaceItem(l,index);        
           var text = elt.getOwnerDocument().getElementById('test5_text');        
           text.getFirstChild().appendData(" ("+nb.getValueAsString()+")");    
        }

        function initializeAppendItem(evt,fromIndex1,fromIndex2) 
        {        
           var elt = evt.target;        
           lengthProvider = elt.getOwnerDocument().getElementById('test1');
           l = lengthProvider.getY().getBaseVal().getItem(fromIndex1);
           nb = elt.getY().getBaseVal().initialize(l);        
           var text = elt.getOwnerDocument().getElementById('test71_text');        
           text.getFirstChild().appendData(" ("+nb.getValueAsString()+")");
           l = lengthProvider.getY().getBaseVal().getItem(fromIndex2);
           nb = elt.getY().getBaseVal().appendItem(l);        
           text = elt.getOwnerDocument().getElementById('test72_text');        
           text.getFirstChild().appendData(" ("+nb.getValueAsString()+")");
        }

   ]]></script>
   <g id="test-content" transform="matrix(1.0 0.0 0.0 1.0 -148.27586 -91.37931)">
     <g>
       <!-- onload="getNumberOfItems(evt)" -->
       <text x="180" y="160" font-size="11">getNumberOfItems</text>
       <g transform="translate(0,30)">
         <text class="testshadow"><tref xlink:href="#myText" x="160" y="220 210 230 220"></tref></text>
       </g>
       <text class="test"><tref id="test1" xlink:href="#myText" x="160" y="220 210 230 220 220"
             onload="getNumberOfItems(evt)"
        ></tref></text>
       <text x="160" font-size="9" y="290" id="test1_text">
          text with
       </text>
     </g>

     <g transform="translate(0,150)" >
        <!-- onload="insertItemBefore(evt)" -->
        <text x="180" y="160" font-size="11"  >insertItemBefore</text>

       <g transform="translate(0,30)">
         <text class="testshadow"><tref xlink:href="#myText" x="160" y="220 210 230 220"></tref></text>
       </g>
       <text class="test"><tref xlink:href="#myText" x="160" y="220 210 230 220"
             onload="insertItemBefore(evt,1,0)"
        ></tref></text>

     <text x="160" font-size="9" y="290"  id="test4_text">
        inserted point
     </text>
    </g>

     <g transform="translate(150,150)" >
        <!-- onload="replaceItem(evt)" -->
        <text x="180" y="160" font-size="11"  >replaceItem</text>

       <g transform="translate(0,30)">
         <text class="testshadow"><tref xlink:href="#myText" x="160" y="220 210 230 220"></tref></text>
       </g>
       <text class="test"><tref xlink:href="#myText" x="160" y="220 210 230 220"
             onload="replaceItem(evt,2,1)"
        ></tref></text>

     <text x="160" font-size="9" y="290"  id="test5_text">
        replaced point
     </text>
    </g>

     <g transform="translate(300,150)" >
        <!-- onload="removeItem(evt)" -->
        <text x="180" y="160" font-size="11"  >removeItem</text>

       <g transform="translate(0,30)">
         <text class="testshadow"><tref xlink:href="#myText" x="160" y="220 210 230 220"></tref></text>
       </g>
       <text class="test"><tref xlink:href="#myText" x="160" y="220 210 230 220"
             onload="initializeAppendItem(evt,0,0)"
        ></tref></text>

     <text x="160" font-size="9" y="275"  id="test71_text">
        intialized point 
     </text>
     <text x="160" font-size="9" y="285"  id="test72_text">
        appended point
     </text>
    </g>


</g>
</svg>