merged tag ooo/DEV300_m102
[LibreOffice.git] / toolkit / test / accessibility / AccessibleActionNode.java
blob7c72ac69803e3af1fde0fd8aa7e2b2419593b551
1 import javax.swing.JOptionPane;
2 import com.sun.star.accessibility.XAccessibleAction;
4 /**
5 Base class for all tree nodes.
6 */
7 class AccessibleActionNode
8 extends StringNode
10 public AccessibleActionNode (String aDisplayObject,
11 AccessibleTreeNode aParent,
12 int nActionIndex)
14 super (aDisplayObject, aParent);
15 mnActionIndex = nActionIndex;
18 public String[] getActions ()
20 return new String[] {"Perform Action"};
23 /** perform action */
24 public void performAction (int nIndex)
26 if (nIndex != 0)
27 return;
28 boolean bResult = false;
29 if (getParent() instanceof AccTreeNode)
30 try
32 bResult = AccessibleActionHandler.getAction(
33 (AccTreeNode)getParent()).doAccessibleAction (
34 mnActionIndex);
36 catch (com.sun.star.lang.IndexOutOfBoundsException e)
40 JOptionPane.showMessageDialog (null,
41 "performed action " + mnActionIndex
42 + (bResult?" with":" without") + " success",
43 "Action " + mnActionIndex,
44 JOptionPane.INFORMATION_MESSAGE);
47 private int mnActionIndex;