001package com.hfg.html; 002 003import com.hfg.html.attribute.Align; 004import com.hfg.xml.XMLNode; 005 006//------------------------------------------------------------------------------ 007/** 008 Represents an applet (<applet>) 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 Applet extends HTMLTag 035{ 036 037 //########################################################################## 038 // CONSTRUCTORS 039 //########################################################################## 040 041 //-------------------------------------------------------------------------- 042 public Applet() 043 { 044 super(HTML.APPLET); 045 } 046 047 //-------------------------------------------------------------------------- 048 public Applet(XMLNode inXMLNode) 049 { 050 this(); 051 initFromXMLNode(inXMLNode); 052 } 053 054 055 //########################################################################## 056 // PUBLIC METHODS 057 //########################################################################## 058 059 //-------------------------------------------------------------------------- 060 public Param addParam() 061 { 062 Param param = new Param(); 063 addSubtag(param); 064 065 return param; 066 } 067 068 //-------------------------------------------------------------------------- 069 public Param addParam(String inName, String inValue) 070 { 071 Param param = new Param(inName, inValue); 072 addSubtag(param); 073 074 return param; 075 } 076 077 //-------------------------------------------------------------------------- 078 public Applet setAlign(Align inValue) 079 { 080 setAttribute(inValue.getHTMLAttributeName(), inValue.toString()); 081 082 return this; 083 } 084 085 //-------------------------------------------------------------------------- 086 /** 087 Sets the string to be displayed before the applet is loaded or in case the 088 applet cannot be loaded. 089 @param inValue the 'alt' attribute content for the applet tag 090 @return this applet object to enable method chaining 091 */ 092 public Applet setAlt(String inValue) 093 { 094 setAttribute(HTML.ALT, inValue); 095 096 return this; 097 } 098 099 //-------------------------------------------------------------------------- 100 public Applet setArchive(String inValue) 101 { 102 setAttribute(HTML.ARCHIVE, inValue); 103 104 return this; 105 } 106 107 //-------------------------------------------------------------------------- 108 /** 109 Specifies the name of the class file to execute. 110 @param inValue the 'code' attribute content for the applet tag 111 @return this applet object to enable method chaining 112 */ 113 public Applet setCode(String inValue) 114 { 115 setAttribute(HTML.CODE, inValue); 116 117 return this; 118 } 119 120 //-------------------------------------------------------------------------- 121 public Applet setCodebase(String inValue) 122 { 123 setAttribute(HTML.CODEBASE, inValue); 124 125 return this; 126 } 127 128 //--------------------------------------------------------------------------- 129 public Applet setName(String inValue) 130 { 131 setAttribute(HTML.NAME, inValue); 132 133 return this; 134 } 135 136 137 //--------------------------------------------------------------------------- 138 public Applet setMayScript(boolean inValue) 139 { 140 setAttribute(HTML.MAYSCRIPT, (inValue ? "1" : "0")); 141 142 return this; 143 } 144 145 146 //-------------------------------------------------------------------------- 147 public Applet setWidth(String inValue) 148 { 149 setAttribute(HTML.WIDTH, inValue); 150 151 return this; 152 } 153 154 //-------------------------------------------------------------------------- 155 public Applet setWidth(int inValue) 156 { 157 setAttribute(HTML.WIDTH, new Integer(inValue).toString()); 158 159 return this; 160 } 161 162 //-------------------------------------------------------------------------- 163 public String getWidth() 164 { 165 return getAttributeValue(HTML.WIDTH); 166 } 167 168 //-------------------------------------------------------------------------- 169 public Applet setHeight(String inValue) 170 { 171 setAttribute(HTML.HEIGHT, inValue); 172 173 return this; 174 } 175 176 //-------------------------------------------------------------------------- 177 public Applet setHeight(int inValue) 178 { 179 setAttribute(HTML.HEIGHT, new Integer(inValue).toString()); 180 181 return this; 182 } 183 184 //-------------------------------------------------------------------------- 185 public String getHeight() 186 { 187 return getAttributeValue(HTML.HEIGHT); 188 } 189 190 191 //-------------------------------------------------------------------------- 192 @Override 193 public Applet setId(String inValue) 194 { 195 setAttribute(HTML.ID, inValue); 196 return this; 197 } 198 199}