cox.jmatt.java.MathTools.markup.html
Class IMGTag

java.lang.Object
  extended by cox.jmatt.java.MathTools.markup.Tag
      extended by cox.jmatt.java.MathTools.markup.html.BaseHTag
          extended by cox.jmatt.java.MathTools.markup.html.IMGTag

public class IMGTag
extends BaseHTag

This class provides the <img> tag. Since a valid source is mandatory these are created by a factory method that returns null if a valid 'src=' attribute is not supplied.


Nested Class Summary
 
Nested classes/interfaces inherited from class cox.jmatt.java.MathTools.markup.html.BaseHTag
BaseHTag.TagKeys
 
Field Summary
 
Fields inherited from class cox.jmatt.java.MathTools.markup.Tag
myTagName
 
Constructor Summary
protected IMGTag(java.lang.String pSrc)
          Construct a tag instance.
 
Method Summary
 IMGTag copyOf()
          Copy the current tag.
static IMGTag newInstance(java.lang.String pSrc)
          Create an <img> tag instance.
static IMGTag newInstance(java.lang.String pSrc, double pWidth, double pHeight)
          Create an <img> tag with source and size specified.
 void reset()
          Overridden to preserve the 'src=' attribute.
 void setAlt(java.lang.String pAltText)
          Set or clear the alternate text for the image.
 void setSize(java.lang.Double pWidth, java.lang.Double pHeight)
          Set the width and height of the image.
 
Methods inherited from class cox.jmatt.java.MathTools.markup.html.BaseHTag
_addTag, _content, _enableCopy, _setContent, addCDATA, addContent, getID, getRawContent, getTagKey, getTagName, isInBody, setClicked, setCSS, setName, setStyle
 
Methods inherited from class cox.jmatt.java.MathTools.markup.Tag
_addAttribute, _addAttributes, _addNAttribute, _asBoolean, _asDouble, _asInt, _attributes, _clampNAttribute, _clampNAttribute, _fixKey, _setEnableXMLTag, badPizza, closeTag, configureTag, configureTagFromGlobalPizza, makeTag, openTag, setID, toString, validString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IMGTag

protected IMGTag(java.lang.String pSrc)
Construct a tag instance. Source is mandatory, hence the constructor is protected.

Method Detail

newInstance

public static final IMGTag newInstance(java.lang.String pSrc)
Create an <img> tag instance. Since this tag does not make sense without the 'src=' attribute, one must be supplied. If not, the return value is null.


newInstance

public static final IMGTag newInstance(java.lang.String pSrc,
                                       double pWidth,
                                       double pHeight)
Create an <img> tag with source and size specified. If no source is specified the return value is null.


copyOf

public IMGTag copyOf()
Copy the current tag.


reset

public void reset()
Overridden to preserve the 'src=' attribute.

Overrides:
reset in class Tag

setSize

public void setSize(java.lang.Double pWidth,
                    java.lang.Double pHeight)

Set the width and height of the image. If null an argument is ignored, otherwise the arguments are interpreted specially. If the value is between 0.0 (inclusive) and 1.0 (exclusive) it is interpreted as a percent and a '%' is appended. If greater than or equal to 1.0 it is interpreted as a pixel width and is set as-is. Negative values are made positive before processing.

Parameters:
pWidth - The width of the image. Ignored if null.
pHeight - The height of the image. Ignored if null.

setAlt

public void setAlt(java.lang.String pAltText)
Set or clear the alternate text for the image. The default is 'Image'.