public Listitem newListitem(Listbox listbox) { //clone from template final Listitem clone = (Listitem) _template.clone(); //TODO: see if databinder has this kind of Listitem, if not, add new CollectionListItem //avoid duplicate id error, will set to new id when render() //Bug #1962153: Data binding generates duplicate id in some case (add "_") if (clone.getId().length() > 0) { clone.setId(null); } //link cloned component with template //each Listitem and and it decendants share the same templatemap Map<Object, Object> templatemap = new HashMap<Object, Object>(8); BindingRendererUtil.linkTemplates(clone, _template, templatemap, _binder); //link this template map to parent templatemap (Listbox in Listbox) Map parenttemplatemap = (Map) listbox.getAttribute(DataBinder.TEMPLATEMAP); if (parenttemplatemap != null) { templatemap.put(DataBinder.TEMPLATEMAP, parenttemplatemap); } //kept clone kids somewhere to avoid create too many components in browser final List<Component> kids = new ArrayList<Component>(clone.getChildren()); clone.setAttribute(KIDS, kids); clone.getChildren().clear(); return clone; }
nli.setAttribute(BinderCtrl.VAR, varnm); // for the converter to get the value nli.setAttribute(AbstractRenderer.IS_TEMPLATE_MODEL_ENABLED_ATTR, true); nli.setAttribute(AbstractRenderer.CURRENT_INDEX_RESOLVER_ATTR, new IndirectBinding(data) { public Binder getBinder() { return BinderUtil.getBinder(nli, true); nli.setAttribute(itervarnm, iterStatus); nli.setAttribute(TemplateResolver.TEMPLATE_OBJECT, obj); } else { nli.removeAttribute(TemplateResolver.TEMPLATE_OBJECT); item.setAttribute(Attributes.MODEL_RENDERAS, nli);
/** * Wire variables and events. */ @Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); for (CodeableConceptDt cat : EncounterUtil.getServiceCategories()) { CodingDt coding = cat.getCodingFirstRep(); Comboitem item = cboServiceCategory.appendItem(coding.getDisplay()); item.setValue(coding.getCode()); item.setTooltiptext(cat.getText()); } List<String> data = broker.callRPCList("RGCWENCX CLINLOC", null, "", 1, 9999); for (String itm : data) { String[] pcs = StrUtil.split(itm, StrUtil.U, 3); Listitem item = lstLocation.appendItem(pcs[1], pcs[0]); item.setAttribute("sc", pcs[2]); } }
String[] pcs = StrUtil.split(itm, StrUtil.U, 3); Listitem item = lstLocation.appendItem(pcs[1], pcs[0]); item.setAttribute("sc", pcs[2]); item.addForward(Events.ON_DOUBLE_CLICK, btnOK, Events.ON_CLICK);
item.setAttribute(Attributes.MODEL_RENDERAS, nli);