@Override public void paintContent(PaintTarget target) throws PaintException { target.addAttribute("type", "optiongroup"); if (isHtmlContentAllowed()) { target.addAttribute(OptionGroupConstants.HTML_CONTENT_ALLOWED, true); } super.paintContent(target); }
@Override protected Element writeItem(Element design, Object itemId, DesignContext context) { Element elem = super.writeItem(design, itemId, context); if (!isItemEnabled(itemId)) { elem.attr("disabled", ""); } if (isHtmlContentAllowed()) { // need to unencode HTML entities. AbstractSelect.writeDesign can't // check if HTML content is allowed, so it always encodes entities // like '>', '<' and '&'; in case HTML content is allowed this is // undesirable so we need to unencode entities. Entities other than // '<' and '>' will be taken care by Jsoup. elem.html(DesignFormatter.decodeFromTextNode(elem.html())); } return elem; }