📜  RichFaces Rich:AutoComplete

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

RichFaces

该组件是具有内置Ajax功能的自动完成输入框。它支持客户端建议,类似浏览器的选择以及外观的自定义。

它是标准的JavaServer Faces用户界面输入控件,具有附加的验证功能。

样式类和皮肤参数

下表包含样式类(选择器)和自动完成组件的相应外观参数。

Class Function Skin Parameters Mapped CSS properties
.rf-au-fnt It is used to define styles for the auto-complete box font. generalTextColor
generalFamilyFont
color
font-family
.rf-au-inp It is used to define styles for the auto-complete input box. controlBackgroundColor background-color
.rf-au-fld It is used to define styles for the auto-complete field. panelBorderColor
controlBackgroundColor
border-color
background-color
.rf-au-fld-btn It is used to define styles for a button in the auto-complete field. No skin parameters.
.rf-au-btn It is used to define styles for the auto-complete box button. panelBorderColor border-left-color
.rf-au-btn-arrow It is used to define styles for the button arrow. No skin parameters.
.rf-au-btn-arrow-dis It is used to define styles for the button arrow when it is disabled. No skin parameters.
.rf-au-lst-scrl It is used to define styles for the scrollbar in the auto-complete list. No skin parameters.
.rf-au-itm It is used to define styles for an item in the auto-complete list. No skin parameters.
.rf-au-itm-sel It is used to define styles for a selected item in the auto-complete list. headerBackgroundColor
generalTextColor
background-color
border-color
.rf-au-shdw It is used to define styles for the auto-complete box shadow. No skin parameters.
.rf-au-shdw-t, .rf-au-shdw-l, .rf-au-shdw-r, .rf-au-shdw-b These classes define styles for the top, left, right, and bottom part of the auto-complete box shadow. No skin parameters.
.rf-au-tbl It is used to define styles for a table in the auto-complete box. No skin parameters.

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

JSF文件

// autocomplete.xhtml






AutoComplete 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;
}
}

输出:

在这里,当我们开始输入国家/地区时,它会显示可自动完成的列表。