Expresso 5-5-0

com.jcorporate.expresso.services.html
Class CheckBox

java.lang.Object
  extended bycom.jcorporate.expresso.services.html.HtmlElement
      extended bycom.jcorporate.expresso.services.html.CheckBox

public class CheckBox
extends HtmlElement

An HTML checkbox for use on HTML forms

Version:
$Revision: 1.7 $ $Date: 2004/03/06 11:14:58 $
Author:
Michael Nash

Field Summary
protected  String currentValue
           
 
Fields inherited from class com.jcorporate.expresso.services.html.HtmlElement
attributes, contents, cSSClass, cSSID
 
Constructor Summary
CheckBox()
          Constructor
CheckBox(String newFieldName, String newCurrentValue)
          Create a checkbox with the field name as given with a specific current value
CheckBox(String newFieldName, String newFieldValue, boolean newChecked)
          Constructor Create the checkbox with a given name and value and state
 
Method Summary
 void addOption(String fieldValue, String fieldLabel)
          Add a new option to this checkbox
protected  void display(PrintWriter out, int depth)
          Display this CheckBox to the appropriate PrintWriter
 void setChecked(boolean newChecked)
          Set the current "checked" status
 void setCurrentValue(String newCurrentValue)
          Set the currently selected value for this checkbox
 void setVertical(boolean state)
           
 
Methods inherited from class com.jcorporate.expresso.services.html.HtmlElement
add, display, finalize, getAttribute, getContentCount, getCSSClass, getName, padWithTabs, setAttribute, setCSSClass, setCSSID, setDisplayed, setName, setParent
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentValue

protected String currentValue
Constructor Detail

CheckBox

public CheckBox()
         throws HtmlException
Constructor

Throws:
HtmlException - If the superclass constructor fails

CheckBox

public CheckBox(String newFieldName,
                String newCurrentValue)
         throws HtmlException
Create a checkbox with the field name as given with a specific current value

Parameters:
newFieldName - Field name of the new checkbox
newCurrentValue - Current value of the drop down (selected item)
Throws:
HtmlException - If the parameters are invalid

CheckBox

public CheckBox(String newFieldName,
                String newFieldValue,
                boolean newChecked)
         throws HtmlException
Constructor Create the checkbox with a given name and value and state

Parameters:
newFieldName - Name of the field on the form
newFieldValue - Value of the field when checked
newChecked - True if the box's initial state is checked, else false
Throws:
HtmlException - If a parameter is invalid
Method Detail

addOption

public void addOption(String fieldValue,
                      String fieldLabel)
               throws HtmlException
Add a new option to this checkbox

Parameters:
fieldValue - Value of the new option
fieldLabel - Label of the new option
Throws:
HtmlException - If the parameters are invalid

display

protected void display(PrintWriter out,
                       int depth)
                throws HtmlException
Display this CheckBox to the appropriate PrintWriter

Specified by:
display in class HtmlElement
Parameters:
out - PrintWriter to display
depth - the number of tabs to indent
Throws:
HtmlException - If the Radio cannot be displayed

setChecked

public void setChecked(boolean newChecked)
                throws HtmlException
Set the current "checked" status

Parameters:
newChecked - set to true if checked
Throws:
HtmlException - If the parameter is invalid

setCurrentValue

public void setCurrentValue(String newCurrentValue)
                     throws HtmlException
Set the currently selected value for this checkbox

Parameters:
newCurrentValue - The value for this checkbox
Throws:
HtmlException - If the parameter is invalid

setVertical

public void setVertical(boolean state)
Parameters:
state - set to true if the checkboxes are vertical

Expresso 5-5-0

Please see www.jcorporate.com for information about new Expresso releases.