xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Ross" <ianc...@hotmail.com>
Subject problem with set element
Date Wed, 03 Sep 2003 11:18:24 GMT
Hi guys

I have a problem. Im using the set element to change the stroke of a 
rectangle when i move my mouse over it. The svg produced is this

<g id="G.5" transform="translate(450,50)">
      <rect x="0" y="0" width="100" 
style="fill:rgb(255,0,0);opacity:1;stroke:rgb(0,0,0);stroke-width:1;filter:url(#dropShadow)"

id="S.216.0054.54.8" height="51">
             <set attributeName="stroke-width" end="mouseout" 
attributeType="XML" to="2" begin="mouseover"/>
      </rect>
      <text font-size="12" dominant-baseline="mathematical" 
font-family="Arial" text-decoration="underline" text-anchor="middle">
              <tspan x="50" y="17"><![CDATA[ThirdDriver:]]></tspan>
              <tspan x="50" y="34"><![CDATA[SampleClass3]]></tspan>
       </text>
</g>
This should change the stroke-width of the rectangle and it does when i view 
it in explorer. However it does not change on the canvas.
This is my code.
        Element g = document.createElementNS(svgNS, "g");
        g.setAttributeNS(null, "id", classifierObject.getId());

        Element set = document.createElementNS(svgNS, "set");
        set.setAttributeNS(null, "attributeName", "stroke-width");
                               set.setAttributeNS(null, "attributeType", 
"XML");
                               set.setAttributeNS(null, "to", "2");
        set.setAttributeNS(null, "begin", "mouseover");
        set.setAttributeNS(null, "end", "mouseout");

        Element classifierElement = document.createElementNS(svgNS, "rect");
        classifierElement.setAttributeNS(null, "id", 
classifierObject.getClassId());
                               classifierElement.setAttributeNS(null, 
"width", Integer.toString(width));
                               classifierElement.setAttributeNS(null, 
"height", Integer.toString(height));
        classifierElement.setAttributeNS(null, "x", "0");
                               classifierElement.setAttributeNS(null, "y", 
"0");
                               classifierElement.setAttributeNS(null, 
"style", classifierStyle);

        Element textContainer = document.createElementNS(svgNS, "text");
        textContainer.setAttributeNS(null, "text-decoration", "underline");
        textContainer.setAttributeNS(null, "text-anchor", "middle");
        textContainer.setAttributeNS(null, "dominant-baseline", 
"mathematical");
        textContainer.setAttributeNS(null, "font-family", "Arial");
        textContainer.setAttributeNS(null, "font-size", "12");

        int xpos = (width/2); //text-anchor="middle", 
dominant-baseline="mathematical"
        int ypos = textInterval;
        Element objectText = document.createElementNS(svgNS, "tspan");
        objectText.setAttributeNS(null, "x", Integer.toString(xpos));
        objectText.setAttributeNS(null, "y", Integer.toString(ypos));
        objectText.appendChild(document.createCDATASection(objectName));

        ypos = ypos + textInterval;
        Element classText = document.createElementNS(svgNS, "tspan");
        classText.setAttributeNS(null, "x", Integer.toString(xpos));
        classText.setAttributeNS(null, "y", Integer.toString(ypos));
        classText.appendChild(document.createCDATASection(className));

        //g.appendChild(set);
        //textContainer.appendChild(set);
        textContainer.appendChild(objectText);
        textContainer.appendChild(classText);
        classifierElement.appendChild(set);
        g.appendChild(classifierElement);
        g.appendChild(textContainer);
Also if append the set attribute to the g element rather than the rectangle 
will this make a difference in the case of a button. Also the mouse changes 
when i place it over the text, can this be prevented??
Thanks for your previous replies.
Ian.

_________________________________________________________________
Get less junk mail with ninemsn Premium. Click here  
http://ninemsn.com.au/premium/landing.asp


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message