diff options
author | Rüdiger Timm <rt@openoffice.org> | 2003-06-12 06:57:47 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2003-06-12 06:57:47 +0000 |
commit | 1802c2497690dfc5f3e4f66c7d17ccdfc10d7d08 (patch) | |
tree | ff668208155ab3109f158e73d708e7693312b0e1 /accessibility | |
parent | 2fa43f17ef2304f554dff89385585a5f22024144 (diff) |
INTEGRATION: CWS uaa04 (1.17.2); FILE MERGED
2003/06/05 15:16:43 obr 1.17.2.3: #109943# changes needed for WindowsAccessBridgeAdapter.java
2003/06/04 07:21:03 obr 1.17.2.2: finished transition from tabs to spaces
2003/06/02 12:49:52 obr 1.17.2.1: #109747# implement getAccessibleContext in a failsafe way, so that it can't kill the dispatch thread of the Java AccessBridge for Windows
Diffstat (limited to 'accessibility')
-rw-r--r-- | accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java index 34129607640c..2002b4ac8d4c 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java @@ -63,6 +63,7 @@ import javax.accessibility.AccessibleStateSet; import com.sun.star.uno.*; import com.sun.star.accessibility.*; +import org.openoffice.java.accessibility.logging.XAccessibleEventLog; /** */ @@ -73,10 +74,11 @@ public class AccessibleObjectFactory { private static java.util.Hashtable objectList = new java.util.Hashtable(); private static java.awt.FocusTraversalPolicy focusTraversalPolicy = new FocusTraversalPolicy(); - private static java.awt.EventQueue eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); + private static java.awt.EventQueue theEventQueue = java.awt.Toolkit.getDefaultToolkit(). + getSystemEventQueue(); public static java.awt.EventQueue getEventQueue() { - return eventQueue; + return theEventQueue; } public static void postFocusGained(java.awt.Component c) { @@ -84,19 +86,42 @@ public class AccessibleObjectFactory { } public static void postWindowGainedFocus(java.awt.Window w) { - getEventQueue().postEvent(new java.awt.event.WindowEvent(w, java.awt.event.WindowEvent.WINDOW_GAINED_FOCUS)); + postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_GAINED_FOCUS); } public static void postWindowLostFocus(java.awt.Window w) { - getEventQueue().postEvent(new java.awt.event.WindowEvent(w, java.awt.event.WindowEvent.WINDOW_LOST_FOCUS)); + postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_LOST_FOCUS); } public static void postWindowActivated(java.awt.Window w) { - getEventQueue().postEvent(new java.awt.event.WindowEvent(w, java.awt.event.WindowEvent.WINDOW_ACTIVATED)); + postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_ACTIVATED); } public static void postWindowDeactivated(java.awt.Window w) { - getEventQueue().postEvent(new java.awt.event.WindowEvent(w, java.awt.event.WindowEvent.WINDOW_DEACTIVATED)); + postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_DEACTIVATED); + } + + public static void postWindowOpened(java.awt.Window w) { + postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_OPENED); + } + + public static void postWindowClosed(java.awt.Window w) { + postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_CLOSED); + } + + public static void invokeAndWait() { + try { + theEventQueue.invokeAndWait( new java.lang.Runnable () { + public void run() { + } + }); + } catch (java.lang.reflect.InvocationTargetException e) { + } catch (java.lang.InterruptedException e) { + } + } + + private static void postWindowEvent(java.awt.Window w, int i) { + theEventQueue.postEvent(new java.awt.event.WindowEvent(w, i)); } public static java.awt.Component getAccessibleComponent(XAccessible xAccessible) { @@ -116,7 +141,7 @@ public class AccessibleObjectFactory { return c; } - protected static void addChild(java.awt.Container parent, Object any) { + public static void addChild(java.awt.Container parent, Object any) { try { addChild(parent, (XAccessible) AnyConverter.toObject(XAccessibleType, any)); } catch (com.sun.star.lang.IllegalArgumentException e) { @@ -124,7 +149,7 @@ public class AccessibleObjectFactory { } } - protected static void addChild(java.awt.Container parent, XAccessible child) { + public static void addChild(java.awt.Container parent, XAccessible child) { try { if (child != null) { XAccessibleContext childAC = child.getAccessibleContext(); @@ -489,6 +514,13 @@ public class AccessibleObjectFactory { if (!xAccessibleStateSet.contains(AccessibleStateType.ENABLED)) { c.setEnabled(false); } + + if (! Build.PRODUCT) { + String property = System.getProperty("AccessBridgeLogging"); + if ((property != null) && (property.indexOf("event") != -1)) { + XAccessibleEventLog.addEventListener(xAccessibleContext); + } + } } return c; |