lazyj.widgets
Class Select<K,V>

java.lang.Object
  extended by lazyj.widgets.Select<K,V>
Type Parameters:
K - key type (hidden ID field). Usually Integer or String.
V - value type. Usually String.
All Implemented Interfaces:
Page

public class Select<K,V>
extends java.lang.Object
implements Page

Build the options for a select HTML tag.

Since:
Nov 26, 2007 (1.0.4)
Author:
costing

Constructor Summary
Select(java.util.Collection<Option<K,V>> options)
          Build the list of options from a collection.
Select(java.util.Collection<Option<K,V>> options, java.util.Set<K> selected)
          Build the list of options from a collection, selecting by default the elements that show up in the set.
Select(java.util.Collection<Option<K,V>> options, java.util.Set<K> selected, java.lang.String sIndent)
          Build the list of options from a collection, selecting by default the elements that show up in the set, indenting options that have level>0 with some string.
Select(java.util.Collection<Option<K,V>> options, java.util.Set<K> selected, java.lang.String sIndent, BasePage pOption)
          Build the list of options from a collection, selecting by default the elements that show up in the set, indenting options that have level>0 with some string.
Select(java.util.Collection<Option<K,V>> options, java.util.Set<K> selected, java.lang.String sIndent, BasePage pOption, OptionFormatter formatter)
          Build the list of options from a collection, selecting by default the elements that show up in the set, indenting options that have level>0 with some string.
 
Method Summary
 java.lang.StringBuilder getContents()
          Get the (dynamic) content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Select

public Select(java.util.Collection<Option<K,V>> options)
Build the list of options from a collection.

Parameters:
options - list of options

Select

public Select(java.util.Collection<Option<K,V>> options,
              java.util.Set<K> selected)
Build the list of options from a collection, selecting by default the elements that show up in the set.

Parameters:
options - list of options
selected - list of selected items. Can be null.

Select

public Select(java.util.Collection<Option<K,V>> options,
              java.util.Set<K> selected,
              java.lang.String sIndent)
Build the list of options from a collection, selecting by default the elements that show up in the set, indenting options that have level>0 with some string.

Parameters:
options - list of options
selected - list of selected items. Can be null.
sIndent - indentation to be appended for each level (can be null or empty string if you don't want indentation based on the level).

Select

public Select(java.util.Collection<Option<K,V>> options,
              java.util.Set<K> selected,
              java.lang.String sIndent,
              BasePage pOption)
Build the list of options from a collection, selecting by default the elements that show up in the set, indenting options that have level>0 with some string. With this constructor you can also override the template used to display an option.

If you give a custom template please take note of the following optional tags:

Parameters:
options - list of options
selected - list of selected items. Can be null.
sIndent - indentation to be appended for each level (can be null or empty string if you don't want indentation based on the level).
pOption - a page that has the following tags : 'key', 'selected', 'indent' and 'value'. Can be null, if you want to use the built-in simple template.

Select

public Select(java.util.Collection<Option<K,V>> options,
              java.util.Set<K> selected,
              java.lang.String sIndent,
              BasePage pOption,
              OptionFormatter formatter)
Build the list of options from a collection, selecting by default the elements that show up in the set, indenting options that have level>0 with some string. With this constructor you can also override the template used to display an option.

If you give a custom template please take note of the following optional tags:

The formatter is used to further change each option, as it is displayed.

Parameters:
options - list of options
selected - list of selected items. Can be null.
sIndent - indentation to be appended for each level (can be null or empty string if you don't want indentation based on the level).
pOption - a page that has the following tags : 'key', 'selected', 'indent' and 'value'. Can be null, if you want to use the built-in simple template.
formatter - line extra formatter
Method Detail

getContents

public java.lang.StringBuilder getContents()
Description copied from interface: Page
Get the (dynamic) content.

Specified by:
getContents in interface Page
Returns:
content