/** * Writes the data source items to a design. Hierarchical select components * should override this method to only write the root items. * * @since 7.5.0 * @param design * the element into which to insert the items * @param context * the DesignContext instance used in writing */ protected void writeItems(Element design, DesignContext context) { for (Object itemId : getItemIds()) { writeItem(design, itemId, context); } }
@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; }