001    /*
002     * Stop.java
003     *
004     *
005     *  The Salamander Project - 2D and 3D graphics libraries in Java
006     *  Copyright (C) 2004 Mark McKay
007     *
008     *  This library is free software; you can redistribute it and/or
009     *  modify it under the terms of the GNU Lesser General Public
010     *  License as published by the Free Software Foundation; either
011     *  version 2.1 of the License, or (at your option) any later version.
012     *
013     *  This library is distributed in the hope that it will be useful,
014     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
015     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016     *  Lesser General Public License for more details.
017     *
018     *  You should have received a copy of the GNU Lesser General Public
019     *  License along with this library; if not, write to the Free Software
020     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
021     *
022     *  Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
023     *  projects can be found at http://www.kitfox.com
024     *
025     * Created on January 26, 2004, 1:56 AM
026     */
027    
028    package com.kitfox.svg;
029    
030    import com.kitfox.svg.xml.StyleAttribute;
031    import java.awt.*;
032    import java.net.URI;
033    
034    /**
035     * @author Mark McKay
036     * @author <a href="mailto:mark@kitfox.com">Mark McKay</a>
037     */
038    public class A extends Group {
039    
040        URI href;
041        String title;
042    
043        /** Creates a new instance of Stop */
044        public A() {
045        }
046    /*
047        public void loaderStartElement(SVGLoaderHelper helper, Attributes attrs, SVGElement parent)
048        {
049                    //Load style string
050            super.loaderStartElement(helper, attrs, parent);
051    
052            String offset = attrs.getValue("offset");
053            this.offset = (float)XMLParseUtil.parseRatio(offset);
054    
055            buildStop();
056        }
057        */
058        
059        protected void build() throws SVGException
060        {
061            super.build();
062            
063            StyleAttribute sty = new StyleAttribute();
064            
065            if (getPres(sty.setName("xlink:href")))
066            {
067                href = sty.getURIValue(getXMLBase());
068            }
069            
070            if (getPres(sty.setName("xlink:title")))
071            {
072                title = sty.getStringValue();
073            }
074        }
075    
076        /**
077         * Updates all attributes in this diagram associated with a time event.
078         * Ie, all attributes with track information.
079         * @return - true if this node has changed state as a result of the time
080         * update
081         */
082        public boolean updateTime(double curTime) throws SVGException
083        {
084            boolean changeState = super.updateTime(curTime);
085    //        if (trackManager.getNumTracks() == 0) return false;
086    
087            //Get current values for parameters
088            StyleAttribute sty = new StyleAttribute();
089            
090            if (getPres(sty.setName("xlink:href")))
091            {
092                href = sty.getURIValue(getXMLBase());
093            }
094            
095            if (getPres(sty.setName("xlink:title")))
096            {
097                title = sty.getStringValue();
098            }
099            
100            return changeState;
101        }
102    }