use of com.agiletec.aps.util.SelectItem in project entando-core by entando.
the class CategoriesTag method doStartTag.
@Override
public int doStartTag() throws JspException {
ServletRequest request = this.pageContext.getRequest();
RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
ICategoryManager catManager = (ICategoryManager) ApsWebApplicationUtils.getBean(SystemConstants.CATEGORY_MANAGER, this.pageContext);
try {
List<SelectItem> categories = new ArrayList<SelectItem>();
Category root = (null != this.getRoot()) ? catManager.getCategory(this.getRoot()) : null;
if (null == root) {
root = catManager.getRoot();
}
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
String langCode = currentLang.getCode();
String reqTitStyle = this.getTitleStyle();
List<String> allowedStyles = Arrays.asList(ALLOWED_TITLE_TYPES);
String titleStyle = (null != reqTitStyle && (allowedStyles.contains(reqTitStyle))) ? reqTitStyle : null;
this.addSmallCategory(categories, root, langCode, titleStyle, catManager);
this.pageContext.setAttribute(this.getVar(), categories);
} catch (Throwable t) {
_logger.error("Error starting tag", t);
throw new JspException("Error starting tag", t);
}
return super.doStartTag();
}
use of com.agiletec.aps.util.SelectItem in project entando-core by entando.
the class EnumeratorMapAttribute method addExtractedItems.
private void addExtractedItems(List<SelectItem> items) {
SelectItem[] values = null;
if (null == this.getMapItems() || this.getMapItems().length == 0) {
values = new SelectItem[items.size()];
for (int i = 0; i < items.size(); i++) {
SelectItem item = items.get(i);
values[i] = item;
}
} else {
values = new SelectItem[this.getMapItems().length + items.size()];
for (int i = 0; i < this.getMapItems().length; i++) {
SelectItem item = this.getMapItems()[i];
values[i] = item;
}
for (int i = 0; i < items.size(); i++) {
SelectItem item = items.get(i);
values[i + this.getMapItems().length] = item;
}
}
this.setMapItems(values);
}
Aggregations