/*
 * FILE: Metadata.java
 * DATE OF CREATION: Mon Dec 01 10:12:36 2003
 * AUTHOR : Emmanuel Pietriga (emmanuel@claribole.net)
 * MODIF: Emmanuel Pietriga (emmanuel.pietriga@inria.fr)
 * Copyright (c) Emmanuel Pietriga, 2003. All Rights Reserved
 * Copyright (c) INRIA, 2010-2011. All Rights Reserved
 * Licensed under the GNU LGPL. For full terms see the file COPYING.
 *
 * $Id: Metadata.java 4271 2011-02-25 07:44:36Z epietrig $
 */
package fr.inria.zvtm.svg;

/**
 * Metadata associated with SVG graphical elements (title, URL, ...).
 * Attached to glyphs generated by SVGReader.
 * Use Glyph.getOwner() to retrieve this information.
 */
public class Metadata {

    String url;
    String title;
    String url_title;
    String closestAncestorGroupClass;
    String closestGroupID;

    public Metadata(String url, String title, String url_title, String cagid, String cagc) {
        this.url = url;
        this.title = title;
        this.url_title = url_title;
        this.closestGroupID = cagid;
        this.closestAncestorGroupClass = cagc;
    }

    /**
     * Set a URL for this part of the SVG document tree.
     */
    public void setURL(String s) {
        url = s;
    }

    /**
     * Get URL associated with this part of the SVG document tree.
     *
     * @return null if none specified.
     */
    public String getURL() {
        return url;
    }

    /**
     * Set a URL's title for this part of the SVG document tree.
     */
    public void setURLTitle(String s) {
        url_title = s;
    }

    /**
     * Get the URL's title associated with this part of the SVG document tree.
     *
     * @return null if none specified.
     */
    public String getURLTitle() {
        return url_title;
    }

    /**
     * Set a Title for this part of the SVG document tree.
     */
    public void setTitle(String s) {
        title = s;
    }

    /**
     * Get Title associated with this part of the SVG document tree.
     *
     * @return null if none specified.
     */
    public String getTitle() {
        return title;
    }

    public void setClosestAncestorGroupClass(String s) {
        closestAncestorGroupClass = s;
    }

    /**
     * @return null if none
     */
    public String getClosestAncestorGroupClass() {
        return closestAncestorGroupClass;
    }

    public void setClosestAncestorGroupID(String s) {
        closestGroupID = s;
    }

    /**
     * @return null if none
     */
    public String getClosestAncestorGroupID() {
        return closestGroupID;
    }

    @Override
    public String toString() {
        return "title=" + ((title != null) ? title : SVGReader.EMPTY_STRING)
            + " url=" + ((url != null) ? url : SVGReader.EMPTY_STRING)
            + " url_title=" + ((url_title != null) ? url_title : SVGReader.EMPTY_STRING)
            + " group ID=" + ((closestGroupID != null) ? closestGroupID : SVGReader.EMPTY_STRING);
    }

}
