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.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    }