com.ibm.as400.util.html

Class HTMLImage

  • All Implemented Interfaces:
    HTMLConstants, HTMLTagElement, java.io.Serializable


    public class HTMLImage
    extends HTMLTagAttributes
    implements HTMLConstants, java.io.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:

    • PropertyChangeEvent
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      HTMLImage()
      Constructs a default HTMLImage object.
      HTMLImage(java.lang.String source, java.lang.String alt)
      Constructs an HTMLImage object with the specified source and alternate text.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      java.lang.String getAlign()
      Returns the alignment of the image.
      java.lang.String getAlt()
      Returns the alternate text.
      int getBorder()
      Returns the thickness of the border around the image.
      java.lang.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.
      java.lang.String getName()
      Returns the unique name of the image.
      java.lang.String getSrc()
      Returns the absolute or relative URL to reference the image.
      java.lang.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(java.lang.String align)
      Sets the alignment of text following the image tag relative to the graphic on screen.
      void setAlt(java.lang.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(java.lang.String name)
      Set the a unique name of the image.
      void setSrc(java.lang.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.
      java.lang.String toString()
      Returns a String representation for the HTMLImage tag.
      • 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(java.lang.String source,
                 java.lang.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 java.lang.String getAlign()
        Returns the alignment of the image.
        Returns:
        The alignment.
      • getAlt

        public java.lang.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 java.lang.String getName()
        Returns the unique name of the image.
        Returns:
        The name.
      • getSrc

        public java.lang.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 java.lang.String getTag()
        Returns the element tag.
        Specified by:
        getTag in interface HTMLTagElement
        Returns:
        The tag.
      • getFOTag

        public java.lang.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(java.lang.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(java.lang.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(java.lang.String name)
        Set the a unique name of the image.
        Parameters:
        name - The name.
      • setSrc

        public void setSrc(java.lang.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 java.lang.String toString()
        Returns a String representation for the HTMLImage tag.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The tag.