001package com.hfg.svg;
002
003
004import com.hfg.util.StringUtil;
005import com.hfg.xml.XMLTag;
006
007//------------------------------------------------------------------------------
008/**
009 * Object representation of an SVG (Scalable Vector Graphics) 'foreignObject' tag.
010 *
011 * @author J. Alex Taylor, hairyfatguy.com
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 SvgForeignObject extends AbstractSvgNode implements SvgNode
035{
036
037   //**************************************************************************
038   // CONSTRUCTORS
039   //**************************************************************************
040
041   //---------------------------------------------------------------------------
042   public SvgForeignObject()
043   {
044      super(SVG.foreignObject);
045   }
046
047   //---------------------------------------------------------------------------
048   public SvgForeignObject(XMLTag inXMLTag)
049   {
050      this();
051      initFromXMLTag(inXMLTag);
052   }
053
054   //**************************************************************************
055   // PUBLIC METHODS
056   //**************************************************************************
057
058   //---------------------------------------------------------------------------
059   @Override
060   public SvgForeignObject setClass(String inValue)
061   {
062      return (SvgForeignObject) super.setClass(inValue);
063   }
064
065   //---------------------------------------------------------------------------
066   public SvgForeignObject setRequiredExtensions(String inValue)
067   {
068      setAttribute(SvgAttr.requiredExtensions, inValue);
069      return this;
070   }
071
072   //---------------------------------------------------------------------------
073   public SvgForeignObject setX(int inValue)
074   {
075      setAttribute(SvgAttr.x, inValue);
076      return this;
077   }
078
079   //---------------------------------------------------------------------------
080   public Integer getX()
081   {
082      String xAttr = getAttributeValue(SvgAttr.x);
083      return (StringUtil.isSet(xAttr) ? (int) Float.parseFloat(xAttr) : null);
084   }
085
086   //---------------------------------------------------------------------------
087   public SvgForeignObject setY(int inValue)
088   {
089      setAttribute(SvgAttr.y, inValue);
090      return this;
091   }
092
093   //---------------------------------------------------------------------------
094   public Integer getY()
095   {
096      String yAttr = getAttributeValue(SvgAttr.y);
097      return (StringUtil.isSet(yAttr) ? (int) Float.parseFloat(yAttr) : null);
098   }
099
100   //---------------------------------------------------------------------------
101   public SvgForeignObject setWidth(int inValue)
102   {
103      setAttribute(SvgAttr.width, inValue);
104      return this;
105   }
106
107   //---------------------------------------------------------------------------
108   public int getWidth()
109   {
110      return (int) Float.parseFloat(getAttributeValue(SvgAttr.width));
111   }
112
113   //---------------------------------------------------------------------------
114   public SvgForeignObject setHeight(int inValue)
115   {
116      setAttribute(SvgAttr.height, inValue);
117      return this;
118   }
119
120   //---------------------------------------------------------------------------
121   public int getHeight()
122   {
123      return (int) Float.parseFloat(getAttributeValue(SvgAttr.height));
124   }
125
126}