Search in sources :

Example 1 with SelectItem

use of com.agiletec.aps.util.SelectItem in project entando-core by entando.

the class AbstractContentAction method getAvalaibleStatus.

/**
 * Restituisce la lista di stati di contenuto definiti nel sistema, come insieme di chiave e valore
 * Il metodo è a servizio delle jsp che richiedono questo dato per fornire
 * una corretta visualizzazione della pagina.
 * @return La lista di stati di contenuto definiti nel sistema.
 */
public List<SelectItem> getAvalaibleStatus() {
    String[] status = Content.AVAILABLE_STATUS;
    List<SelectItem> items = new ArrayList<SelectItem>(status.length);
    for (int i = 0; i < status.length; i++) {
        SelectItem item = new SelectItem(status[i], "name.contentStatus." + status[i]);
        items.add(item);
    }
    return items;
}
Also used : SelectItem(com.agiletec.aps.util.SelectItem) ArrayList(java.util.ArrayList)

Example 2 with SelectItem

use of com.agiletec.aps.util.SelectItem in project entando-core by entando.

the class ContentAction method getShowingPageSelectItems.

/**
 * Return the list of the showing pages of the current content on edit
 *
 * @return The list of the showing pages.
 */
public List<SelectItem> getShowingPageSelectItems() {
    List<SelectItem> pageItems = new ArrayList<SelectItem>();
    try {
        Content content = this.getContent();
        if (null != content) {
            IPage defaultViewerPage = this.getPageManager().getOnlinePage(content.getViewPage());
            if (null != defaultViewerPage && CmsPageUtil.isOnlineFreeViewerPage(defaultViewerPage, null)) {
                pageItems.add(new SelectItem("", this.getText("label.default")));
            }
            if (null == content.getId())
                return pageItems;
            ContentUtilizer pageManagerWrapper = (ContentUtilizer) ApsWebApplicationUtils.getBean(JacmsSystemConstants.PAGE_MANAGER_WRAPPER, this.getRequest());
            List<IPage> pages = pageManagerWrapper.getContentUtilizers(content.getId());
            for (int i = 0; i < pages.size(); i++) {
                IPage page = pages.get(i);
                String pageCode = page.getCode();
                pageItems.add(new SelectItem(pageCode, super.getTitle(pageCode, page.getTitles())));
            }
        }
    } catch (Throwable t) {
        _logger.error("Error on extracting showing pages", t);
        throw new RuntimeException("Error on extracting showing pages", t);
    }
    return pageItems;
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) SelectItem(com.agiletec.aps.util.SelectItem) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ArrayList(java.util.ArrayList) ContentUtilizer(com.agiletec.plugins.jacms.aps.system.services.content.ContentUtilizer)

Example 3 with SelectItem

use of com.agiletec.aps.util.SelectItem in project entando-core by entando.

the class ContentFinderAction method getAvalaibleStatus.

/**
 * Restituisce la lista di stati di contenuto definiti nel sistema, come
 * insieme di chiave e valore Il metodo è a servizio delle jsp che
 * richiedono questo dato per fornire una corretta visualizzazione della
 * pagina.
 *
 * @return La lista di stati di contenuto definiti nel sistema.
 */
public List<SelectItem> getAvalaibleStatus() {
    String[] status = Content.AVAILABLE_STATUS;
    List<SelectItem> items = new ArrayList<SelectItem>(status.length);
    for (int i = 0; i < status.length; i++) {
        SelectItem item = new SelectItem(status[i], "name.contentStatus." + status[i]);
        items.add(item);
    }
    return items;
}
Also used : SelectItem(com.agiletec.aps.util.SelectItem) ArrayList(java.util.ArrayList)

Example 4 with SelectItem

use of com.agiletec.aps.util.SelectItem in project entando-core by entando.

the class ContentListViewerWidgetAction method getAllowedFilterTypes.

public List<SelectItem> getAllowedFilterTypes() throws ApsSystemException {
    List<SelectItem> types = new ArrayList<SelectItem>();
    try {
        types.add(new SelectItem(IContentListFilterAction.METADATA_KEY_PREFIX + IContentManager.CONTENT_CREATION_DATE_FILTER_KEY, this.getText("label.creationDate")));
        types.add(new SelectItem(IContentListFilterAction.METADATA_KEY_PREFIX + IContentManager.CONTENT_MODIFY_DATE_FILTER_KEY, this.getText("label.lastModifyDate")));
        String contentType = this.getWidget().getConfig().getProperty(IContentListWidgetHelper.WIDGET_PARAM_CONTENT_TYPE);
        Content prototype = this.getContentManager().createContentType(contentType);
        List<AttributeInterface> contentAttributes = prototype.getAttributeList();
        for (int i = 0; i < contentAttributes.size(); i++) {
            AttributeInterface attribute = contentAttributes.get(i);
            if (attribute.isSearchable()) {
                types.add(new SelectItem(attribute.getName(), this.getText("label.attribute", new String[] { attribute.getName() })));
            }
        }
    } catch (Throwable t) {
        _logger.error("Error extracting allowed filter types", t);
        throw new ApsSystemException("Error extracting allowed filter types", t);
    }
    return types;
}
Also used : SelectItem(com.agiletec.aps.util.SelectItem) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ArrayList(java.util.ArrayList) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 5 with SelectItem

use of com.agiletec.aps.util.SelectItem in project entando-core by entando.

the class PageTreeMenuAction method addGroup.

private void addGroup(String code, Map<String, List<SelectItem>> mapping, List<List<SelectItem>> group) {
    List<SelectItem> singleGroup = mapping.get(code);
    if (null != singleGroup) {
        BeanComparator comparator = new BeanComparator("value");
        Collections.sort(singleGroup, comparator);
        group.add(singleGroup);
    }
}
Also used : SelectItem(com.agiletec.aps.util.SelectItem) BeanComparator(org.apache.commons.beanutils.BeanComparator)

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