1 import com.sun.star.accessibility.XAccessible;
2 import com.sun.star.accessibility.AccessibleEventObject;
3 import com.sun.star.uno.UnoRuntime;
4 
5 import java.io.PrintStream;
6 import java.util.LinkedList;
7 
8 class GeometryEventHandler
9     extends EventHandler
10 {
11     public GeometryEventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
12     {
13         super (aEvent, aTreeModel);
14     }
15 
16     public void PrintOldAndNew (PrintStream out)
17     {
18         out.println ("   children not relevant");
19     }
20 
21     public void Process ()
22     {
23         AccTreeNode aNode = maTreeModel.updateNode (mxEventSource,
24             AccessibleComponentHandler.class,
25             AccessibleExtendedComponentHandler.class);
26 
27         // Update the graphical representation of aNode in the Canvas.
28         Canvas aCanvas = maTreeModel.getCanvas();
29         if (aCanvas != null)
30         {
31             // Iterate over all nodes in the sub-tree rooted in aNode.
32             LinkedList aShapeQueue = new LinkedList();
33             aShapeQueue.addLast (aNode);
34             while (aShapeQueue.size() > 0)
35             {
36                 // Remove the first node from the queue and update its
37                 // graphical representation.
38                 AccTreeNode aShapeNode = (AccTreeNode) aShapeQueue.getFirst();
39                 aShapeQueue.removeFirst();
40                 aCanvas.updateNodeGeometry (aShapeNode);
41 
42                 // Add the node's children to the queue.
43                 int nChildCount = maTreeModel.getChildCount (aShapeNode);
44                 for (int i=0; i<nChildCount; i++)
45                 {
46                     Object aTreeNode = maTreeModel.getChildNoCreate (aShapeNode, i);
47                     if (aTreeNode instanceof AccTreeNode)
48                         aShapeQueue.addLast (aTreeNode);
49                 }
50             }
51             aCanvas.repaint ();
52         }
53     }
54 }
55