Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
    Copyright 2001,2003  The Apache Software Foundation 
    Licensed 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

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   See the License for the specific language governing permissions and
   limitations under the License.
package org.apache.batik.svggen;
The DefaultStyleHandler class provides the default way to style an SVG Element.

Christophe Jolif
$Id:,v 1.5 2004/08/18 07:14:59 vhardy Exp $
public class DefaultStyleHandler implements StyleHandlerSVGConstants {
Static initializer for which attributes should be ignored on some elements.
    static HashMap ignoreAttributes = new HashMap();
    static {
        Vector textAttributes = new Vector();

Sets the style described by styleMap on the given element. That is sets the xml attributes with their styled value.

element the SVG Element to be styled.
styleMap the Map containing pairs of style property names, style values.
    public void setStyle(Element elementMap styleMap,
                         SVGGeneratorContext generatorContext) {
        String tagName = element.getTagName();
        Iterator iter = styleMap.keySet().iterator();
        String styleName = null;
        while (iter.hasNext()) {
            styleName = (String);
            if (element.getAttributeNS(nullstyleName).length() == 0){
                if (appliesTo(styleNametagName)) {

Controls whether or not a given attribute applies to a particular element.
    protected boolean appliesTo(String styleNameString tagName) {
        Vector v = (Vector).get(tagName);
        if (v == null) {
            return true;
        } else {
            return !v.contains(styleName);
New to GrepCode? Check out our FAQ X