protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException { super.renderProperties(renderer); render(renderer, "autodrop", _autodrop); if (!_autocomplete) renderer.render("autocomplete", false); if (!_btnVisible) renderer.render("buttonVisible", false); if (_selItem != null) renderer.render("selectedItemUuid_", _selItem.getUuid()); if (_popupWidth != null) renderer.render("popupWidth", _popupWidth); if (_emptySearchMessage != null) renderer.render("emptySearchMessage", _emptySearchMessage); }
/** Deselects the currently selected items and selects the given item. * <p>Note: if the label of comboitem has the same more than one, the first * comboitem will be selected at client side, it is a limitation of {@link Combobox} * and it is different from {@link Listbox}.</p> * @since 3.0.2 */ public void setSelectedItem(Comboitem item) { if (item != null && item.getParent() != this) throw new UiException("Not a child: " + item); if (item != _selItem) { _selItem = item; if (item != null) { setValue(item.getLabel()); smartUpdate("selectedItemUuid_", item.getUuid()); } else { //Bug#2919037: don't call setRawValue(), or the error message will be cleared if (_value != null && !"".equals(_value)) { _value = ""; smartUpdate("value", coerceToString(_value)); } } _lastCkVal = getValue(); } }
public void render(Component comp, Writer out) throws IOException { final SmartWriter wh = new SmartWriter(out); final Comboitem self = (Comboitem) comp; final String uuid = self.getUuid(); final String zcls = self.getZclass(); wh.write("<tr id=\"").write(uuid).write("\" z.type=\"Cmit\"") .write(self.getOuterAttrs()).write(self.getInnerAttrs()).writeln(">") .write("<td class=\"").write(zcls).write("-img\">").write(self.getImgTag()) .write("</td>\n<td class=\"").write(zcls).write("-text\">"); Out o = new Out(self.getLabel()); o.setPre(true); o.render(out); String s = self.getDescription(); if (!Strings.isBlank(s)) { wh.write("<br/>\n<span class=\"").write(zcls).write("-inner\">"); new Out(s).render(out); wh.write("</span>"); } s = self.getContent(); if (!Strings.isBlank(s)) wh.write("<span class=\"").write(zcls).write("-cnt\">").write(s).write("</span>"); //1. don't use Out to encode since content might contain HTML tags //2. Feature 1908524: no <br/> wh.writeln("</td></tr>"); } }