com.ibm.as400.util.html
Class HTMLImage

java.lang.Object
  extended by com.ibm.as400.util.html.HTMLTagAttributes
      extended by com.ibm.as400.util.html.HTMLImage
All Implemented Interfaces:
HTMLConstants, HTMLTagElement, Serializable

public class HTMLImage
extends HTMLTagAttributes
implements HTMLConstants, Serializable

The HTMLImage class represents an image tag within an HTML page.

This example creates a HTMLImage tag:

  // Create an HTMLImage.
  HTMLImage image = new HTMLImage("http://myWebPage/pic.gif", "alternate text");
  image.setHeight(50);
  image.setWidth(50);
  System.out.println(image);
  

Here is the output of the HTMLImage tag:

  <img src="http://myWebPage/pic.gif" alt="alternate text" height="50" width="50" />
  

The equivalent tag using XSL Formatting Objects looks like the following:

<fo:block> <fo:external-graphic src="file:http://myWebPage/pic.gif" content-height="50px" content-width="50px"/> </fo:block>

HTMLImage objects generate the following events:

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.ibm.as400.util.html.HTMLConstants
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CAPITALS, CENTER, CIRCLE, DISC, JUSTIFY, LARGE_ROMAN, LEFT, LOWER_CASE, LTR, MIDDLE, NUMBERS, RIGHT, RTL, SMALL_ROMAN, SQUARE, TARGET_BLANK, TARGET_PARENT, TARGET_SELF, TARGET_TOP, TEXTTOP, TOP
 
Constructor Summary
HTMLImage()
          Constructs a default HTMLImage object.
HTMLImage(String source, String alt)
          Constructs an HTMLImage object with the specified source and alternate text.
 
Method Summary
 String getAlign()
          Returns the alignment of the image.
 String getAlt()
          Returns the alternate text.
 int getBorder()
          Returns the thickness of the border around the image.
 String getFOTag()
          Returns the element tag for the XSL-FO image.
 int getHeight()
          Returns the height of the image.
 int getHSpace()
          Returns the horizontal space around the image in pixels.
 String getName()
          Returns the unique name of the image.
 String getSrc()
          Returns the absolute or relative URL to reference the image.
 String getTag()
          Returns the element tag.
 int getVSpace()
          Returns the vertical space around the Image in pixels.
 int getWidth()
          Sets the width of the image in pixels.
 boolean isUseFO()
          Returns if Formatting Object tags are outputted.
 void setAlign(String align)
          Sets the alignment of text following the image tag relative to the graphic on screen.
 void setAlt(String alt)
          Sets the alternate text to be displayed in place of the image.
 void setBorder(int border)
          Sets the thickness of the border around the image.
 void setHeight(int height)
          Sets the height of the image in pixels.
 void setHSpace(int hspace)
          Sets the horizontal space around the image in pixels.
 void setName(String name)
          Set the a unique name of the image.
 void setSrc(String source)
          Sets the absolute or relative URL to reference the image.
 void setUseFO(boolean useFO)
          Sets if Formatting Object tags should be used.
 void setVSpace(int vspace)
          Sets the vertical space around the image in pixels.
 void setWidth(int width)
          Sets the width of the image in pixels.
 String toString()
          Returns a String representation for the HTMLImage tag.
 
Methods inherited from class com.ibm.as400.util.html.HTMLTagAttributes
addPropertyChangeListener, getAttributes, getAttributeString, removePropertyChangeListener, setAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HTMLImage

public HTMLImage()
Constructs a default HTMLImage object.


HTMLImage

public HTMLImage(String source,
                 String alt)
Constructs an HTMLImage object with the specified source and alternate text.

Parameters:
source - The absolute or relative URL.
alt - The alternate text.
Method Detail

getAlign

public String getAlign()
Returns the alignment of the image.

Returns:
The alignment.

getAlt

public String getAlt()
Returns the alternate text.

Returns:
The alternate text.

getBorder

public int getBorder()
Returns the thickness of the border around the image.

Returns:
The border.

getHeight

public int getHeight()
Returns the height of the image.

Returns:
The height.

getHSpace

public int getHSpace()
Returns the horizontal space around the image in pixels.

Returns:
The horizontal space.

getName

public String getName()
Returns the unique name of the image.

Returns:
The name.

getSrc

public String getSrc()
Returns the absolute or relative URL to reference the image.

Returns:
The source.

getVSpace

public int getVSpace()
Returns the vertical space around the Image in pixels.

Returns:
The vertical space.

getWidth

public int getWidth()
Sets the width of the image in pixels.

Returns:
The width.

getTag

public String getTag()
Returns the element tag.

Specified by:
getTag in interface HTMLTagElement
Returns:
The tag.

getFOTag

public String getFOTag()
Returns the element tag for the XSL-FO image. The alternate text and name attributes are not supported by XSL-FO.

Specified by:
getFOTag in interface HTMLTagElement
Returns:
The tag.

isUseFO

public boolean isUseFO()
Returns if Formatting Object tags are outputted. The default value is false.

Returns:
true if the output generated is an XSL formatting object, false if the output generated is HTML.

setAlign

public void setAlign(String align)
Sets the alignment of text following the image tag relative to the graphic on screen.

Parameters:
align - The alignment. One of the following constants defined in HTMLConstants: LEFT, RIGHT, TOP, TEXTTOP, MIDDLE, ABSMIDDLE, BASELINE, BOTTOM, or ABSBOTTOM .
See Also:
HTMLConstants

setAlt

public void setAlt(String alt)
Sets the alternate text to be displayed in place of the image. This text will be displayed for browsers that can not handle this ability or that have disabled this ability.

Parameters:
alt - The alternate text.

setBorder

public void setBorder(int border)
Sets the thickness of the border around the image.

Parameters:
border - The border thickness.

setHeight

public void setHeight(int height)
Sets the height of the image in pixels.

Parameters:
height - The height.

setHSpace

public void setHSpace(int hspace)
Sets the horizontal space around the image in pixels.

Parameters:
hspace - The horizontal space.

setName

public void setName(String name)
Set the a unique name of the image.

Parameters:
name - The name.

setSrc

public void setSrc(String source)
Sets the absolute or relative URL to reference the image.

Parameters:
source - The source.

setVSpace

public void setVSpace(int vspace)
Sets the vertical space around the image in pixels.

Parameters:
vspace - The vertical space.

setWidth

public void setWidth(int width)
Sets the width of the image in pixels.

Parameters:
width - The width.

setUseFO

public void setUseFO(boolean useFO)
Sets if Formatting Object tags should be used. The default value is false.

Parameters:
useFO - - true if output generated is an XSL formatting object, false if the output generated is HTML.

toString

public String toString()
Returns a String representation for the HTMLImage tag.

Overrides:
toString in class Object
Returns:
The tag.