1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.component.html.ext;
20
21 import java.util.Iterator;
22 import java.util.List;
23 import java.util.NoSuchElementException;
24
25 import javax.faces.component.UIComponent;
26
27
28
29
30
31 class _DetailStampFacetAndChildrenIterator implements Iterator<UIComponent>
32 {
33 private UIComponent _detailStamp;
34 private Iterator<UIComponent> _childrenIterator;
35
36 _DetailStampFacetAndChildrenIterator(UIComponent detailStamp, List<UIComponent> childrenList)
37 {
38 _detailStamp = detailStamp;
39 _childrenIterator = childrenList != null ? childrenList.iterator() : null;
40 }
41
42 public boolean hasNext()
43 {
44 boolean hasNext = (_detailStamp != null)
45 || (_childrenIterator != null && _childrenIterator.hasNext());
46 if (!hasNext)
47 {
48 _detailStamp = null;
49 _childrenIterator = null;
50 }
51
52 return hasNext;
53 }
54
55 public UIComponent next()
56 {
57 if (_detailStamp != null)
58 {
59 UIComponent detailStamp = _detailStamp;
60 _detailStamp = null;
61 return detailStamp;
62 }
63 else if (_childrenIterator != null && _childrenIterator.hasNext())
64 {
65 return _childrenIterator.next();
66 }
67 else
68 {
69 throw new NoSuchElementException();
70 }
71 }
72
73 public void remove()
74 {
75 throw new UnsupportedOperationException(this.getClass().getName() + " UnsupportedOperationException");
76 }
77 }