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.ServerDetector;
18  import com.liferay.portlet.calendar.model.CalEvent;
19  import com.liferay.taglib.util.IncludeTag;
20  
21  import javax.servlet.http.HttpServletRequest;
22  import javax.servlet.jsp.JspException;
23  
24  /**
25   * <a href="InputRepeatTag.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Bruno Farache
28   * @author Julio Camarero
29   */
30  public class InputRepeatTag extends IncludeTag {
31  
32      public int doEndTag() throws JspException {
33          try {
34              return super.doEndTag();
35          }
36          catch (Exception e) {
37              throw new JspException(e);
38          }
39          finally {
40              if (!ServerDetector.isResin()) {
41                  _cssClass = null;
42                  _event = null;
43              }
44          }
45      }
46  
47      public int doStartTag() {
48          HttpServletRequest request =
49              (HttpServletRequest)pageContext.getRequest();
50  
51          request.setAttribute("liferay-ui:input-repeat:cssClass", _cssClass);
52          request.setAttribute("liferay-ui:input-repeat:event", _event);
53  
54          return EVAL_BODY_BUFFERED;
55      }
56  
57      public void setCssClass(String cssClass) {
58          _cssClass = cssClass;
59      }
60  
61      public void setEvent(CalEvent event) {
62          _event = event;
63      }
64  
65      protected String getDefaultPage() {
66          return _PAGE;
67      }
68  
69      private static final String _PAGE =
70          "/html/taglib/ui/input_repeat/page.jsp";
71  
72      private String _cssClass;
73      private CalEvent _event;
74  
75  }