diff options
Diffstat (limited to 'accessibility/bridge/org/openoffice/java/accessibility/Dialog.java')
-rw-r--r-- | accessibility/bridge/org/openoffice/java/accessibility/Dialog.java | 196 |
1 files changed, 98 insertions, 98 deletions
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java b/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java index dcb067368996..64b5572a2fcc 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -34,28 +34,28 @@ import com.sun.star.accessibility.*; public class Dialog extends java.awt.Dialog implements javax.accessibility.Accessible, NativeFrame { protected XAccessibleComponent unoAccessibleComponent; - + boolean opened = false; boolean visible = false; boolean active = false; - + java.awt.EventQueue eventQueue = null; - + protected Dialog(java.awt.Frame owner, XAccessibleComponent xAccessibleComponent) { super(owner); initialize(xAccessibleComponent); } - + protected Dialog(java.awt.Frame owner, String name, XAccessibleComponent xAccessibleComponent) { super(owner, name); initialize(xAccessibleComponent); } - + protected Dialog(java.awt.Frame owner, String name, boolean modal, XAccessibleComponent xAccessibleComponent) { super(owner, name, modal); initialize(xAccessibleComponent); } - + private void initialize(XAccessibleComponent xAccessibleComponent) { unoAccessibleComponent = xAccessibleComponent; eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); @@ -66,24 +66,24 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces broadcaster.addEventListener(new AccessibleDialogListener()); } } - + java.awt.Component initialComponent = null; - + public java.awt.Component getInitialComponent() { return initialComponent; } - + public void setInitialComponent(java.awt.Component c) { initialComponent = c; } - + public Integer getHWND() { return null; } - + /** - * Determines whether this <code>Component</code> is showing on screen. - * This means that the component must be visible, and it must be in a + * Determines whether this <code>Component</code> is showing on screen. + * This means that the component must be visible, and it must be in a * <code>container</code> that is visible and showing. * @see #addNotify * @see #removeNotify @@ -96,10 +96,10 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces } return false; } - + /** * Makes this <code>Component</code> displayable by connecting it to a - * native screen resource. + * native screen resource. * This method is called internally by the toolkit and should * not be called directly by programs. * @see #isDisplayable @@ -109,10 +109,10 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces public void addNotify() { // createHierarchyEvents(0, null, null, 0, false); } - - /** + + /** * Makes this <code>Component</code> undisplayable by destroying it native - * screen resource. + * screen resource. * This method is called by the toolkit internally and should * not be called directly by programs. * @see #isDisplayable @@ -121,7 +121,7 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces */ public void removeNotify() { } - + /** * Determines if the object is visible. Note: this means that the * object intends to be visible; however, it may not in fact be @@ -134,7 +134,7 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces public boolean isVisible(){ return visible; } - + /** * Shows or hides this component depending on the value of parameter * <code>b</code>. @@ -158,28 +158,28 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces } } } - + public void dispose() { setVisible(false); postWindowEvent(java.awt.event.WindowEvent.WINDOW_CLOSED); } - + protected void postWindowEvent(int i) { eventQueue.postEvent(new java.awt.event.WindowEvent(this, i)); } - + protected void postComponentEvent(int i) { eventQueue.postEvent(new java.awt.event.ComponentEvent(this, i)); } - + /** * Update the proxy objects appropriatly on property change events */ protected class AccessibleDialogListener implements XAccessibleEventListener { - + protected AccessibleDialogListener() { } - + protected void setComponentState(short state, boolean enable) { switch (state) { case AccessibleStateType.ACTIVE: @@ -191,8 +191,8 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces } break; case AccessibleStateType.ICONIFIED: - postWindowEvent(enable ? - java.awt.event.WindowEvent.WINDOW_ICONIFIED : + postWindowEvent(enable ? + java.awt.event.WindowEvent.WINDOW_ICONIFIED : java.awt.event.WindowEvent.WINDOW_DEICONIFIED); break; case AccessibleStateType.VISIBLE: @@ -205,7 +205,7 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces break; } } - + /** Updates the accessible name and fires the appropriate PropertyChangedEvent */ protected void handleNameChangedEvent(Object any) { try { @@ -221,7 +221,7 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces } catch (com.sun.star.lang.IllegalArgumentException e) { } } - + /** Updates the accessible description and fires the appropriate PropertyChangedEvent */ protected void handleDescriptionChangedEvent(Object any) { try { @@ -235,21 +235,21 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces } catch (com.sun.star.lang.IllegalArgumentException e) { } } - + /** Updates the internal states and fires the appropriate PropertyChangedEvent */ protected void handleStateChangedEvent(Object any1, Object any2) { try { if (AnyConverter.isShort(any1)) { setComponentState(AnyConverter.toShort(any1), false); } - + if (AnyConverter.isShort(any2)) { setComponentState(AnyConverter.toShort(any2), true); } } catch (com.sun.star.lang.IllegalArgumentException e) { } } - + /** Fires a visible data property change event */ protected void handleVisibleDataEvent() { javax.accessibility.AccessibleContext ac = accessibleContext; @@ -257,7 +257,7 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces ac.firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null); } } - + /** Called by OpenOffice process to notify property changes */ public void notifyEvent(AccessibleEventObject event) { switch (event.EventId) { @@ -293,14 +293,14 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces } } } - + /** Called by OpenOffice process to notify that the UNO component is disposing */ public void disposing(com.sun.star.lang.EventObject eventObject) { } } - + javax.accessibility.AccessibleContext accessibleContext = null; - + /** Returns the AccessibleContext associated with this object */ public javax.accessibility.AccessibleContext getAccessibleContext() { if (accessibleContext == null) { @@ -309,14 +309,14 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces } return accessibleContext; } - + protected class AccessibleDialog extends java.awt.Dialog.AccessibleAWTDialog { protected AccessibleDialog() { super(); } - + protected java.awt.event.ComponentListener accessibleComponentHandler = null; - + /** * Fire PropertyChange listener, if one is registered, * when shown/hidden.. @@ -327,22 +327,22 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, javax.accessibility.AccessibleState.VISIBLE, null); } - + public void componentShown(java.awt.event.ComponentEvent e) { AccessibleDialog.this.firePropertyChange( javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null, javax.accessibility.AccessibleState.VISIBLE); } - + public void componentMoved(java.awt.event.ComponentEvent e) { } - + public void componentResized(java.awt.event.ComponentEvent e) { } } // inner class AccessibleComponentHandler - + protected java.awt.event.WindowListener accessibleWindowHandler = null; - + /** * Fire PropertyChange listener, if one is registered, * when window events happen @@ -357,21 +357,21 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces System.err.println("[Dialog] " + getTitle() + " is now active"); } } - + /** Invoked when a window has been closed as the result of calling dispose on the window. */ public void windowClosed(java.awt.event.WindowEvent e) { if (Build.DEBUG) { System.err.println("[Dialog] " + getTitle() + " has been closed"); } } - + /** Invoked when the user attempts to close the window from the window's system menu. */ public void windowClosing(java.awt.event.WindowEvent e) { if (Build.DEBUG) { System.err.println("[Dialog] " + getTitle() + " is closing"); } } - + /** Invoked when a Window is no longer the active Window. */ public void windowDeactivated(java.awt.event.WindowEvent e) { AccessibleDialog.this.firePropertyChange( @@ -381,43 +381,43 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces System.err.println("[Dialog] " + getTitle() + " is no longer active"); } } - + /** Invoked when a window is changed from a minimized to a normal state. */ public void windowDeiconified(java.awt.event.WindowEvent e) { if (Build.DEBUG) { System.err.println("[Dialog] " + getTitle() + " has been deiconified"); } } - + /** Invoked when a window is changed from a normal to a minimized state. */ public void windowIconified(java.awt.event.WindowEvent e) { if (Build.DEBUG) { System.err.println("[Dialog] " + getTitle() + " has been iconified"); } } - + /** Invoked the first time a window is made visible. */ public void windowOpened(java.awt.event.WindowEvent e) { if (Build.DEBUG) { System.err.println("[Dialog] " + getTitle() + " has been opened"); } } - + } // inner class AccessibleWindowHandler - + protected java.awt.event.ContainerListener accessibleContainerHandler = null; - + /** * Fire PropertyChange listener, if one is registered, * when children added/removed. */ - + protected class AccessibleContainerHandler implements java.awt.event.ContainerListener { public void componentAdded(java.awt.event.ContainerEvent e) { java.awt.Component c = e.getChild(); if (c != null && c instanceof javax.accessibility.Accessible) { AccessibleDialog.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, + javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, null, ((javax.accessibility.Accessible) c).getAccessibleContext()); } } @@ -425,14 +425,14 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces java.awt.Component c = e.getChild(); if (c != null && c instanceof javax.accessibility.Accessible) { AccessibleDialog.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - ((javax.accessibility.Accessible) c).getAccessibleContext(), null); + javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, + ((javax.accessibility.Accessible) c).getAccessibleContext(), null); } } } - + protected int propertyChangeListenerCount = 0; - + /** * Add a PropertyChangeListener to the listener list. * @@ -442,16 +442,16 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces if (propertyChangeListenerCount++ == 0) { accessibleWindowHandler = new AccessibleWindowHandler(); Dialog.this.addWindowListener(accessibleWindowHandler); - + accessibleContainerHandler = new AccessibleContainerHandler(); Dialog.this.addContainerListener(accessibleContainerHandler); - + accessibleComponentHandler = new AccessibleComponentHandler(); Dialog.this.addComponentListener(accessibleComponentHandler); } super.addPropertyChangeListener(listener); } - + /** * Remove a PropertyChangeListener from the listener list. * This removes a PropertyChangeListener that was registered @@ -463,20 +463,20 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces if (--propertyChangeListenerCount == 0) { Dialog.this.removeComponentListener(accessibleComponentHandler); accessibleComponentHandler = null; - + Dialog.this.removeContainerListener(accessibleContainerHandler); accessibleContainerHandler = null; - + Dialog.this.removeWindowListener(accessibleWindowHandler); accessibleWindowHandler = null; } super.removePropertyChangeListener(listener); } - + /* * AccessibleComponent */ - + /** Returns the background color of the object */ public java.awt.Color getBackground() { try { @@ -485,11 +485,11 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces return null; } } - + public void setBackground(java.awt.Color c) { // Not supported by UNO accessibility API } - + /** Returns the foreground color of the object */ public java.awt.Color getForeground() { try { @@ -498,118 +498,118 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces return null; } } - + public void setForeground(java.awt.Color c) { // Not supported by UNO accessibility API } - + public java.awt.Cursor getCursor() { // Not supported by UNO accessibility API return null; } - + public void setCursor(java.awt.Cursor cursor) { // Not supported by UNO accessibility API } - + public java.awt.Font getFont() { // FIXME return null; } - + public void setFont(java.awt.Font f) { // Not supported by UNO accessibility API } - + public java.awt.FontMetrics getFontMetrics(java.awt.Font f) { // FIXME return null; } - + public boolean isEnabled() { return Dialog.this.isEnabled(); } - + public void setEnabled(boolean b) { // Not supported by UNO accessibility API } - + public boolean isVisible() { return Dialog.this.isVisible(); } - + public void setVisible(boolean b) { // Not supported by UNO accessibility API } - + public boolean isShowing() { return Dialog.this.isShowing(); } - + public boolean contains(java.awt.Point p) { try { - return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y)); + return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y)); } catch (com.sun.star.uno.RuntimeException e) { return false; } } - + /** Returns the location of the object on the screen. */ public java.awt.Point getLocationOnScreen() { try { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen(); + com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen(); return new java.awt.Point(unoPoint.X, unoPoint.Y); } catch (com.sun.star.uno.RuntimeException e) { return null; } } - + /** Gets the location of this component in the form of a point specifying the component's top-left corner */ public java.awt.Point getLocation() { try { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocation(); + com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocation(); return new java.awt.Point( unoPoint.X, unoPoint.Y ); } catch (com.sun.star.uno.RuntimeException e) { return null; } } - + /** Moves this component to a new location */ public void setLocation(java.awt.Point p) { // Not supported by UNO accessibility API } - + /** Gets the bounds of this component in the form of a Rectangle object */ public java.awt.Rectangle getBounds() { try { - com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds(); + com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds(); return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height); } catch (com.sun.star.uno.RuntimeException e) { return null; } } - + /** Moves and resizes this component to conform to the new bounding rectangle r */ public void setBounds(java.awt.Rectangle r) { // Not supported by UNO accessibility API } - + /** Returns the size of this component in the form of a Dimension object */ public java.awt.Dimension getSize() { try { - com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize(); + com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize(); return new java.awt.Dimension(unoSize.Width, unoSize.Height); } catch (com.sun.star.uno.RuntimeException e) { return null; } } - + /** Resizes this component so that it has width d.width and height d.height */ public void setSize(java.awt.Dimension d) { // Not supported by UNO accessibility API } - - /** Returns the Accessible child, if one exists, contained at the local coordinate Point */ + + /** Returns the Accessible child, if one exists, contained at the local coordinate Point */ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { try { java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent( @@ -620,11 +620,11 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces return null; } } - + public boolean isFocusTraversable() { return Dialog.this.isFocusable(); } - + public void requestFocus() { unoAccessibleComponent.grabFocus(); } |