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.portal.kernel.dao.search.SearchContainer;
018    import com.liferay.portal.kernel.util.Validator;
019    
020    import java.util.List;
021    
022    import javax.servlet.jsp.tagext.TagData;
023    import javax.servlet.jsp.tagext.TagExtraInfo;
024    import javax.servlet.jsp.tagext.VariableInfo;
025    
026    /**
027     * @author Raymond Aug??
028     */
029    public class SearchContainerResultsTei extends TagExtraInfo {
030    
031            @Override
032            public VariableInfo[] getVariableInfo(TagData tagData) {
033                    String resultsVar = tagData.getAttributeString("resultsVar");
034    
035                    if (Validator.isNull(resultsVar)) {
036                            resultsVar = SearchContainer.DEFAULT_RESULTS_VAR;
037                    }
038    
039                    String totalVar = tagData.getAttributeString("totalVar");
040    
041                    if (Validator.isNull(totalVar)) {
042                            totalVar = SearchContainer.DEFAULT_DEPRECATED_TOTAL_VAR;
043                    }
044    
045                    return new VariableInfo[] {
046                            new VariableInfo(
047                                    resultsVar, List.class.getName(), true, VariableInfo.AT_BEGIN),
048                            new VariableInfo(
049                                    totalVar, Integer.class.getName(), true, VariableInfo.AT_BEGIN)
050                    };
051            }
052    
053    }