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 setHiddenInput(String hiddenInput) {
049                    _hiddenInput = hiddenInput;
050            }
051    
052            @Override
053            protected void cleanUp() {
054                    _className = null;
055                    _classPK = 0;
056                    _classTypePK = AssetCategoryConstants.ALL_CLASS_TYPE_PK;
057                    _contentCallback = null;
058                    _curCategoryIds = null;
059                    _hiddenInput = "assetCategoryIds";
060            }
061    
062            @Override
063            protected String getPage() {
064                    return _PAGE;
065            }
066    
067            @Override
068            protected void setAttributes(HttpServletRequest request) {
069                    request.setAttribute(
070                            "liferay-ui:asset-categories-selector:className", _className);
071                    request.setAttribute(
072                            "liferay-ui:asset-categories-selector:classPK",
073                            String.valueOf(_classPK));
074                    request.setAttribute(
075                            "liferay-ui:asset-categories-selector:classTypePK",
076                            String.valueOf(_classTypePK));
077                    request.setAttribute(
078                            "liferay-ui:asset-categories-selector:contentCallback",
079                            String.valueOf(_contentCallback));
080                    request.setAttribute(
081                            "liferay-ui:asset-categories-selector:curCategoryIds",
082                            _curCategoryIds);
083                    request.setAttribute(
084                            "liferay-ui:asset-categories-selector:hiddenInput", _hiddenInput);
085            }
086    
087            private static final String _PAGE =
088                    "/html/taglib/ui/asset_categories_selector/page.jsp";
089    
090            private String _className;
091            private long _classPK;
092            private long _classTypePK = AssetCategoryConstants.ALL_CLASS_TYPE_PK;
093            private String _contentCallback;
094            private String _curCategoryIds;
095            private String _hiddenInput = "assetCategoryIds";
096    
097    }