Select - Color

Displays a "combo box" that allows you to pick a color. The list of colors (the palette) that a user can choose from is configurable just like the choices in a combo box.

 

Properties and All Attributes views

The Properties view for a component shows the most common set of attributes you can set on a component, and, depending on the component, you might also see options for adding controls, actions, or other components. To open the Properties view, click

Window | Show View | Properties.

These common attributes for the Select - Color component display on the h:selectOneColor, Validation, Behavior, and Accessibility tabs in the Properties view. See the table for a list of attributes.

Configuration option

Description

Add a choice for each item in the color menu

Allows you to specify the names, values and order of colors in the selectOneColor component. You can add single choices or a set of choices.

The All Attributes view shows a table of all the attributes you can set on a component, which includes those attributes you can access from the Properties view. To switch to the All Attributes view, click the

All Attributes icon in the upper right corner of the Properties view.

Table 1. Select - Color attributes

Attribute name

Description

buttonBorder

Controls how the button is drawn relative to the input field. By default, the button is drawn in a manner appropriate to the operating system of the browser so that the button looks like a combo box button. For example in Windows® 2000 or Windows 9X, the button is drawn as part of the border. In Windows XP, the button is drawn as a separately from the input field (to the right). The following values can be set:

  • -1 - Draws the button to match the OS of the browser.

  • +1 - Draws the button to the right of the input field.

buttonColor

Specifies the background-color of the button. By default the background color matches the border color of the input field. Use of this attribute is of limited value, it's currently more of a placeholder for a future extension that will allow an alternate button background graphic to be supplied.

converter

The ID or class name of a custom converter to use with this component. If a custom converter is defined in a TLD, it may also be specified by using the converter tag as a child tag of the component.

dropdownClass

The base class of a set of CSS classes that describe the visual appearance of the dropdown popup. Note that the name excludes the suffixes (e.g., it's inputColor1 not inputColor1_ColorPicker).

onchange

If provided, the function is called whenever an action is taken.

onselect

JavaScript™ event handler invoked when the color changes.

required

The component must be specified. Check this to require the user to enter a value.

showLabels

If specified (true), the name of the currently selected color is displayed in the input field on top of the color swatch. If omitted (or false), the name is not displayed and the input field displays only a color swatch showing the currently selected color.

Note: Ensure the width of the picker is set to a value large enough to accommodate the largest name or the picker may not display properly.

size

The width (in characters) of the control. The width can be more precisely specified via CSS.

validator

A method (represented by a MethodBinding expression) that accepts FacesContext, UIComponent, and Object parameters. It is called during the validation process to ensure that value of the component is correct.

value

Specifies the initial text value for the component displayed at runtime. Contains information to be displayed, in the form of a specified value or a pointer to a dynamic value.

valueChangeListener

Method to be notified when value of component has changed.

 

Related tasks

Adding selection lists to a Faces JSP file