001package com.hfg.html;
002
003
004
005import com.hfg.xml.XMLNode;
006
007//------------------------------------------------------------------------------
008/**
009 * Represents a frame (<frame>) 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// [email protected]
032//------------------------------------------------------------------------------
033
034public class Frame extends HTMLTag
035{
036
037   //##########################################################################
038   // PRIVATE FIELDS
039   //##########################################################################
040
041
042   //##########################################################################
043   // CONSTRUCTORS
044   //##########################################################################
045
046   //--------------------------------------------------------------------------
047   public Frame()
048   {
049      super(HTML.FRAME);
050   }
051
052   //--------------------------------------------------------------------------
053   public Frame(String inName, String inSrc)
054   {
055      this();
056      setName(inName);
057      setSrc(inSrc);
058   }
059
060   //--------------------------------------------------------------------------
061   public Frame(XMLNode inXMLNode)
062   {
063      this();
064      initFromXMLNode(inXMLNode);
065   }
066
067   //##########################################################################
068   // PUBLIC METHODS
069   //##########################################################################
070
071   //--------------------------------------------------------------------------
072   public Frame setName(String inName)
073   {
074      setAttribute(HTML.NAME, inName);
075
076      return this;
077   }
078
079   //--------------------------------------------------------------------------
080   public String getName()
081   {
082      return getAttributeValue(HTML.NAME);
083   }
084
085   //--------------------------------------------------------------------------
086   public Frame setSrc(String inSrc)
087   {
088      setAttribute(HTML.SRC, inSrc);
089
090      return this;
091   }
092
093   //--------------------------------------------------------------------------
094   public String getSrc()
095   {
096      return getAttributeValue(HTML.SRC);
097   }
098
099   //--------------------------------------------------------------------------
100   public Frame setFrameBorder(int inBorder)
101   {
102      setAttribute(HTML.FRAMEBORDER, inBorder + "");
103
104      return this;
105   }
106
107   //--------------------------------------------------------------------------
108   public Integer getFrameBorder()
109   {
110      Integer frameBorder = null;
111
112      String value = getAttributeValue(HTML.FRAMEBORDER);
113      if (value != null)
114      {
115         frameBorder = new Integer(value);
116      }
117
118      return frameBorder;
119   }
120
121   //--------------------------------------------------------------------------
122   public Frame setScrolling(boolean inValue)
123   {
124      setAttribute(HTML.SCROLLING, (inValue ? "yes" : "no"));
125
126      return this;
127   }
128
129   //--------------------------------------------------------------------------
130   public boolean getScrolling()
131   {
132      return (getAttributeValue(HTML.SCROLLING).equalsIgnoreCase("yes") ? true : false);
133   }
134
135   //--------------------------------------------------------------------------
136   public Frame setResizable(boolean inValue)
137   {
138      setAttribute(HTML.RESIZABLE, (inValue ? "yes" : "no"));
139
140      return this;
141   }
142
143   //--------------------------------------------------------------------------
144   public boolean getResizable()
145   {
146      return (getAttributeValue(HTML.RESIZABLE).equalsIgnoreCase("yes") ? true : false);
147   }
148
149
150   // Overrides for HTMLTag setters to allow method chaining.
151
152   //--------------------------------------------------------------------------
153   @Override
154   public Frame addClass(String inValue)
155   {
156      return (Frame) super.addClass(inValue);
157   }
158
159   //--------------------------------------------------------------------------
160   @Override
161   public Frame setClass(String inValue)
162   {
163      return (Frame) super.setClass(inValue);
164   }
165
166   //--------------------------------------------------------------------------
167   @Override
168   public Frame setId(String inValue)
169   {
170      return (Frame) super.setId(inValue);
171   }
172
173   //--------------------------------------------------------------------------
174   @Override
175   public Frame setStyle(CharSequence inValue)
176   {
177      return (Frame) super.setStyle(inValue);
178   }
179
180   //--------------------------------------------------------------------------
181   @Override
182   public Frame addStyle(String inValue)
183   {
184      return (Frame) super.addStyle(inValue);
185   }
186
187}