bump product version to 7.2.5.1
[LibreOffice.git] / toolkit / test / accessibility / ChildEventHandler.java
blobe36f3502ad45e3f68b9a84df9946c0aee478a6a4
1 /*
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 com.sun.star.accessibility.XAccessible;
20 import com.sun.star.accessibility.AccessibleEventObject;
21 import com.sun.star.uno.UnoRuntime;
23 import java.io.PrintStream;
25 class ChildEventHandler
26 extends EventHandler
28 public ChildEventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
30 super (aEvent, aTreeModel);
31 mxOldChild = UnoRuntime.queryInterface(
32 XAccessible.class, aEvent.OldValue);
33 mxNewChild = UnoRuntime.queryInterface(
34 XAccessible.class, aEvent.NewValue);
37 @Override
38 public void PrintOldAndNew (PrintStream out)
40 if (mxOldChild != null)
41 out.println (" removing child " + mxOldChild);
42 if (mxNewChild != null)
43 out.println (" adding child " + mxNewChild);
46 @Override
47 public void Process ()
49 // Insertion and removal of children should be mutually exclusive.
50 // But this is a test tool and should take everything into account.
51 if (mxOldChild != null)
53 maTreeModel.removeNode (mxOldChild.getAccessibleContext());
54 maTreeModel.updateNode (mxEventSource, AccessibleTreeHandler.class);
57 if (mxNewChild != null)
59 maTreeModel.addChild (mxEventSource, mxNewChild);
64 private final XAccessible mxOldChild;
65 private final XAccessible mxNewChild;