001 /*
002 * Set.java
003 *
004 * The Salamander Project - 2D and 3D graphics libraries in Java
005 * Copyright (C) 2004 Mark McKay
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * You should have received a copy of the GNU Lesser General Public
018 * License along with this library; if not, write to the Free Software
019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020 *
021 * Mark McKay can be contacted at mark@kitfox.com. Salamander and other
022 * projects can be found at http://www.kitfox.com
023 *
024 * Created on August 15, 2004, 2:51 AM
025 */
026
027 package com.kitfox.svg.animation;
028
029 import com.kitfox.svg.SVGElement;
030 import com.kitfox.svg.SVGException;
031 import com.kitfox.svg.SVGLoaderHelper;
032 import com.kitfox.svg.animation.parser.AnimTimeParser;
033 import com.kitfox.svg.xml.StyleAttribute;
034 import org.xml.sax.Attributes;
035 import org.xml.sax.SAXException;
036
037
038 /**
039 * Set is used to set a textual value; most likely for a style element.
040 *
041 * @author Mark McKay
042 * @author <a href="mailto:mark@kitfox.com">Mark McKay</a>
043 */
044 public class SetSmil extends AnimationElement
045 {
046 String toValue;
047
048 /** Creates a new instance of Set */
049 public SetSmil()
050 {
051 }
052
053 public void loaderStartElement(SVGLoaderHelper helper, Attributes attrs, SVGElement parent) throws SAXException
054 {
055 //Load style string
056 super.loaderStartElement(helper, attrs, parent);
057
058 toValue = attrs.getValue("to");
059 }
060
061 protected void rebuild(AnimTimeParser animTimeParser) throws SVGException
062 {
063 super.rebuild(animTimeParser);
064
065 StyleAttribute sty = new StyleAttribute();
066
067 if (getPres(sty.setName("to")))
068 {
069 String newVal = sty.getStringValue();
070 toValue = newVal;
071 }
072 }
073 }