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