01: /*
02: * Copyright 2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package javax.faces.component;
17:
18: import java.util.Iterator;
19: import java.util.List;
20: import java.util.Map;
21: import java.util.NoSuchElementException;
22:
23: /**
24: * @author Manfred Geiler (latest modification by $Author: matzew $)
25: * @version $Revision: 411989 $ $Date: 2006-06-06 06:16:03 +0200 (Di, 06 Jun 2006) $
26: */
27: class _FacetsAndChildrenIterator<E> implements Iterator {
28: private Iterator<UIComponent> _facetsIterator;
29: private Iterator<UIComponent> _childrenIterator;
30:
31: _FacetsAndChildrenIterator(Map facetMap, List childrenList) {
32: _facetsIterator = facetMap != null ? facetMap.values()
33: .iterator() : null;
34: _childrenIterator = childrenList != null ? childrenList
35: .iterator() : null;
36: }
37:
38: public boolean hasNext() {
39: return (_facetsIterator != null && _facetsIterator.hasNext())
40: || (_childrenIterator != null && _childrenIterator
41: .hasNext());
42: }
43:
44: public Object next() {
45: if (_facetsIterator != null && _facetsIterator.hasNext()) {
46: return _facetsIterator.next();
47: } else if (_childrenIterator != null
48: && _childrenIterator.hasNext()) {
49: return _childrenIterator.next();
50: } else {
51: throw new NoSuchElementException();
52: }
53: }
54:
55: public void remove() {
56: throw new UnsupportedOperationException(this .getClass()
57: .getName()
58: + " UnsupportedOperationException");
59: }
60:
61: }
|