All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mathiewz.slick.svg.inkscape.InkscapeNonGeometricData Maven / Gradle / Ivy

Go to download

The main purpose of this libraryis to modernize and maintain the slick2D library.

The newest version!
package com.github.mathiewz.slick.svg.inkscape;

import org.w3c.dom.Element;

import com.github.mathiewz.slick.svg.NonGeometricData;

/**
 * A custom non-geometric data type that can pass back any attribute
 * on the field.
 *
 * @author kevin
 */
public class InkscapeNonGeometricData extends NonGeometricData {
    /** The element read from the SVG */
    private final Element element;

    /**
     * Create a new non-geometric data holder
     *
     * @param metaData
     *            The metadata provided
     * @param element
     *            The XML element from the SVG document
     */
    public InkscapeNonGeometricData(String metaData, Element element) {
        super(metaData);

        this.element = element;
    }

    /**
     * @see com.github.mathiewz.slick.svg.NonGeometricData#getAttribute(java.lang.String)
     */
    @Override
    public String getAttribute(String attribute) {
        String result = super.getAttribute(attribute);
        if (result == null) {
            result = element.getAttribute(attribute);
        }

        return result;
    }

    /**
     * Returns the XML element that is wrapped by this instance.
     *
     * @return The XML element for this instance
     */
    public Element getElement() {
        return element;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy