001    /**
002     * Copyright (c) 2000-2010 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.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    }