1 import com.sun.star.lang.IndexOutOfBoundsException; 2 import java.util.Vector; 3 4 /** The VectorNode class is a simple container whose list of children is 5 managed entirely by its owner. 6 */ 7 class VectorNode 8 extends StringNode 9 { 10 private Vector maChildren; 11 12 public VectorNode (String sDisplayObject, AccessibleTreeNode aParent) 13 { 14 super (sDisplayObject, aParent); 15 16 maChildren = new Vector (); 17 } 18 19 public void addChild (AccessibleTreeNode aChild) 20 { 21 maChildren.add (aChild); 22 } 23 24 public int getChildCount () 25 { 26 return maChildren.size(); 27 } 28 29 public AccessibleTreeNode getChild (int nIndex) 30 throws IndexOutOfBoundsException 31 { 32 return (AccessibleTreeNode)maChildren.elementAt (nIndex); 33 } 34 35 public boolean removeChild (int nIndex) 36 throws IndexOutOfBoundsException 37 { 38 return maChildren.remove (nIndex) != null; 39 } 40 41 public int indexOf (AccessibleTreeNode aNode) 42 { 43 return maChildren.indexOf (aNode); 44 } 45 46 public boolean isLeaf() 47 { 48 return maChildren.isEmpty(); 49 } 50 } 51