1 import com
.sun
.star
.accessibility
.XAccessible
;
2 import com
.sun
.star
.accessibility
.AccessibleEventObject
;
3 import com
.sun
.star
.uno
.UnoRuntime
;
5 import java
.io
.PrintStream
;
7 class ChildEventHandler
10 public ChildEventHandler (AccessibleEventObject aEvent
, AccessibilityTreeModel aTreeModel
)
12 super (aEvent
, aTreeModel
);
13 mxOldChild
= (XAccessible
)UnoRuntime
.queryInterface(
14 XAccessible
.class, aEvent
.OldValue
);
15 mxNewChild
= (XAccessible
)UnoRuntime
.queryInterface(
16 XAccessible
.class, aEvent
.NewValue
);
19 public void PrintOldAndNew (PrintStream out
)
21 if (mxOldChild
!= null)
22 out
.println (" removing child " + mxOldChild
);
23 if (mxNewChild
!= null)
24 out
.println (" adding child " + mxNewChild
);
27 public void Process ()
29 // Insertion and removal of children should be mutually exclusive.
30 // But this is a test tool and should take everything into account.
31 if (mxOldChild
!= null)
33 maTreeModel
.removeNode (mxOldChild
.getAccessibleContext());
34 maTreeModel
.updateNode (mxEventSource
, AccessibleTreeHandler
.class);
37 if (mxNewChild
!= null)
39 maTreeModel
.addChild (mxEventSource
, mxNewChild
);
44 private XAccessible mxOldChild
;
45 private XAccessible mxNewChild
;