KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > improve > struts > taglib > layout > field > AbstractMultipleSelectTag


1 package fr.improve.struts.taglib.layout.field;
2
3 import java.util.Collection JavaDoc;
4 import java.util.ArrayList JavaDoc;
5
6 import javax.servlet.jsp.JspException JavaDoc;
7
8 import fr.improve.struts.taglib.layout.util.LayoutUtils;
9 /**
10  * Base class for multiple select tag.
11  * @author: Jean-NoŽl Ribette
12  */

13 public abstract class AbstractMultipleSelectTag extends AbstractSelectTag {
14     protected Collection JavaDoc matches;
15     private static final Collection JavaDoc EMPTY_COLLECTION = new ArrayList JavaDoc();
16 /**
17  * Return the value to display.
18  * Note that this value will be test to check if the field should be displayed or not.
19  */

20 protected Object JavaDoc getFieldValue() throws JspException JavaDoc {
21     Collection JavaDoc lc_value;
22     if (matches==null) {
23         lc_value = LayoutUtils.getCollection(LayoutUtils.getBeanFromPageContext(pageContext, name, property));
24         if (lc_value==null) matches = EMPTY_COLLECTION; else matches = lc_value;
25     } else {
26         lc_value = matches;
27     }
28     if (lc_value==null || lc_value.isEmpty()) return null;
29     return lc_value;
30 }
31 protected void reset() {
32     super.reset();
33    matches = null;
34 }
35 public void setMatches(Collection JavaDoc in_matches) {
36     matches = in_matches;
37 }
38 }
39
Popular Tags