org.mortbay.html

Class Select


public class Select
extends Block

HTML select Block.
See Also:
Block

Field Summary

Fields inherited from class org.mortbay.html.Block

Bold, Center, Div, Italic, Left, Listing, Plain, Pre, Quote, Right, Span, Xmp

Fields inherited from class org.mortbay.html.Composite

elements, nest

Fields inherited from class org.mortbay.html.Element

ALIGN, BGCOLOR, BOTTOM, CENTER, CLASS, COLOR, HEIGHT, ID, LEFT, MIDDLE, RIGHT, SIZE, STYLE, TOP, VALIGN, WIDTH, attributeMap, noAttributes

Constructor Summary

Select(String name, boolean multiple)
Select(String name, boolean multiple, String[] options)

Method Summary

Select
add(Enumeration e)
Composite
add(Object o)
Add option and specify if selected.
Select
add(Object o, boolean selected)
Add option and specify if selected.
Select
add(Object o, boolean selected, String value)
Add an option.
Select
add(arr[] , String selected)
Build a select from the given array of Strings.
Select
add(arr[] , int selected)
Build a select from the given array of Strings.
static int
bitsetFormResult(String result)
Utility function for multi-selectors.
Select
setSize(int size)
Set the number of options to display at once

Methods inherited from class org.mortbay.html.Block

write

Methods inherited from class org.mortbay.html.Composite

add, contents, nest, replace, reset, setNest, size, unnest, write

Methods inherited from class org.mortbay.html.Element

attribute, attribute, attribute, attributes, attributes, bgColor, bottom, center, color, cssClass, cssID, height, height, height, left, middle, right, setAttributesFrom, size, size, size, style, toString, top, width, width, width, write, write, write

Constructor Details

Select

public Select(String name,
              boolean multiple)
Parameters:
name - Name of the form element
multiple - Whether multiple selections can be made

Select

public Select(String name,
              boolean multiple,
              String[] options)
Parameters:
name - Name of the form element
multiple - Whether multiple selections can be made

Method Details

add

public Select add(Enumeration e)

add

public Composite add(Object o)
Add option and specify if selected.
Overrides:
add in interface Composite

add

public Select add(Object o,
                  boolean selected)
Add option and specify if selected.

add

public Select add(Object o,
                  boolean selected,
                  String value)
Add an option.
Parameters:
o - The name of the option (displayed in the form)
selected - Whether the option is selected
value - The value of this option (returned in the form content)

add

public Select add(arr[] ,
                  String selected)
Build a select from the given array of Strings. The values of the select are the indexes into the array of the strings, which are used as the labels on the selector.
Parameters:
selected - The index of the selected label, -1 for default

add

public Select add(arr[] ,
                  int selected)
Build a select from the given array of Strings. The values of the select are the indexes into the array of the strings, which are used as the labels on the selector.
Parameters:
selected - The index of the selected label, -1 for default

bitsetFormResult

public static int bitsetFormResult(String result)
Utility function for multi-selectors.

This function takes the result returned by a multi-select input and produces an integer bit-set result of the selections made. It assumes the values of the multi-select are all different powers of 2.


setSize

public Select setSize(int size)
Set the number of options to display at once

Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.