Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
_UISelectItems |
|
| 1.3333333333333333;1.333 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one | |
3 | * or more contributor license agreements. See the NOTICE file | |
4 | * distributed with this work for additional information | |
5 | * regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the | |
7 | * "License"); you may not use this file except in compliance | |
8 | * with the License. You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, | |
13 | * software distributed under the License is distributed on an | |
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
15 | * KIND, either express or implied. See the License for the | |
16 | * specific language governing permissions and limitations | |
17 | * under the License. | |
18 | */ | |
19 | package javax.faces.component; | |
20 | ||
21 | import javax.faces.context.FacesContext; | |
22 | import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent; | |
23 | import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFExclude; | |
24 | import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty; | |
25 | ||
26 | /** | |
27 | * This tag associates a set of selection list items with the nearest | |
28 | * parent UIComponent. The set of SelectItem objects is retrieved via | |
29 | * a value-binding. | |
30 | * <p> | |
31 | * Unless otherwise specified, all attributes accept static values | |
32 | * or EL expressions. | |
33 | * </p> | |
34 | * <p> | |
35 | * UISelectItems should be nested inside a UISelectMany or UISelectOne component, | |
36 | * and results in the addition of one ore more SelectItem instance to the list of available options | |
37 | * for the parent component | |
38 | * </p> | |
39 | */ | |
40 | @JSFComponent | |
41 | (clazz = "javax.faces.component.UISelectItems",template=true, | |
42 | name = "f:selectItems", | |
43 | tagClass = "org.apache.myfaces.taglib.core.SelectItemsTag", | |
44 | bodyContent = "empty") | |
45 | 0 | abstract class _UISelectItems extends UIComponentBase |
46 | { | |
47 | ||
48 | static public final String COMPONENT_FAMILY = | |
49 | "javax.faces.SelectItems"; | |
50 | static public final String COMPONENT_TYPE = | |
51 | "javax.faces.SelectItems"; | |
52 | ||
53 | /** | |
54 | * Disable this property; although this class extends a base-class that | |
55 | * defines a read/write rendered property, this particular subclass | |
56 | * does not support setting it. Yes, this is broken OO design: direct | |
57 | * all complaints to the JSF spec group. | |
58 | */ | |
59 | @JSFProperty(tagExcluded=true) | |
60 | @Override | |
61 | public void setRendered(boolean state) | |
62 | { | |
63 | 0 | super.setRendered(state); |
64 | //call parent method due TCK problems | |
65 | //throw new UnsupportedOperationException(); | |
66 | 0 | } |
67 | ||
68 | @Override | |
69 | protected FacesContext getFacesContext() | |
70 | { | |
71 | //In theory the parent most of the times has | |
72 | //the cached FacesContext instance, because this | |
73 | //element is purely logical, and the parent is the one | |
74 | //where encodeXXX was invoked. But only limit the | |
75 | //search to the closest parent. | |
76 | 0 | UIComponent parent = getParent(); |
77 | 0 | if (parent != null && parent.isCachedFacesContext()) |
78 | { | |
79 | 0 | return parent.getFacesContext(); |
80 | } | |
81 | else | |
82 | { | |
83 | 0 | return super.getFacesContext(); |
84 | } | |
85 | } | |
86 | ||
87 | /** | |
88 | * The initial value of this component. | |
89 | * | |
90 | * @return the new value value | |
91 | */ | |
92 | @JSFProperty | |
93 | public abstract Object getValue(); | |
94 | ||
95 | /** | |
96 | * Name of a request-scope attribute under which the current item | |
97 | * of the collection, array, etc. of the value attribute will be | |
98 | * exposed so that it can be referred to in EL for other attributes | |
99 | * of this component. | |
100 | * | |
101 | * @since 2.0 | |
102 | * @return | |
103 | */ | |
104 | @JSFExclude | |
105 | @JSFProperty(literalOnly = true) | |
106 | public String getVar() | |
107 | { | |
108 | 0 | return null; |
109 | } | |
110 | ||
111 | /** | |
112 | * The value for the current item. | |
113 | * | |
114 | * @since 2.0 | |
115 | * @return | |
116 | */ | |
117 | @JSFExclude | |
118 | @JSFProperty | |
119 | public Object getItemValue() | |
120 | { | |
121 | 0 | return null; |
122 | } | |
123 | ||
124 | /** | |
125 | * The label of the current item. | |
126 | * | |
127 | * @since 2.0 | |
128 | * @return | |
129 | */ | |
130 | @JSFExclude | |
131 | @JSFProperty | |
132 | public String getItemLabel() | |
133 | { | |
134 | 0 | return null; |
135 | } | |
136 | ||
137 | /** | |
138 | * The description of the current item. | |
139 | * | |
140 | * @since 2.0 | |
141 | * @return | |
142 | */ | |
143 | @JSFExclude | |
144 | @JSFProperty | |
145 | public String getItemDescription() | |
146 | { | |
147 | 0 | return null; |
148 | } | |
149 | ||
150 | /** | |
151 | * Determines if the current item is selectable or not. | |
152 | * | |
153 | * @since 2.0 | |
154 | * @return | |
155 | */ | |
156 | @JSFExclude | |
157 | @JSFProperty(defaultValue = "false", deferredValueType="java.lang.Boolean") | |
158 | public boolean isItemDisabled() | |
159 | { | |
160 | 0 | return false; |
161 | } | |
162 | ||
163 | /** | |
164 | * Determines if the rendered markup for the current item receives | |
165 | * normal JSF HTML escaping or not. | |
166 | * | |
167 | * @since 2.0 | |
168 | * @return | |
169 | */ | |
170 | @JSFExclude | |
171 | @JSFProperty(defaultValue = "true", deferredValueType="java.lang.Boolean") | |
172 | public boolean isItemLabelEscaped() | |
173 | { | |
174 | 0 | return true; |
175 | } | |
176 | ||
177 | } |