diff options
author | Daniel Vogelheim <dvo@openoffice.org> | 2002-03-08 16:30:18 +0000 |
---|---|---|
committer | Daniel Vogelheim <dvo@openoffice.org> | 2002-03-08 16:30:18 +0000 |
commit | 75345d9b5845e57c3f83ade2266f59fe01ac6572 (patch) | |
tree | 1c5fc8380ea0a7a9491804e7d45344f9e733a159 /toolkit/test/accessibility/AccessibleActionHandler.java | |
parent | a403b7e53223c93b47a1afa0d81da155e6920873 (diff) |
Now use custom tree model in order to create data on-the-fly.
Diffstat (limited to 'toolkit/test/accessibility/AccessibleActionHandler.java')
-rw-r--r-- | toolkit/test/accessibility/AccessibleActionHandler.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/toolkit/test/accessibility/AccessibleActionHandler.java b/toolkit/test/accessibility/AccessibleActionHandler.java new file mode 100644 index 000000000000..e0c5b6cbb56a --- /dev/null +++ b/toolkit/test/accessibility/AccessibleActionHandler.java @@ -0,0 +1,45 @@ + +import com.sun.star.uno.UnoRuntime; +import drafts.com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.lang.IndexOutOfBoundsException; + +class AccessibleActionHandler extends NodeHandler +{ + protected XAccessibleAction getAction(Object aObject) + { + return (XAccessibleAction) UnoRuntime.queryInterface ( + XAccessibleAction.class, aObject); + } + + public int getChildCount(Object aObject) + { + XAccessibleAction xAction = getAction(aObject); + return (xAction == null) ? 0 : 1 + xAction.getAccessibleActionCount(); + } + + public Object getChild(Object aObject, int nIndex) + { + Object aRet = null; + + XAccessibleAction xAction = getAction(aObject); + if( xAction != null ) + { + if( nIndex == 1 ) + aRet = "Actions: " + xAction.getAccessibleActionCount(); + else + { + try + { + aRet = "Action " + (nIndex-1) + " : " + + xAction.getAccessibleActionDescription(nIndex-1); + } + catch( IndexOutOfBoundsException e ) + { + aRet = "ERROR"; + } + } + } + + return aRet; + } +} |