diff options
author | Andre Fischer <af@openoffice.org> | 2002-06-13 10:12:44 +0000 |
---|---|---|
committer | Andre Fischer <af@openoffice.org> | 2002-06-13 10:12:44 +0000 |
commit | 324fdf2793a059d068c51b3cf80f67c101ef6ced (patch) | |
tree | 41cd5785264284882bda408cc2d1d47f078e38b6 /toolkit/test/accessibility/AccessibleActionNode.java | |
parent | 30f80e99c1cae20c4bc29c788844e21ee225947c (diff) |
Added support for execution of accessibility actions.
Diffstat (limited to 'toolkit/test/accessibility/AccessibleActionNode.java')
-rw-r--r-- | toolkit/test/accessibility/AccessibleActionNode.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/toolkit/test/accessibility/AccessibleActionNode.java b/toolkit/test/accessibility/AccessibleActionNode.java new file mode 100644 index 000000000000..9f5ed1742167 --- /dev/null +++ b/toolkit/test/accessibility/AccessibleActionNode.java @@ -0,0 +1,48 @@ +import javax.swing.JOptionPane; +import drafts.com.sun.star.accessibility.XAccessibleAction; + +/** + Base class for all tree nodes. + */ +class AccessibleActionNode + extends StringNode +{ + public AccessibleActionNode (String aDisplayObject, + AccessibleTreeNode aParent, + int nActionIndex) + { + super (aDisplayObject, aParent); + mnActionIndex = nActionIndex; + } + + public String[] getActions () + { + return new String[] {"Perform Action"}; + } + + /** perform action */ + public void performAction (int nIndex) + { + if (nIndex != 0) + return; + boolean bResult = false; + if (getParent() instanceof AccTreeNode) + try + { + bResult = AccessibleActionHandler.getAction( + (AccTreeNode)getParent()).doAccessibleAction ( + mnActionIndex); + } + catch (com.sun.star.lang.IndexOutOfBoundsException e) + { + } + + JOptionPane.showMessageDialog (null, + "performed action " + mnActionIndex + + (bResult?" with":" without") + " success", + "Action " + mnActionIndex, + JOptionPane.INFORMATION_MESSAGE); + } + + private int mnActionIndex; +} |