001    /**
002     * Copyright (c) 2000-2013 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.taglib.util.IncludeTag;
018    
019    import javax.servlet.http.HttpServletRequest;
020    
021    /**
022     * @author Alvaro del Castillo
023     * @author Eduardo Lundgren
024     * @author Jorge Ferrer
025     */
026    public class AssetTagsNavigationTag extends IncludeTag {
027    
028            public void setClassNameId(long classNameId) {
029                    _classNameId = classNameId;
030            }
031    
032            public void setDisplayStyle(String displayStyle) {
033                    _displayStyle = displayStyle;
034            }
035    
036            public void setHidePortletWhenEmpty(boolean hidePortletWhenEmpty) {
037                    _hidePortletWhenEmpty = hidePortletWhenEmpty;
038            }
039    
040            public void setMaxAssetTags(int maxAssetTags) {
041                    _maxAssetTags = maxAssetTags;
042            }
043    
044            public void setShowAssetCount(boolean showAssetCount) {
045                    _showAssetCount = showAssetCount;
046            }
047    
048            public void setShowZeroAssetCount(boolean showZeroAssetCount) {
049                    _showZeroAssetCount = showZeroAssetCount;
050            }
051    
052            @Override
053            protected void cleanUp() {
054                    _classNameId = 0;
055                    _displayStyle = "cloud";
056                    _hidePortletWhenEmpty = false;
057                    _maxAssetTags = 0;
058                    _showAssetCount = false;
059                    _showZeroAssetCount = false;
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-tags-navigation:classNameId",
071                            String.valueOf(_classNameId));
072                    request.setAttribute(
073                            "liferay-ui:asset-tags-navigation:displayStyle", _displayStyle);
074                    request.setAttribute(
075                            "liferay-ui:asset-tags-navigation:hidePortletWhenEmpty",
076                            String.valueOf(_hidePortletWhenEmpty));
077                    request.setAttribute(
078                            "liferay-ui:asset-tags-navigation:maxAssetTags",
079                            String.valueOf(_maxAssetTags));
080                    request.setAttribute(
081                            "liferay-ui:asset-tags-navigation:showAssetCount",
082                            String.valueOf(_showAssetCount));
083                    request.setAttribute(
084                            "liferay-ui:asset-tags-navigation:showZeroAssetCount",
085                            String.valueOf(_showZeroAssetCount));
086            }
087    
088            private static final String _PAGE =
089                    "/html/taglib/ui/asset_tags_navigation/page.jsp";
090    
091            private long _classNameId;
092            private String _displayStyle = "cloud";
093            private boolean _hidePortletWhenEmpty;
094            private int _maxAssetTags = 10;
095            private boolean _showAssetCount;
096            private boolean _showZeroAssetCount;
097    
098    }