001package com.hfg.svg;
002
003import com.hfg.util.StringUtil;
004import com.hfg.xml.XMLTag;
005
006//------------------------------------------------------------------------------
007/**
008 * Object representation of an SVG (Scalable Vector Graphics) 'tspan' tag.
009 * <div>
010 * @author J. Alex Taylor, hairyfatguy.com
011 * </div>
012 */
013//------------------------------------------------------------------------------
014// com.hfg XML/HTML Coding Library
015//
016// This library is free software; you can redistribute it and/or
017// modify it under the terms of the GNU Lesser General Public
018// License as published by the Free Software Foundation; either
019// version 2.1 of the License, or (at your option) any later version.
020//
021// This library is distributed in the hope that it will be useful,
022// but WITHOUT ANY WARRANTY; without even the implied warranty of
023// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
024// Lesser General Public License for more details.
025//
026// You should have received a copy of the GNU Lesser General Public
027// License along with this library; if not, write to the Free Software
028// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
029//
030// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
031// jataylor@hairyfatguy.com
032//------------------------------------------------------------------------------
033
034public class SvgTSpan extends AbstractSvgNode implements SvgNode
035{
036
037   //##########################################################################
038   // CONSTRUCTORS
039   //##########################################################################
040
041   //---------------------------------------------------------------------------
042   public SvgTSpan()
043   {
044      super(SVG.tspan);
045   }
046
047   //---------------------------------------------------------------------------
048   public SvgTSpan(CharSequence inTitle)
049   {
050      this();
051      setContent(inTitle);
052   }
053
054   //---------------------------------------------------------------------------
055   public SvgTSpan(XMLTag inXMLTag)
056   {
057      this();
058      initFromXMLTag(inXMLTag);
059   }
060
061   //##########################################################################
062   // PUBLIC METHODS
063   //##########################################################################
064
065
066   //---------------------------------------------------------------------------
067   public SvgTSpan setId(String inValue)
068   {
069      setAttribute(SvgAttr.id, inValue);
070      return this;
071   }
072
073   //---------------------------------------------------------------------------
074   public SvgTSpan setX(int inValue)
075   {
076      setAttribute(SvgAttr.x, inValue);
077      return this;
078   }
079
080   //---------------------------------------------------------------------------
081   public SvgTSpan setX(float inValue)
082   {
083      setAttribute(SvgAttr.x, inValue);
084      return this;
085   }
086
087   //---------------------------------------------------------------------------
088   public Float getX()
089   {
090      String xAttr = getAttributeValue(SvgAttr.x);
091      return (StringUtil.isSet(xAttr) ? Float.parseFloat(xAttr) : null);
092   }
093
094
095   //---------------------------------------------------------------------------
096   public SvgTSpan setY(int inValue)
097   {
098      setAttribute(SvgAttr.y, inValue);
099      return this;
100   }
101
102   //---------------------------------------------------------------------------
103   public SvgTSpan setY(float inValue)
104   {
105      setAttribute(SvgAttr.y, inValue);
106      return this;
107   }
108
109   //---------------------------------------------------------------------------
110   public Float getY()
111   {
112      String yAttr = getAttributeValue(SvgAttr.y);
113      return (StringUtil.isSet(yAttr) ? Float.parseFloat(yAttr) : null);
114   }
115   //---------------------------------------------------------------------------
116   public SvgTSpan setLineHeight(float inValue)
117   {
118      setAttribute(SvgAttr.lineHeight, inValue);
119      return this;
120   }
121
122   //---------------------------------------------------------------------------
123   public Float getLineHeight()
124   {
125      String value = getAttributeValue(SvgAttr.lineHeight);
126      return (StringUtil.isSet(value) ? Float.parseFloat(value) : null);
127   }
128
129   //--------------------------------------------------------------------------
130   @Override
131   public SvgTSpan addStyle(String inValue)
132   {
133      return (SvgTSpan) super.addStyle(inValue);
134   }
135
136   //---------------------------------------------------------------------------
137   @Override
138   public SvgTSpan setStyle(String inValue)
139   {
140      return (SvgTSpan) super.setStyle(inValue);
141   }
142
143}