INTEGRATION: CWS vcl08 (1.3.8); FILE MERGED
2003/04/10 13:33:13 obr 1.3.8.1: #108177# fixed several lifecycle issues
This commit is contained in:
parent
fd64277d8f
commit
4473760281
1 changed files with 70 additions and 56 deletions
|
@ -205,9 +205,11 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi
|
|||
protected void setComponentState(short state, boolean enable) {
|
||||
switch (state) {
|
||||
case AccessibleStateType.ACTIVE:
|
||||
postWindowEvent(enable ?
|
||||
java.awt.event.WindowEvent.WINDOW_GAINED_FOCUS :
|
||||
java.awt.event.WindowEvent.WINDOW_LOST_FOCUS);
|
||||
if (enable) {
|
||||
AccessibleObjectFactory.postWindowActivated(Frame.this);
|
||||
} else {
|
||||
AccessibleObjectFactory.postWindowLostFocus(Frame.this);
|
||||
}
|
||||
break;
|
||||
case AccessibleStateType.ICONIFIED:
|
||||
if (Build.DEBUG) {
|
||||
|
@ -231,9 +233,16 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi
|
|||
/** Updates the accessible name and fires the appropriate PropertyChangedEvent */
|
||||
protected void handleNameChangedEvent(Object any) {
|
||||
try {
|
||||
Frame.this.setTitle(AnyConverter.toString(any));
|
||||
}
|
||||
catch (com.sun.star.lang.IllegalArgumentException e) {
|
||||
String title = AnyConverter.toString(any);
|
||||
setTitle(title);
|
||||
// This causes the property change event to be fired in the VCL thread
|
||||
// context. If this causes problems, it has to be deligated to the java
|
||||
// dispatch thread ..
|
||||
javax.accessibility.AccessibleContext ac = accessibleContext;
|
||||
if (ac!= null) {
|
||||
ac.setAccessibleDescription(title);
|
||||
}
|
||||
} catch (com.sun.star.lang.IllegalArgumentException e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,11 +252,11 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi
|
|||
// This causes the property change event to be fired in the VCL thread
|
||||
// context. If this causes problems, it has to be deligated to the java
|
||||
// dispatch thread ..
|
||||
if (accessibleContext != null) {
|
||||
accessibleContext.setAccessibleDescription(AnyConverter.toString(any));
|
||||
javax.accessibility.AccessibleContext ac = accessibleContext;
|
||||
if (ac!= null) {
|
||||
ac.setAccessibleDescription(AnyConverter.toString(any));
|
||||
}
|
||||
}
|
||||
catch (com.sun.star.lang.IllegalArgumentException e) {
|
||||
} catch (com.sun.star.lang.IllegalArgumentException e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,40 +276,6 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi
|
|||
}
|
||||
}
|
||||
|
||||
/** Updates the internal child list and fires the appropriate PropertyChangeEvent */
|
||||
protected void handleChildRemovedEvent(Object any) {
|
||||
try {
|
||||
java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(
|
||||
(XAccessible) AnyConverter.toObject(Container.XAccessibleType, any));
|
||||
if (c != null) {
|
||||
Frame.this.remove(c);
|
||||
}
|
||||
} catch (com.sun.star.uno.Exception e) {
|
||||
// FIXME: output
|
||||
}
|
||||
}
|
||||
|
||||
/** Updates the internal child list and fires the appropriate PropertyChangeEvent */
|
||||
protected void handleChildAddedEvent(Object any) {
|
||||
try {
|
||||
XAccessible xAccessible = (XAccessible) AnyConverter.toObject(Container.XAccessibleType, any);
|
||||
java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(xAccessible);
|
||||
if (c != null) {
|
||||
// Seems to be already in child list
|
||||
if (this.equals(c.getParent()))
|
||||
return;
|
||||
} else {
|
||||
c = AccessibleObjectFactory.createAccessibleComponent(xAccessible);
|
||||
}
|
||||
if (c != null) {
|
||||
Frame.this.add(c, xAccessible.getAccessibleContext().
|
||||
getAccessibleIndexInParent());
|
||||
}
|
||||
} catch (com.sun.star.uno.Exception e) {
|
||||
// FIXME: output
|
||||
}
|
||||
}
|
||||
|
||||
/** Fires a visible data property change event */
|
||||
protected void handleVisibleDataEvent() {
|
||||
javax.accessibility.AccessibleContext ac = accessibleContext;
|
||||
|
@ -328,9 +303,9 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi
|
|||
break;
|
||||
case AccessibleEventId.ACCESSIBLE_CHILD_EVENT:
|
||||
if (AnyConverter.isObject(event.OldValue)) {
|
||||
handleChildRemovedEvent(event.OldValue);
|
||||
AccessibleObjectFactory.removeChild(Frame.this, event.OldValue);
|
||||
} else if (AnyConverter.isObject(event.NewValue)) {
|
||||
handleChildAddedEvent(event.NewValue);
|
||||
AccessibleObjectFactory.addChild(Frame.this, event.NewValue);
|
||||
}
|
||||
break;
|
||||
case AccessibleEventId.ACCESSIBLE_VISIBLE_DATA_EVENT:
|
||||
|
@ -392,14 +367,15 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi
|
|||
}
|
||||
} // inner class AccessibleComponentHandler
|
||||
|
||||
protected java.awt.event.WindowFocusListener accessibleWindowFocusHandler = null;
|
||||
protected java.awt.event.WindowListener accessibleWindowHandler = null;
|
||||
|
||||
/**
|
||||
* Fire PropertyChange listener, if one is registered,
|
||||
* when focus events happen
|
||||
* when window events happen
|
||||
*/
|
||||
protected class AccessibleWindowFocusHandler implements java.awt.event.WindowFocusListener {
|
||||
public void windowGainedFocus(java.awt.event.WindowEvent e) {
|
||||
protected class AccessibleWindowHandler implements java.awt.event.WindowListener {
|
||||
/** Invoked when the Window is set to be the active Window. */
|
||||
public void windowActivated(java.awt.event.WindowEvent e) {
|
||||
AccessibleFrame.this.firePropertyChange(
|
||||
javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
|
||||
null, javax.accessibility.AccessibleState.ACTIVE);
|
||||
|
@ -407,7 +383,23 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi
|
|||
System.err.println("[frame] " + getTitle() + " is now active");
|
||||
}
|
||||
}
|
||||
public void windowLostFocus(java.awt.event.WindowEvent e) {
|
||||
|
||||
/** 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(
|
||||
javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
|
||||
javax.accessibility.AccessibleState.ACTIVE, null);
|
||||
|
@ -415,7 +407,29 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi
|
|||
System.err.println("[frame] " + getTitle() + " is no longer active");
|
||||
}
|
||||
}
|
||||
} // inner class AccessibleFocusHandler
|
||||
|
||||
/** 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;
|
||||
|
||||
|
@ -452,8 +466,8 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi
|
|||
*/
|
||||
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) {
|
||||
if (propertyChangeListenerCount++ == 0) {
|
||||
accessibleWindowFocusHandler = new AccessibleWindowFocusHandler();
|
||||
Frame.this.addWindowFocusListener(accessibleWindowFocusHandler);
|
||||
accessibleWindowHandler = new AccessibleWindowHandler();
|
||||
Frame.this.addWindowListener(accessibleWindowHandler);
|
||||
|
||||
accessibleContainerHandler = new AccessibleContainerHandler();
|
||||
Frame.this.addContainerListener(accessibleContainerHandler);
|
||||
|
@ -479,8 +493,8 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi
|
|||
Frame.this.removeContainerListener(accessibleContainerHandler);
|
||||
accessibleContainerHandler = null;
|
||||
|
||||
Frame.this.removeWindowFocusListener(accessibleWindowFocusHandler);
|
||||
accessibleWindowFocusHandler = null;
|
||||
Frame.this.removeWindowListener(accessibleWindowHandler);
|
||||
accessibleWindowHandler = null;
|
||||
}
|
||||
super.removePropertyChangeListener(listener);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue