001    /**
002     * Copyright (c) 2000-2011 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.util.DiffResult;
018    import com.liferay.taglib.util.IncludeTag;
019    
020    import java.util.List;
021    
022    import javax.servlet.http.HttpServletRequest;
023    
024    /**
025     * @author Bruno Farache
026     */
027    public class DiffTag extends IncludeTag {
028    
029            public void setDiffResults(List<DiffResult>[] diffResults) {
030                    _diffResults = diffResults;
031            }
032    
033            public void setSourceName(String sourceName) {
034                    _sourceName = sourceName;
035            }
036    
037            public void setTargetName(String targetName) {
038                    _targetName = targetName;
039            }
040    
041            @Override
042            protected void cleanUp() {
043                    _diffResults = null;
044                    _sourceName = null;
045                    _targetName = null;
046            }
047    
048            @Override
049            protected String getPage() {
050                    return _PAGE;
051            }
052    
053            @Override
054            protected void setAttributes(HttpServletRequest request) {
055                    request.setAttribute("liferay-ui:diff:diffResults", _diffResults);
056                    request.setAttribute("liferay-ui:diff:sourceName", _sourceName);
057                    request.setAttribute("liferay-ui:diff:targetName", _targetName);
058            }
059    
060            private static final String _PAGE = "/html/taglib/ui/diff/page.jsp";
061    
062            private List<DiffResult>[] _diffResults;
063            private String _sourceName;
064            private String _targetName;
065    
066    }