merged tag ooo/DEV300_m102
[LibreOffice.git] / toolkit / test / accessibility / GeometryEventHandler.java
blob07236785e8629e13bda6f260249bb4909ee9ccdf
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;
6 import java.util.LinkedList;
8 class GeometryEventHandler
9 extends EventHandler
11 public GeometryEventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
13 super (aEvent, aTreeModel);
16 public void PrintOldAndNew (PrintStream out)
18 out.println (" children not relevant");
21 public void Process ()
23 AccTreeNode aNode = maTreeModel.updateNode (mxEventSource,
24 AccessibleComponentHandler.class,
25 AccessibleExtendedComponentHandler.class);
27 // Update the graphical representation of aNode in the Canvas.
28 Canvas aCanvas = maTreeModel.getCanvas();
29 if (aCanvas != null)
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)
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);
42 // Add the node's children to the queue.
43 int nChildCount = maTreeModel.getChildCount (aShapeNode);
44 for (int i=0; i<nChildCount; i++)
46 Object aTreeNode = maTreeModel.getChildNoCreate (aShapeNode, i);
47 if (aTreeNode instanceof AccTreeNode)
48 aShapeQueue.addLast (aTreeNode);
51 aCanvas.repaint ();