1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.myfaces.view.facelets.impl; |
20 | |
|
21 | |
import java.util.ArrayList; |
22 | |
import java.util.HashMap; |
23 | |
import java.util.Iterator; |
24 | |
import java.util.LinkedList; |
25 | |
import java.util.List; |
26 | |
import java.util.Map; |
27 | |
import javax.faces.FactoryFinder; |
28 | |
|
29 | |
import javax.faces.component.UIComponent; |
30 | |
import javax.faces.component.UIViewRoot; |
31 | |
import javax.faces.component.UniqueIdVendor; |
32 | |
import javax.faces.component.visit.VisitContextFactory; |
33 | |
import javax.faces.context.FacesContext; |
34 | |
import javax.faces.view.AttachedObjectHandler; |
35 | |
import javax.faces.view.EditableValueHolderAttachedObjectHandler; |
36 | |
|
37 | |
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam; |
38 | |
import org.apache.myfaces.shared.config.MyfacesConfig; |
39 | |
import org.apache.myfaces.shared.util.WebConfigParamUtils; |
40 | |
import org.apache.myfaces.view.facelets.ELExpressionCacheMode; |
41 | |
import org.apache.myfaces.view.facelets.FaceletCompositionContext; |
42 | |
import org.apache.myfaces.view.facelets.FaceletFactory; |
43 | |
import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage; |
44 | |
import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport; |
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
public class FaceletCompositionContextImpl extends FaceletCompositionContext |
52 | |
{ |
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
@JSFWebConfigParam(since="2.0.8", defaultValue="noCache", |
71 | |
expectedValues="noCache, strict, allowCset, always, alwaysRecompile", |
72 | |
group="EL", tags="performance") |
73 | |
public static final String INIT_PARAM_CACHE_EL_EXPRESSIONS = "org.apache.myfaces.CACHE_EL_EXPRESSIONS"; |
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
@JSFWebConfigParam(since="2.0.9, 2.1.3" , defaultValue="true", expectedValues="true, false") |
87 | |
public static final String INIT_PARAM_WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE |
88 | |
= "org.apache.myfaces.WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE"; |
89 | |
|
90 | |
private static final String JAVAX_FACES_LOCATION_PREFIX = "javax_faces_location_"; |
91 | |
|
92 | |
private FacesContext _facesContext; |
93 | |
|
94 | |
private FaceletFactory _factory; |
95 | |
|
96 | |
private LinkedList<UIComponent> _compositeComponentStack; |
97 | |
|
98 | |
private LinkedList<UniqueIdVendor> _uniqueIdVendorStack; |
99 | |
|
100 | |
private LinkedList<String> _validationGroupsStack; |
101 | |
|
102 | |
private LinkedList<String> _excludedValidatorIdsStack; |
103 | |
|
104 | |
private LinkedList<Map.Entry<String, EditableValueHolderAttachedObjectHandler>> _enclosingValidatorIdsStack; |
105 | |
|
106 | |
private Boolean _isRefreshingTransientBuild; |
107 | |
|
108 | |
private Boolean _isMarkInitialState; |
109 | |
|
110 | |
private Boolean _isBuildingViewMetadata; |
111 | |
|
112 | |
private Boolean _refreshTransientBuildOnPSS; |
113 | |
|
114 | |
private Boolean _refreshTransientBuildOnPSSPreserveState; |
115 | |
|
116 | |
private Boolean _usingPSSOnThisView; |
117 | |
|
118 | |
private ELExpressionCacheMode _elExpressionCacheMode; |
119 | |
|
120 | |
private Boolean _isWrapTagExceptionsAsContextAware; |
121 | |
|
122 | |
private List<Map<String, UIComponent>> _componentsMarkedForDeletion; |
123 | |
|
124 | |
private Map<String, UIComponent> _relocatableResourceForDeletion; |
125 | |
|
126 | |
private int _deletionLevel; |
127 | |
|
128 | |
private Map<UIComponent, List<AttachedObjectHandler>> _attachedObjectHandlers; |
129 | |
|
130 | |
private Map<UIComponent, Map<String, Object> > _methodExpressionsTargeted; |
131 | |
|
132 | |
private Map<UIComponent, Map<String, Boolean> > _compositeComponentAttributesMarked; |
133 | |
|
134 | |
private static final String VIEWROOT_FACELET_ID = "oam.VIEW_ROOT"; |
135 | |
|
136 | |
private SectionUniqueIdCounter _sectionUniqueIdCounter; |
137 | |
|
138 | |
private SectionUniqueIdCounter _sectionUniqueComponentIdCounter; |
139 | |
|
140 | |
private List<String> _uniqueIdsList; |
141 | |
private Iterator<String> _uniqueIdsIterator; |
142 | |
private int _level; |
143 | |
|
144 | |
private int _isInMetadataSection; |
145 | |
private SectionUniqueIdCounter _sectionUniqueMetadataIdCounter; |
146 | |
private SectionUniqueIdCounter _sectionUniqueNormalIdCounter; |
147 | |
private SectionUniqueIdCounter _sectionUniqueComponentMetadataIdCounter; |
148 | |
private SectionUniqueIdCounter _sectionUniqueComponentNormalIdCounter; |
149 | |
|
150 | |
private List<SectionUniqueIdCounter> _sectionUniqueIdCounterStack; |
151 | |
private List<SectionUniqueIdCounter> _sectionUniqueComponentIdCounterStack; |
152 | |
|
153 | |
private StringBuilder _sharedStringBuilder; |
154 | |
|
155 | |
private int _ccLevel; |
156 | |
|
157 | |
private boolean _dynamicComponentHandler; |
158 | |
private boolean _oldRefreshingTransientBuild; |
159 | |
private boolean _dynamicComponentTopLevel; |
160 | 0 | private int _dynamicComponentSection = 0; |
161 | |
|
162 | |
private List<Integer> _dynamicOldDeletionLevel; |
163 | |
|
164 | 0 | private VisitContextFactory _visitContextFactory = null; |
165 | 0 | private UIViewRoot _viewRoot = null; |
166 | |
|
167 | |
public FaceletCompositionContextImpl(FaceletFactory factory, FacesContext facesContext) |
168 | |
{ |
169 | 0 | super(); |
170 | 0 | _factory = factory; |
171 | 0 | _facesContext = facesContext; |
172 | 0 | _componentsMarkedForDeletion = new ArrayList<Map<String,UIComponent>>(); |
173 | 0 | _relocatableResourceForDeletion = new HashMap<String, UIComponent>(); |
174 | 0 | _deletionLevel = -1; |
175 | 0 | _sectionUniqueIdCounter = new SectionUniqueIdCounter(); |
176 | |
|
177 | 0 | MyfacesConfig myfacesConfig = MyfacesConfig.getCurrentInstance( |
178 | |
facesContext.getExternalContext()); |
179 | 0 | if (myfacesConfig.getComponentUniqueIdsCacheSize() > 0) |
180 | |
{ |
181 | 0 | String[] componentIdsCache = (String [])facesContext.getExternalContext(). |
182 | |
getApplicationMap().get(FaceletViewDeclarationLanguage.CACHED_COMPONENT_IDS); |
183 | 0 | if (componentIdsCache != null) |
184 | |
{ |
185 | 0 | _sectionUniqueComponentIdCounter = new SectionUniqueIdCounter("_", |
186 | |
componentIdsCache); |
187 | |
} |
188 | |
else |
189 | |
{ |
190 | 0 | _sectionUniqueComponentIdCounter = new SectionUniqueIdCounter("_"); |
191 | |
} |
192 | 0 | } |
193 | |
else |
194 | |
{ |
195 | 0 | _sectionUniqueComponentIdCounter = new SectionUniqueIdCounter("_"); |
196 | |
} |
197 | 0 | _sectionUniqueNormalIdCounter = _sectionUniqueIdCounter; |
198 | 0 | _sectionUniqueComponentNormalIdCounter = _sectionUniqueComponentIdCounter; |
199 | 0 | _uniqueIdsList = null; |
200 | 0 | _uniqueIdsIterator = null; |
201 | 0 | _level = 0; |
202 | 0 | _isInMetadataSection = 0; |
203 | 0 | _sharedStringBuilder = null; |
204 | 0 | _ccLevel = 0; |
205 | 0 | _viewRoot = null; |
206 | 0 | } |
207 | |
|
208 | |
|
209 | |
|
210 | |
|
211 | |
|
212 | |
|
213 | |
|
214 | |
|
215 | |
|
216 | |
public FaceletCompositionContextImpl(FaceletFactory factory, FacesContext facesContext, String base) |
217 | |
{ |
218 | 0 | this(factory, facesContext); |
219 | 0 | _sectionUniqueIdCounter = new SectionUniqueIdCounter(base+"_"); |
220 | 0 | _sectionUniqueComponentIdCounter = new SectionUniqueIdCounter("_"+ base +"_"); |
221 | 0 | _sectionUniqueNormalIdCounter = _sectionUniqueIdCounter; |
222 | 0 | _sectionUniqueComponentNormalIdCounter = _sectionUniqueComponentIdCounter; |
223 | 0 | _dynamicComponentTopLevel = true; |
224 | 0 | _dynamicComponentSection = 1; |
225 | 0 | } |
226 | |
|
227 | |
|
228 | |
@Override |
229 | |
public void setUniqueIdsIterator(Iterator<String> uniqueIdsIterator) |
230 | |
{ |
231 | 0 | _uniqueIdsList = null; |
232 | 0 | _uniqueIdsIterator = uniqueIdsIterator; |
233 | 0 | } |
234 | |
|
235 | |
@Override |
236 | |
public void initUniqueIdRecording() |
237 | |
{ |
238 | 0 | _uniqueIdsList = new LinkedList<String>(); |
239 | 0 | _uniqueIdsIterator = null; |
240 | 0 | } |
241 | |
|
242 | |
@Override |
243 | |
public void addUniqueId(String uniqueId) |
244 | |
{ |
245 | 0 | if (_uniqueIdsList != null && _level == 0 && !(_isInMetadataSection > 0) |
246 | |
&& !(_dynamicComponentSection > 0)) |
247 | |
{ |
248 | 0 | _uniqueIdsList.add(uniqueId); |
249 | |
} |
250 | 0 | } |
251 | |
|
252 | |
@Override |
253 | |
public String getUniqueIdFromIterator() |
254 | |
{ |
255 | 0 | if (_uniqueIdsIterator != null && _uniqueIdsIterator.hasNext() && |
256 | |
_level == 0 && !(_isInMetadataSection > 0) && !(_dynamicComponentSection > 0)) |
257 | |
{ |
258 | 0 | return _uniqueIdsIterator.next(); |
259 | |
} |
260 | 0 | return null; |
261 | |
} |
262 | |
|
263 | |
@Override |
264 | |
public List<String> getUniqueIdList() |
265 | |
{ |
266 | 0 | return _uniqueIdsList; |
267 | |
} |
268 | |
|
269 | |
public FaceletFactory getFaceletFactory() |
270 | |
{ |
271 | 0 | return _factory; |
272 | |
} |
273 | |
|
274 | |
@Override |
275 | |
public void release(FacesContext facesContext) |
276 | |
{ |
277 | 0 | super.release(facesContext); |
278 | 0 | _factory = null; |
279 | 0 | _facesContext = null; |
280 | 0 | _compositeComponentStack = null; |
281 | 0 | _enclosingValidatorIdsStack = null; |
282 | 0 | _excludedValidatorIdsStack = null; |
283 | 0 | _uniqueIdVendorStack = null; |
284 | 0 | _validationGroupsStack = null; |
285 | 0 | _componentsMarkedForDeletion = null; |
286 | 0 | _relocatableResourceForDeletion = null; |
287 | 0 | _sectionUniqueIdCounter = null; |
288 | 0 | _sectionUniqueNormalIdCounter = null; |
289 | 0 | _sectionUniqueMetadataIdCounter = null; |
290 | 0 | _sectionUniqueComponentIdCounter = null; |
291 | 0 | _sectionUniqueComponentNormalIdCounter = null; |
292 | 0 | _sectionUniqueComponentMetadataIdCounter = null; |
293 | 0 | _sharedStringBuilder = null; |
294 | 0 | _visitContextFactory = null; |
295 | 0 | _dynamicOldDeletionLevel = null; |
296 | 0 | _viewRoot = null; |
297 | 0 | } |
298 | |
|
299 | |
@Override |
300 | |
public UIComponent getCompositeComponentFromStack() |
301 | |
{ |
302 | 0 | if (_compositeComponentStack != null && !_compositeComponentStack.isEmpty()) |
303 | |
{ |
304 | 0 | return _compositeComponentStack.peek(); |
305 | |
} |
306 | 0 | return null; |
307 | |
} |
308 | |
|
309 | |
@Override |
310 | |
public void pushCompositeComponentToStack(UIComponent parent) |
311 | |
{ |
312 | 0 | if (_compositeComponentStack == null) |
313 | |
{ |
314 | 0 | _compositeComponentStack = new LinkedList<UIComponent>(); |
315 | |
} |
316 | 0 | _compositeComponentStack.addFirst(parent); |
317 | 0 | _ccLevel++; |
318 | 0 | } |
319 | |
|
320 | |
@Override |
321 | |
public void popCompositeComponentToStack() |
322 | |
{ |
323 | 0 | if (_compositeComponentStack != null && !_compositeComponentStack.isEmpty()) |
324 | |
{ |
325 | 0 | _compositeComponentStack.removeFirst(); |
326 | |
} |
327 | 0 | _ccLevel--; |
328 | 0 | } |
329 | |
|
330 | |
@Override |
331 | |
public int getCompositeComponentLevel() |
332 | |
{ |
333 | 0 | return _ccLevel; |
334 | |
} |
335 | |
|
336 | |
@Override |
337 | |
public UniqueIdVendor getUniqueIdVendorFromStack() |
338 | |
{ |
339 | 0 | if (_uniqueIdVendorStack != null && !_uniqueIdVendorStack.isEmpty()) |
340 | |
{ |
341 | 0 | return _uniqueIdVendorStack.peek(); |
342 | |
} |
343 | 0 | return null; |
344 | |
} |
345 | |
|
346 | |
@Override |
347 | |
public void popUniqueIdVendorToStack() |
348 | |
{ |
349 | 0 | if (_uniqueIdVendorStack != null && !_uniqueIdVendorStack.isEmpty()) |
350 | |
{ |
351 | 0 | _uniqueIdVendorStack.removeFirst(); |
352 | |
} |
353 | 0 | } |
354 | |
|
355 | |
@Override |
356 | |
public void pushUniqueIdVendorToStack(UniqueIdVendor parent) |
357 | |
{ |
358 | 0 | if (_uniqueIdVendorStack == null) |
359 | |
{ |
360 | 0 | _uniqueIdVendorStack = new LinkedList<UniqueIdVendor>(); |
361 | |
} |
362 | 0 | _uniqueIdVendorStack.addFirst(parent); |
363 | 0 | } |
364 | |
|
365 | |
|
366 | |
|
367 | |
|
368 | |
|
369 | |
|
370 | |
@Override |
371 | |
public String getFirstValidationGroupFromStack() |
372 | |
{ |
373 | 0 | if (_validationGroupsStack != null && !_validationGroupsStack.isEmpty()) |
374 | |
{ |
375 | 0 | return _validationGroupsStack.getFirst(); |
376 | |
} |
377 | 0 | return null; |
378 | |
} |
379 | |
|
380 | |
|
381 | |
|
382 | |
|
383 | |
|
384 | |
@Override |
385 | |
public void popValidationGroupsToStack() |
386 | |
{ |
387 | 0 | if (_validationGroupsStack != null && !_validationGroupsStack.isEmpty()) |
388 | |
{ |
389 | 0 | _validationGroupsStack.removeFirst(); |
390 | |
} |
391 | 0 | } |
392 | |
|
393 | |
|
394 | |
|
395 | |
|
396 | |
|
397 | |
|
398 | |
@Override |
399 | |
public void pushValidationGroupsToStack(String validationGroups) |
400 | |
{ |
401 | 0 | if (_validationGroupsStack == null) |
402 | |
{ |
403 | 0 | _validationGroupsStack = new LinkedList<String>(); |
404 | |
} |
405 | |
|
406 | 0 | _validationGroupsStack.addFirst(validationGroups); |
407 | 0 | } |
408 | |
|
409 | |
|
410 | |
|
411 | |
|
412 | |
|
413 | |
|
414 | |
@Override |
415 | |
public Iterator<String> getExcludedValidatorIds() |
416 | |
{ |
417 | 0 | if (_excludedValidatorIdsStack != null && !_excludedValidatorIdsStack.isEmpty()) |
418 | |
{ |
419 | 0 | return _excludedValidatorIdsStack.iterator(); |
420 | |
} |
421 | 0 | return null; |
422 | |
} |
423 | |
|
424 | |
|
425 | |
|
426 | |
|
427 | |
|
428 | |
@Override |
429 | |
public void popExcludedValidatorIdToStack() |
430 | |
{ |
431 | 0 | if (_excludedValidatorIdsStack != null && !_excludedValidatorIdsStack.isEmpty()) |
432 | |
{ |
433 | 0 | _excludedValidatorIdsStack.removeFirst(); |
434 | |
} |
435 | 0 | } |
436 | |
|
437 | |
|
438 | |
|
439 | |
|
440 | |
|
441 | |
|
442 | |
@Override |
443 | |
public void pushExcludedValidatorIdToStack(String validatorId) |
444 | |
{ |
445 | 0 | if (_excludedValidatorIdsStack == null) |
446 | |
{ |
447 | 0 | _excludedValidatorIdsStack = new LinkedList<String>(); |
448 | |
} |
449 | |
|
450 | 0 | _excludedValidatorIdsStack.addFirst(validatorId); |
451 | 0 | } |
452 | |
|
453 | |
|
454 | |
|
455 | |
|
456 | |
|
457 | |
|
458 | |
@Override |
459 | |
public Iterator<String> getEnclosingValidatorIds() |
460 | |
{ |
461 | 0 | if (_enclosingValidatorIdsStack != null && !_enclosingValidatorIdsStack.isEmpty()) |
462 | |
{ |
463 | 0 | return new KeyEntryIterator<String, EditableValueHolderAttachedObjectHandler> |
464 | |
(_enclosingValidatorIdsStack.iterator()); |
465 | |
} |
466 | 0 | return null; |
467 | |
} |
468 | |
|
469 | |
|
470 | |
|
471 | |
|
472 | |
|
473 | |
@Override |
474 | |
public void popEnclosingValidatorIdToStack() |
475 | |
{ |
476 | 0 | if (_enclosingValidatorIdsStack != null && !_enclosingValidatorIdsStack.isEmpty()) |
477 | |
{ |
478 | 0 | _enclosingValidatorIdsStack.removeFirst(); |
479 | |
} |
480 | 0 | } |
481 | |
|
482 | |
|
483 | |
|
484 | |
|
485 | |
|
486 | |
|
487 | |
@Override |
488 | |
public void pushEnclosingValidatorIdToStack(String validatorId) |
489 | |
{ |
490 | 0 | pushEnclosingValidatorIdToStack(validatorId, null); |
491 | 0 | } |
492 | |
|
493 | |
@Override |
494 | |
public void pushEnclosingValidatorIdToStack(String validatorId, |
495 | |
EditableValueHolderAttachedObjectHandler attachedObjectHandler) |
496 | |
{ |
497 | 0 | if (_enclosingValidatorIdsStack == null) |
498 | |
{ |
499 | 0 | _enclosingValidatorIdsStack = |
500 | |
new LinkedList<Map.Entry<String, EditableValueHolderAttachedObjectHandler>>(); |
501 | |
} |
502 | |
|
503 | 0 | _enclosingValidatorIdsStack.addFirst( |
504 | |
new SimpleEntry<String, EditableValueHolderAttachedObjectHandler> |
505 | |
(validatorId, attachedObjectHandler)); |
506 | 0 | } |
507 | |
|
508 | |
public Iterator<Map.Entry<String, EditableValueHolderAttachedObjectHandler>> getEnclosingValidatorIdsAndHandlers() |
509 | |
{ |
510 | 0 | if (_enclosingValidatorIdsStack != null && !_enclosingValidatorIdsStack.isEmpty()) |
511 | |
{ |
512 | 0 | return _enclosingValidatorIdsStack.iterator(); |
513 | |
} |
514 | 0 | return null; |
515 | |
} |
516 | |
|
517 | |
public boolean containsEnclosingValidatorId(String id) |
518 | |
{ |
519 | 0 | if (_enclosingValidatorIdsStack != null && !_enclosingValidatorIdsStack.isEmpty()) |
520 | |
{ |
521 | 0 | for (Map.Entry<String, EditableValueHolderAttachedObjectHandler> entry : _enclosingValidatorIdsStack) |
522 | |
{ |
523 | 0 | if (entry.getKey().equals(id)) |
524 | |
{ |
525 | 0 | return true; |
526 | |
} |
527 | 0 | } |
528 | |
} |
529 | 0 | return false; |
530 | |
} |
531 | |
|
532 | |
@Override |
533 | |
public boolean isRefreshingTransientBuild() |
534 | |
{ |
535 | 0 | if (_isRefreshingTransientBuild == null) |
536 | |
{ |
537 | 0 | _isRefreshingTransientBuild = FaceletViewDeclarationLanguage. |
538 | |
isRefreshingTransientBuild(_facesContext); |
539 | |
} |
540 | 0 | return _isRefreshingTransientBuild; |
541 | |
} |
542 | |
|
543 | |
@Override |
544 | |
public boolean isMarkInitialState() |
545 | |
{ |
546 | 0 | if (_isMarkInitialState == null) |
547 | |
{ |
548 | 0 | _isMarkInitialState = FaceletViewDeclarationLanguage. |
549 | |
isMarkInitialState(_facesContext); |
550 | |
} |
551 | 0 | return _isMarkInitialState; |
552 | |
} |
553 | |
|
554 | |
@Override |
555 | |
public void setMarkInitialState(boolean value) |
556 | |
{ |
557 | 0 | _isMarkInitialState = value; |
558 | 0 | } |
559 | |
|
560 | |
@Override |
561 | |
public boolean isRefreshTransientBuildOnPSS() |
562 | |
{ |
563 | 0 | if (_refreshTransientBuildOnPSS == null) |
564 | |
{ |
565 | 0 | _refreshTransientBuildOnPSS = FaceletViewDeclarationLanguage. |
566 | |
isRefreshTransientBuildOnPSS(_facesContext); |
567 | |
} |
568 | 0 | return _refreshTransientBuildOnPSS; |
569 | |
} |
570 | |
|
571 | |
public boolean isRefreshTransientBuildOnPSSPreserveState() |
572 | |
{ |
573 | 0 | if (_refreshTransientBuildOnPSSPreserveState == null) |
574 | |
{ |
575 | 0 | _refreshTransientBuildOnPSSPreserveState = MyfacesConfig.getCurrentInstance( |
576 | |
_facesContext.getExternalContext()).isRefreshTransientBuildOnPSSPreserveState(); |
577 | |
} |
578 | 0 | return _refreshTransientBuildOnPSSPreserveState; |
579 | |
} |
580 | |
|
581 | |
@Override |
582 | |
public boolean isBuildingViewMetadata() |
583 | |
{ |
584 | 0 | if (_isBuildingViewMetadata == null) |
585 | |
{ |
586 | 0 | _isBuildingViewMetadata = FaceletViewDeclarationLanguage. |
587 | |
isBuildingViewMetadata(_facesContext); |
588 | |
} |
589 | 0 | return _isBuildingViewMetadata; |
590 | |
} |
591 | |
|
592 | |
@Override |
593 | |
public boolean isUsingPSSOnThisView() |
594 | |
{ |
595 | 0 | if (_usingPSSOnThisView == null) |
596 | |
{ |
597 | 0 | _usingPSSOnThisView = FaceletViewDeclarationLanguage. |
598 | |
isUsingPSSOnThisView(_facesContext); |
599 | |
} |
600 | 0 | return _usingPSSOnThisView; |
601 | |
} |
602 | |
|
603 | |
public boolean isMarkInitialStateAndIsRefreshTransientBuildOnPSS() |
604 | |
{ |
605 | 0 | return isMarkInitialState() && isRefreshTransientBuildOnPSS(); |
606 | |
} |
607 | |
|
608 | |
@Override |
609 | |
public ELExpressionCacheMode getELExpressionCacheMode() |
610 | |
{ |
611 | 0 | if (_elExpressionCacheMode == null) |
612 | |
{ |
613 | 0 | String value = WebConfigParamUtils.getStringInitParameter( |
614 | |
_facesContext.getExternalContext(), |
615 | |
INIT_PARAM_CACHE_EL_EXPRESSIONS, ELExpressionCacheMode.noCache.name()); |
616 | |
|
617 | 0 | _elExpressionCacheMode = Enum.valueOf(ELExpressionCacheMode.class, value); |
618 | |
} |
619 | 0 | return _elExpressionCacheMode; |
620 | |
} |
621 | |
|
622 | |
@Override |
623 | |
public boolean isWrapTagExceptionsAsContextAware() |
624 | |
{ |
625 | 0 | if (_isWrapTagExceptionsAsContextAware == null) |
626 | |
{ |
627 | 0 | _isWrapTagExceptionsAsContextAware |
628 | |
= WebConfigParamUtils.getBooleanInitParameter(_facesContext.getExternalContext(), |
629 | |
INIT_PARAM_WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE, true); |
630 | |
} |
631 | 0 | return _isWrapTagExceptionsAsContextAware; |
632 | |
} |
633 | |
|
634 | |
@Override |
635 | |
public void addAttachedObjectHandler(UIComponent compositeComponentParent, AttachedObjectHandler handler) |
636 | |
{ |
637 | 0 | List<AttachedObjectHandler> list = null; |
638 | 0 | if (_attachedObjectHandlers == null) |
639 | |
{ |
640 | 0 | _attachedObjectHandlers = new HashMap<UIComponent, List<AttachedObjectHandler>>(); |
641 | |
} |
642 | |
else |
643 | |
{ |
644 | 0 | list = _attachedObjectHandlers.get(compositeComponentParent); |
645 | |
} |
646 | |
|
647 | 0 | if (list == null) |
648 | |
{ |
649 | 0 | list = new ArrayList<AttachedObjectHandler>(); |
650 | 0 | _attachedObjectHandlers.put(compositeComponentParent, list); |
651 | |
} |
652 | |
|
653 | 0 | list.add(handler); |
654 | 0 | } |
655 | |
|
656 | |
@Override |
657 | |
public void removeAttachedObjectHandlers(UIComponent compositeComponentParent) |
658 | |
{ |
659 | 0 | if (_attachedObjectHandlers == null) |
660 | |
{ |
661 | 0 | return; |
662 | |
} |
663 | 0 | _attachedObjectHandlers.remove(compositeComponentParent); |
664 | 0 | } |
665 | |
|
666 | |
@Override |
667 | |
public List<AttachedObjectHandler> getAttachedObjectHandlers(UIComponent compositeComponentParent) |
668 | |
{ |
669 | 0 | if (_attachedObjectHandlers == null) |
670 | |
{ |
671 | 0 | return null; |
672 | |
} |
673 | 0 | return _attachedObjectHandlers.get(compositeComponentParent); |
674 | |
} |
675 | |
|
676 | |
@Override |
677 | |
public void addMethodExpressionTargeted(UIComponent targetedComponent, String attributeName, Object backingValue) |
678 | |
{ |
679 | 0 | Map<String, Object> map = null; |
680 | 0 | if (_methodExpressionsTargeted == null) |
681 | |
{ |
682 | 0 | _methodExpressionsTargeted = new HashMap<UIComponent, Map<String, Object>>(); |
683 | |
} |
684 | |
else |
685 | |
{ |
686 | 0 | map = _methodExpressionsTargeted.get(targetedComponent); |
687 | |
} |
688 | |
|
689 | 0 | if (map == null) |
690 | |
{ |
691 | 0 | map = new HashMap<String, Object>(8); |
692 | 0 | _methodExpressionsTargeted.put(targetedComponent, map); |
693 | |
} |
694 | |
|
695 | 0 | map.put(attributeName, backingValue); |
696 | 0 | } |
697 | |
|
698 | |
public boolean isMethodExpressionAttributeApplied(UIComponent compositeComponentParent, String attributeName) |
699 | |
{ |
700 | 0 | if (_compositeComponentAttributesMarked == null) |
701 | |
{ |
702 | 0 | return false; |
703 | |
} |
704 | 0 | Map<String, Boolean> map = _compositeComponentAttributesMarked.get(compositeComponentParent); |
705 | 0 | if (map == null) |
706 | |
{ |
707 | 0 | return false; |
708 | |
} |
709 | 0 | Boolean v = map.get(attributeName); |
710 | 0 | return v == null ? false : v.booleanValue(); |
711 | |
} |
712 | |
|
713 | |
public void markMethodExpressionAttribute(UIComponent compositeComponentParent, String attributeName) |
714 | |
{ |
715 | 0 | Map<String, Boolean> map = null; |
716 | 0 | if (_compositeComponentAttributesMarked == null) |
717 | |
{ |
718 | 0 | _compositeComponentAttributesMarked = new HashMap<UIComponent, Map<String, Boolean>>(); |
719 | |
} |
720 | |
else |
721 | |
{ |
722 | 0 | map = _compositeComponentAttributesMarked.get(compositeComponentParent); |
723 | |
} |
724 | |
|
725 | 0 | if (map == null) |
726 | |
{ |
727 | 0 | map = new HashMap<String, Boolean>(8); |
728 | 0 | _compositeComponentAttributesMarked.put(compositeComponentParent, map); |
729 | |
} |
730 | 0 | map.put(attributeName, Boolean.TRUE); |
731 | |
|
732 | 0 | } |
733 | |
|
734 | |
public void clearMethodExpressionAttribute(UIComponent compositeComponentParent, String attributeName) |
735 | |
{ |
736 | 0 | if (_compositeComponentAttributesMarked == null) |
737 | |
{ |
738 | 0 | return; |
739 | |
} |
740 | 0 | Map<String, Boolean> map = _compositeComponentAttributesMarked.get(compositeComponentParent); |
741 | 0 | if (map == null) |
742 | |
{ |
743 | |
|
744 | 0 | return; |
745 | |
} |
746 | 0 | map.put(attributeName, Boolean.FALSE); |
747 | 0 | } |
748 | |
|
749 | |
|
750 | |
@Override |
751 | |
public Object removeMethodExpressionTargeted(UIComponent targetedComponent, String attributeName) |
752 | |
{ |
753 | 0 | if (_methodExpressionsTargeted == null) |
754 | |
{ |
755 | 0 | return null; |
756 | |
} |
757 | 0 | Map<String, Object> map = _methodExpressionsTargeted.get(targetedComponent); |
758 | 0 | if (map != null) |
759 | |
{ |
760 | 0 | return map.remove(attributeName); |
761 | |
} |
762 | 0 | return null; |
763 | |
} |
764 | |
|
765 | |
|
766 | |
|
767 | |
|
768 | |
private void increaseComponentLevelMarkedForDeletion() |
769 | |
{ |
770 | 0 | _deletionLevel++; |
771 | 0 | if (_componentsMarkedForDeletion.size() <= _deletionLevel) |
772 | |
{ |
773 | 0 | _componentsMarkedForDeletion.add(new HashMap<String, UIComponent>()); |
774 | |
|
775 | |
} |
776 | 0 | } |
777 | |
|
778 | |
|
779 | |
|
780 | |
|
781 | |
|
782 | |
|
783 | |
|
784 | |
private void decreaseComponentLevelMarkedForDeletion() |
785 | |
{ |
786 | |
|
787 | 0 | if (!_componentsMarkedForDeletion.get(_deletionLevel).isEmpty()) |
788 | |
{ |
789 | 0 | _componentsMarkedForDeletion.get(_deletionLevel).clear(); |
790 | |
} |
791 | 0 | _deletionLevel--; |
792 | 0 | } |
793 | |
|
794 | |
|
795 | |
|
796 | |
|
797 | |
|
798 | |
|
799 | |
|
800 | |
private void markComponentForDeletion(String id , UIComponent component) |
801 | |
{ |
802 | 0 | _componentsMarkedForDeletion.get(_deletionLevel).put(id, component); |
803 | 0 | } |
804 | |
|
805 | |
|
806 | |
|
807 | |
|
808 | |
|
809 | |
|
810 | |
private UIComponent removeComponentForDeletion(String id) |
811 | |
{ |
812 | 0 | UIComponent removedComponent = _componentsMarkedForDeletion.get(_deletionLevel).remove(id); |
813 | 0 | if (removedComponent != null && _deletionLevel > 0) |
814 | |
{ |
815 | 0 | _componentsMarkedForDeletion.get(_deletionLevel-1).remove(id); |
816 | |
} |
817 | 0 | return removedComponent; |
818 | |
} |
819 | |
|
820 | |
public void markForDeletion(UIComponent component) |
821 | |
{ |
822 | 0 | increaseComponentLevelMarkedForDeletion(); |
823 | |
|
824 | 0 | String id = (String) component.getAttributes().get(ComponentSupport.MARK_CREATED); |
825 | 0 | id = (id == null) ? VIEWROOT_FACELET_ID : id; |
826 | 0 | markComponentForDeletion(id, component); |
827 | |
|
828 | |
|
829 | 0 | if (component.getFacetCount() > 0) |
830 | |
{ |
831 | 0 | for (UIComponent fc: component.getFacets().values()) |
832 | |
{ |
833 | 0 | id = (String) fc.getAttributes().get(ComponentSupport.MARK_CREATED); |
834 | 0 | if (id != null) |
835 | |
{ |
836 | 0 | markComponentForDeletion(id, fc); |
837 | |
} |
838 | 0 | else if (Boolean.TRUE.equals(fc.getAttributes().get(ComponentSupport.FACET_CREATED_UIPANEL_MARKER))) |
839 | |
{ |
840 | |
|
841 | 0 | int childCount = fc.getChildCount(); |
842 | 0 | if (childCount > 0) |
843 | |
{ |
844 | 0 | for (int i = 0; i < childCount; i++) |
845 | |
{ |
846 | 0 | UIComponent child = fc.getChildren().get(i); |
847 | 0 | id = (String) child.getAttributes().get(ComponentSupport.MARK_CREATED); |
848 | 0 | if (id != null) |
849 | |
{ |
850 | 0 | markComponentForDeletion(id, child); |
851 | |
} |
852 | |
} |
853 | |
} |
854 | |
} |
855 | 0 | } |
856 | |
} |
857 | |
|
858 | 0 | int childCount = component.getChildCount(); |
859 | 0 | if (childCount > 0) |
860 | |
{ |
861 | 0 | for (int i = 0; i < childCount; i++) |
862 | |
{ |
863 | 0 | UIComponent child = component.getChildren().get(i); |
864 | 0 | id = (String) child.getAttributes().get(ComponentSupport.MARK_CREATED); |
865 | 0 | if (id != null) |
866 | |
{ |
867 | 0 | markComponentForDeletion(id, child); |
868 | |
} |
869 | |
} |
870 | |
} |
871 | 0 | } |
872 | |
|
873 | |
@Override |
874 | |
public void removeComponentForDeletion(UIComponent component) |
875 | |
{ |
876 | 0 | String id = (String) component.getAttributes().get(ComponentSupport.MARK_CREATED); |
877 | 0 | if (id != null) |
878 | |
{ |
879 | 0 | removeComponentForDeletion(id); |
880 | |
} |
881 | 0 | else if (id == null |
882 | |
&& Boolean.TRUE.equals(component.getAttributes().get(ComponentSupport.FACET_CREATED_UIPANEL_MARKER))) |
883 | |
{ |
884 | 0 | if (component.getChildCount() > 0) |
885 | |
{ |
886 | 0 | for (int i = 0, size = component.getChildCount(); i < size; i++) |
887 | |
{ |
888 | 0 | UIComponent child = component.getChildren().get(i); |
889 | 0 | id = (String) child.getAttributes().get(ComponentSupport.MARK_CREATED); |
890 | 0 | if (id != null) |
891 | |
{ |
892 | 0 | removeComponentForDeletion(id); |
893 | |
} |
894 | |
} |
895 | |
} |
896 | |
} |
897 | 0 | } |
898 | |
|
899 | |
public void finalizeForDeletion(UIComponent component) |
900 | |
{ |
901 | 0 | String id = (String) component.getAttributes().get(ComponentSupport.MARK_CREATED); |
902 | 0 | id = (id == null) ? VIEWROOT_FACELET_ID : id; |
903 | |
|
904 | 0 | removeComponentForDeletion(id); |
905 | |
|
906 | |
|
907 | 0 | int childCount = component.getChildCount(); |
908 | 0 | if (childCount > 0) |
909 | |
{ |
910 | 0 | for (int i = 0; i < childCount; i ++) |
911 | |
{ |
912 | 0 | UIComponent child = component.getChildren().get(i); |
913 | 0 | id = (String) child.getAttributes().get(ComponentSupport.MARK_CREATED); |
914 | 0 | if (id != null && removeComponentForDeletion(id) != null) |
915 | |
{ |
916 | 0 | component.getChildren().remove(i); |
917 | 0 | i--; |
918 | 0 | childCount--; |
919 | |
} |
920 | |
} |
921 | |
} |
922 | |
|
923 | |
|
924 | |
|
925 | 0 | if (component.getFacetCount() > 0) |
926 | |
{ |
927 | 0 | Map<String, UIComponent> facets = component.getFacets(); |
928 | 0 | for (Iterator<UIComponent> itr = facets.values().iterator(); itr.hasNext();) |
929 | |
{ |
930 | 0 | UIComponent fc = itr.next(); |
931 | 0 | id = (String) fc.getAttributes().get(ComponentSupport.MARK_CREATED); |
932 | 0 | if (id != null && removeComponentForDeletion(id) != null) |
933 | |
{ |
934 | 0 | itr.remove(); |
935 | |
} |
936 | 0 | else if (id == null |
937 | |
&& Boolean.TRUE.equals(fc.getAttributes().get(ComponentSupport.FACET_CREATED_UIPANEL_MARKER))) |
938 | |
{ |
939 | 0 | if (fc.getChildCount() > 0) |
940 | |
{ |
941 | 0 | for (int i = 0, size = fc.getChildCount(); i < size; i++) |
942 | |
{ |
943 | 0 | UIComponent child = fc.getChildren().get(i); |
944 | 0 | id = (String) child.getAttributes().get(ComponentSupport.MARK_CREATED); |
945 | 0 | if (id != null && removeComponentForDeletion(id) != null) |
946 | |
{ |
947 | 0 | fc.getChildren().remove(i); |
948 | 0 | i--; |
949 | 0 | size--; |
950 | |
} |
951 | |
} |
952 | |
} |
953 | 0 | if (fc.getChildCount() == 0) |
954 | |
{ |
955 | 0 | itr.remove(); |
956 | |
} |
957 | |
} |
958 | 0 | } |
959 | |
} |
960 | |
|
961 | 0 | decreaseComponentLevelMarkedForDeletion(); |
962 | 0 | } |
963 | |
|
964 | |
@Override |
965 | |
public void markRelocatableResourceForDeletion(UIComponent component) |
966 | |
{ |
967 | |
|
968 | |
|
969 | 0 | String id = (String) component.getAttributes().get(ComponentSupport.MARK_CREATED); |
970 | 0 | if (id != null) |
971 | |
{ |
972 | 0 | _relocatableResourceForDeletion.put(id, component); |
973 | |
} |
974 | 0 | } |
975 | |
|
976 | |
@Override |
977 | |
public void finalizeRelocatableResourcesForDeletion(UIViewRoot root) |
978 | |
{ |
979 | 0 | String id = null; |
980 | |
|
981 | 0 | if (root.getFacetCount() > 0) |
982 | |
{ |
983 | 0 | Map<String, UIComponent> facets = root.getFacets(); |
984 | 0 | for (Iterator<UIComponent> itr = facets.values().iterator(); itr.hasNext();) |
985 | |
{ |
986 | 0 | UIComponent fc = itr.next(); |
987 | |
|
988 | |
|
989 | |
|
990 | 0 | if (fc.getId() != null && fc.getId().startsWith(JAVAX_FACES_LOCATION_PREFIX)) |
991 | |
{ |
992 | |
|
993 | |
|
994 | 0 | int childCount = fc.getChildCount(); |
995 | 0 | if (childCount > 0) |
996 | |
{ |
997 | 0 | for (int i = 0; i < childCount; i ++) |
998 | |
{ |
999 | 0 | UIComponent child = fc.getChildren().get(i); |
1000 | 0 | id = (String) child.getAttributes().get(ComponentSupport.MARK_CREATED); |
1001 | 0 | if (id != null && finalizeRelocatableResourcesForDeletion(id) == null) |
1002 | |
{ |
1003 | 0 | fc.getChildren().remove(i); |
1004 | 0 | i--; |
1005 | 0 | childCount--; |
1006 | |
} |
1007 | |
} |
1008 | |
} |
1009 | |
} |
1010 | 0 | } |
1011 | |
} |
1012 | 0 | } |
1013 | |
|
1014 | |
private UIComponent finalizeRelocatableResourcesForDeletion(String id) |
1015 | |
{ |
1016 | 0 | return _relocatableResourceForDeletion.remove(id); |
1017 | |
} |
1018 | |
|
1019 | |
public String startComponentUniqueIdSection() |
1020 | |
{ |
1021 | 0 | _level++; |
1022 | 0 | _sectionUniqueComponentIdCounter.startUniqueIdSection(); |
1023 | 0 | return _sectionUniqueIdCounter.startUniqueIdSection(); |
1024 | |
} |
1025 | |
|
1026 | |
public String startComponentUniqueIdSection(String base) |
1027 | |
{ |
1028 | 0 | _level++; |
1029 | 0 | _sectionUniqueComponentIdCounter.startUniqueIdSection(base); |
1030 | 0 | return _sectionUniqueIdCounter.startUniqueIdSection(base); |
1031 | |
} |
1032 | |
|
1033 | |
@Override |
1034 | |
public void incrementUniqueId() |
1035 | |
{ |
1036 | 0 | _sectionUniqueIdCounter.incrementUniqueId(); |
1037 | 0 | } |
1038 | |
|
1039 | |
@Override |
1040 | |
public String generateUniqueId() |
1041 | |
{ |
1042 | 0 | return _sectionUniqueIdCounter.generateUniqueId(); |
1043 | |
} |
1044 | |
|
1045 | |
@Override |
1046 | |
public void generateUniqueId(StringBuilder builderToAdd) |
1047 | |
{ |
1048 | 0 | _sectionUniqueIdCounter.generateUniqueId(builderToAdd); |
1049 | 0 | } |
1050 | |
|
1051 | |
@Override |
1052 | |
public String generateUniqueComponentId() |
1053 | |
{ |
1054 | 0 | return _sectionUniqueComponentIdCounter.generateUniqueId(); |
1055 | |
} |
1056 | |
|
1057 | |
@Override |
1058 | |
public void incrementUniqueComponentId() |
1059 | |
{ |
1060 | 0 | _sectionUniqueComponentIdCounter.incrementUniqueId(); |
1061 | 0 | } |
1062 | |
|
1063 | |
public void endComponentUniqueIdSection() |
1064 | |
{ |
1065 | 0 | _level--; |
1066 | 0 | _sectionUniqueIdCounter.endUniqueIdSection(); |
1067 | 0 | _sectionUniqueComponentIdCounter.endUniqueIdSection(); |
1068 | 0 | } |
1069 | |
|
1070 | |
public void endComponentUniqueIdSection(String base) |
1071 | |
{ |
1072 | 0 | _level--; |
1073 | 0 | _sectionUniqueIdCounter.endUniqueIdSection(base); |
1074 | 0 | _sectionUniqueComponentIdCounter.endUniqueIdSection(base); |
1075 | 0 | } |
1076 | |
|
1077 | |
@Override |
1078 | |
public void startMetadataSection() |
1079 | |
{ |
1080 | 0 | if (_isInMetadataSection == 0) |
1081 | |
{ |
1082 | 0 | if (_sectionUniqueMetadataIdCounter == null) |
1083 | |
{ |
1084 | 0 | _sectionUniqueMetadataIdCounter = new SectionUniqueIdCounter("__md_"); |
1085 | |
} |
1086 | 0 | if (_sectionUniqueComponentMetadataIdCounter == null) |
1087 | |
{ |
1088 | 0 | _sectionUniqueComponentMetadataIdCounter = new SectionUniqueIdCounter("__md_"); |
1089 | |
} |
1090 | |
|
1091 | 0 | _sectionUniqueIdCounter = _sectionUniqueMetadataIdCounter; |
1092 | 0 | _sectionUniqueComponentIdCounter = _sectionUniqueComponentMetadataIdCounter; |
1093 | |
} |
1094 | 0 | _isInMetadataSection++; |
1095 | 0 | } |
1096 | |
|
1097 | |
@Override |
1098 | |
public void endMetadataSection() |
1099 | |
{ |
1100 | 0 | _isInMetadataSection--; |
1101 | 0 | if (_isInMetadataSection == 0) |
1102 | |
{ |
1103 | |
|
1104 | 0 | _sectionUniqueIdCounter = _sectionUniqueNormalIdCounter; |
1105 | 0 | _sectionUniqueComponentIdCounter = _sectionUniqueComponentNormalIdCounter; |
1106 | |
} |
1107 | 0 | } |
1108 | |
|
1109 | |
@Override |
1110 | |
public boolean isInMetadataSection() |
1111 | |
{ |
1112 | 0 | return _isInMetadataSection > 0; |
1113 | |
} |
1114 | |
|
1115 | |
@Override |
1116 | |
public boolean isRefreshingSection() |
1117 | |
{ |
1118 | 0 | return isRefreshingTransientBuild() || (!isBuildingViewMetadata() && isInMetadataSection()); |
1119 | |
} |
1120 | |
|
1121 | |
@Override |
1122 | |
public StringBuilder getSharedStringBuilder() |
1123 | |
{ |
1124 | 0 | if (_sharedStringBuilder == null) |
1125 | |
{ |
1126 | 0 | _sharedStringBuilder = new StringBuilder(); |
1127 | |
} |
1128 | |
else |
1129 | |
{ |
1130 | 0 | _sharedStringBuilder.setLength(0); |
1131 | |
} |
1132 | 0 | return _sharedStringBuilder; |
1133 | |
} |
1134 | |
|
1135 | |
public boolean isDynamicCompositeComponentHandler() |
1136 | |
{ |
1137 | 0 | return this._dynamicComponentHandler; |
1138 | |
} |
1139 | |
|
1140 | |
public void setDynamicCompositeComponentHandler(boolean value) |
1141 | |
{ |
1142 | 0 | this._dynamicComponentHandler = value; |
1143 | 0 | } |
1144 | |
|
1145 | |
@Override |
1146 | |
public void pushDynamicComponentSection(String base) |
1147 | |
{ |
1148 | 0 | if (_sectionUniqueIdCounterStack == null) |
1149 | |
{ |
1150 | 0 | _sectionUniqueIdCounterStack = new ArrayList<SectionUniqueIdCounter>(); |
1151 | |
} |
1152 | 0 | if (_sectionUniqueComponentIdCounterStack == null) |
1153 | |
{ |
1154 | 0 | _sectionUniqueComponentIdCounterStack = new ArrayList<SectionUniqueIdCounter>(); |
1155 | |
} |
1156 | |
|
1157 | 0 | if (_sectionUniqueComponentIdCounterStack.isEmpty()) |
1158 | |
{ |
1159 | 0 | _oldRefreshingTransientBuild = _isRefreshingTransientBuild; |
1160 | |
} |
1161 | 0 | _isRefreshingTransientBuild = true; |
1162 | |
|
1163 | 0 | _sectionUniqueIdCounterStack.add(_sectionUniqueIdCounter); |
1164 | 0 | _sectionUniqueComponentIdCounterStack.add(_sectionUniqueComponentIdCounter); |
1165 | 0 | _sectionUniqueIdCounter = new SectionUniqueIdCounter(base+"_"); |
1166 | 0 | _sectionUniqueComponentIdCounter = new SectionUniqueIdCounter("_"+ base +"_"); |
1167 | 0 | _sectionUniqueNormalIdCounter = _sectionUniqueIdCounter; |
1168 | 0 | _sectionUniqueComponentNormalIdCounter = _sectionUniqueComponentIdCounter; |
1169 | 0 | _dynamicComponentTopLevel = true; |
1170 | 0 | _dynamicComponentSection++; |
1171 | 0 | if (_dynamicOldDeletionLevel == null) |
1172 | |
{ |
1173 | 0 | _dynamicOldDeletionLevel = new ArrayList<Integer>(4); |
1174 | |
} |
1175 | 0 | _dynamicOldDeletionLevel.add(_deletionLevel); |
1176 | |
|
1177 | 0 | increaseComponentLevelMarkedForDeletion(); |
1178 | |
|
1179 | 0 | } |
1180 | |
|
1181 | |
@Override |
1182 | |
public void popDynamicComponentSection() |
1183 | |
{ |
1184 | 0 | decreaseComponentLevelMarkedForDeletion(); |
1185 | 0 | int oldDeletionLevel = _dynamicOldDeletionLevel.remove(_dynamicOldDeletionLevel.size()-1); |
1186 | 0 | if (_deletionLevel != oldDeletionLevel) |
1187 | |
{ |
1188 | |
|
1189 | |
|
1190 | |
|
1191 | 0 | decreaseComponentLevelMarkedForDeletion(); |
1192 | |
} |
1193 | |
|
1194 | 0 | _sectionUniqueIdCounter = _sectionUniqueIdCounterStack.remove( |
1195 | |
_sectionUniqueIdCounterStack.size()-1); |
1196 | 0 | _sectionUniqueComponentIdCounter = _sectionUniqueComponentIdCounterStack.remove( |
1197 | |
_sectionUniqueComponentIdCounterStack.size()-1); |
1198 | |
|
1199 | |
|
1200 | 0 | if (_sectionUniqueComponentIdCounterStack.isEmpty()) |
1201 | |
{ |
1202 | 0 | _isRefreshingTransientBuild = _oldRefreshingTransientBuild; |
1203 | |
} |
1204 | |
|
1205 | 0 | _sectionUniqueNormalIdCounter = _sectionUniqueIdCounter; |
1206 | 0 | _sectionUniqueComponentNormalIdCounter = _sectionUniqueComponentIdCounter; |
1207 | 0 | _dynamicComponentTopLevel = false; |
1208 | 0 | _dynamicComponentSection--; |
1209 | 0 | } |
1210 | |
|
1211 | |
@Override |
1212 | |
public boolean isDynamicComponentTopLevel() |
1213 | |
{ |
1214 | 0 | return _dynamicComponentTopLevel; |
1215 | |
} |
1216 | |
|
1217 | |
@Override |
1218 | |
public void setDynamicComponentTopLevel(boolean value) |
1219 | |
{ |
1220 | 0 | _dynamicComponentTopLevel = value; |
1221 | 0 | } |
1222 | |
|
1223 | |
@Override |
1224 | |
public boolean isDynamicComponentSection() |
1225 | |
{ |
1226 | 0 | return _dynamicComponentSection > 0; |
1227 | |
} |
1228 | |
|
1229 | |
@Override |
1230 | |
public void setViewRoot(UIViewRoot root) |
1231 | |
{ |
1232 | 0 | this._viewRoot = root; |
1233 | 0 | } |
1234 | |
|
1235 | |
@Override |
1236 | |
public UIViewRoot getViewRoot(FacesContext facesContext) |
1237 | |
{ |
1238 | 0 | if (_viewRoot == null) |
1239 | |
{ |
1240 | 0 | return facesContext.getViewRoot(); |
1241 | |
} |
1242 | 0 | return _viewRoot; |
1243 | |
} |
1244 | |
|
1245 | |
@Override |
1246 | |
public VisitContextFactory getVisitContextFactory() |
1247 | |
{ |
1248 | 0 | if (_visitContextFactory == null) |
1249 | |
{ |
1250 | |
|
1251 | |
|
1252 | 0 | _visitContextFactory = (VisitContextFactory) _facesContext.getExternalContext(). |
1253 | |
getApplicationMap().get("oam.vf.VisitContextFactory"); |
1254 | 0 | if (_visitContextFactory == null) |
1255 | |
{ |
1256 | 0 | VisitContextFactory factory = (VisitContextFactory) |
1257 | |
FactoryFinder.getFactory(FactoryFinder.VISIT_CONTEXT_FACTORY); |
1258 | 0 | _facesContext.getExternalContext(). |
1259 | |
getApplicationMap().put("oam.vf.VisitContextFactory", factory); |
1260 | 0 | _visitContextFactory = factory; |
1261 | |
} |
1262 | |
} |
1263 | 0 | return _visitContextFactory; |
1264 | |
} |
1265 | |
|
1266 | |
private static class KeyEntryIterator<K, V> implements Iterator<K> |
1267 | |
{ |
1268 | |
private Iterator<Map.Entry<K, V>> _delegateIterator; |
1269 | |
|
1270 | |
public KeyEntryIterator(Iterator<Map.Entry<K, V>> delegate) |
1271 | 0 | { |
1272 | 0 | _delegateIterator = delegate; |
1273 | 0 | } |
1274 | |
|
1275 | |
public boolean hasNext() |
1276 | |
{ |
1277 | 0 | if (_delegateIterator != null) |
1278 | |
{ |
1279 | 0 | return _delegateIterator.hasNext(); |
1280 | |
} |
1281 | 0 | return false; |
1282 | |
} |
1283 | |
|
1284 | |
public K next() |
1285 | |
{ |
1286 | 0 | if (_delegateIterator != null) |
1287 | |
{ |
1288 | 0 | return _delegateIterator.next().getKey(); |
1289 | |
} |
1290 | 0 | return null; |
1291 | |
} |
1292 | |
|
1293 | |
public void remove() |
1294 | |
{ |
1295 | 0 | if (_delegateIterator != null) |
1296 | |
{ |
1297 | 0 | _delegateIterator.remove(); |
1298 | |
} |
1299 | 0 | } |
1300 | |
|
1301 | |
} |
1302 | |
|
1303 | |
private static class SimpleEntry<K, V> implements Map.Entry<K, V> |
1304 | |
{ |
1305 | |
private final K _key; |
1306 | |
private final V _value; |
1307 | |
|
1308 | |
public SimpleEntry(K key, V value) |
1309 | 0 | { |
1310 | 0 | _key = key; |
1311 | 0 | _value = value; |
1312 | 0 | } |
1313 | |
|
1314 | |
public K getKey() |
1315 | |
{ |
1316 | 0 | return _key; |
1317 | |
} |
1318 | |
|
1319 | |
public V getValue() |
1320 | |
{ |
1321 | 0 | return _value; |
1322 | |
} |
1323 | |
|
1324 | |
@Override |
1325 | |
public int hashCode() |
1326 | |
{ |
1327 | 0 | final int prime = 31; |
1328 | 0 | int result = 1; |
1329 | 0 | result = prime * result + ((_key == null) ? 0 : _key.hashCode()); |
1330 | 0 | result = prime * result + ((_value == null) ? 0 : _value.hashCode()); |
1331 | 0 | return result; |
1332 | |
} |
1333 | |
|
1334 | |
@SuppressWarnings("unchecked") |
1335 | |
@Override |
1336 | |
public boolean equals(Object obj) |
1337 | |
{ |
1338 | 0 | if (this == obj) |
1339 | |
{ |
1340 | 0 | return true; |
1341 | |
} |
1342 | 0 | if (obj == null) |
1343 | |
{ |
1344 | 0 | return false; |
1345 | |
} |
1346 | 0 | if (getClass() != obj.getClass()) |
1347 | |
{ |
1348 | 0 | return false; |
1349 | |
} |
1350 | 0 | SimpleEntry other = (SimpleEntry) obj; |
1351 | 0 | if (_key == null) |
1352 | |
{ |
1353 | 0 | if (other._key != null) |
1354 | |
{ |
1355 | 0 | return false; |
1356 | |
} |
1357 | |
} |
1358 | 0 | else if (!_key.equals(other._key)) |
1359 | |
{ |
1360 | 0 | return false; |
1361 | |
} |
1362 | |
|
1363 | 0 | if (_value == null) |
1364 | |
{ |
1365 | 0 | if (other._value != null) |
1366 | |
{ |
1367 | 0 | return false; |
1368 | |
} |
1369 | |
} |
1370 | 0 | else if (!_value.equals(other._value)) |
1371 | |
{ |
1372 | 0 | return false; |
1373 | |
} |
1374 | 0 | return true; |
1375 | |
} |
1376 | |
|
1377 | |
public V setValue(V value) |
1378 | |
{ |
1379 | 0 | throw new UnsupportedOperationException(); |
1380 | |
} |
1381 | |
} |
1382 | |
} |