BEA Systems, Inc.

WebLogic Server 5.1.0 API Reference

weblogic.html
Class ImageElement

java.lang.Object
  |
  +--weblogic.html.HtmlElement
        |
        +--weblogic.html.ElementWithAttributes
              |
              +--weblogic.html.SinglePartElement
                    |
                    +--weblogic.html.ImageElement

public class ImageElement
extends SinglePartElement

An ImageElement is used to display an image (GIF/JPEG) on an htmlKona page and set the HTML attributes of the image, such as source, border, size, and alignment. This class also supports browser extensions that allow you to use an image as a server-side or client-side image map.

Here's an example of displaying a single JPG image.

     HtmlPage hp = new HtmlPage();
     hp.getHead()
       .addElement(new TitleElement("A Simple Image"));
     hp.getBodyElement()
       .setAttribute(BodyElement.bgColor, HtmlColor.white);
     
     TableElement tab = new TableElement();

     tab.addElement(new TableRowElement()
                    .addElement(new BoldElement("A Plane:"))
                    .addElement(new ImageElement("http://public_html/images/GA-747.JPG")));
     hp.getBody()
       .addElement(new HeadingElement("A Simple Image", 2))
       .addElement(MarkupElement.HorizontalRule)
       .addElement(tab);
     hp.output();
 

Version:
2.1
Author:
Copyright (c) 1995-96, WebLogic, Inc.
Copyright © 2000 BEA Systems, Inc. All Rights Reserved.
See Also:
ImagePage, MapElement

Fields inherited from class weblogic.html.HtmlElement
codeset, useObsolete
 
Constructor Summary
ImageElement()
          Constructs an ImageElement.
ImageElement(HtmlElement src)
          Constructs an ImageElement with the specified source.
ImageElement(java.lang.String src)
          Constructs an ImageElement with the specified source.
 
Method Summary
protected  java.lang.String getHtmlCode()
           
protected  boolean printBody()
           
protected  boolean printEndingTag()
           
 ImageElement setAlign(AlignType val)
          Sets the ALIGN attribute for an ImageElement.
 ImageElement setAlt(java.lang.String val)
          Sets the ALT attribute for an ImageElement.
 ImageElement setBorder(int val)
          Sets the BORDER attribute for an ImageElement.
 ImageElement setHeight(int val)
          Sets the HEIGHT attribute for an ImageElement.
 ImageElement setHSpace(int val)
          Sets the HSPACE attribute for an ImageElement.
 ImageElement setIsMap(boolean ismap)
          Sets the ISMAP attribute for an ImageElement.
 ImageElement setLowSource(java.lang.String val)
          Sets the LOWSRC attribute for an ImageElement.
 ImageElement setSource(java.lang.String val)
          Sets the SRC attribute for an ImageElement.
 ImageElement setUseMap(HtmlElement url, boolean ismap)
          Sets the USEMAP attribute for an ImageElement.
 ImageElement setUseMap(java.lang.String url, boolean ismap)
          Sets the USEMAP attribute for an ImageElement.
 ImageElement setVSpace(int val)
          Sets the VSPACE attribute for an ImageElement.
 ImageElement setWidth(int val)
          Sets the WIDTH attribute for an ImageElement.
 ImageElement setWidth(java.lang.String val)
          Sets the WIDTH attribute for an ImageElement.
 
Methods inherited from class weblogic.html.SinglePartElement
getElement, printBody, printBody, printBody, setElement, setElement, widthAsLiteral
 
Methods inherited from class weblogic.html.ElementWithAttributes
addAttribute, addAttribute, escapeQuotes, getBooleanAttribute, getElementAttribute, getLocalVar, getQuotedAttribute, output, output, output, printCR, setBooleanAttribute, setBooleanAttribute, setClass, setDirection, setElementAttribute, setElementAttribute, setElementAttribute, setElementAttribute, setElementAttribute, setId, setLang, setLocalVar, setQuotedAttribute, setStyle
 
Methods inherited from class weblogic.html.HtmlElement
asAnchorElement, asBigElement, asBlockquoteElement, asBoldElement, asCenteredElement, asCiteElement, asCodeElement, asCommentElement, asDefineTermElement, asEmphasisElement, asFontElement, asFontElement, asFontElement, asHtmlContainer, asItalicElement, asKeyboardElement, asLiteralElement, asParagraphElement, asSampleElement, asSmallElement, asStrikeElement, asStrongElement, asSubscriptElement, asSuperscriptElement, asTeletypeElement, asUnderlineElement, asVariableElement, getVersion, setAnchorMode, setCodeset, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageElement

public ImageElement()
Constructs an ImageElement.

ImageElement

public ImageElement(java.lang.String src)
Constructs an ImageElement with the specified source.

Parameters:
src - SRC attribute for image

ImageElement

public ImageElement(HtmlElement src)
Constructs an ImageElement with the specified source.

Parameters:
src - SRC attribute for image
Method Detail

getHtmlCode

protected java.lang.String getHtmlCode()

Overrides:
getHtmlCode in class ElementWithAttributes

printEndingTag

protected boolean printEndingTag()

Overrides:
printEndingTag in class ElementWithAttributes

printBody

protected boolean printBody()

Overrides:
printBody in class ElementWithAttributes

setAlign

public ImageElement setAlign(AlignType val)
Sets the ALIGN attribute for an ImageElement. Valid types are left, right, top, middle, bottom.

Parameters:
val - AlignType object
Returns:
ImageElement object

setAlt

public ImageElement setAlt(java.lang.String val)
Sets the ALT attribute for an ImageElement.

Parameters:
val - Text to be displayed if image is not
Returns:
ImageElement object

setBorder

public ImageElement setBorder(int val)
Sets the BORDER attribute for an ImageElement.

Parameters:
val - Size of border in pixels
Returns:
ImageElement object

setHeight

public ImageElement setHeight(int val)
Sets the HEIGHT attribute for an ImageElement.

Parameters:
val - Height of image
Returns:
ImageElement object

setHSpace

public ImageElement setHSpace(int val)
Sets the HSPACE attribute for an ImageElement.

Parameters:
val - Hspace of image
Returns:
ImageElement object

setIsMap

public ImageElement setIsMap(boolean ismap)
Sets the ISMAP attribute for an ImageElement. This supports server-side image maps. For example:
ImageElement ie = new ImageElement("icons.gif");
 ie.setIsMap(true);
 hp.getBody()
   .addElement(new AnchorElement("/cgi-bin/imagemap", ie));

Parameters:
ismap - True if the ISMAP attribute should be added to an ImageElement
Returns:
ImageElement

setLowSource

public ImageElement setLowSource(java.lang.String val)
Sets the LOWSRC attribute for an ImageElement.

Parameters:
val - Source for the image
Returns:
ImageElement object

setSource

public ImageElement setSource(java.lang.String val)
Sets the SRC attribute for an ImageElement.

Parameters:
val - Source for the image
Returns:
ImageElement object

setUseMap

public ImageElement setUseMap(java.lang.String url,
                              boolean ismap)
Sets the USEMAP attribute for an ImageElement. This supports browser extensions for client-side image maps.

Parameters:
url - URL for the map to use with the image
ismap - True to add the attribute ISMAP
Returns:
ImageElement object
See Also:
MapElement

setUseMap

public ImageElement setUseMap(HtmlElement url,
                              boolean ismap)
Sets the USEMAP attribute for an ImageElement. This supports browser extensions for client-side image maps. The URL is not enclosed in double quotes in this method.

Parameters:
url - URL for the map to use with the image
ismap - True to add the attribute ISMAP
Returns:
ImageElement object
See Also:
MapElement

setVSpace

public ImageElement setVSpace(int val)
Sets the VSPACE attribute for an ImageElement.

Parameters:
val - Vspace of image
Returns:
ImageElement object

setWidth

public ImageElement setWidth(int val)
Sets the WIDTH attribute for an ImageElement.

Parameters:
val - Width of image
Returns:
ImageElement object

setWidth

public ImageElement setWidth(java.lang.String val)
Sets the WIDTH attribute for an ImageElement. Also use this method to set the image width to a percentage of the window width.

Parameters:
val - String (as in "50%")
Returns:
ImageElement object

Documentation is available at
http://www.weblogic.com/docs51