Search in sources :

Example 21 with SelectItem

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();
}
Also used : ServletRequest(javax.servlet.ServletRequest) JspException(javax.servlet.jsp.JspException) Category(com.agiletec.aps.system.services.category.Category) SelectItem(com.agiletec.aps.util.SelectItem) ArrayList(java.util.ArrayList) Lang(com.agiletec.aps.system.services.lang.Lang) RequestContext(com.agiletec.aps.system.RequestContext) ICategoryManager(com.agiletec.aps.system.services.category.ICategoryManager)

Example 22 with SelectItem

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);
}
Also used : SelectItem(com.agiletec.aps.util.SelectItem)

Aggregations

SelectItem (com.agiletec.aps.util.SelectItem)22 ArrayList (java.util.ArrayList)15 BeanComparator (org.apache.commons.beanutils.BeanComparator)6 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)4 List (java.util.List)4 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)3 HashMap (java.util.HashMap)3 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)2 Category (com.agiletec.aps.system.services.category.Category)2 Lang (com.agiletec.aps.system.services.lang.Lang)2 WidgetType (org.entando.entando.aps.system.services.widgettype.WidgetType)2 RequestContext (com.agiletec.aps.system.RequestContext)1 ICategoryManager (com.agiletec.aps.system.services.category.ICategoryManager)1 IPage (com.agiletec.aps.system.services.page.IPage)1 Permission (com.agiletec.aps.system.services.role.Permission)1 ContentUtilizer (com.agiletec.plugins.jacms.aps.system.services.content.ContentUtilizer)1 ServletRequest (javax.servlet.ServletRequest)1 JspException (javax.servlet.jsp.JspException)1 RootFolderAttributeView (org.entando.entando.aps.system.services.storage.RootFolderAttributeView)1 Shortcut (org.entando.entando.apsadmin.system.services.shortcut.model.Shortcut)1