com.hfg.html.Applet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com_hfg Show documentation
Show all versions of com_hfg Show documentation
com.hfg xml, html, svg, and bioinformatics utility library
package com.hfg.html;
import com.hfg.html.attribute.Align;
import com.hfg.xml.XMLNode;
//------------------------------------------------------------------------------
/**
Represents an applet (<applet>) tag.
@author J. Alex Taylor, hairyfatguy.com
*/
//------------------------------------------------------------------------------
// com.hfg XML/HTML Coding Library
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
// [email protected]
//------------------------------------------------------------------------------
public class Applet extends HTMLTag
{
//##########################################################################
// CONSTRUCTORS
//##########################################################################
//--------------------------------------------------------------------------
public Applet()
{
super(HTML.APPLET);
}
//--------------------------------------------------------------------------
public Applet(XMLNode inXMLNode)
{
this();
initFromXMLNode(inXMLNode);
}
//##########################################################################
// PUBLIC METHODS
//##########################################################################
//--------------------------------------------------------------------------
public Param addParam()
{
Param param = new Param();
addSubtag(param);
return param;
}
//--------------------------------------------------------------------------
public Param addParam(String inName, String inValue)
{
Param param = new Param(inName, inValue);
addSubtag(param);
return param;
}
//--------------------------------------------------------------------------
public Applet setAlign(Align inValue)
{
setAttribute(inValue.getHTMLAttributeName(), inValue.toString());
return this;
}
//--------------------------------------------------------------------------
/**
Sets the string to be displayed before the applet is loaded or in case the
applet cannot be loaded.
@param inValue the 'alt' attribute content for the applet tag
@return this applet object to enable method chaining
*/
public Applet setAlt(String inValue)
{
setAttribute(HTML.ALT, inValue);
return this;
}
//--------------------------------------------------------------------------
public Applet setArchive(String inValue)
{
setAttribute(HTML.ARCHIVE, inValue);
return this;
}
//--------------------------------------------------------------------------
/**
Specifies the name of the class file to execute.
@param inValue the 'code' attribute content for the applet tag
@return this applet object to enable method chaining
*/
public Applet setCode(String inValue)
{
setAttribute(HTML.CODE, inValue);
return this;
}
//--------------------------------------------------------------------------
public Applet setCodebase(String inValue)
{
setAttribute(HTML.CODEBASE, inValue);
return this;
}
//---------------------------------------------------------------------------
public Applet setName(String inValue)
{
setAttribute(HTML.NAME, inValue);
return this;
}
//---------------------------------------------------------------------------
public Applet setMayScript(boolean inValue)
{
setAttribute(HTML.MAYSCRIPT, (inValue ? "1" : "0"));
return this;
}
//--------------------------------------------------------------------------
public Applet setWidth(String inValue)
{
setAttribute(HTML.WIDTH, inValue);
return this;
}
//--------------------------------------------------------------------------
public Applet setWidth(int inValue)
{
setAttribute(HTML.WIDTH, new Integer(inValue).toString());
return this;
}
//--------------------------------------------------------------------------
public String getWidth()
{
return getAttributeValue(HTML.WIDTH);
}
//--------------------------------------------------------------------------
public Applet setHeight(String inValue)
{
setAttribute(HTML.HEIGHT, inValue);
return this;
}
//--------------------------------------------------------------------------
public Applet setHeight(int inValue)
{
setAttribute(HTML.HEIGHT, new Integer(inValue).toString());
return this;
}
//--------------------------------------------------------------------------
public String getHeight()
{
return getAttributeValue(HTML.HEIGHT);
}
//--------------------------------------------------------------------------
@Override
public Applet setId(String inValue)
{
setAttribute(HTML.ID, inValue);
return this;
}
}