mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-16 16:39:48 +00:00
8384602: Remove AppContext from java.awt.Component
Reviewed-by: azvegint, serb
This commit is contained in:
parent
061bd076da
commit
35913b8a36
@ -88,7 +88,6 @@ import javax.swing.JComponent;
|
||||
import javax.swing.JRootPane;
|
||||
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.ComponentFactory;
|
||||
import sun.awt.ConstrainableGraphics;
|
||||
import sun.awt.EmbeddedFrame;
|
||||
@ -235,11 +234,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
*/
|
||||
transient Container parent;
|
||||
|
||||
/**
|
||||
* The {@code AppContext} of the component.
|
||||
*/
|
||||
transient AppContext appContext;
|
||||
|
||||
/**
|
||||
* The x position of the component in the parent's coordinate system.
|
||||
*
|
||||
@ -877,12 +871,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
{
|
||||
Component.setRequestFocusController(requestController);
|
||||
}
|
||||
public AppContext getAppContext(Component comp) {
|
||||
return comp.appContext;
|
||||
}
|
||||
public void setAppContext(Component comp, AppContext appContext) {
|
||||
comp.appContext = appContext;
|
||||
}
|
||||
public Container getParent(Component comp) {
|
||||
return comp.getParent_NoClientCode();
|
||||
}
|
||||
@ -975,7 +963,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
* tree (for example, by a {@code Frame} object).
|
||||
*/
|
||||
protected Component() {
|
||||
appContext = AppContext.getAppContext();
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@ -3452,7 +3439,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
(width > 0) && (height > 0)) {
|
||||
PaintEvent e = new PaintEvent(this, PaintEvent.UPDATE,
|
||||
new Rectangle(x, y, width, height));
|
||||
SunToolkit.postEvent(SunToolkit.targetToAppContext(this), e);
|
||||
SunToolkit.postEvent(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4787,14 +4774,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
void dispatchEventImpl(AWTEvent e) {
|
||||
int id = e.getID();
|
||||
|
||||
// Check that this component belongs to this app-context
|
||||
AppContext compContext = appContext;
|
||||
if (compContext != null && !compContext.equals(AppContext.getAppContext())) {
|
||||
if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
eventLog.fine("Event " + e + " is being dispatched on the wrong AppContext");
|
||||
}
|
||||
}
|
||||
|
||||
if (eventLog.isLoggable(PlatformLogger.Level.FINEST)) {
|
||||
eventLog.finest("{0}", e);
|
||||
}
|
||||
@ -8936,7 +8915,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
|
||||
s.defaultReadObject();
|
||||
|
||||
appContext = AppContext.getAppContext();
|
||||
coalescingEnabled = checkCoalescing();
|
||||
if (componentSerializedDataVersion < 4) {
|
||||
// These fields are non-transient and rely on default
|
||||
|
||||
@ -127,16 +127,6 @@ public final class AWTAccessor {
|
||||
*/
|
||||
void setRequestFocusController(RequestFocusController requestController);
|
||||
|
||||
/**
|
||||
* Returns the appContext of the component.
|
||||
*/
|
||||
AppContext getAppContext(Component comp);
|
||||
|
||||
/**
|
||||
* Sets the appContext of the component.
|
||||
*/
|
||||
void setAppContext(Component comp, AppContext appContext);
|
||||
|
||||
/**
|
||||
* Returns the parent of the component.
|
||||
*/
|
||||
|
||||
@ -322,13 +322,7 @@ public abstract class SunToolkit extends Toolkit
|
||||
*/
|
||||
private static boolean setAppContext(Object target,
|
||||
AppContext context) {
|
||||
if (target instanceof Component) {
|
||||
AWTAccessor.getComponentAccessor().
|
||||
setAppContext((Component)target, context);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return (target instanceof Component);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -336,10 +330,8 @@ public abstract class SunToolkit extends Toolkit
|
||||
* Component or MenuComponent this returns null.
|
||||
*/
|
||||
private static AppContext getAppContext(Object target) {
|
||||
if (target instanceof Component) {
|
||||
return AWTAccessor.getComponentAccessor().
|
||||
getAppContext((Component)target);
|
||||
} else if (target instanceof MenuComponent) {
|
||||
if ((target instanceof Component) ||
|
||||
(target instanceof MenuComponent)) {
|
||||
return AppContext.getAppContext();
|
||||
} else {
|
||||
return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user