1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.taglib.ui;
16  
17  import com.liferay.portal.kernel.util.DiffResult;
18  import com.liferay.taglib.util.IncludeTag;
19  
20  import java.util.List;
21  
22  import javax.servlet.http.HttpServletRequest;
23  
24  /**
25   * <a href="DiffTag.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Bruno Farache
28   */
29  public class DiffTag extends IncludeTag {
30  
31      public int doStartTag() {
32          HttpServletRequest request =
33              (HttpServletRequest)pageContext.getRequest();
34  
35          request.setAttribute("liferay-ui:diff:diffResults", _diffResults);
36          request.setAttribute("liferay-ui:diff:sourceName", _sourceName);
37          request.setAttribute("liferay-ui:diff:targetName", _targetName);
38  
39          return EVAL_BODY_BUFFERED;
40      }
41  
42      public void setDiffResults(List<DiffResult>[] diffResults) {
43          _diffResults = diffResults;
44      }
45  
46      public void setSourceName(String sourceName) {
47          _sourceName = sourceName;
48      }
49  
50      public void setTargetName(String targetName) {
51          _targetName = targetName;
52      }
53  
54      protected String getDefaultPage() {
55          return _PAGE;
56      }
57  
58      private static final String _PAGE = "/html/taglib/ui/diff/page.jsp";
59  
60      private List<DiffResult>[] _diffResults;
61      private String _sourceName;
62      private String _targetName;
63  
64  }