/** * @param fontName * @return */ private static UISelectItem createItem(String fontName) { UISelectItem item = new UISelectItem(); item.setItemLabel(fontName); item.setItemValue(fontName); return item; }
RichSelectOneChoice choiceList; List child = choiceList.getChildren(); child.clear(); for (int i = 0; i < child.size(); i++){ child.remove(i); } if ("1..1".equalsIgnoreCase(ccCode)){ UISelectItem addChild = new UISelectItem(); addChild.setItemLabel("1..1"); addChild.setItemValue("1..1"); child.add(addChild); } else if ("0..1".equalsIgnoreCase(ccCode)){ UISelectItem addChild1 = new UISelectItem(); addChild1.setItemLabel("0..1"); addChild1.setItemValue("0..1"); child.add(addChild1); UISelectItem addChild2 = new UISelectItem(); addChild2.setItemLabel("1..1"); addChild2.setItemValue("1..1"); child.add(addChild2); }
/** * @param styleName * @param resources * @return */ private UISelectItem createItem(String styleName, ResourceBundle resources) { UISelectItem item = new UISelectItem(); if (StringUtils.isEmpty(styleName)) { item.setItemLabel(""); } else { String key = "properties.fontStyle.option." + styleName; item.setItemLabel(resources.getString(key)); } item.setItemValue(styleName); return item; }
UISelectItem defaultItem = new UISelectItem(); defaultItem.setItemLabel(messages .getString("message.catalog.chooser.default")); UISelectItem item = new UISelectItem();
UISelectItem defaultItem = new UISelectItem(); defaultItem.setItemLabel(messages .getString("message.cubeList.default")); UISelectItem item = new UISelectItem();
public List<UISelectItem> getCubes() throws SQLException { if (cubeItems == null) { FacesContext context = FacesContext.getCurrentInstance(); ResourceBundle bundle = context.getApplication().getResourceBundle( context, "msg"); String defaultLabel = bundle.getString("message.cubeList.default"); this.cubeItems = new ArrayList<UISelectItem>(); UISelectItem defaultItem = new UISelectItem(); defaultItem.setItemLabel(defaultLabel); defaultItem.setItemValue(""); cubeItems.add(defaultItem); if (model != null) { OlapDataSource dataSource = ((PivotModelImpl) model) .getDataSource(); Schema schema = dataSource.getConnection().getOlapSchema(); List<Cube> cubes = schema.getCubes(); for (Cube cube : cubes) { if (cube.isVisible()) { UISelectItem item = new UISelectItem(); item.setItemLabel(cube.getCaption()); item.setItemValue(cube.getName()); cubeItems.add(item); } } } } return cubeItems; }
selectItem = new UISelectItem(); selectItem.setItemValue(itemValue); selectItem.setItemLabel(itemLabel);
int currentMonth = timeKeeper.get(Calendar.MONTH); for (int i = 0; i < months.length; i++) { selectItem = new UISelectItem(); calendar = shiftMonth(facesContext, timeKeeper, currentDay, i - currentMonth); selectItem.setItemValue(converter.getAsString(facesContext, component, calendar.getTime()));