当前位置: 首页>>代码示例>>Java>>正文


Java UISelectItem.setItemValue方法代码示例

本文整理汇总了Java中javax.faces.component.UISelectItem.setItemValue方法的典型用法代码示例。如果您正苦于以下问题:Java UISelectItem.setItemValue方法的具体用法?Java UISelectItem.setItemValue怎么用?Java UISelectItem.setItemValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.faces.component.UISelectItem的用法示例。


在下文中一共展示了UISelectItem.setItemValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSelectOneChoice

import javax.faces.component.UISelectItem; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void testSelectOneChoice() throws IOException
{
  CoreSelectOneChoice choice = new CoreSelectOneChoice();
  choice.setSimple(true);
  choice.setValue(new Integer(2));
  for (int i = 0 ; i < 10; i++)
  {
    UISelectItem selectItem  = new UISelectItem();
    selectItem.setItemLabel("Item " + i);
    selectItem.setItemValue(new Integer(i));
    choice.getChildren().add(selectItem);
  }

  UIViewRoot root = createTestTree(choice, "testSelectOneChoice");
  renderRoot(root);

  root = createTestTree(choice, "testSelectOneChoice2");
  renderRoot(root);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:21,代码来源:CoreRenderKitPerf.java

示例2: testRISelectOneMenu

import javax.faces.component.UISelectItem; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void testRISelectOneMenu() throws IOException
{
  //
  HtmlSelectOneMenu menu = new HtmlSelectOneMenu();
  menu.setValue(new Integer(2));
  for (int i = 0 ; i < 10; i++)
  {
    UISelectItem selectItem  = new UISelectItem();
    selectItem.setItemLabel("Item " + i);
    selectItem.setItemValue("" + i);
    menu.getChildren().add(selectItem);
  }

  UIViewRoot root = createTestTree(menu, "testRISelectOneMenu");
  renderRoot(root);

  root = createTestTree(menu, "testRISelectOneNavigation2");
  renderRoot(root);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:21,代码来源:CoreRenderKitPerf.java

示例3: testSelectOneRadio

import javax.faces.component.UISelectItem; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void testSelectOneRadio() throws IOException
{
  CoreSelectOneRadio radio = new CoreSelectOneRadio();
  radio.setSimple(true);
  radio.setValue(new Integer(2));
  for (int i = 0 ; i < 10; i++)
  {
    UISelectItem selectItem  = new UISelectItem();
    selectItem.setItemLabel("Item " + i);
    selectItem.setItemValue(new Integer(i));
    radio.getChildren().add(selectItem);
  }

  UIViewRoot root = createTestTree(radio, "testSelectOneRadio");
  renderRoot(root);

  root = createTestTree(radio, "testSelectOneRadio2");
  renderRoot(root);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:21,代码来源:CoreRenderKitPerf.java

示例4: testRISelectOneRadio

import javax.faces.component.UISelectItem; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void testRISelectOneRadio() throws IOException
{
  //
  HtmlSelectOneRadio radio = new HtmlSelectOneRadio();
  radio.setValue(new Integer(2));
  for (int i = 0 ; i < 10; i++)
  {
    UISelectItem selectItem  = new UISelectItem();
    selectItem.setItemLabel("Item " + i);
    selectItem.setItemValue("" + i);
    radio.getChildren().add(selectItem);
  }

  UIViewRoot root = createTestTree(radio, "testRISelectOneRadio");
  renderRoot(root);

  root = createTestTree(radio, "testRISelectOneRadio2");
  renderRoot(root);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:21,代码来源:CoreRenderKitPerf.java

示例5: addEmptySelectItem

import javax.faces.component.UISelectItem; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void addEmptySelectItem(final UIComponent component, final Class<?> enumType, final ResourceBundle translation) {
	UISelectItem empty = new UISelectItem();
	try {
		String transKey = enumType.getName() + ".(SELECT_ONE)";
		empty.setItemLabel(translation.getString(transKey));
	} catch(Exception e) {
		try {
			empty.setItemLabel(translation.getString("(SELECT_ONE)"));
		} catch(Exception e2) {
			empty.setItemLabel(" - Select One -");
		}
	}
	empty.setItemValue("");
	component.getChildren().add(empty);
	empty.setParent(component);
}
 
开发者ID:jesse-gallagher,项目名称:XPages-Scaffolding,代码行数:18,代码来源:ComponentMap.java

示例6: populateEnumSelectItems

import javax.faces.component.UISelectItem; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void populateEnumSelectItems(final UIComponent component, final Class<?> enumType, final ResourceBundle translation) {

	Enum<?>[] constants = (Enum<?>[])enumType.getEnumConstants();
	for(Enum<?> constant : constants) {
		UISelectItem item = new UISelectItem();

		// Look for a localized label
		String label = constant.name();
		if(translation != null) {
			String transKey = enumType.getName() + "." + constant.name();
			try {
				label = translation.getString(transKey);
			} catch(Exception e) {
				// Ignore
			}
		}

		item.setItemLabel(label);

		item.setItemValue(constant);
		component.getChildren().add(item);
		item.setParent(component);
	}
}
 
开发者ID:jesse-gallagher,项目名称:XPages-Scaffolding,代码行数:26,代码来源:ComponentMap.java


注:本文中的javax.faces.component.UISelectItem.setItemValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。