|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.click.control.Option
public class 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("Commercial 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.setMultiple(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)
Create an Option with the given value. |
|
Option(Object value,
Object label)
Create an Option with the given value and display label. |
Method Summary | |
---|---|
String |
getLabel()
Return the Option display label. |
String |
getTag()
Return the Option'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(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 |
---|
public static final Option EMPTY_OPTION
protected final String label
protected final String value
Constructor Detail |
---|
public Option(Object value, Object label)
value
- the Option valuelabel
- the Option display labelpublic Option(Object 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(org.apache.click.control.Select, org.apache.click.util.HtmlStringBuffer)
instead
select
- the parent Select
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |