|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.click.control.Option
Provides a select Option element: <option></option>.
The Option class uses an immutable design so Option instances can be shared by multiple Pages in the multi-threaded Servlet environment. This enables Option instances to be cached as static variables.public class InvestmentSelect extends Select { private static final List INVESTMENT_OPTIONS = new ArrayList(); static { OptionGroup property = new OptionGroup("Property"); property.add(new Option("Commerical Property", "Commercial")); property.add(new Option("Residential Property", "Residential")); INVESTMENT_OPTIONS.add(property); OptionGroup securities = new OptionGroup("Securities"); securities.add(new Option("Bonds")); securities.add(new Option("Options")); securities.add(new Option("Stocks")); INVESTMENT_OPTIONS.add(securities); } public InvestmentSelect(String label) { super(label); setOptionList(INVESTMENT_OPTIONS); } } public class InvestmentsPage extends Page { public Form form = new Form(); private Select investmentsSelect = new InvestmentsSelect("investments");; public InvestmentsPage() { investmentsSelect.setMutliple(true); investmentsSelect(7); form.add(investmentsSelect); form.add(new Submit("ok", " OK ")); } .. }Rendered HTML:
|
Select
,
OptionGroup
,
Serialized FormField Summary | |
static Option |
EMPTY_OPTION
The empty select empty option. |
protected String |
label
The Options display label. |
protected String |
value
The Option value. |
Constructor Summary | |
Option(Object value,
String label)
Create an Option with the given value and display label. |
|
Option(String value)
Create an Option with the given value. |
Method Summary | |
String |
getLabel()
Return the Option display label. |
String |
getTag()
Return the Options's html tag: option. |
String |
getValue()
Return the Option value. |
void |
render(Select select,
HtmlStringBuffer buffer)
Return a HTML rendered Option string. |
String |
renderHTML(Select select)
Deprecated. use render(net.sf.click.control.Select, net.sf.click.util.HtmlStringBuffer)
instead |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final Option EMPTY_OPTION
protected final String label
protected final String value
Constructor Detail |
public Option(Object value, String label)
value
- the Option valuelabel
- the Option display labelpublic Option(String value)
value
- the Option value and display labelMethod Detail |
public String getTag()
public String getLabel()
public String getValue()
public void render(Select select, HtmlStringBuffer buffer)
select
- the parent Selectbuffer
- the specified buffer to render topublic String renderHTML(Select select)
render(net.sf.click.control.Select, net.sf.click.util.HtmlStringBuffer)
instead
select
- the parent Select
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |