summaryrefslogtreecommitdiff
path: root/toolkit/test/accessibility/AccessibilityTreeModel.java
diff options
context:
space:
mode:
authorAndre Fischer <af@openoffice.org>2002-04-04 10:53:51 +0000
committerAndre Fischer <af@openoffice.org>2002-04-04 10:53:51 +0000
commit4114e80da70ba106858df09cd367a94e45061698 (patch)
treeec499f7b702c46741393dbeed2a43768d75adebf /toolkit/test/accessibility/AccessibilityTreeModel.java
parent6c11246ad32ba7a3d683f01ac8ccd3b87eb2f396 (diff)
#97772# Register only once as listener at each node.
Diffstat (limited to 'toolkit/test/accessibility/AccessibilityTreeModel.java')
-rw-r--r--toolkit/test/accessibility/AccessibilityTreeModel.java29
1 files changed, 18 insertions, 11 deletions
diff --git a/toolkit/test/accessibility/AccessibilityTreeModel.java b/toolkit/test/accessibility/AccessibilityTreeModel.java
index d643dd05af94..f65af5368cfb 100644
--- a/toolkit/test/accessibility/AccessibilityTreeModel.java
+++ b/toolkit/test/accessibility/AccessibilityTreeModel.java
@@ -138,17 +138,20 @@ public class AccessibilityTreeModel
AccessibleTreeNode aChild = null;
if (aParent != null)
aChild = aParent.getChild(nIndex);
- registerAccListener (aChild);
// Keep translation table up-to-date.
if (aChild != null)
if (aChild instanceof AccTreeNode)
- {
- maXAccessibleToNode.put (((AccTreeNode)aChild).getAccessible(), aChild);
- addToCanvas ((AccTreeNode)aChild);
- }
+ if (maXAccessibleToNode.get (((AccTreeNode)aChild).getAccessible()) == null)
+ {
+ registerAccListener (aChild);
+ maXAccessibleToNode.put (((AccTreeNode)aChild).getAccessible(), aChild);
+ addToCanvas ((AccTreeNode)aChild);
+ }
+
if (aChild == null)
System.out.println ("getChild: child not found");
+
return aChild;
}
@@ -199,7 +202,10 @@ public class AccessibilityTreeModel
try
{
if( aNode == null )
+ {
+ System.out.println ("can't remove null node");
return;
+ }
removeAccListener (aNode);
removeFromCanvas (aNode);
if (aNode instanceof AccTreeNode)
@@ -217,7 +223,7 @@ public class AccessibilityTreeModel
}
catch (com.sun.star.lang.IndexOutOfBoundsException e)
{
- // Ignore.
+ System.out.println ("caught exception while removing node " + aNode + " : " + e);
}
}
@@ -369,12 +375,13 @@ public class AccessibilityTreeModel
private final XAccessibleEventListener xListener;
- protected XAccessibleEventBroadcaster getBroadcaster( Object aObject )
+ protected XAccessibleEventBroadcaster getBroadcaster (Object aObject)
{
- if( aObject instanceof AccTreeNode )
- aObject = ((AccTreeNode)aObject).getContext();
- return (XAccessibleEventBroadcaster) UnoRuntime.queryInterface (
- XAccessibleEventBroadcaster.class, aObject);
+ if (aObject instanceof AccTreeNode)
+ return (XAccessibleEventBroadcaster) UnoRuntime.queryInterface (
+ XAccessibleEventBroadcaster.class, ((AccTreeNode)aObject).getContext());
+ else
+ return null;
}
protected void registerAccListener( Object aObject )