net.xoetrope.html
Class XImage

java.lang.Object
  extended by net.xoetrope.html.XHtmlWidget
      extended by net.xoetrope.html.XImage
All Implemented Interfaces:
XAttributedComponent, XImageHolder

public class XImage
extends XHtmlWidget
implements XImageHolder, XAttributedComponent

Draws an image

Copyright: Copyright (c) Xoetrope Ltd., 1998-2003

License: see license.txt $Revision: 2.7 $


Field Summary
protected  netscape.javascript.JSObject obj
           
 
Fields inherited from class net.xoetrope.html.XHtmlWidget
currentProject, divElement, htmlDoc, imageElement, inputElement, labelElement, metaElement, olElement, selectElement, tableElement, textareaElement, ulElement
 
Constructor Summary
XImage()
          Constructs a blank image control.
XImage(org.w3c.dom.html.HTMLImageElement imageElement)
          Create a new XImage based on an existing HTML edit field.
XImage(java.lang.String src, java.lang.String id)
          Create a new XImage with an id and a src attribute
 
Method Summary
 java.lang.String getAlign()
          Get the align attribute of the XImage.
 java.lang.String getAttribute(java.lang.String attribName)
          Get an attribute value
 java.lang.String getBorder()
          Get the border of the image
 java.lang.String getFullSize()
          Get the size of this image
 java.lang.String getHorizontalMargin()
          Get the horizontal margin of the image
 org.w3c.dom.html.HTMLImageElement getHTMLElement()
          Get the HTML element at which refers the XImage
 java.lang.String getImageName()
          Gets the name of the image being displayed.
 java.lang.String getImageSrc()
          Get the image src attribute
 java.lang.String getMargins()
          Get the margins of the image.
 java.lang.String getVerticalMargin()
          Set the vertical margin of the image
 void setAlign(java.lang.String align)
          Set the align attribute of the XImage
 int setAttribute(java.lang.String attribName, java.lang.Object attribValue)
          Set one or more attributes of the component.
 void setBorder(int size)
          Set the border of the image
 void setFullSize(int width, int height)
          Set the size of the image
 void setHorizontalMargin(int margin)
          Set the horizontal margin of the image
 void setImage(java.awt.Image img)
          Sets the image to display.
 void setImageName(java.lang.String name)
          Set the name attribute of the XImage
 void setImageSrc(java.lang.String src)
          Sets the image to display.
 void setMargins(int horizontalMargin, int verticalMargin)
          Set the margins of the image
 void setVerticalMargin(int margin)
          Set the vertical margin of the image
 void setVisible(boolean visible)
          Set the XImage visible or invisible.
 
Methods inherited from class net.xoetrope.html.XHtmlWidget
addEvent, setObject, setObject, setObject, setObject, setObject, setObject, setObject, setObject, setObject, setObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

obj

protected netscape.javascript.JSObject obj
Constructor Detail

XImage

public XImage()
Constructs a blank image control.


XImage

public XImage(java.lang.String src,
              java.lang.String id)
Create a new XImage with an id and a src attribute

Parameters:
src - the path where to find the image to display
id - the id of the image

XImage

public XImage(org.w3c.dom.html.HTMLImageElement imageElement)
Create a new XImage based on an existing HTML edit field.

Parameters:
inputElement - the HTML img tag the XImage refers to
Method Detail

setImageSrc

public void setImageSrc(java.lang.String src)
Sets the image to display.

Parameters:
img - the image

getImageSrc

public java.lang.String getImageSrc()
Get the image src attribute

Returns:
the relative path where to find the attribute

setImageName

public void setImageName(java.lang.String name)
Set the name attribute of the XImage

Parameters:
name - the name of the image

getImageName

public java.lang.String getImageName()
Gets the name of the image being displayed.

Returns:
the image name

getFullSize

public java.lang.String getFullSize()
Get the size of this image

Returns:
the size

setFullSize

public void setFullSize(int width,
                        int height)
Set the size of the image

Parameters:
width - the width od the image
height - the height of the image

setAttribute

public int setAttribute(java.lang.String attribName,
                        java.lang.Object attribValue)
Set one or more attributes of the component.
  1. content, value=the image file name
  2. imagename, value=the image file name

Specified by:
setAttribute in interface XAttributedComponent
Parameters:
attribName - the attribute name
attribValue - the attribute value
Returns:
0 for success, non zero for failure or to require some further action

getAttribute

public java.lang.String getAttribute(java.lang.String attribName)
Get an attribute value

Parameters:
attribName - the attribute which value is requested
Returns:
the value of this attribute

setMargins

public void setMargins(int horizontalMargin,
                       int verticalMargin)
Set the margins of the image

Parameters:
horizontalMargin - the horizontal margin
verticalMargin - the vertical margin

getMargins

public java.lang.String getMargins()
Get the margins of the image.

Returns:
a String representing the margins of the image

setHorizontalMargin

public void setHorizontalMargin(int margin)
Set the horizontal margin of the image

Parameters:
margin - the horizontal margin

getHorizontalMargin

public java.lang.String getHorizontalMargin()
Get the horizontal margin of the image

Returns:
the horizontal margin

setVerticalMargin

public void setVerticalMargin(int margin)
Set the vertical margin of the image

Parameters:
margin - the vertical margin

getVerticalMargin

public java.lang.String getVerticalMargin()
Set the vertical margin of the image

Returns:
the vertical margin

setAlign

public void setAlign(java.lang.String align)
Set the align attribute of the XImage

Parameters:
align - the alignment of the XImage (left, right, center, justified)

getAlign

public java.lang.String getAlign()
Get the align attribute of the XImage.

Returns:
the alignment of this XImage

setBorder

public void setBorder(int size)
Set the border of the image

Parameters:
size - the thickness of the border in pixel

getBorder

public java.lang.String getBorder()
Get the border of the image

Returns:
the thickness of the border in pixel

setVisible

public void setVisible(boolean visible)
Set the XImage visible or invisible.

Parameters:
visible - true if visible, false otherwise

getHTMLElement

public org.w3c.dom.html.HTMLImageElement getHTMLElement()
Get the HTML element at which refers the XImage

Returns:
the HTML element.

setImage

public void setImage(java.awt.Image img)
Sets the image to display.

Specified by:
setImage in interface XImageHolder
Parameters:
img - the image