01: /* FacadeList.java
02:
03: {{IS_NOTE
04:
05: Purpose:
06: Description:
07: History:
08: 2001/10/22 18:10:32, Create, Tom M. Yeh.
09: }}IS_NOTE
10:
11: Copyright (C) 2001 Potix Corporation. All Rights Reserved.
12:
13: {{IS_RIGHT
14: This program is distributed under GPL Version 2.0 in the hope that
15: it will be useful, but WITHOUT ANY WARRANTY.
16: }}IS_RIGHT
17: */
18: package org.zkoss.xml;
19:
20: import java.util.AbstractList;
21: import org.w3c.dom.Node;
22: import org.w3c.dom.NodeList;
23:
24: /**
25: * The java List which is a facade of a NodeList.
26: *
27: * @author tomyeh
28: * @see FacadeNodeList
29: */
30: public class FacadeList extends AbstractList {
31: /** The node list to facade. */
32: protected NodeList _nlist;
33:
34: /** Constructor.
35: */
36: public FacadeList(NodeList nlist) {
37: _nlist = nlist;
38: }
39:
40: //-- List --//
41: public Object get(int index) {
42: if (index < 0 || index >= size())
43: throw new IndexOutOfBoundsException("index: " + index);
44: return _nlist.item(index);
45: }
46:
47: public int size() {
48: return _nlist.getLength();
49: }
50: }
|