About this tag
This tag renders a drop-down menu. Use the selected
attribute to associate the component with a model object that
represents the current choice, by setting the value to an EL
expression that corresponds to a property of a
managed bean.
Configuring the dropdown tag
Use the items attribute to specify the options
from which the web application user can choose. The value must be
an EL expression that identifies an array, a
java.util.Collection or a java.util.Map
of com.sun.rave.web.ui.model.Option .
The first time the component is rendered, the option which
corresponds to the value of the selected model object
property is marked as selected, using the equals
method on the model object.
To optionally specify a label for the component, use the
label attribute, or specify a label facet.
Facets
label : use this facet to specify a custom
component for the label.
Client-side JavaScript functions
dropDown_setDisabled(<id>, <disabled>) : use
this function to enable/disable the drop-down menu. <id>
must be the generated id of the component. Set
<disabled> to true to disable the component,
false to enable it.
dropDown_changed(<id>) : this
function is automatically invoked by the drop-down menu's
onchange handler. <id>
must be the generated id of the component.
Examples
<ui:dropDown selected="#{flightSearch.leaveAirport}"
items="#{dataBean.airports}"
id="leaveAirport"
tooltip="#{msgs.chooseAirport}" label="#{msgs.chooseDepartureAirport}" />
<ui:dropDown selected="#{flightSearch.leaveAirport}"
items="#{dataBean.airports}"
id="leaveAirport"
tooltip="#{msgs.chooseAirport}"
label="#{msgs.chooseDepartureAirport}" >
<f:facet name="label">
<facet component goes here>
</f:facet>
</ui:dropDown>
The dataBean backing bean would include the following definition for the "airports" items:
private Option[] airports = null;
// Creates a new instance of backing bean //
public DataBean() {
airports = new Option[11];
airports[0] = new Option("SFO", "San Francisco");
airports[1] = new Option("OAK", "Oakland");
airports[2] = new Option("SAN", "San Diego");
airports[3] = new Option("BOS", "Boston");
airports[4] = new Option("ARN", "Stockholm");
airports[5] = new Option("MNL", "Manila");
airports[6] = new Option("CDG", "Paris");
airports[7] = new Option("PDX", "Portland");
airports[8] = new Option("LAX", "Los Angeles");
airports[9] = new Option("NRT", "Tokyo");
airports[10] = new Option("TBD", "Future Airport");
airports[10].setDisabled(true);
}
public Option[] getAirports() {
return airports;
}
Auto-generated component class.
Do NOT modify; all changes
will be lost!
|