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    import javax.servlet.jsp.JspWriter;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class JournalContentSearchTag extends IncludeTag {
026    
027            public void setShowListed(boolean showListed) {
028                    _showListed = showListed;
029            }
030    
031            public void setTargetPortletId(String targetPortletId) {
032                    _targetPortletId = targetPortletId;
033            }
034    
035            public void setType(String type) {
036                    _type = type;
037            }
038    
039            @Override
040            protected void cleanUp() {
041                    _showListed = true;
042                    _targetPortletId = null;
043                    _type = null;
044            }
045    
046            @Override
047            protected String getEndPage() {
048                    return _END_PAGE;
049            }
050    
051            @Override
052            protected String getStartPage() {
053                    return _START_PAGE;
054            }
055    
056            @Override
057            protected int processEndTag() throws Exception {
058                    JspWriter jspWriter = pageContext.getOut();
059    
060                    jspWriter.write("</form>");
061    
062                    return EVAL_PAGE;
063            }
064    
065            @Override
066            protected void setAttributes(HttpServletRequest request) {
067                    request.setAttribute(
068                            "liferay-ui:journal-content-search:showListed",
069                            String.valueOf(_showListed));
070                    request.setAttribute(
071                            "liferay-ui:journal-content-search:targetPortletId",
072                            _targetPortletId);
073                    request.setAttribute("liferay-ui:journal-content-search:type", _type);
074            }
075    
076            private static final String _END_PAGE =
077                    "/html/taglib/ui/journal_content_search/end.jsp";
078    
079            private static final String _START_PAGE =
080                    "/html/taglib/ui/journal_content_search/start.jsp";
081    
082            private boolean _showListed;
083            private String _targetPortletId;
084            private String _type;
085    
086    }