Search in sources :

Example 1 with UIAjaxCategoryPicker

use of org.alfresco.web.ui.repo.component.UIAjaxCategoryPicker in project acs-community-packaging by Alfresco.

the class AdvancedSearchDialog method addCategory.

/**
 * Action handler called when the Add button is pressed to add the current Category selection
 */
@SuppressWarnings("unchecked")
public void addCategory(ActionEvent event) {
    UIAjaxCategoryPicker selector = (UIAjaxCategoryPicker) event.getComponent().findComponent("catSelector");
    UISelectBoolean chkChildren = (UISelectBoolean) event.getComponent().findComponent("chkCatChildren");
    List<NodeRef> categoryRefs = (List<NodeRef>) selector.getValue();
    if (categoryRefs != null) {
        for (NodeRef categoryRef : categoryRefs) {
            Node categoryNode = new MapNode(categoryRef);
            // add a value bound propery used to indicate if searching across children is selected
            categoryNode.getProperties().put(INCLUDE_CHILDREN, chkChildren.isSelected());
            properties.getCategories().add(categoryNode);
        }
        // clear selector value after the list has been populated
        selector.setValue(null);
    }
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) UIAjaxCategoryPicker(org.alfresco.web.ui.repo.component.UIAjaxCategoryPicker) Node(org.alfresco.web.bean.repository.Node) MapNode(org.alfresco.web.bean.repository.MapNode) UISelectBoolean(javax.faces.component.UISelectBoolean) ArrayList(java.util.ArrayList) UIModeList(org.alfresco.web.ui.common.component.UIModeList) List(java.util.List) MapNode(org.alfresco.web.bean.repository.MapNode)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 UISelectBoolean (javax.faces.component.UISelectBoolean)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 MapNode (org.alfresco.web.bean.repository.MapNode)1 Node (org.alfresco.web.bean.repository.Node)1 UIModeList (org.alfresco.web.ui.common.component.UIModeList)1 UIAjaxCategoryPicker (org.alfresco.web.ui.repo.component.UIAjaxCategoryPicker)1