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 setContentCallback(String contentCallback) {
041                    _contentCallback = contentCallback;
042            }
043    
044            public void setCurCategoryIds(String curCategoryIds) {
045                    _curCategoryIds = curCategoryIds;
046            }
047    
048            public void setGroupIds(long[] groupIds) {
049                    _groupIds = groupIds;
050            }
051    
052            public void setHiddenInput(String hiddenInput) {
053                    _hiddenInput = hiddenInput;
054            }
055    
056            public void setIgnoreRequestValue(boolean ignoreRequestValue) {
057                    _ignoreRequestValue = ignoreRequestValue;
058            }
059    
060            @Override
061            protected void cleanUp() {
062                    _className = null;
063                    _classPK = 0;
064                    _classTypePK = AssetCategoryConstants.ALL_CLASS_TYPE_PK;
065                    _contentCallback = null;
066                    _curCategoryIds = null;
067                    _groupIds = null;
068                    _hiddenInput = "assetCategoryIds";
069                    _ignoreRequestValue = false;
070            }
071    
072            @Override
073            protected String getPage() {
074                    return _PAGE;
075            }
076    
077            @Override
078            protected void setAttributes(HttpServletRequest request) {
079                    request.setAttribute(
080                            "liferay-ui:asset-categories-selector:className", _className);
081                    request.setAttribute(
082                            "liferay-ui:asset-categories-selector:classPK",
083                            String.valueOf(_classPK));
084                    request.setAttribute(
085                            "liferay-ui:asset-categories-selector:classTypePK",
086                            String.valueOf(_classTypePK));
087                    request.setAttribute(
088                            "liferay-ui:asset-categories-selector:contentCallback",
089                            String.valueOf(_contentCallback));
090                    request.setAttribute(
091                            "liferay-ui:asset-categories-selector:curCategoryIds",
092                            _curCategoryIds);
093                    request.setAttribute(
094                            "liferay-ui:asset-categories-selector:groupIds", _groupIds);
095                    request.setAttribute(
096                            "liferay-ui:asset-categories-selector:hiddenInput", _hiddenInput);
097                    request.setAttribute(
098                            "liferay-ui:asset-categories-selector:ignoreRequestValue",
099                            _ignoreRequestValue);
100            }
101    
102            private static final String _PAGE =
103                    "/html/taglib/ui/asset_categories_selector/page.jsp";
104    
105            private String _className;
106            private long _classPK;
107            private long _classTypePK = AssetCategoryConstants.ALL_CLASS_TYPE_PK;
108            private String _contentCallback;
109            private String _curCategoryIds;
110            private long[] _groupIds;
111            private String _hiddenInput = "assetCategoryIds";
112            private boolean _ignoreRequestValue;
113    
114    }