summaryrefslogtreecommitdiff
path: root/accessibility
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2003-07-01 13:59:34 +0000
committerVladimir Glazounov <vg@openoffice.org>2003-07-01 13:59:34 +0000
commit4aa07a182b0fd962ca69a2079882bea339a558b8 (patch)
tree1e5f9dcc98bc12a98d4728f77e971aa98736a564 /accessibility
parentbfce6bcf539a115a0f821f7d61fff30660997055 (diff)
INTEGRATION: CWS juabrc7 (1.5.4); FILE MERGED
2003/07/01 07:24:34 obr 1.5.4.3: #i16159# added LABELED_BY relation as well 2003/07/01 07:15:53 obr 1.5.4.2: #i15585# exclude AWT EventDispatcherThread from executing actions 2003/06/30 14:42:59 obr 1.5.4.1: #i16160# buttons should expose MEMBER_OF relations
Diffstat (limited to 'accessibility')
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java86
1 files changed, 69 insertions, 17 deletions
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java b/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java
index 520286d9a7d7..504720e357f5 100644
--- a/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java
@@ -126,6 +126,48 @@ public abstract class AbstractButton extends Component {
}
}
+ /** Returns the relation set of this object */
+ public javax.accessibility.AccessibleRelationSet getAccessibleRelationSet() {
+ try {
+ XAccessibleRelationSet unoAccessibleRelationSet = unoAccessibleContext.getAccessibleRelationSet();
+
+ if (unoAccessibleRelationSet == null) {
+ return null;
+ }
+
+ javax.accessibility.AccessibleRelationSet relationSet = new javax.accessibility.AccessibleRelationSet();
+ int count = unoAccessibleRelationSet.getRelationCount();
+
+ for (int i = 0; i < count; i++) {
+ AccessibleRelation unoAccessibleRelation = unoAccessibleRelationSet.getRelation(i);
+
+ switch (unoAccessibleRelation.RelationType) {
+ case AccessibleRelationType.MEMBER_OF:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.MEMBER_OF,
+ getAccessibleComponents(
+ unoAccessibleRelation.TargetSet)));
+ break;
+
+ case AccessibleRelationType.LABELED_BY:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.LABELED_BY,
+ getAccessibleComponents(
+ unoAccessibleRelation.TargetSet)));
+ break;
+ default:
+ break;
+ }
+ }
+
+ return relationSet;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
/*
* AccessibleAction
*/
@@ -133,26 +175,36 @@ public abstract class AbstractButton extends Component {
/** Performs the specified Action on the object */
public boolean doAccessibleAction(int param) {
if (param == 0) {
- // Actions of MenuItems may also be performed if the item is not
- // visible, so just try ..
- try {
- XAccessibleComponent xAccessibleComponent = AbstractButton.this.unoAccessibleComponent;
- if (xAccessibleComponent != null) {
- // Query for XAccessibleValue interface
- XAccessibleAction xAccessibleAction = (XAccessibleAction)
- UnoRuntime.queryInterface(XAccessibleAction.class,
- xAccessibleComponent);
-
- if (xAccessibleAction != null) {
- return xAccessibleAction.doAccessibleAction(0);
+ // HACK: this action might open a modal dialog and therefor block
+ // until the dialog is closed. In case of this thread being the
+ // AWT EventDispatcherThread this means, the opened dialog will
+ // not be accessible, so deligate this request to another thread.
+ if (java.awt.EventQueue.isDispatchThread()) {
+ Thread t = new Thread () {
+ public void run() {
+ AbstractButton.AccessibleAbstractButton.this.doAccessibleAction(0);
}
+ };
+ t.start();
+ return true;
+ } else {
+ // Actions of MenuItems may also be performed if the item is not
+ // visible, so just try ..
+ try {
+ XAccessibleContext xAccessibleContext = unoAccessibleContext;
+ if (xAccessibleContext != null) {
+ // Query for XAccessibleAction interface
+ XAccessibleAction xAccessibleAction = (XAccessibleAction)
+ UnoRuntime.queryInterface(XAccessibleAction.class, xAccessibleContext);
+
+ if (xAccessibleAction != null) {
+ return xAccessibleAction.doAccessibleAction(0);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
}
}
-
- // Catch any type of uno exception
- catch(com.sun.star.uno.Exception e) {
- return false;
- }
}
return false;