diff options
Diffstat (limited to 'accessibility/bridge/org/openoffice/java/accessibility/Frame.java')
-rw-r--r-- | accessibility/bridge/org/openoffice/java/accessibility/Frame.java | 200 |
1 files changed, 100 insertions, 100 deletions
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Frame.java b/accessibility/bridge/org/openoffice/java/accessibility/Frame.java index b7f37b2d6b18..7768afdc8af7 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Frame.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Frame.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 @@ -32,22 +32,22 @@ import com.sun.star.accessibility.*; public class Frame extends java.awt.Frame implements javax.accessibility.Accessible, NativeFrame { protected XAccessibleComponent unoAccessibleComponent; - + boolean opened = false; boolean visible = false; boolean active = false; - + java.awt.EventQueue eventQueue = null; - + protected Frame(XAccessibleComponent xAccessibleComponent) { initialize(xAccessibleComponent); } - + protected Frame(String name, XAccessibleComponent xAccessibleComponent) { super(name); initialize(xAccessibleComponent); } - + private void initialize(XAccessibleComponent xAccessibleComponent) { unoAccessibleComponent = xAccessibleComponent; eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); @@ -58,24 +58,24 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi broadcaster.addEventListener(new AccessibleFrameListener()); } } - + 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 @@ -88,10 +88,10 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi } 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 @@ -101,10 +101,10 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi 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 @@ -113,7 +113,7 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi */ 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 @@ -126,7 +126,7 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi public boolean isVisible(){ return visible; } - + /** * Shows or hides this component depending on the value of parameter * <code>b</code>. @@ -150,28 +150,28 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi } } } - + 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 AccessibleFrameListener implements XAccessibleEventListener { - + protected AccessibleFrameListener() { } - + // The only expected state changes are ACTIVE and VISIBLE protected void setComponentState(short state, boolean enable) { switch (state) { @@ -187,8 +187,8 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi if (Build.DEBUG) { System.err.println("[frame]" + getTitle() + (enable ? " is now " : " is no longer ") + "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: @@ -201,7 +201,7 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi break; } } - + /** Updates the accessible name and fires the appropriate PropertyChangedEvent */ protected void handleNameChangedEvent(Object any) { try { @@ -217,7 +217,7 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi } catch (com.sun.star.lang.IllegalArgumentException e) { } } - + /** Updates the accessible description and fires the appropriate PropertyChangedEvent */ protected void handleDescriptionChangedEvent(Object any) { try { @@ -231,23 +231,23 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi } 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; @@ -255,7 +255,7 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi 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) { @@ -291,14 +291,14 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi } } } - + /** Called by OpenOffice process to notify that the UNO component is disposing */ public void disposing(com.sun.star.lang.EventObject eventObject) { } } - + protected javax.accessibility.AccessibleContext accessibleContext = null; - + /** Returns the AccessibleContext associated with this object */ public javax.accessibility.AccessibleContext getAccessibleContext() { if (accessibleContext == null) { @@ -307,14 +307,14 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi } return accessibleContext; } - + protected class AccessibleFrame extends java.awt.Frame.AccessibleAWTFrame { protected AccessibleFrame() { super(); } - + protected java.awt.event.ComponentListener accessibleComponentHandler = null; - + /** * Fire PropertyChange listener, if one is registered, * when shown/hidden.. @@ -325,22 +325,22 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, javax.accessibility.AccessibleState.VISIBLE, null); } - + public void componentShown(java.awt.event.ComponentEvent e) { AccessibleFrame.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 @@ -355,21 +355,21 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi System.err.println("[frame] " + 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("[frame] " + 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("[frame] " + getTitle() + " is closing"); } } - + /** Invoked when a Window is no longer the active Window. */ public void windowDeactivated(java.awt.event.WindowEvent e) { AccessibleFrame.this.firePropertyChange( @@ -379,43 +379,43 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi System.err.println("[frame] " + 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("[frame] " + getTitle() + " is no longer iconified"); } } - + /** 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("[frame] " + 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("[frame] " + 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) { AccessibleFrame.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, + javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, null, ((javax.accessibility.Accessible) c).getAccessibleContext()); } } @@ -423,14 +423,14 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi java.awt.Component c = e.getChild(); if (c != null && c instanceof javax.accessibility.Accessible) { AccessibleFrame.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. * @@ -440,16 +440,16 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi if (propertyChangeListenerCount++ == 0) { accessibleWindowHandler = new AccessibleWindowHandler(); Frame.this.addWindowListener(accessibleWindowHandler); - + accessibleContainerHandler = new AccessibleContainerHandler(); Frame.this.addContainerListener(accessibleContainerHandler); - + accessibleComponentHandler = new AccessibleComponentHandler(); Frame.this.addComponentListener(accessibleComponentHandler); } super.addPropertyChangeListener(listener); } - + /** * Remove a PropertyChangeListener from the listener list. * This removes a PropertyChangeListener that was registered @@ -461,20 +461,20 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi if (--propertyChangeListenerCount == 0) { Frame.this.removeComponentListener(accessibleComponentHandler); accessibleComponentHandler = null; - + Frame.this.removeContainerListener(accessibleContainerHandler); accessibleContainerHandler = null; - + Frame.this.removeWindowListener(accessibleWindowHandler); accessibleWindowHandler = null; } super.removePropertyChangeListener(listener); } - + /** * Get the state set of this object. * - * @return an instance of AccessibleState containing the current state + * @return an instance of AccessibleState containing the current state * of the object * @see AccessibleState */ @@ -485,11 +485,11 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi } return states; } - + /* * AccessibleComponent */ - + /** Returns the background color of the object */ public java.awt.Color getBackground() { try { @@ -498,11 +498,11 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi 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 { @@ -511,118 +511,118 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi 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 Frame.this.isEnabled(); } - + public void setEnabled(boolean b) { // Not supported by UNO accessibility API } - + public boolean isVisible() { return Frame.this.isVisible(); } - + public void setVisible(boolean b) { // Not supported by UNO accessibility API } - + public boolean isShowing() { return Frame.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( @@ -633,11 +633,11 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi return null; } } - + public boolean isFocusTraversable() { return Frame.this.isFocusable(); } - + public void requestFocus() { unoAccessibleComponent.grabFocus(); } |