001package com.hfg.html; 002 003import java.net.URL; 004 005import com.hfg.html.attribute.Align; 006import com.hfg.html.attribute.VAlign; 007import com.hfg.xml.XMLNode; 008 009//------------------------------------------------------------------------------ 010/** 011 Represents an iframe (<iframe>) tag. iframe is not XHTML 1.0 Strict compliant. 012 <div> 013 @author J. Alex Taylor, hairyfatguy.com 014 </div> 015 */ 016//------------------------------------------------------------------------------ 017// com.hfg XML/HTML Coding Library 018// 019// This library is free software; you can redistribute it and/or 020// modify it under the terms of the GNU Lesser General Public 021// License as published by the Free Software Foundation; either 022// version 2.1 of the License, or (at your option) any later version. 023// 024// This library is distributed in the hope that it will be useful, 025// but WITHOUT ANY WARRANTY; without even the implied warranty of 026// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 027// Lesser General Public License for more details. 028// 029// You should have received a copy of the GNU Lesser General Public 030// License along with this library; if not, write to the Free Software 031// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 032// 033// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 034// jataylor@hairyfatguy.com 035//------------------------------------------------------------------------------ 036 037public class IFrame extends HTMLTag 038{ 039 040 //########################################################################## 041 // CONSTRUCTORS 042 //########################################################################## 043 044 //-------------------------------------------------------------------------- 045 public IFrame() 046 { 047 super(HTML.IFRAME); 048 } 049 050 //-------------------------------------------------------------------------- 051 public IFrame(String inSrc) 052 { 053 this(); 054 setSrc(inSrc); 055 } 056 057 //-------------------------------------------------------------------------- 058 public IFrame(URL inSrc) 059 { 060 this(); 061 setSrc(inSrc.toString()); 062 } 063 064 //-------------------------------------------------------------------------- 065 public IFrame(XMLNode inXMLNode) 066 { 067 this(); 068 initFromXMLNode(inXMLNode); 069 } 070 071 //########################################################################## 072 // PUBLIC METHODS 073 //########################################################################## 074 075 //-------------------------------------------------------------------------- 076 public IFrame setSrc(String inValue) 077 { 078 setAttribute(HTML.SRC, inValue); 079 080 return this; 081 } 082 083 //-------------------------------------------------------------------------- 084 public String getSrc() 085 { 086 return getAttributeValue(HTML.SRC); 087 } 088 089 //-------------------------------------------------------------------------- 090 public IFrame setAlign(Align inValue) 091 { 092 setAttribute(inValue.getHTMLAttributeName(), inValue.toString()); 093 094 return this; 095 } 096 097 //-------------------------------------------------------------------------- 098 /** 099 Since an img align attribute allows the normally valign values of 'top' 100 and 'bottom', this alternate setAlign method takes a VAlign object. 101 @param inValue the value to use for the 'align' attribute 102 @return this IFrame object to enable method chaining 103 */ 104 public IFrame setAlign(VAlign inValue) 105 { 106 setAttribute(HTML.ALIGN, inValue.toString()); 107 108 return this; 109 } 110 111 112 //--------------------------------------------------------------------------- 113 public IFrame setName(String inValue) 114 { 115 setAttribute(HTML.NAME, inValue); 116 117 return this; 118 } 119 120 //--------------------------------------------------------------------------- 121 public String getName() 122 { 123 return getAttributeValue(HTML.NAME); 124 } 125 126 127 128 //-------------------------------------------------------------------------- 129 public IFrame setWidth(String inValue) 130 { 131 setAttribute(HTML.WIDTH, inValue); 132 133 return this; 134 } 135 136 //-------------------------------------------------------------------------- 137 public IFrame setWidth(int inValue) 138 { 139 setAttribute(HTML.WIDTH, new Integer(inValue).toString()); 140 141 return this; 142 } 143 144 //-------------------------------------------------------------------------- 145 public String getWidth() 146 { 147 return getAttributeValue(HTML.WIDTH); 148 } 149 150 //-------------------------------------------------------------------------- 151 public IFrame setHeight(String inValue) 152 { 153 setAttribute(HTML.HEIGHT, inValue); 154 155 return this; 156 } 157 158 //-------------------------------------------------------------------------- 159 public IFrame setHeight(int inValue) 160 { 161 setAttribute(HTML.HEIGHT, new Integer(inValue).toString()); 162 163 return this; 164 } 165 166 //-------------------------------------------------------------------------- 167 public String getHeight() 168 { 169 return getAttributeValue(HTML.HEIGHT); 170 } 171 172 173 //-------------------------------------------------------------------------- 174 public IFrame setFrameBorder(boolean inValue) 175 { 176 setAttribute(HTML.FRAMEBORDER, inValue ? 1 : 0); 177 178 return this; 179 } 180 181 //-------------------------------------------------------------------------- 182 public String getFrameBorder() 183 { 184 return getAttributeValue(HTML.FRAMEBORDER); 185 } 186 187 188 //-------------------------------------------------------------------------- 189 public IFrame setTitle(String inValue) 190 { 191 setAttribute(HTML.TITLE, inValue); 192 return this; 193 } 194 195 //-------------------------------------------------------------------------- 196 @Override 197 public IFrame setId(String inValue) 198 { 199 setAttribute(HTML.ID, inValue); 200 return this; 201 } 202 203 //-------------------------------------------------------------------------- 204 @Override 205 public IFrame setClass(String inValue) 206 { 207 setAttribute(HTML.CLASS, inValue); 208 return this; 209 } 210 211 //-------------------------------------------------------------------------- 212 public IFrame setStyle(String inValue) 213 { 214 setAttribute(HTML.STYLE, inValue); 215 return this; 216 } 217}