56 |
|
|
57 |
import javax.accessibility.Accessible; |
import javax.accessibility.Accessible; |
58 |
import javax.accessibility.AccessibleContext; |
import javax.accessibility.AccessibleContext; |
59 |
|
import javax.accessibility.AccessibleRole; |
60 |
|
import javax.accessibility.AccessibleState; |
61 |
|
import javax.accessibility.AccessibleStateSet; |
62 |
|
|
63 |
/** |
/** |
64 |
* This class represents a top-level window with no decorations. |
* This class represents a top-level window with no decorations. |
87 |
private transient WindowFocusListener windowFocusListener; |
private transient WindowFocusListener windowFocusListener; |
88 |
private transient WindowStateListener windowStateListener; |
private transient WindowStateListener windowStateListener; |
89 |
private transient GraphicsConfiguration graphicsConfiguration; |
private transient GraphicsConfiguration graphicsConfiguration; |
|
private transient AccessibleContext accessibleContext; |
|
90 |
|
|
91 |
private transient boolean shown; |
private transient boolean shown; |
92 |
|
|
93 |
private transient Component windowFocusOwner; |
private transient Component windowFocusOwner; |
94 |
|
|
95 |
|
protected class AccessibleAWTWindow extends AccessibleAWTContainer |
96 |
|
{ |
97 |
|
public AccessibleRole getAccessibleRole() |
98 |
|
{ |
99 |
|
return AccessibleRole.WINDOW; |
100 |
|
} |
101 |
|
|
102 |
|
public AccessibleStateSet getAccessibleState() |
103 |
|
{ |
104 |
|
AccessibleStateSet states = super.getAccessibleStateSet(); |
105 |
|
if (isActive()) |
106 |
|
states.add(AccessibleState.ACTIVE); |
107 |
|
return states; |
108 |
|
} |
109 |
|
} |
110 |
|
|
111 |
/** |
/** |
112 |
* This (package access) constructor is used by subclasses that want |
* This (package access) constructor is used by subclasses that want |
690 |
} |
} |
691 |
} |
} |
692 |
} |
} |
693 |
|
|
694 |
|
/** |
695 |
|
* Identifies if this window is active. The active window is a Frame or |
696 |
|
* Dialog that has focus or owns the active window. |
697 |
|
* |
698 |
|
* @return true if active, else false. |
699 |
|
* @since 1.4 |
700 |
|
*/ |
701 |
|
public boolean isActive() |
702 |
|
{ |
703 |
|
KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); |
704 |
|
return manager.getActiveWindow() == this; |
705 |
|
} |
706 |
|
|
707 |
/** |
/** |
708 |
|
* Identifies if this window is focused. A window is focused if it is the |
709 |
|
* focus owner or it contains the focus owner. |
710 |
|
* |
711 |
|
* @return true if focused, else false. |
712 |
|
* @since 1.4 |
713 |
|
*/ |
714 |
|
public boolean isFocused() |
715 |
|
{ |
716 |
|
KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); |
717 |
|
return manager.getFocusedWindow() == this; |
718 |
|
} |
719 |
|
|
720 |
|
/** |
721 |
* Returns the child window that has focus if this window is active. |
* Returns the child window that has focus if this window is active. |
722 |
* This method returns <code>null</code> if this window is not active |
* This method returns <code>null</code> if this window is not active |
723 |
* or no children have focus. |
* or no children have focus. |
814 |
applyResourceBundle(rb); |
applyResourceBundle(rb); |
815 |
} |
} |
816 |
|
|
817 |
|
/** |
818 |
|
* Gets the AccessibleContext associated with this <code>Window</code>. |
819 |
|
* The context is created, if necessary. |
820 |
|
* |
821 |
|
* @return the associated context |
822 |
|
*/ |
823 |
public AccessibleContext getAccessibleContext() |
public AccessibleContext getAccessibleContext() |
824 |
{ |
{ |
825 |
// FIXME |
/* Create the context if this is the first request */ |
826 |
//return null; |
if (accessibleContext == null) |
827 |
throw new Error ("Not implemented"); |
{ |
828 |
|
/* Create the context */ |
829 |
|
accessibleContext = new AccessibleAWTWindow(); |
830 |
|
} |
831 |
|
return accessibleContext; |
832 |
} |
} |
833 |
|
|
834 |
/** |
/** |