001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.taglib.ui;
016    
017    import com.liferay.portlet.asset.model.AssetCategoryConstants;
018    import com.liferay.taglib.util.IncludeTag;
019    
020    import javax.servlet.http.HttpServletRequest;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     * @author Jorge Ferrer
025     */
026    public class AssetCategoriesSelectorTag extends IncludeTag {
027    
028            public void setClassName(String className) {
029                    _className = className;
030            }
031    
032            public void setClassPK(long classPK) {
033                    _classPK = classPK;
034            }
035    
036            public void setClassTypePK(long classTypePK) {
037                    _classTypePK = classTypePK;
038            }
039    
040            public void setCurCategoryIds(String curCategoryIds) {
041                    _curCategoryIds = curCategoryIds;
042            }
043    
044            public void setGroupIds(long[] groupIds) {
045                    _groupIds = groupIds;
046            }
047    
048            public void setHiddenInput(String hiddenInput) {
049                    _hiddenInput = hiddenInput;
050            }
051    
052            public void setIgnoreRequestValue(boolean ignoreRequestValue) {
053                    _ignoreRequestValue = ignoreRequestValue;
054            }
055    
056            @Override
057            protected void cleanUp() {
058                    _className = null;
059                    _classPK = 0;
060                    _classTypePK = AssetCategoryConstants.ALL_CLASS_TYPE_PK;
061                    _curCategoryIds = null;
062                    _groupIds = null;
063                    _hiddenInput = "assetCategoryIds";
064                    _ignoreRequestValue = false;
065            }
066    
067            @Override
068            protected String getPage() {
069                    return _PAGE;
070            }
071    
072            @Override
073            protected void setAttributes(HttpServletRequest request) {
074                    request.setAttribute(
075                            "liferay-ui:asset-categories-selector:className", _className);
076                    request.setAttribute(
077                            "liferay-ui:asset-categories-selector:classPK",
078                            String.valueOf(_classPK));
079                    request.setAttribute(
080                            "liferay-ui:asset-categories-selector:classTypePK",
081                            String.valueOf(_classTypePK));
082                    request.setAttribute(
083                            "liferay-ui:asset-categories-selector:curCategoryIds",
084                            _curCategoryIds);
085                    request.setAttribute(
086                            "liferay-ui:asset-categories-selector:groupIds", _groupIds);
087                    request.setAttribute(
088                            "liferay-ui:asset-categories-selector:hiddenInput", _hiddenInput);
089                    request.setAttribute(
090                            "liferay-ui:asset-categories-selector:ignoreRequestValue",
091                            _ignoreRequestValue);
092            }
093    
094            private static final String _PAGE =
095                    "/html/taglib/ui/asset_categories_selector/page.jsp";
096    
097            private String _className;
098            private long _classPK;
099            private long _classTypePK = AssetCategoryConstants.ALL_CLASS_TYPE_PK;
100            private String _curCategoryIds;
101            private long[] _groupIds;
102            private String _hiddenInput = "assetCategoryIds";
103            private boolean _ignoreRequestValue;
104    
105    }