2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 import java
.util
.ArrayList
;
21 import com
.sun
.star
.lang
.IndexOutOfBoundsException
;
24 Base class for all tree nodes.
26 class AccessibleTreeNode
28 /// The parent node. It is null for the root node.
29 protected AccessibleTreeNode maParent
;
31 /// The object to be displayed.
32 private Object maDisplayObject
;
34 public AccessibleTreeNode (Object aDisplayObject
, AccessibleTreeNode aParent
)
36 maDisplayObject
= aDisplayObject
;
45 public AccessibleTreeNode
getParent ()
50 public Object
getDisplayObject ()
52 return maDisplayObject
;
55 public int getChildCount ()
60 public AccessibleTreeNode
getChild (int nIndex
)
61 throws IndexOutOfBoundsException
63 throw new IndexOutOfBoundsException();
66 public AccessibleTreeNode
getChildNoCreate (int nIndex
)
67 throws IndexOutOfBoundsException
69 throw new IndexOutOfBoundsException();
72 public boolean removeChild (int nIndex
)
73 throws IndexOutOfBoundsException
75 throw new IndexOutOfBoundsException();
78 public int indexOf (AccessibleTreeNode aNode
)
83 /** Create a path to this node by first asking the parent for its path
84 and then appending this object.
86 public void createPath (java
.util
.List
<AccessibleTreeNode
> aPath
)
89 maParent
.createPath (aPath
);
93 public Object
[] createPath ()
95 ArrayList
<AccessibleTreeNode
> aPath
= new ArrayList
<AccessibleTreeNode
> (1);
97 return aPath
.toArray();
100 public boolean isLeaf()
105 public String
toString()
107 return maDisplayObject
.toString();
110 /** get names of suported actions */
111 public String
[] getActions ()
113 return new String
[] {};
116 /** perform action */
117 public void performAction (int nIndex
)