static void assignDataIfNull(Object selectItem) { UISelectItem uiSelectItem = (UISelectItem) selectItem; if (uiSelectItem.getItemValue() == null) { if (uiSelectItem.getItemLabel() != null) { uiSelectItem.setItemValue(uiSelectItem.getItemLabel()); } } if (uiSelectItem.getItemLabel() == null) { if (uiSelectItem.getItemValue() != null) { uiSelectItem.setItemLabel(uiSelectItem.getItemValue().toString()); } } }
private HtmlSelectOneMenu buildSelectBox(String[] opts, CustomButtonNode parent) { HtmlSelectOneMenu newMenu = new HtmlSelectOneMenu(); for (int a = 0; a < opts.length; a++) { UISelectItem item = new UISelectItem(); item.setItemValue(opts[a]); newMenu.getChildren().add(item); } newMenu.setStyle("margin-left:" + (parent.getOffset() + 5) + "px;"); newMenu.addValueChangeListener( new ValueChangeListener() { public void processValueChange(ValueChangeEvent e) throws AbortProcessingException { valueChanged(e); } }); newMenu.setPartialSubmit(true); return newMenu; }
private static UISelectItem newUISelectItem(Object value) { UISelectItem item = new UISelectItem(); item.setItemValue(value); item.setItemLabel(value.toString()); return item; }