Clover Coverage Report - SmartWeb
Coverage timestamp: Sun Jun 8 2008 21:20:12 CEST
../../../../img/srcFileCovDistChart0.png 29% of files have more coverage
23   109   14   7,67
12   52   0,61   3
3     4,67  
1    
5% of code in this file is excluded from these metrics.
 
  ReminderTag       Line # 43 23 14 0% 0.0
 
No Tests
 
1    /*
2    * The SmartWeb Framework
3    * Copyright (C) 2004-2006
4    *
5    * This library is free software; you can redistribute it and/or
6    * modify it under the terms of the GNU Lesser General Public
7    * License as published by the Free Software Foundation; either
8    * version 2.1 of the License, or (at your option) any later version.
9    *
10    * This library is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this library; if not, write to the Free Software
17    * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18    *
19    * For further informations on the SmartWeb Framework please visit
20    *
21    * http://smartweb.sourceforge.net
22    */
23   
24    package net.smartlab.web.page;
25   
26    import java.io.Writer;
27   
28    import javax.servlet.jsp.JspException;
29    import javax.servlet.jsp.JspTagException;
30   
31    import net.smartlab.web.EmptyMarkerTag;
32   
33    import org.apache.commons.beanutils.BeanUtils;
34    import org.apache.struts.taglib.TagUtils;
35    import org.apache.struts.taglib.html.Constants;
36   
37    /**
38    * TODO documentation
39    *
40    * @author rlogiacco
41    * @jsp.tag name = "reminder" body-content = "empty"
42    */
 
43    public class ReminderTag extends AbstractTag {
44   
45    /**
46    * TODO documentation Comment for <code>property</code>
47    */
48    private String property;
49   
50    /**
51    * TODO documentation Comment for <code>value</code>
52    */
53    private String value;
54   
55    /**
56    * @param value the value to set.
57    * @jsp.attribute required="true" rtexprvalue="true"
58    */
 
59  0 toggle public void setValue(String value) {
60  0 this.value = value;
61    }
62   
63    /**
64    * @param property the property to set.
65    * @jsp.attribute required="true" rtexprvalue="true"
66    */
 
67  0 toggle public void setProperty(String property) {
68  0 this.property = property;
69    }
70   
71    /**
72    * @see javax.servlet.jsp.tagext.Tag#doStartTag()
73    */
 
74  0 toggle public int doStartTag() throws JspException {
75  0 String[] items = null;
76  0 try {
77  0 String[] values = (String[])TagUtils.getInstance().lookup(super.context, Constants.BEAN_KEY, property, null);
78  0 items = new String[values.length];
79  0 System.arraycopy(values, 0, items, 0, items.length);
80    } catch (Exception e) {
81    items = context.getRequest().getParameterValues(property);
82    }
83  0 if (items != null) {
84  0 try {
85  0 Paginator paginator = super.getPaginator();
86  0 paginator.reset();
87  0 while (paginator.hasNext()) {
88  0 Object item = BeanUtils.getProperty(paginator.next(), value);
89  0 for (int i = 0; i < items.length; i++) {
90  0 if (item != null && items[i] != null && (items[i].equals(EmptyMarkerTag.EMPTY_MARKER) || items[i].equals(item.toString()))) {
91  0 items[i] = null;
92  0 break;
93    }
94    }
95    }
96  0 paginator.reset();
97  0 Writer out = context.getOut();
98  0 for (int i = 0; i < items.length; i++) {
99  0 if (items[i] != null) {
100  0 out.write("<input type=\"hidden\" name=\"" + property + "\" value=\"" + items[i] + "\"/>");
101    }
102    }
103    } catch (Exception e) {
104    throw new JspTagException(e);
105    }
106    }
107  0 return EVAL_PAGE;
108    }
109    }