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 abstract class AccessibleTreeNode
28 /// The parent node. It is null for the root node.
29 private AccessibleTreeNode maParent
;
31 /// The object to be displayed.
32 private final Object maDisplayObject
;
34 public AccessibleTreeNode (Object aDisplayObject
, AccessibleTreeNode aParent
)
36 maDisplayObject
= aDisplayObject
;
45 public AccessibleTreeNode
getParent ()
50 public int getChildCount ()
55 public AccessibleTreeNode
getChild (int nIndex
)
56 throws IndexOutOfBoundsException
58 throw new IndexOutOfBoundsException();
61 public AccessibleTreeNode
getChildNoCreate (int nIndex
)
62 throws IndexOutOfBoundsException
64 throw new IndexOutOfBoundsException();
67 public boolean removeChild (int nIndex
)
68 throws IndexOutOfBoundsException
70 throw new IndexOutOfBoundsException();
73 public abstract int indexOf (AccessibleTreeNode aNode
);
75 /** Create a path to this node by first asking the parent for its path
76 and then appending this object.
78 public void createPath (java
.util
.List
<AccessibleTreeNode
> aPath
)
81 maParent
.createPath (aPath
);
85 public Object
[] createPath ()
87 ArrayList
<AccessibleTreeNode
> aPath
= new ArrayList
<AccessibleTreeNode
> (1);
89 return aPath
.toArray();
92 public boolean isLeaf()
98 public String
toString()
100 return maDisplayObject
.toString();
103 /** get names of supported actions */
104 public String
[] getActions ()
106 return new String
[] {};
109 /** perform action */
110 public void performAction (int nIndex
)