net.xoetrope.html
Class XCheckbox

java.lang.Object
  extended by net.xoetrope.html.XHtmlWidget
      extended by net.xoetrope.html.XCheckbox
All Implemented Interfaces:
XAttributedComponent, XStateHolder, XTextHolder, XValueHolder

public class XCheckbox
extends XHtmlWidget
implements XStateHolder, XTextHolder, XValueHolder, XAttributedComponent

A wrapper for the Swing JCheckbox class

Copyright (c) Xoetrope Ltd., 1998-2004
License: see license.txt


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
XCheckbox()
          Construct a new checkbox
XCheckbox(org.w3c.dom.html.HTMLInputElement inputElement)
          Create a new XCheckbox based on an existing HTML checkbox element.
XCheckbox(java.lang.String id, java.lang.String value)
          Create a new check box with a value and an id
 
Method Summary
 void click()
          Simulate a click on the XCheckbox.
 void deleteElement()
          Delete the current XCheckbox.
 java.lang.String getAlign()
          Get the align attribute of the XCheckbox.
 java.lang.String getAlternativeName()
          Get the alt attribute of the XCheckbox.
 java.lang.String getAttribute(java.lang.String attribName)
          Get an attribute value
 java.lang.Object getComponentState()
          Get the component state
 boolean getDefaultChecked()
          Get whether the checkbox is checked by default
 java.lang.String getFontColor()
          Get the font color of the XCheckbox's elements.
 java.lang.String getFontSize()
          Get the size of the XCheckbox's text.
 org.w3c.dom.html.HTMLFormElement getForm()
          Get the form this XCheckbox belongs to.
 org.w3c.dom.html.HTMLInputElement getHTMLElement()
          Get the HTML element at which refers the XCheckbox.
 java.lang.String getText()
          Gets the text/caption
 java.lang.Object getValue()
          Get the checkbox's value if it has one or else get the text
 void insertAfter(java.lang.String element, java.lang.String id, boolean checked)
          Insert a new radiobutton after the current one
 void insertBefore(java.lang.String element, java.lang.String id, boolean checked)
          Insert a new radiobutton before the current one
 boolean isSelected()
          Get the status of the check box
 void setAlign(java.lang.String align)
          Set the align attribute of the XCheckbox
 void setAlternativeName(java.lang.String name)
          Set the alt attribute of the XCheckbox.
 int setAttribute(java.lang.String attribName, java.lang.Object attribValue)
          Set one or more attributes of the component.
 void setComponentState(java.lang.Object object)
          Set the component state
 void setDefaultChecked(boolean defaultChecked)
          Set whether the checkbox is checked by default
 void setEnabled(boolean enabled)
          Set the XCheckbox enabled or disabled.
 void setFontColor(java.lang.String hexColor)
          Set the font color of the XCheckbox's elements.
 void setFontSize(int size)
          Set the size of the XCheckbox's text.
 void setSelected(boolean checked)
          Enables or disables the check box
 void setText(java.lang.String s)
          Set the check box text
 void setValue(java.lang.Object newValue)
          Set the value associated with this box
 void setVisible(boolean visible)
          Set the XCheckbox 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

XCheckbox

public XCheckbox()
Construct a new checkbox


XCheckbox

public XCheckbox(java.lang.String id,
                 java.lang.String value)
Create a new check box with a value and an id

Parameters:
id - the check box id
value - the check box value

XCheckbox

public XCheckbox(org.w3c.dom.html.HTMLInputElement inputElement)
Create a new XCheckbox based on an existing HTML checkbox element.

Parameters:
inputElement - the HTML input tag the XCheckbox refers to
Method Detail

click

public void click()
Simulate a click on the XCheckbox.


setText

public void setText(java.lang.String s)
Set the check box text

Specified by:
setText in interface XTextHolder
Specified by:
setText in interface XValueHolder
Parameters:
s - the new text

getText

public java.lang.String getText()
Gets the text/caption

Specified by:
getText in interface XTextHolder
Specified by:
getText in interface XValueHolder
Returns:
the text value

getValue

public java.lang.Object getValue()
Get the checkbox's value if it has one or else get the text

Specified by:
getValue in interface XValueHolder
Returns:
the value for this box

setValue

public void setValue(java.lang.Object newValue)
Set the value associated with this box

Specified by:
setValue in interface XValueHolder
Parameters:
newValue - the new box value

isSelected

public boolean isSelected()
Get the status of the check box

Returns:
true if the check box is enabled, false otherwise

setDefaultChecked

public void setDefaultChecked(boolean defaultChecked)
Set whether the checkbox is checked by default

Parameters:
defaultChecked - true if the checkbox is checked by default, false otherwise

getDefaultChecked

public boolean getDefaultChecked()
Get whether the checkbox is checked by default

Returns:
true if the checkbox is checked by default, false otherwise

setSelected

public void setSelected(boolean checked)
Enables or disables the check box


setVisible

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

Parameters:
visible - true if visible, false otherwise

setEnabled

public void setEnabled(boolean enabled)
Set the XCheckbox enabled or disabled.

Parameters:
enabled - true if enabled, false otherwise

setAttribute

public int setAttribute(java.lang.String attribName,
                        java.lang.Object attribValue)
Set one or more attributes of the component.

Specified by:
setAttribute in interface XAttributedComponent
Parameters:
attribName - the name of the attribute
attribValue - the value of the attribute
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

setAlign

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

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

getAlign

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

Returns:
the alignment of this XCheckbox

setAlternativeName

public void setAlternativeName(java.lang.String name)
Set the alt attribute of the XCheckbox.

Parameters:
name - the alternative name to be displayed

getAlternativeName

public java.lang.String getAlternativeName()
Get the alt attribute of the XCheckbox.

Returns:
the alternative name for this XCheckbox

getForm

public org.w3c.dom.html.HTMLFormElement getForm()
Get the form this XCheckbox belongs to.

Returns:
the HTML Form element

insertAfter

public void insertAfter(java.lang.String element,
                        java.lang.String id,
                        boolean checked)
Insert a new radiobutton after the current one

Parameters:
element - the displayed name of the button
id - the unique identifier of the radio button

insertBefore

public void insertBefore(java.lang.String element,
                         java.lang.String id,
                         boolean checked)
Insert a new radiobutton before the current one

Parameters:
element - the displayed name of the button
id - the unique identifier of the radio button

deleteElement

public void deleteElement()
Delete the current XCheckbox.


setFontSize

public void setFontSize(int size)
Set the size of the XCheckbox's text.

Parameters:
size - the int value of the font size

getFontSize

public java.lang.String getFontSize()
Get the size of the XCheckbox's text.

Returns:
the int value of the font size

setFontColor

public void setFontColor(java.lang.String hexColor)
Set the font color of the XCheckbox's elements.

Parameters:
hexColor - the hexadecimal value of the font color

getFontColor

public java.lang.String getFontColor()
Get the font color of the XCheckbox's elements.

Returns:
the hexadecimal value of the font color

getHTMLElement

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

Returns:
the HTML element.

getComponentState

public java.lang.Object getComponentState()
Get the component state

Specified by:
getComponentState in interface XStateHolder
Returns:
the Boolean value for the state

setComponentState

public void setComponentState(java.lang.Object object)
Set the component state

Specified by:
setComponentState in interface XStateHolder
Parameters:
object - the selection state. Possible values: 1 or true and 0 or false