org.apache.click.control
Class OptionGroup

java.lang.Object
  extended by org.apache.click.control.OptionGroup
All Implemented Interfaces:
Serializable

public class OptionGroup
extends Object
implements Serializable

Provides a select Option Group element:   <optgroup></optgroup>.

The OptionGroup class uses an immutable design so Option instances can be shared by multiple Pages in the multi-threaded Servlet environment. This enables OptionGroup instances to be cached as static variables.

For an OptionGroup code example see the Option Javadoc example.

See also the W3C HTML reference: OPTGROUP

See Also:
Select, Option, Serialized Form

Field Summary
protected  List children
          The groups child Option/OptGroup objects.
protected  String label
          The label for the OptionGroup.
 
Constructor Summary
OptionGroup(String label)
          Create an OptionGroup with the given display label.
 
Method Summary
 void add(Object object)
          Add the given Option or OptionGroup object to this group.
 List getChildren()
          Return the OptionGroup children.
 String getLabel()
          Return the display label.
 String getTag()
          Return the OptionGroup's html tag: optgroup.
 void render(Select select, HtmlStringBuffer buffer)
          Return a HTML rendered Option string.
 String renderHTML(Select select)
          Deprecated. use render(org.apache.click.control.Select, org.apache.click.util.HtmlStringBuffer) instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

children

protected List children
The groups child Option/OptGroup objects.


label

protected final String label
The label for the OptionGroup.

Constructor Detail

OptionGroup

public OptionGroup(String label)
Create an OptionGroup with the given display label.

Parameters:
label - the display label for the OptionGroup
Method Detail

getTag

public String getTag()
Return the OptionGroup's html tag: optgroup.

Returns:
the OptionGroup's html tag

add

public void add(Object object)
Add the given Option or OptionGroup object to this group.

Parameters:
object - the Option or OptionGroup to add

getChildren

public List getChildren()
Return the OptionGroup children.

Returns:
the OptionGroup children

getLabel

public String getLabel()
Return the display label.

Returns:
the display label

render

public void render(Select select,
                   HtmlStringBuffer buffer)
Return a HTML rendered Option string.

Parameters:
select - the parent Select
buffer - the specified buffer to render to

renderHTML

public String renderHTML(Select select)
Deprecated. use render(org.apache.click.control.Select, org.apache.click.util.HtmlStringBuffer) instead

Return a HTML rendered OptionGroup string.

Parameters:
select - the parent Select
Returns:
a rendered HTML OptionGroup string