📜  RichFaces Rich:Select

📅  最后修改于: 2021-01-08 12:31:11             🧑  作者: Mango

RichFaces

该组件提供了一个下拉列表框,用于从多个选项中选择一个值。它类似于JSF UISelectOne组件。

我们可以在自动完成模式下使用它,该下拉列表中的值是使用autocompleteMethod或autocompleteList属性动态提供的。

样式类和皮肤参数

下表包含用于select的样式类和相应的外观参数。

Class Function Skin Parameters Mapped CSS properties
.rf-sel It is used to define styles for the select control itself. No skin parameters.
.rf-sel-cntr It is used to define styles for the container of the select control. panelBorderColor border-color
.rf-sel-inp It is used to define styles for the select control input field. controlBackgroundColor background-color
.rf-sel-fld-err It is used to define styles for the input field when an error occurs. No skin parameters.
.rf-sel-opt It is used to define styles for an option in the select control. generalTextColor
generalSizeFont
color
font-size
.rf-sel-sel It is used to define styles for the selected option of the select control. generalTextColor border-color
.rf-sel-dflt-lbl It is used to define styles for the default label of the select control. No skin parameters.
.rf-sel-btn It is used to define styles for the button of the select control. headerBackgroundColor background-color
.rf-sel-btn-arrow It is used to define styles for the arrow on the button. No skin parameters.
.rf-sel-btn-dis It is used to define styles for the button of the select control when it is disabled. No skin parameters.
.rf-sel-lst-scrl It is used to define styles for the list scrollbar. No skin parameters.
.rf-sel-shdw It is used to define styles for the select control shadow. No skin parameters.
.rf-sel-shdw-t, .rf-sel-shdw-b, .rf-sel-shdw-l, .rf-sel-shdw-r These classes define the top, bottom, left, and right edge of the select control shadows. No skin parameters.

在下面的示例中,我们正在实现< rich:select >组件。本示例包含以下文件。

JSF文件

// rich-select.xhtml






Rich Select Example





托管豆

// Country.java

import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
@ManagedBean
@RequestScoped
public class Country {
String CountryName;
public List countryList() {
ArrayList list = new ArrayList<>();
list.add("India");
list.add("Australia");
list.add("Germany");
list.add("Italy");
list.add("United States");
list.add("Russia");
return list;
}
public String getCountryName() {
return CountryName;
}
public void setCountryName(String CountryName) {
this.CountryName = CountryName;
}
}

输出: