本文整理汇总了Java中javax.faces.component.UISelectItems.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java UISelectItems.setValue方法的具体用法?Java UISelectItems.setValue怎么用?Java UISelectItems.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.component.UISelectItems
的用法示例。
在下文中一共展示了UISelectItems.setValue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encodeBegin
import javax.faces.component.UISelectItems; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void encodeBegin(FacesContext context) throws IOException
{
// if the component does not have any children yet create the
// list of Charsets the user can choose from as a child
// SelectItems component.
if (getChildren().size() == 0)
{
UISelectItems items = (UISelectItems)context.getApplication().createComponent("javax.faces.SelectItems");
items.setId(this.getId() + "_items");
items.setValue(createList());
// add the child component
getChildren().add(items);
}
// do the default processing
super.encodeBegin(context);
}
示例2: encodeBegin
import javax.faces.component.UISelectItems; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void encodeBegin(FacesContext context) throws IOException
{
// if the component does not have any children yet create the
// list of MIME types the user can choose from as a child
// SelectItems component.
if (getChildren().size() == 0)
{
UISelectItems items = (UISelectItems)context.getApplication().
createComponent("javax.faces.SelectItems");
items.setId(this.getId() + "_items");
items.setValue(createList());
// add the child component
getChildren().add(items);
}
// do the default processing
super.encodeBegin(context);
}
示例3: encodeBegin
import javax.faces.component.UISelectItems; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void encodeBegin(FacesContext context) throws IOException
{
if (getChildren().size() == 0)
{
UISelectItems items = (UISelectItems)context.getApplication().
createComponent("javax.faces.SelectItems");
items.setId(this.getId() + "_items");
items.setValue(createList());
// add the child component
getChildren().add(items);
}
// do the default processing
super.encodeBegin(context);
}
示例4: encodeBegin
import javax.faces.component.UISelectItems; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void encodeBegin(FacesContext context) throws IOException
{
// if the component does not have any children yet create the
// list of Languages the user can choose from as a child
// SelectItems component.
if (getChildren().size() == 0)
{
UISelectItems items = (UISelectItems) context.getApplication().
createComponent("javax.faces.SelectItems");
items.setId(this.getId() + "_items");
items.setValue(createList());
// add the child component
getChildren().add(items);
}
// do the default processing
super.encodeBegin(context);
}
示例5: generate
import javax.faces.component.UISelectItems; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public UIComponent generate(FacesContext context, String id)
{
UIComponent component = context.getApplication().
createComponent(UISelectOne.COMPONENT_TYPE);
FacesHelper.setupComponentId(context, component, id);
// create the list of choices
UISelectItems itemsComponent = (UISelectItems)context.getApplication().
createComponent("javax.faces.SelectItems");
itemsComponent.setValue(getLanguageItems());
// add the items as a child component
component.getChildren().add(itemsComponent);
return component;
}
示例6: getSelectRemoteType
import javax.faces.component.UISelectItems; //导入方法依赖的package包/类
/**
* @return
*/
public HtmlSelectOneMenu getSelectRemoteType() {
remoteDropDown = new HtmlSelectOneMenu();
final Collection<SelectItem> list = new ArrayList<SelectItem>();
initComponents();
for (RemoteType r : this.remoteList) {
list.add(new SelectItem(r.getRemoteTypeName()));
}
final UISelectItems items = new UISelectItems();
items.setValue(list);
remoteDropDown.getChildren().add(items);
return remoteDropDown;
}
示例7: getSelectKeyCodeFormat
import javax.faces.component.UISelectItems; //导入方法依赖的package包/类
/**
* @return
*/
public HtmlSelectOneMenu getSelectKeyCodeFormat() {
kcFormatDropDown = new HtmlSelectOneMenu();
final Collection<SelectItem> list = new ArrayList<SelectItem>();
initComponents();
for (KeyCodeFormat kcf : this.kcfList) {
list.add(new SelectItem(kcf.getKeyCodeFormatName()));
}
final UISelectItems items = new UISelectItems();
items.setValue(list);
this.kcFormatDropDown.getChildren().add(items);
return kcFormatDropDown;
}
示例8: encodeBegin
import javax.faces.component.UISelectItems; //导入方法依赖的package包/类
@Override
public void encodeBegin(FacesContext context) throws IOException {
// Dynamically generate dropdown selectItems based on component
// attributes
UISelectItems dayItems = (UISelectItems) dayComponent.findComponent(SELECT_ITEMS_DAY_ID);
dayItems.setValue(getDays());
UISelectItems monthItems = (UISelectItems) monthComponent.findComponent(SELECT_ITEMS_MONTH_ID);
monthItems.setValue(getMonths());
UISelectItems yearItems = (UISelectItems) yearComponent.findComponent(SELECT_ITEMS_YEAR_ID);
yearItems.setValue(getYears());
// set dropdowns to values in bound date in model
Date dateValue = (Date) getValue();
if (dateValue != null) {
Calendar cal = Calendar.getInstance();
cal.setTime(dateValue);
int day = cal.get(Calendar.DAY_OF_MONTH);
dayComponent.setValue(day);
int month = cal.get(Calendar.MONTH);
monthComponent.setValue(month + 1);
int year = cal.get(Calendar.YEAR);
yearComponent.setValue(year);
} else {
dayComponent.setValue(null);
monthComponent.setValue(null);
yearComponent.setValue(null);
}
super.encodeBegin(context);
}
示例9: setItems
import javax.faces.component.UISelectItems; //导入方法依赖的package包/类
public void setItems(final List<T> items, final LabelProvider<T> label) {
clear();
UISelectItems uiItems = KarakuComponentFactory.getNewSelectItems();
List<SelectItem> selectItems = SelectHelper
.getSelectItems(items, label);
uiItems.setValue(selectItems);
addDefault();
getBind().getChildren().add(uiItems);
}
示例10: makeSelectOneMenu
import javax.faces.component.UISelectItems; //导入方法依赖的package包/类
/**
* Makes a Faces HtmlSelectOneMenu component for a parameter.
* <p/>
* The menu items are based upon the defined codes for the parameter.
* @param context the UI context
* @param section the parent section
* @param parameter the associated parameter
* @param onchange Javascript associated with the "onchange" event
* @return the UI component
*/
protected HtmlSelectOneMenu makeSelectOneMenu(UiContext context,
Section section,
Parameter parameter,
String onchange) {
// initialize the component
MessageBroker msgBroker = context.extractMessageBroker();
HtmlSelectOneMenu component = new HtmlSelectOneMenu();
component.setId(getFacesId());
component.setDisabled(!getEditable());
component.setOnchange(getOnChange());
component.setOnclick(getOnClick());
setComponentValue(context,component,parameter);
onchange = Val.chkStr(onchange);
if (onchange.length() > 0) {
component.setOnchange(onchange);
}
// add each code as a SelectItem
ArrayList<SelectItem> codeItems = new ArrayList<SelectItem>();
Codes codes = parameter.getContent().getCodes();
for (Code code: codes.values()) {
String sResKey = code.getResourceKey();
String sLabel = code.getKey();
if (sResKey.length() > 0) {
sLabel = msgBroker.retrieveMessage(sResKey);
}
codeItems.add(new SelectItem(code.getKey(),sLabel));
}
UISelectItems uiItems = new UISelectItems();
uiItems.setValue(codeItems);
component.getChildren().add(uiItems);
return component;
}
示例11: constructDatalinkPanelGrid
import javax.faces.component.UISelectItems; //导入方法依赖的package包/类
private void constructDatalinkPanelGrid() {
List<UIComponent> children = this.datalinkPanelGrid.getChildren();
children.clear();
for (Param p : parsedVotable.getDatalinkInputParams()) {
if (p.isIdParam()) {
continue;
}
HtmlOutputText label = new HtmlOutputText();
label.setValue(p.getName() + ": ");
children.add(label);
//check if there are some options available
if (p.getOptions().isEmpty()) {
//no options - just inputText
InputText text = new InputText();
text.setId("datalinkProperty" + p.getName());
children.add(text);
} else {
SelectOneMenu menu = new SelectOneMenu();
menu.setId("datalinkProperty" + p.getName());
List<SelectItem> items = new ArrayList<>();
SelectItem item = new SelectItem();//null value
item.setValue("");
item.setLabel("Nothing selected");
items.add(item);
for (Option o : p.getOptions()) {
item = new SelectItem();
item.setValue(o.getValue());
if (o.getValue().equals(o.getName())) {
item.setLabel(o.getName());
} else if (o.getName().trim().isEmpty()) {
item.setLabel(o.getValue());
} else {
item.setLabel(o.getName() + ": " + o.getValue());
}
items.add(item);
}
UISelectItems uiContainer = new UISelectItems();
uiContainer.setValue(items);
menu.getChildren().add(uiContainer);
children.add(menu);
}
}
}
示例12: JsfSelectOneRenderer
import javax.faces.component.UISelectItems; //导入方法依赖的package包/类
public JsfSelectOneRenderer(String componentType, Model model) {
super(componentType, model, String.class);
UISelectItems items = new UISelectItems();
items.setValue(model.getSelectItems());
component.getChildren().add(items);
}