001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.taglib.ui;
016    
017    import com.liferay.portal.kernel.dao.search.DisplayTerms;
018    import com.liferay.taglib.util.IncludeTag;
019    
020    import javax.servlet.http.HttpServletRequest;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class SearchToggleTag extends IncludeTag {
026    
027            public void setButtonLabel(String buttonLabel) {
028                    _buttonLabel = buttonLabel;
029            }
030    
031            public void setDisplayTerms(DisplayTerms displayTerms) {
032                    _displayTerms = displayTerms;
033            }
034    
035            public void setId(String id) {
036                    _id = id;
037            }
038    
039            protected void cleanUp() {
040                    _buttonLabel = null;
041                    _displayTerms = null;
042                    _id = null;
043            }
044    
045            protected String getEndPage() {
046                    return _END_PAGE;
047            }
048    
049            protected String getStartPage() {
050                    return _START_PAGE;
051            }
052    
053            protected void setAttributes(HttpServletRequest request) {
054                    request.setAttribute(
055                            "liferay-ui:search-toggle:buttonLabel", _buttonLabel);
056                    request.setAttribute(
057                            "liferay-ui:search-toggle:displayTerms", _displayTerms);
058                    request.setAttribute("liferay-ui:search-toggle:id", _id);
059            }
060    
061            private static final String _END_PAGE =
062                    "/html/taglib/ui/search_toggle/end.jsp";
063    
064            private static final String _START_PAGE =
065                    "/html/taglib/ui/search_toggle/start.jsp";
066    
067            private String _buttonLabel;
068            private DisplayTerms _displayTerms;
069            private String _id;
070    
071    }