merged tag ooo/DEV300_m102
[LibreOffice.git] / toolkit / test / accessibility / ContextEventHandler.java
blobab7166fdede1f6edfc1cfa7b3e596ec4416d3349
1 import com.sun.star.accessibility.XAccessible;
2 import com.sun.star.accessibility.AccessibleEventObject;
3 import com.sun.star.accessibility.AccessibleEventId;
4 import com.sun.star.uno.UnoRuntime;
5 import com.sun.star.uno.AnyConverter;
7 import java.io.PrintStream;
9 import tools.NameProvider;
11 class ContextEventHandler
12 extends EventHandler
14 public ContextEventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
16 super (aEvent, aTreeModel);
19 public void PrintOldAndNew (PrintStream out)
21 switch (mnEventId)
23 case AccessibleEventId.STATE_CHANGED:
24 try
26 int nOldValue = AnyConverter.toInt (maEvent.OldValue);
27 out.println (" turning off state " + nOldValue + " ("
28 + NameProvider.getStateName (nOldValue) + ")");
30 catch (com.sun.star.lang.IllegalArgumentException e)
32 try
34 int nNewValue = AnyConverter.toInt (maEvent.NewValue);
35 out.println (" turning on state " + nNewValue + " ("
36 + NameProvider.getStateName (nNewValue) + ")");
38 catch (com.sun.star.lang.IllegalArgumentException e)
40 break;
42 default:
43 super.PrintOldAndNew (out);
48 public void Process ()
50 maTreeModel.updateNode (mxEventSource, AccessibleContextHandler.class);