merge the formfield patch from ooo-build
[ooovba.git] / toolkit / test / accessibility / AccessibleTreeNode.java
blob205556c061c63337e9c61dd06570a5fa1a594544
1 import java.util.Vector;
2 import com.sun.star.lang.IndexOutOfBoundsException;
4 /**
5 Base class for all tree nodes.
6 */
7 class AccessibleTreeNode
9 /// The parent node. It is null for the root node.
10 protected AccessibleTreeNode maParent;
12 /// The object to be displayed.
13 private Object maDisplayObject;
15 public AccessibleTreeNode (Object aDisplayObject, AccessibleTreeNode aParent)
17 maDisplayObject = aDisplayObject;
18 maParent = aParent;
21 public void update ()
23 // Empty
26 public AccessibleTreeNode getParent ()
28 return maParent;
31 public Object getDisplayObject ()
33 return maDisplayObject;
36 public int getChildCount ()
38 return 0;
41 public AccessibleTreeNode getChild (int nIndex)
42 throws IndexOutOfBoundsException
44 throw new IndexOutOfBoundsException();
47 public AccessibleTreeNode getChildNoCreate (int nIndex)
48 throws IndexOutOfBoundsException
50 throw new IndexOutOfBoundsException();
53 public boolean removeChild (int nIndex)
54 throws IndexOutOfBoundsException
56 throw new IndexOutOfBoundsException();
59 public int indexOf (AccessibleTreeNode aNode)
61 return -1;
64 /** Create a path to this node by first asking the parent for its path
65 and then appending this object.
67 public void createPath (java.util.Vector aPath)
69 if (maParent != null)
70 maParent.createPath (aPath);
71 aPath.add (this);
74 public Object[] createPath ()
76 Vector aPath = new Vector (1);
77 createPath (aPath);
78 return aPath.toArray();
81 public boolean isLeaf()
83 return true;
86 public String toString()
88 return maDisplayObject.toString();
91 /** get names of suported actions */
92 public String[] getActions ()
94 return new String[] {};
97 /** perform action */
98 public void performAction (int nIndex)