C H A P T E R  9

Data-Driven Combo Box

The Data-Driven Combo Box component is a type of choice component that can have its choices populated from a model component. It provides a list of choices presented in a drop-down list style interface.

Property Name

Description

Notes

Cached Choices Attribute Name

The name of the attribute used to cache choices for reuse. This value is used in accordance with the value of the Choices Retrieval Policy property.

 

Choices Label Binding

The model fields that will be used to generate the labels for the component's list of choices. The Choices Model Reference property must be configured before this property can be configured. This property allows multiple bindings, which will be combined via the Choices Label Message Format property into a single choice label.

Req

Dependent on Choices Model Reference

Choices Label Message Format

The message format string that will be applied to transform the raw choice data into formatted choice labels. This format string may include plain text as well as standard Java message format tokens ("{0}", "{1}", etc.). Each message format token will be replaced by the value of the label model binding that corresponds to the specified index.

 

Choices Model Reference

A reference to the model from which the component's choices list will be obtained using the value and choice label model field bindings. This property must be configured before the Choices Label Binding and Choices Value Binding properties can be configured.

Req

Choices Retrieval Exception Handler

Determines how an exception is handled if an exception is thrown while the choices values or labels are being retrieved from the model. The possible settings for this property are the following: the default (throw the Exception); invoke the data-driven choice component retrieval exception handler method (handle<ComponentName>ChoicesRetrievalException), or delegate to a command component.

 

Choices Retrieval Policy

Determines how and when the choices for the component are retrieved and populated. The possible settings for this property are the following: manual retrieval (developer takes full control of initiating choices retrieval), once per request, once per session (once for each new HTTP session created), once per application (upon first request per virtual machine), and every time (if component is used more than once in a request, choices are retrieved once each time the component is rendered). Default setting is once per request.

 

Choices Value Binding

The model fields that will be used to generate the values for the component's list of choices. The Choices Model Reference property must be configured before this property can be configured.

Req

Dependent on Choices Model Reference

Initial Value

The value to which the visual component is initialized upon its instantiation. Note, this value will overwrite any value in the bound model field if one exists. If you want to set a value on a component without potentially overwriting the model field's value, avoid using this property and instead use the setValue(Object value,boolean overwrite) method with the overwrite parameter set to false. You may call this method from your code as needed (for example, from an event handler) or from the Post-initialization Code property of the component.

 

Model Field Binding

The model field to which the visual component is bound (where it stores/retrieves its value). The Model Reference property must be configured before this property can be configured.

Dependent on Model Reference

Model Reference

A reference to the model to which the visual component's bound model field belongs. This property must be configured before the Model Field Binding property can be configured.

Req

Name

The name of the component instance.

 

Null Choice Label

The text that is displayed as the component's choice when the field's value is null. Leaving this property empty (null) will prevent a null choice option from being presented to the user, thus forcing the user to select one of the choices from the list.

 

Visible

Controls whether the component will be displayed or not. Can also be set programmatically using the component's setVisible(boolean) method.