All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class net.strandberg.html.CheckboxSet

java.lang.Object
   |
   +----net.strandberg.html.CheckboxSet

public class CheckboxSet
extends Object
implements HTMLItem

The class CheckboxSet is used to create a set of HTML checkboxes to be used in Forms. The set of checkboxes are not physically connected in any way. A set of checkboxes is only used for layout reasons. To create a checkbox set, inside an HTML form, that looks like this:

Checkboxes: Checkbox 1 Checkbox 2 Checkbox 3

you would need HTML code like this:

   Checkboxes: 
   <INPUT TYPE="checkbox" NAME="cb1" VALUE="Y">Checkbox 1
   <INPUT TYPE="checkbox" NAME="cb2" VALUE="Y">Checkbox 2
   <INPUT TYPE="checkbox" NAME="cb3" VALUE="Y">Checkbox 3
 
which is created by this Java code:
   CheckboxSet cbs = new CheckboxSet("Checkboxes:", false);
   cbs.addCheckbox("cb1", "Checkbox 1");
   cbs.addCheckbox("cb2", "Checkbox 2");
   cbs.addCheckbox("cb3", "Checkbox 3");
   String myString = cbs.toHTML();
 

Version:
$Revision: 0.0 $
Author:
Mats Strandberg
See Also:
Form

Constructor Index

 o CheckboxSet()
Constructs a checkbox set with no label.
 o CheckboxSet(String)
Constructs a checkbox set with a label.
 o CheckboxSet(String, boolean)
Constructs a checkbox set with a label.

Method Index

 o add(Checkbox)
Adds a Checkbox to this set.
 o addCheckbox(String, String)
Adds a Checkbox to this set.
 o main(String[])
Tests the class
 o makeLayoutVertical()
Makes the layout of the checkboxes vertical.
 o toHTML()

Constructors

 o CheckboxSet
 public CheckboxSet()
Constructs a checkbox set with no label. The HTML code for this checkbox set will be generated as table items, i.e. as table cells. The layout is horizontal.

 o CheckboxSet
 public CheckboxSet(String label)
Constructs a checkbox set with a label. The label will be placed to the left of the checkboxes. The HTML code for this checkbox set will be generated as table items, i.e. as table cells. The layout is horizontal.

Parameters:
label - the text presented left of the checkbox set
 o CheckboxSet
 public CheckboxSet(String label,
                    boolean asTableItems)
Constructs a checkbox set with a label. The label will be placed to the left of the checkboxes. The layout is horizontal.

Parameters:
label - the text presented left of the checkbox set
asTableItems - if true the HTML code for this checkbox set will be generated as table items, i.e. as table cells

Methods

 o makeLayoutVertical
 public void makeLayoutVertical()
Makes the layout of the checkboxes vertical. (The layout is by default horizontal).

 o addCheckbox
 public void addCheckbox(String name,
                         String label)
Adds a Checkbox to this set. The added checkbox will have the value "Y" assigned to it when it is ticked. Its HTML code will be generated as a table cell if this checkbox set is generated as table cells. The added checkbox will get its label to the right of the box.

Parameters:
name - the name of this checkbox in the form
label - the text presented next to the checkbox
 o add
 public void add(Checkbox cb)
Adds a Checkbox to this set.

Parameters:
cb - the checkbox to add
 o toHTML
 public String toHTML()
 o main
 public static void main(String args[])
Tests the class


All Packages  Class Hierarchy  This Package  Previous  Next  Index