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.portal.kernel.util.StringPool;
018    import com.liferay.portal.kernel.util.Validator;
019    
020    import javax.servlet.http.HttpServletRequest;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class SearchPaginatorTag<R> extends SearchFormTag<R> {
026    
027            public void setId(String id) {
028                    _id = id;
029            }
030    
031            public void setMarkupView(String markupView) {
032                    _markupView = markupView;
033            }
034    
035            public void setType(String type) {
036                    _type = type;
037            }
038    
039            @Override
040            protected void cleanUp() {
041                    super.cleanUp();
042    
043                    _markupView = StringPool.BLANK;
044                    _type = "regular";
045            }
046    
047            @Override
048            protected String getPage() {
049                    if (Validator.isNotNull(_markupView)) {
050                            return "/html/taglib/ui/search_paginator/" + _markupView +
051                                    "/page.jsp";
052                    }
053    
054                    return "/html/taglib/ui/search_paginator/page.jsp";
055            }
056    
057            @Override
058            protected void setAttributes(HttpServletRequest request) {
059                    super.setAttributes(request);
060    
061                    request.setAttribute("liferay-ui:search:id", _id);
062                    request.setAttribute("liferay-ui:search:markupView", _markupView);
063                    request.setAttribute("liferay-ui:search:type", _type);
064            }
065    
066            private String _id;
067            private String _markupView;
068            private String _type = "regular";
069    
070    }