7163201: Simplify toolkit internals references
Reviewed-by: art, anthony, ahgross
This commit is contained in:
parent
5f51412783
commit
ffc9ae1245
@ -81,14 +81,6 @@ public class LWCToolkit extends LWToolkit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getSystemProperty(final String name, final String deflt) {
|
|
||||||
return AccessController.doPrivileged (new PrivilegedAction<String>() {
|
|
||||||
public String run() {
|
|
||||||
return System.getProperty(name, deflt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public LWCToolkit() {
|
public LWCToolkit() {
|
||||||
SunToolkit.setDataTransfererClassName("sun.lwawt.macosx.CDataTransferer");
|
SunToolkit.setDataTransfererClassName("sun.lwawt.macosx.CDataTransferer");
|
||||||
|
|
||||||
@ -700,8 +692,8 @@ public class LWCToolkit extends LWToolkit {
|
|||||||
*/
|
*/
|
||||||
public synchronized static boolean getSunAwtDisableCALayers() {
|
public synchronized static boolean getSunAwtDisableCALayers() {
|
||||||
if (sunAwtDisableCALayers == null) {
|
if (sunAwtDisableCALayers == null) {
|
||||||
sunAwtDisableCALayers =
|
sunAwtDisableCALayers = AccessController.doPrivileged(
|
||||||
getBooleanSystemProperty("sun.awt.disableCALayers");
|
new GetBooleanAction("sun.awt.disableCALayers")));
|
||||||
}
|
}
|
||||||
return sunAwtDisableCALayers.booleanValue();
|
return sunAwtDisableCALayers.booleanValue();
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,6 @@ import sun.util.logging.PlatformLogger;
|
|||||||
|
|
||||||
import java.security.AccessControlContext;
|
import java.security.AccessControlContext;
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.io.ObjectInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The root event class for all AWT events.
|
* The root event class for all AWT events.
|
||||||
@ -262,9 +260,11 @@ public abstract class AWTEvent extends EventObject {
|
|||||||
public void setPosted(AWTEvent ev) {
|
public void setPosted(AWTEvent ev) {
|
||||||
ev.isPosted = true;
|
ev.isPosted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSystemGenerated(AWTEvent ev) {
|
public void setSystemGenerated(AWTEvent ev) {
|
||||||
ev.isSystemGenerated = true;
|
ev.isSystemGenerated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSystemGenerated(AWTEvent ev) {
|
public boolean isSystemGenerated(AWTEvent ev) {
|
||||||
return ev.isSystemGenerated;
|
return ev.isSystemGenerated;
|
||||||
}
|
}
|
||||||
@ -272,6 +272,15 @@ public abstract class AWTEvent extends EventObject {
|
|||||||
public AccessControlContext getAccessControlContext(AWTEvent ev) {
|
public AccessControlContext getAccessControlContext(AWTEvent ev) {
|
||||||
return ev.getAccessControlContext();
|
return ev.getAccessControlContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte[] getBData(AWTEvent ev) {
|
||||||
|
return ev.bdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBData(AWTEvent ev, byte[] bdata) {
|
||||||
|
ev.bdata = bdata;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ import java.io.ObjectOutputStream;
|
|||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.accessibility.*;
|
import javax.accessibility.*;
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,6 +69,13 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
|||||||
if (!GraphicsEnvironment.isHeadless()) {
|
if (!GraphicsEnvironment.isHeadless()) {
|
||||||
initIDs();
|
initIDs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AWTAccessor.setCheckboxMenuItemAccessor(
|
||||||
|
new AWTAccessor.CheckboxMenuItemAccessor() {
|
||||||
|
public boolean getState(CheckboxMenuItem cmi) {
|
||||||
|
return cmi.state;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,10 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
package java.awt;
|
package java.awt;
|
||||||
|
|
||||||
import java.awt.AWTException;
|
|
||||||
import java.awt.Point;
|
|
||||||
import java.awt.Toolkit;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
|
||||||
@ -39,6 +35,7 @@ import java.util.StringTokenizer;
|
|||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
|
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class to encapsulate the bitmap representation of the mouse cursor.
|
* A class to encapsulate the bitmap representation of the mouse cursor.
|
||||||
@ -199,6 +196,21 @@ public class Cursor implements java.io.Serializable {
|
|||||||
if (!GraphicsEnvironment.isHeadless()) {
|
if (!GraphicsEnvironment.isHeadless()) {
|
||||||
initIDs();
|
initIDs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AWTAccessor.setCursorAccessor(
|
||||||
|
new AWTAccessor.CursorAccessor() {
|
||||||
|
public long getPData(Cursor cursor) {
|
||||||
|
return cursor.pData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPData(Cursor cursor, long pData) {
|
||||||
|
cursor.pData = pData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType(Cursor cursor) {
|
||||||
|
return cursor.type;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,6 +39,7 @@ import sun.util.logging.PlatformLogger;
|
|||||||
|
|
||||||
import sun.awt.AppContext;
|
import sun.awt.AppContext;
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
import sun.awt.CausedFocusEvent;
|
import sun.awt.CausedFocusEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,6 +76,15 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
|
|||||||
typeAheadMarkers = new LinkedList();
|
typeAheadMarkers = new LinkedList();
|
||||||
private boolean consumeNextKeyTyped;
|
private boolean consumeNextKeyTyped;
|
||||||
|
|
||||||
|
static {
|
||||||
|
AWTAccessor.setDefaultKeyboardFocusManagerAccessor(
|
||||||
|
new AWTAccessor.DefaultKeyboardFocusManagerAccessor() {
|
||||||
|
public void consumeNextKeyTyped(DefaultKeyboardFocusManager dkfm, KeyEvent e) {
|
||||||
|
dkfm.consumeNextKeyTyped(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private static class TypeAheadMarker {
|
private static class TypeAheadMarker {
|
||||||
long after;
|
long after;
|
||||||
Component untilFocused;
|
Component untilFocused;
|
||||||
|
@ -50,7 +50,6 @@ import java.util.concurrent.locks.Lock;
|
|||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import java.security.AccessControlContext;
|
import java.security.AccessControlContext;
|
||||||
import java.security.ProtectionDomain;
|
|
||||||
|
|
||||||
import sun.misc.SharedSecrets;
|
import sun.misc.SharedSecrets;
|
||||||
import sun.misc.JavaSecurityAccess;
|
import sun.misc.JavaSecurityAccess;
|
||||||
@ -186,6 +185,17 @@ public class EventQueue {
|
|||||||
public boolean isDispatchThreadImpl(EventQueue eventQueue) {
|
public boolean isDispatchThreadImpl(EventQueue eventQueue) {
|
||||||
return eventQueue.isDispatchThreadImpl();
|
return eventQueue.isDispatchThreadImpl();
|
||||||
}
|
}
|
||||||
|
public void removeSourceEvents(EventQueue eventQueue,
|
||||||
|
Object source,
|
||||||
|
boolean removeAllEvents) {
|
||||||
|
eventQueue.removeSourceEvents(source, removeAllEvents);
|
||||||
|
}
|
||||||
|
public boolean noEvents(EventQueue eventQueue) {
|
||||||
|
return eventQueue.noEvents();
|
||||||
|
}
|
||||||
|
public void wakeup(EventQueue eventQueue, boolean isShutdown) {
|
||||||
|
eventQueue.wakeup(isShutdown);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,6 @@ import java.util.WeakHashMap;
|
|||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
|
|
||||||
import sun.awt.AppContext;
|
import sun.awt.AppContext;
|
||||||
import sun.awt.HeadlessToolkit;
|
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
import sun.awt.CausedFocusEvent;
|
import sun.awt.CausedFocusEvent;
|
||||||
import sun.awt.KeyboardFocusManagerPeerProvider;
|
import sun.awt.KeyboardFocusManagerPeerProvider;
|
||||||
@ -148,6 +147,9 @@ public abstract class KeyboardFocusManager
|
|||||||
public KeyboardFocusManager getCurrentKeyboardFocusManager(AppContext ctx) {
|
public KeyboardFocusManager getCurrentKeyboardFocusManager(AppContext ctx) {
|
||||||
return KeyboardFocusManager.getCurrentKeyboardFocusManager(ctx);
|
return KeyboardFocusManager.getCurrentKeyboardFocusManager(ctx);
|
||||||
}
|
}
|
||||||
|
public Container getCurrentFocusCycleRoot() {
|
||||||
|
return KeyboardFocusManager.currentFocusCycleRoot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import java.util.Enumeration;
|
|||||||
import java.awt.peer.MenuPeer;
|
import java.awt.peer.MenuPeer;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import javax.accessibility.*;
|
import javax.accessibility.*;
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A <code>Menu</code> object is a pull-down menu component
|
* A <code>Menu</code> object is a pull-down menu component
|
||||||
@ -62,6 +63,13 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
|
|||||||
if (!GraphicsEnvironment.isHeadless()) {
|
if (!GraphicsEnvironment.isHeadless()) {
|
||||||
initIDs();
|
initIDs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AWTAccessor.setMenuAccessor(
|
||||||
|
new AWTAccessor.MenuAccessor() {
|
||||||
|
public Vector getItems(Menu menu) {
|
||||||
|
return menu.items;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +28,7 @@ import java.io.IOException;
|
|||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
import java.awt.peer.MenuBarPeer;
|
import java.awt.peer.MenuBarPeer;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import javax.accessibility.*;
|
import javax.accessibility.*;
|
||||||
@ -74,6 +75,16 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
|
|||||||
if (!GraphicsEnvironment.isHeadless()) {
|
if (!GraphicsEnvironment.isHeadless()) {
|
||||||
initIDs();
|
initIDs();
|
||||||
}
|
}
|
||||||
|
AWTAccessor.setMenuBarAccessor(
|
||||||
|
new AWTAccessor.MenuBarAccessor() {
|
||||||
|
public Menu getHelpMenu(MenuBar menuBar) {
|
||||||
|
return menuBar.helpMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector getMenus(MenuBar menuBar) {
|
||||||
|
return menuBar.menus;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,6 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import sun.awt.AppContext;
|
import sun.awt.AppContext;
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
import sun.awt.AWTAccessor;
|
import sun.awt.AWTAccessor;
|
||||||
import javax.accessibility.*;
|
import javax.accessibility.*;
|
||||||
|
|
||||||
@ -143,6 +142,9 @@ public abstract class MenuComponent implements java.io.Serializable {
|
|||||||
public MenuContainer getParent(MenuComponent menuComp) {
|
public MenuContainer getParent(MenuComponent menuComp) {
|
||||||
return menuComp.parent;
|
return menuComp.parent;
|
||||||
}
|
}
|
||||||
|
public Font getFont_NoClientCode(MenuComponent menuComp) {
|
||||||
|
return menuComp.getFont_NoClientCode();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import java.io.ObjectOutputStream;
|
|||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.accessibility.*;
|
import javax.accessibility.*;
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All items in a menu must belong to the class
|
* All items in a menu must belong to the class
|
||||||
@ -76,6 +76,29 @@ public class MenuItem extends MenuComponent implements Accessible {
|
|||||||
if (!GraphicsEnvironment.isHeadless()) {
|
if (!GraphicsEnvironment.isHeadless()) {
|
||||||
initIDs();
|
initIDs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AWTAccessor.setMenuItemAccessor(
|
||||||
|
new AWTAccessor.MenuItemAccessor() {
|
||||||
|
public boolean isEnabled(MenuItem item) {
|
||||||
|
return item.enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel(MenuItem item) {
|
||||||
|
return item.label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MenuShortcut getShortcut(MenuItem item) {
|
||||||
|
return item.shortcut;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getActionCommandImpl(MenuItem item) {
|
||||||
|
return item.getActionCommandImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isItemEnabled(MenuItem item) {
|
||||||
|
return item.isItemEnabled();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,6 +33,7 @@ import sun.awt.AppContext;
|
|||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
import sun.awt.HeadlessToolkit;
|
import sun.awt.HeadlessToolkit;
|
||||||
import sun.security.util.SecurityConstants;
|
import sun.security.util.SecurityConstants;
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <code>SystemTray</code> class represents the system tray for a
|
* The <code>SystemTray</code> class represents the system tray for a
|
||||||
@ -127,6 +128,18 @@ public class SystemTray {
|
|||||||
|
|
||||||
private static final TrayIcon[] EMPTY_TRAY_ARRAY = new TrayIcon[0];
|
private static final TrayIcon[] EMPTY_TRAY_ARRAY = new TrayIcon[0];
|
||||||
|
|
||||||
|
static {
|
||||||
|
AWTAccessor.setSystemTrayAccessor(
|
||||||
|
new AWTAccessor.SystemTrayAccessor() {
|
||||||
|
public void firePropertyChange(SystemTray tray,
|
||||||
|
String propertyName,
|
||||||
|
Object oldValue,
|
||||||
|
Object newValue) {
|
||||||
|
tray.firePropertyChange(propertyName, oldValue, newValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private <code>SystemTray</code> constructor.
|
* Private <code>SystemTray</code> constructor.
|
||||||
*
|
*
|
||||||
|
@ -25,19 +25,11 @@
|
|||||||
|
|
||||||
package java.awt;
|
package java.awt;
|
||||||
|
|
||||||
import java.awt.Point;
|
|
||||||
import java.awt.Toolkit;
|
|
||||||
import java.awt.GraphicsEnvironment;
|
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.awt.AWTEvent;
|
|
||||||
import java.awt.AWTEventMulticaster;
|
|
||||||
import java.awt.EventQueue;
|
|
||||||
import java.awt.PopupMenu;
|
|
||||||
import java.awt.Image;
|
|
||||||
import java.util.EventListener;
|
|
||||||
import java.awt.peer.TrayIconPeer;
|
import java.awt.peer.TrayIconPeer;
|
||||||
import sun.awt.AppContext;
|
import sun.awt.AppContext;
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
import sun.awt.HeadlessToolkit;
|
import sun.awt.HeadlessToolkit;
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
import java.security.AccessControlContext;
|
import java.security.AccessControlContext;
|
||||||
@ -129,6 +121,16 @@ public class TrayIcon {
|
|||||||
if (!GraphicsEnvironment.isHeadless()) {
|
if (!GraphicsEnvironment.isHeadless()) {
|
||||||
initIDs();
|
initIDs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AWTAccessor.setTrayIconAccessor(
|
||||||
|
new AWTAccessor.TrayIconAccessor() {
|
||||||
|
public void addNotify(TrayIcon trayIcon) throws AWTException {
|
||||||
|
trayIcon.addNotify();
|
||||||
|
}
|
||||||
|
public void removeNotify(TrayIcon trayIcon) {
|
||||||
|
trayIcon.removeNotify();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private TrayIcon()
|
private TrayIcon()
|
||||||
|
@ -25,12 +25,12 @@
|
|||||||
|
|
||||||
package java.awt.event;
|
package java.awt.event;
|
||||||
|
|
||||||
import java.awt.Event;
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.GraphicsEnvironment;
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event which indicates that a keystroke occurred in a component.
|
* An event which indicates that a keystroke occurred in a component.
|
||||||
@ -914,6 +914,23 @@ public class KeyEvent extends InputEvent {
|
|||||||
if (!GraphicsEnvironment.isHeadless()) {
|
if (!GraphicsEnvironment.isHeadless()) {
|
||||||
initIDs();
|
initIDs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AWTAccessor.setKeyEventAccessor(
|
||||||
|
new AWTAccessor.KeyEventAccessor() {
|
||||||
|
public void setRawCode(KeyEvent ev, long rawCode) {
|
||||||
|
ev.rawCode = rawCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrimaryLevelUnicode(KeyEvent ev,
|
||||||
|
long primaryLevelUnicode) {
|
||||||
|
ev.primaryLevelUnicode = primaryLevelUnicode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtendedKeyCode(KeyEvent ev,
|
||||||
|
long extendedKeyCode) {
|
||||||
|
ev.extendedKeyCode = extendedKeyCode;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
package javax.swing;
|
package javax.swing;
|
||||||
|
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enumeration for keys used as client properties within the Swing
|
* An enumeration for keys used as client properties within the Swing
|
||||||
* implementation.
|
* implementation.
|
||||||
@ -86,6 +88,15 @@ enum ClientPropertyKey {
|
|||||||
*/
|
*/
|
||||||
private final boolean reportValueNotSerializable;
|
private final boolean reportValueNotSerializable;
|
||||||
|
|
||||||
|
static {
|
||||||
|
AWTAccessor.setClientPropertyKeyAccessor(
|
||||||
|
new AWTAccessor.ClientPropertyKeyAccessor() {
|
||||||
|
public Object getJComponent_TRANSFER_HANDLER() {
|
||||||
|
return JComponent_TRANSFER_HANDLER;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a key with the {@code reportValueNotSerializable} property
|
* Constructs a key with the {@code reportValueNotSerializable} property
|
||||||
* set to {@code false}.
|
* set to {@code false}.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,12 +29,15 @@ import sun.misc.Unsafe;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.KeyboardFocusManager;
|
import java.awt.KeyboardFocusManager;
|
||||||
|
import java.awt.DefaultKeyboardFocusManager;
|
||||||
import java.awt.event.InputEvent;
|
import java.awt.event.InputEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.awt.peer.ComponentPeer;
|
import java.awt.peer.ComponentPeer;
|
||||||
import java.security.AccessControlContext;
|
import java.security.AccessControlContext;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The AWTAccessor utility class.
|
* The AWTAccessor utility class.
|
||||||
@ -314,7 +317,7 @@ public final class AWTAccessor {
|
|||||||
void setTrayIconWindow(Window w, boolean isTrayIconWindow);
|
void setTrayIconWindow(Window w, boolean isTrayIconWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* An accessor for the AWTEvent class.
|
* An accessor for the AWTEvent class.
|
||||||
*/
|
*/
|
||||||
public interface AWTEventAccessor {
|
public interface AWTEventAccessor {
|
||||||
@ -334,12 +337,20 @@ public final class AWTAccessor {
|
|||||||
*/
|
*/
|
||||||
boolean isSystemGenerated(AWTEvent ev);
|
boolean isSystemGenerated(AWTEvent ev);
|
||||||
|
|
||||||
|
/**
|
||||||
/*
|
|
||||||
* Returns the acc this event was constructed with.
|
* Returns the acc this event was constructed with.
|
||||||
*/
|
*/
|
||||||
AccessControlContext getAccessControlContext(AWTEvent ev);
|
AccessControlContext getAccessControlContext(AWTEvent ev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns binary data associated with this event;
|
||||||
|
*/
|
||||||
|
byte[] getBData(AWTEvent ev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associates binary data with this event;
|
||||||
|
*/
|
||||||
|
void setBData(AWTEvent ev, byte[] bdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface InputEventAccessor {
|
public interface InputEventAccessor {
|
||||||
@ -367,11 +378,11 @@ public final class AWTAccessor {
|
|||||||
Rectangle getMaximizedBounds(Frame frame);
|
Rectangle getMaximizedBounds(Frame frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* An interface of accessor for the java.awt.KeyboardFocusManager class.
|
* An interface of accessor for the java.awt.KeyboardFocusManager class.
|
||||||
*/
|
*/
|
||||||
public interface KeyboardFocusManagerAccessor {
|
public interface KeyboardFocusManagerAccessor {
|
||||||
/*
|
/**
|
||||||
* Indicates whether the native implementation should
|
* Indicates whether the native implementation should
|
||||||
* proceed with a pending focus request for the heavyweight.
|
* proceed with a pending focus request for the heavyweight.
|
||||||
*/
|
*/
|
||||||
@ -381,7 +392,7 @@ public final class AWTAccessor {
|
|||||||
boolean focusedWindowChangeAllowed,
|
boolean focusedWindowChangeAllowed,
|
||||||
long time,
|
long time,
|
||||||
CausedFocusEvent.Cause cause);
|
CausedFocusEvent.Cause cause);
|
||||||
/*
|
/**
|
||||||
* Delivers focus for the lightweight descendant of the heavyweight
|
* Delivers focus for the lightweight descendant of the heavyweight
|
||||||
* synchronously.
|
* synchronously.
|
||||||
*/
|
*/
|
||||||
@ -390,23 +401,28 @@ public final class AWTAccessor {
|
|||||||
boolean temporary,
|
boolean temporary,
|
||||||
boolean focusedWindowChangeAllowed,
|
boolean focusedWindowChangeAllowed,
|
||||||
long time);
|
long time);
|
||||||
/*
|
/**
|
||||||
* Removes the last focus request for the heavyweight from the queue.
|
* Removes the last focus request for the heavyweight from the queue.
|
||||||
*/
|
*/
|
||||||
void removeLastFocusRequest(Component heavyweight);
|
void removeLastFocusRequest(Component heavyweight);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Sets the most recent focus owner in the window.
|
* Sets the most recent focus owner in the window.
|
||||||
*/
|
*/
|
||||||
void setMostRecentFocusOwner(Window window, Component component);
|
void setMostRecentFocusOwner(Window window, Component component);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns current KFM of the specified AppContext.
|
* Returns current KFM of the specified AppContext.
|
||||||
*/
|
*/
|
||||||
KeyboardFocusManager getCurrentKeyboardFocusManager(AppContext ctx);
|
KeyboardFocusManager getCurrentKeyboardFocusManager(AppContext ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current focus cycle root
|
||||||
|
*/
|
||||||
|
Container getCurrentFocusCycleRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* An accessor for the MenuComponent class.
|
* An accessor for the MenuComponent class.
|
||||||
*/
|
*/
|
||||||
public interface MenuComponentAccessor {
|
public interface MenuComponentAccessor {
|
||||||
@ -424,20 +440,42 @@ public final class AWTAccessor {
|
|||||||
* Returns the menu container of the menu component
|
* Returns the menu container of the menu component
|
||||||
*/
|
*/
|
||||||
MenuContainer getParent(MenuComponent menuComp);
|
MenuContainer getParent(MenuComponent menuComp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the font used for this menu component.
|
||||||
|
*/
|
||||||
|
Font getFont_NoClientCode(MenuComponent menuComp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* An accessor for the EventQueue class
|
* An accessor for the EventQueue class
|
||||||
*/
|
*/
|
||||||
public interface EventQueueAccessor {
|
public interface EventQueueAccessor {
|
||||||
/*
|
/**
|
||||||
* Gets the event dispatch thread.
|
* Gets the event dispatch thread.
|
||||||
*/
|
*/
|
||||||
Thread getDispatchThread(EventQueue eventQueue);
|
Thread getDispatchThread(EventQueue eventQueue);
|
||||||
/*
|
|
||||||
|
/**
|
||||||
* Checks if the current thread is EDT for the given EQ.
|
* Checks if the current thread is EDT for the given EQ.
|
||||||
*/
|
*/
|
||||||
public boolean isDispatchThreadImpl(EventQueue eventQueue);
|
public boolean isDispatchThreadImpl(EventQueue eventQueue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes any pending events for the specified source object.
|
||||||
|
*/
|
||||||
|
void removeSourceEvents(EventQueue eventQueue, Object source, boolean removeAllEvents);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether an event is pending on any of the separate Queues.
|
||||||
|
*/
|
||||||
|
boolean noEvents(EventQueue eventQueue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called from PostEventQueue.postEvent to notify that a new event
|
||||||
|
* appeared.
|
||||||
|
*/
|
||||||
|
void wakeup(EventQueue eventQueue, boolean isShutdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -486,6 +524,148 @@ public final class AWTAccessor {
|
|||||||
final int type);
|
final int type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An accessor for the CheckboxMenuItem class
|
||||||
|
*/
|
||||||
|
public interface CheckboxMenuItemAccessor {
|
||||||
|
/**
|
||||||
|
* Returns whether menu item is checked
|
||||||
|
*/
|
||||||
|
boolean getState(CheckboxMenuItem cmi);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An accessor for the Cursor class
|
||||||
|
*/
|
||||||
|
public interface CursorAccessor {
|
||||||
|
/**
|
||||||
|
* Returns pData of the Cursor class
|
||||||
|
*/
|
||||||
|
long getPData(Cursor cursor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets pData to the Cursor class
|
||||||
|
*/
|
||||||
|
void setPData(Cursor cursor, long pData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return type of the Cursor class
|
||||||
|
*/
|
||||||
|
int getType(Cursor cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An accessor for the MenuBar class
|
||||||
|
*/
|
||||||
|
public interface MenuBarAccessor {
|
||||||
|
/**
|
||||||
|
* Returns help menu
|
||||||
|
*/
|
||||||
|
Menu getHelpMenu(MenuBar menuBar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns menus
|
||||||
|
*/
|
||||||
|
Vector getMenus(MenuBar menuBar);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An accessor for the MenuItem class
|
||||||
|
*/
|
||||||
|
public interface MenuItemAccessor {
|
||||||
|
/**
|
||||||
|
* Returns whether menu item is enabled
|
||||||
|
*/
|
||||||
|
boolean isEnabled(MenuItem item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the command name of the action event that is fired
|
||||||
|
* by this menu item.
|
||||||
|
*/
|
||||||
|
String getActionCommandImpl(MenuItem item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the item and all its ancestors are
|
||||||
|
* enabled, false otherwise
|
||||||
|
*/
|
||||||
|
boolean isItemEnabled(MenuItem item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns label
|
||||||
|
*/
|
||||||
|
String getLabel(MenuItem item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns shortcut
|
||||||
|
*/
|
||||||
|
MenuShortcut getShortcut(MenuItem item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An accessor for the Menu class
|
||||||
|
*/
|
||||||
|
public interface MenuAccessor {
|
||||||
|
/**
|
||||||
|
* Returns vector of the items that are part of the Menu
|
||||||
|
*/
|
||||||
|
Vector getItems(Menu menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An accessor for the KeyEvent class
|
||||||
|
*/
|
||||||
|
public interface KeyEventAccessor {
|
||||||
|
/**
|
||||||
|
* Sets rawCode field for KeyEvent
|
||||||
|
*/
|
||||||
|
void setRawCode(KeyEvent ev, long rawCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets primaryLevelUnicode field for KeyEvent
|
||||||
|
*/
|
||||||
|
void setPrimaryLevelUnicode(KeyEvent ev, long primaryLevelUnicode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets extendedKeyCode field for KeyEvent
|
||||||
|
*/
|
||||||
|
void setExtendedKeyCode(KeyEvent ev, long extendedKeyCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An accessor for the ClientPropertyKey class
|
||||||
|
*/
|
||||||
|
public interface ClientPropertyKeyAccessor {
|
||||||
|
/**
|
||||||
|
* Retrieves JComponent_TRANSFER_HANDLER enum object
|
||||||
|
*/
|
||||||
|
Object getJComponent_TRANSFER_HANDLER();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An accessor for the SystemTray class
|
||||||
|
*/
|
||||||
|
public interface SystemTrayAccessor {
|
||||||
|
/**
|
||||||
|
* Support for reporting bound property changes for Object properties.
|
||||||
|
*/
|
||||||
|
void firePropertyChange(SystemTray tray, String propertyName, Object oldValue, Object newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An accessor for the TrayIcon class
|
||||||
|
*/
|
||||||
|
public interface TrayIconAccessor {
|
||||||
|
void addNotify(TrayIcon trayIcon) throws AWTException;
|
||||||
|
void removeNotify(TrayIcon trayIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An accessor for the DefaultKeyboardFocusManager class
|
||||||
|
*/
|
||||||
|
public interface DefaultKeyboardFocusManagerAccessor {
|
||||||
|
public void consumeNextKeyTyped(DefaultKeyboardFocusManager dkfm, KeyEvent e);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Accessor instances are initialized in the static initializers of
|
* Accessor instances are initialized in the static initializers of
|
||||||
* corresponding AWT classes by using setters defined below.
|
* corresponding AWT classes by using setters defined below.
|
||||||
@ -502,6 +682,16 @@ public final class AWTAccessor {
|
|||||||
private static PopupMenuAccessor popupMenuAccessor;
|
private static PopupMenuAccessor popupMenuAccessor;
|
||||||
private static FileDialogAccessor fileDialogAccessor;
|
private static FileDialogAccessor fileDialogAccessor;
|
||||||
private static ScrollPaneAdjustableAccessor scrollPaneAdjustableAccessor;
|
private static ScrollPaneAdjustableAccessor scrollPaneAdjustableAccessor;
|
||||||
|
private static CheckboxMenuItemAccessor checkboxMenuItemAccessor;
|
||||||
|
private static CursorAccessor cursorAccessor;
|
||||||
|
private static MenuBarAccessor menuBarAccessor;
|
||||||
|
private static MenuItemAccessor menuItemAccessor;
|
||||||
|
private static MenuAccessor menuAccessor;
|
||||||
|
private static KeyEventAccessor keyEventAccessor;
|
||||||
|
private static ClientPropertyKeyAccessor clientPropertyKeyAccessor;
|
||||||
|
private static SystemTrayAccessor systemTrayAccessor;
|
||||||
|
private static TrayIconAccessor trayIconAccessor;
|
||||||
|
private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set an accessor object for the java.awt.Component class.
|
* Set an accessor object for the java.awt.Component class.
|
||||||
@ -709,4 +899,174 @@ public final class AWTAccessor {
|
|||||||
}
|
}
|
||||||
return scrollPaneAdjustableAccessor;
|
return scrollPaneAdjustableAccessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an accessor object for the java.awt.CheckboxMenuItem class.
|
||||||
|
*/
|
||||||
|
public static void setCheckboxMenuItemAccessor(CheckboxMenuItemAccessor cmia) {
|
||||||
|
checkboxMenuItemAccessor = cmia;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the accessor object for the java.awt.CheckboxMenuItem class.
|
||||||
|
*/
|
||||||
|
public static CheckboxMenuItemAccessor getCheckboxMenuItemAccessor() {
|
||||||
|
if (checkboxMenuItemAccessor == null) {
|
||||||
|
unsafe.ensureClassInitialized(CheckboxMenuItemAccessor.class);
|
||||||
|
}
|
||||||
|
return checkboxMenuItemAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an accessor object for the java.awt.Cursor class.
|
||||||
|
*/
|
||||||
|
public static void setCursorAccessor(CursorAccessor ca) {
|
||||||
|
cursorAccessor = ca;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the accessor object for the java.awt.Cursor class.
|
||||||
|
*/
|
||||||
|
public static CursorAccessor getCursorAccessor() {
|
||||||
|
if (cursorAccessor == null) {
|
||||||
|
unsafe.ensureClassInitialized(CursorAccessor.class);
|
||||||
|
}
|
||||||
|
return cursorAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an accessor object for the java.awt.MenuBar class.
|
||||||
|
*/
|
||||||
|
public static void setMenuBarAccessor(MenuBarAccessor mba) {
|
||||||
|
menuBarAccessor = mba;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the accessor object for the java.awt.MenuBar class.
|
||||||
|
*/
|
||||||
|
public static MenuBarAccessor getMenuBarAccessor() {
|
||||||
|
if (menuBarAccessor == null) {
|
||||||
|
unsafe.ensureClassInitialized(MenuBarAccessor.class);
|
||||||
|
}
|
||||||
|
return menuBarAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an accessor object for the java.awt.MenuItem class.
|
||||||
|
*/
|
||||||
|
public static void setMenuItemAccessor(MenuItemAccessor mia) {
|
||||||
|
menuItemAccessor = mia;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the accessor object for the java.awt.MenuItem class.
|
||||||
|
*/
|
||||||
|
public static MenuItemAccessor getMenuItemAccessor() {
|
||||||
|
if (menuItemAccessor == null) {
|
||||||
|
unsafe.ensureClassInitialized(MenuItemAccessor.class);
|
||||||
|
}
|
||||||
|
return menuItemAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an accessor object for the java.awt.Menu class.
|
||||||
|
*/
|
||||||
|
public static void setMenuAccessor(MenuAccessor ma) {
|
||||||
|
menuAccessor = ma;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the accessor object for the java.awt.Menu class.
|
||||||
|
*/
|
||||||
|
public static MenuAccessor getMenuAccessor() {
|
||||||
|
if (menuAccessor == null) {
|
||||||
|
unsafe.ensureClassInitialized(MenuAccessor.class);
|
||||||
|
}
|
||||||
|
return menuAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an accessor object for the java.awt.event.KeyEvent class.
|
||||||
|
*/
|
||||||
|
public static void setKeyEventAccessor(KeyEventAccessor kea) {
|
||||||
|
keyEventAccessor = kea;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the accessor object for the java.awt.event.KeyEvent class.
|
||||||
|
*/
|
||||||
|
public static KeyEventAccessor getKeyEventAccessor() {
|
||||||
|
if (keyEventAccessor == null) {
|
||||||
|
unsafe.ensureClassInitialized(KeyEventAccessor.class);
|
||||||
|
}
|
||||||
|
return keyEventAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an accessor object for the javax.swing.ClientPropertyKey class.
|
||||||
|
*/
|
||||||
|
public static void setClientPropertyKeyAccessor(ClientPropertyKeyAccessor cpka) {
|
||||||
|
clientPropertyKeyAccessor = cpka;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the accessor object for the javax.swing.ClientPropertyKey class.
|
||||||
|
*/
|
||||||
|
public static ClientPropertyKeyAccessor getClientPropertyKeyAccessor() {
|
||||||
|
if (clientPropertyKeyAccessor == null) {
|
||||||
|
unsafe.ensureClassInitialized(ClientPropertyKeyAccessor.class);
|
||||||
|
}
|
||||||
|
return clientPropertyKeyAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an accessor object for the java.awt.SystemTray class.
|
||||||
|
*/
|
||||||
|
public static void setSystemTrayAccessor(SystemTrayAccessor sta) {
|
||||||
|
systemTrayAccessor = sta;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the accessor object for the java.awt.SystemTray class.
|
||||||
|
*/
|
||||||
|
public static SystemTrayAccessor getSystemTrayAccessor() {
|
||||||
|
if (systemTrayAccessor == null) {
|
||||||
|
unsafe.ensureClassInitialized(SystemTrayAccessor.class);
|
||||||
|
}
|
||||||
|
return systemTrayAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an accessor object for the java.awt.TrayIcon class.
|
||||||
|
*/
|
||||||
|
public static void setTrayIconAccessor(TrayIconAccessor tia) {
|
||||||
|
trayIconAccessor = tia;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the accessor object for the java.awt.TrayIcon class.
|
||||||
|
*/
|
||||||
|
public static TrayIconAccessor getTrayIconAccessor() {
|
||||||
|
if (trayIconAccessor == null) {
|
||||||
|
unsafe.ensureClassInitialized(TrayIconAccessor.class);
|
||||||
|
}
|
||||||
|
return trayIconAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an accessor object for the java.awt.DefaultKeyboardFocusManager class.
|
||||||
|
*/
|
||||||
|
public static void setDefaultKeyboardFocusManagerAccessor(DefaultKeyboardFocusManagerAccessor dkfma) {
|
||||||
|
defaultKeyboardFocusManagerAccessor = dkfma;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the accessor object for the java.awt.DefaultKeyboardFocusManager class.
|
||||||
|
*/
|
||||||
|
public static DefaultKeyboardFocusManagerAccessor getDefaultKeyboardFocusManagerAccessor() {
|
||||||
|
if (defaultKeyboardFocusManagerAccessor == null) {
|
||||||
|
unsafe.ensureClassInitialized(DefaultKeyboardFocusManagerAccessor.class);
|
||||||
|
}
|
||||||
|
return defaultKeyboardFocusManagerAccessor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,6 @@ import java.awt.*;
|
|||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.awt.image.*;
|
import java.awt.image.*;
|
||||||
import java.awt.peer.*;
|
import java.awt.peer.*;
|
||||||
import java.security.AccessController;
|
|
||||||
import java.security.PrivilegedAction;
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -66,8 +60,6 @@ public abstract class EmbeddedFrame extends Frame
|
|||||||
implements KeyEventDispatcher, PropertyChangeListener {
|
implements KeyEventDispatcher, PropertyChangeListener {
|
||||||
|
|
||||||
private boolean isCursorAllowed = true;
|
private boolean isCursorAllowed = true;
|
||||||
private static Field fieldPeer;
|
|
||||||
private static Field currentCycleRoot;
|
|
||||||
private boolean supportsXEmbed = false;
|
private boolean supportsXEmbed = false;
|
||||||
private KeyboardFocusManager appletKFM;
|
private KeyboardFocusManager appletKFM;
|
||||||
// JDK 1.1 compatibility
|
// JDK 1.1 compatibility
|
||||||
@ -213,39 +205,8 @@ public abstract class EmbeddedFrame extends Frame
|
|||||||
*/
|
*/
|
||||||
public boolean dispatchKeyEvent(KeyEvent e) {
|
public boolean dispatchKeyEvent(KeyEvent e) {
|
||||||
|
|
||||||
// We can't guarantee that this is called on the same AppContext as EmbeddedFrame
|
Container currentRoot = AWTAccessor.getKeyboardFocusManagerAccessor()
|
||||||
// belongs to. That's why we can't use public methods to find current focus cycle
|
.getCurrentFocusCycleRoot();
|
||||||
// root. Instead, we access KFM's private field directly.
|
|
||||||
if (currentCycleRoot == null) {
|
|
||||||
currentCycleRoot = AccessController.doPrivileged(new PrivilegedAction<Field>() {
|
|
||||||
public Field run() {
|
|
||||||
try {
|
|
||||||
Field unaccessibleRoot = KeyboardFocusManager.class.
|
|
||||||
getDeclaredField("currentFocusCycleRoot");
|
|
||||||
if (unaccessibleRoot != null) {
|
|
||||||
unaccessibleRoot.setAccessible(true);
|
|
||||||
}
|
|
||||||
return unaccessibleRoot;
|
|
||||||
} catch (NoSuchFieldException e1) {
|
|
||||||
assert false;
|
|
||||||
} catch (SecurityException e2) {
|
|
||||||
assert false;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Container currentRoot = null;
|
|
||||||
if (currentCycleRoot != null) {
|
|
||||||
try {
|
|
||||||
// The field is static, so we can pass null to Field.get() as the argument.
|
|
||||||
currentRoot = (Container)currentCycleRoot.get(null);
|
|
||||||
} catch (IllegalAccessException e3) {
|
|
||||||
// This is impossible: currentCycleRoot would be null if setAccessible failed.
|
|
||||||
assert false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we are not in EmbeddedFrame's cycle, we should not try to leave.
|
// if we are not in EmbeddedFrame's cycle, we should not try to leave.
|
||||||
if (this != currentRoot) {
|
if (this != currentRoot) {
|
||||||
@ -389,32 +350,8 @@ public abstract class EmbeddedFrame extends Frame
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
protected void setPeer(final ComponentPeer p){
|
protected void setPeer(final ComponentPeer p){
|
||||||
if (fieldPeer == null) {
|
AWTAccessor.getComponentAccessor().setPeer(EmbeddedFrame.this, p);
|
||||||
fieldPeer = AccessController.doPrivileged(new PrivilegedAction<Field>() {
|
};
|
||||||
public Field run() {
|
|
||||||
try {
|
|
||||||
Field lnkPeer = Component.class.getDeclaredField("peer");
|
|
||||||
if (lnkPeer != null) {
|
|
||||||
lnkPeer.setAccessible(true);
|
|
||||||
}
|
|
||||||
return lnkPeer;
|
|
||||||
} catch (NoSuchFieldException e) {
|
|
||||||
assert false;
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
assert false;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}//run
|
|
||||||
});
|
|
||||||
}
|
|
||||||
try{
|
|
||||||
if (fieldPeer != null){
|
|
||||||
fieldPeer.set(EmbeddedFrame.this, p);
|
|
||||||
}
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
assert false;
|
|
||||||
}
|
|
||||||
}; //setPeer method ends
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synthesize native message to activate or deactivate EmbeddedFrame window
|
* Synthesize native message to activate or deactivate EmbeddedFrame window
|
||||||
|
@ -51,14 +51,8 @@ import sun.awt.im.InputContext;
|
|||||||
import sun.awt.image.*;
|
import sun.awt.image.*;
|
||||||
import sun.security.action.GetPropertyAction;
|
import sun.security.action.GetPropertyAction;
|
||||||
import sun.security.action.GetBooleanAction;
|
import sun.security.action.GetBooleanAction;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.security.PrivilegedAction;
|
|
||||||
import java.security.PrivilegedActionException;
|
|
||||||
import java.security.PrivilegedExceptionAction;
|
|
||||||
|
|
||||||
public abstract class SunToolkit extends Toolkit
|
public abstract class SunToolkit extends Toolkit
|
||||||
implements WindowClosingSupport, WindowClosingListener,
|
implements WindowClosingSupport, WindowClosingListener,
|
||||||
@ -80,7 +74,6 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
*/
|
*/
|
||||||
public static final int GRAB_EVENT_MASK = 0x80000000;
|
public static final int GRAB_EVENT_MASK = 0x80000000;
|
||||||
|
|
||||||
private static Method wakeupMethod;
|
|
||||||
/* The key to put()/get() the PostEventQueue into/from the AppContext.
|
/* The key to put()/get() the PostEventQueue into/from the AppContext.
|
||||||
*/
|
*/
|
||||||
private static final String POST_EVENT_QUEUE_KEY = "PostEventQueue";
|
private static final String POST_EVENT_QUEUE_KEY = "PostEventQueue";
|
||||||
@ -295,52 +288,8 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
return appContext;
|
return appContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Field getField(final Class<?> klass, final String fieldName) {
|
|
||||||
return AccessController.doPrivileged(new PrivilegedAction<Field>() {
|
|
||||||
public Field run() {
|
|
||||||
try {
|
|
||||||
Field field = klass.getDeclaredField(fieldName);
|
|
||||||
assert (field != null);
|
|
||||||
field.setAccessible(true);
|
|
||||||
return field;
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
assert false;
|
|
||||||
} catch (NoSuchFieldException e) {
|
|
||||||
assert false;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}//run
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
static void wakeupEventQueue(EventQueue q, boolean isShutdown){
|
static void wakeupEventQueue(EventQueue q, boolean isShutdown){
|
||||||
if (wakeupMethod == null){
|
AWTAccessor.getEventQueueAccessor().wakeup(q, isShutdown);
|
||||||
wakeupMethod = AccessController.doPrivileged(new PrivilegedAction<Method>() {
|
|
||||||
public Method run() {
|
|
||||||
try {
|
|
||||||
Method method = EventQueue.class.getDeclaredMethod("wakeup",new Class [] {Boolean.TYPE} );
|
|
||||||
if (method != null) {
|
|
||||||
method.setAccessible(true);
|
|
||||||
}
|
|
||||||
return method;
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
assert false;
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
assert false;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}//run
|
|
||||||
});
|
|
||||||
}
|
|
||||||
try{
|
|
||||||
if (wakeupMethod != null){
|
|
||||||
wakeupMethod.invoke(q, new Object[]{Boolean.valueOf(isShutdown)});
|
|
||||||
}
|
|
||||||
} catch (InvocationTargetException e){
|
|
||||||
assert false;
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
assert false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1460,22 +1409,6 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
|| comp instanceof Window);
|
|| comp instanceof Window);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Method getMethod(final Class<?> clz, final String methodName, final Class[] params) {
|
|
||||||
Method res = null;
|
|
||||||
try {
|
|
||||||
res = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
|
|
||||||
public Method run() throws Exception {
|
|
||||||
Method m = clz.getDeclaredMethod(methodName, params);
|
|
||||||
m.setAccessible(true);
|
|
||||||
return m;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (PrivilegedActionException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public static class OperationTimedOut extends RuntimeException {
|
public static class OperationTimedOut extends RuntimeException {
|
||||||
public OperationTimedOut(String msg) {
|
public OperationTimedOut(String msg) {
|
||||||
@ -1622,21 +1555,9 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
private boolean queueEmpty = false;
|
private boolean queueEmpty = false;
|
||||||
private final Object waitLock = "Wait Lock";
|
private final Object waitLock = "Wait Lock";
|
||||||
|
|
||||||
static Method eqNoEvents;
|
|
||||||
|
|
||||||
private boolean isEQEmpty() {
|
private boolean isEQEmpty() {
|
||||||
EventQueue queue = getSystemEventQueueImpl();
|
EventQueue queue = getSystemEventQueueImpl();
|
||||||
synchronized(SunToolkit.class) {
|
return AWTAccessor.getEventQueueAccessor().noEvents(queue);
|
||||||
if (eqNoEvents == null) {
|
|
||||||
eqNoEvents = getMethod(java.awt.EventQueue.class, "noEvents", null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return (Boolean)eqNoEvents.invoke(queue);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1892,20 +1813,14 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
* consumeNextKeyTyped() method is not currently used,
|
* consumeNextKeyTyped() method is not currently used,
|
||||||
* however Swing could use it in the future.
|
* however Swing could use it in the future.
|
||||||
*/
|
*/
|
||||||
private static Method consumeNextKeyTypedMethod = null;
|
|
||||||
public static synchronized void consumeNextKeyTyped(KeyEvent keyEvent) {
|
public static synchronized void consumeNextKeyTyped(KeyEvent keyEvent) {
|
||||||
if (consumeNextKeyTypedMethod == null) {
|
|
||||||
consumeNextKeyTypedMethod = getMethod(DefaultKeyboardFocusManager.class,
|
|
||||||
"consumeNextKeyTyped",
|
|
||||||
new Class<?>[] {KeyEvent.class});
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
consumeNextKeyTypedMethod.invoke(KeyboardFocusManager.getCurrentKeyboardFocusManager(),
|
AWTAccessor.getDefaultKeyboardFocusManagerAccessor().consumeNextKeyTyped(
|
||||||
keyEvent);
|
(DefaultKeyboardFocusManager)KeyboardFocusManager.
|
||||||
} catch (IllegalAccessException iae) {
|
getCurrentKeyboardFocusManager(),
|
||||||
iae.printStackTrace();
|
keyEvent);
|
||||||
} catch (InvocationTargetException ite) {
|
} catch (ClassCastException cce) {
|
||||||
ite.printStackTrace();
|
cce.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1925,24 +1840,6 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
return (Window)comp;
|
return (Window)comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the value of the system property indicated by the specified key.
|
|
||||||
*/
|
|
||||||
public static String getSystemProperty(final String key) {
|
|
||||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
|
||||||
public String run() {
|
|
||||||
return System.getProperty(key);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the boolean value of the system property indicated by the specified key.
|
|
||||||
*/
|
|
||||||
protected static Boolean getBooleanSystemProperty(String key) {
|
|
||||||
return AccessController.doPrivileged(new GetBooleanAction(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Boolean sunAwtDisableMixing = null;
|
private static Boolean sunAwtDisableMixing = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1951,7 +1848,8 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
*/
|
*/
|
||||||
public synchronized static boolean getSunAwtDisableMixing() {
|
public synchronized static boolean getSunAwtDisableMixing() {
|
||||||
if (sunAwtDisableMixing == null) {
|
if (sunAwtDisableMixing == null) {
|
||||||
sunAwtDisableMixing = getBooleanSystemProperty("sun.awt.disableMixing");
|
sunAwtDisableMixing = AccessController.doPrivileged(
|
||||||
|
new GetBooleanAction("sun.awt.disableMixing"));
|
||||||
}
|
}
|
||||||
return sunAwtDisableMixing.booleanValue();
|
return sunAwtDisableMixing.booleanValue();
|
||||||
}
|
}
|
||||||
|
@ -29,25 +29,10 @@ import java.awt.*;
|
|||||||
import java.awt.peer.*;
|
import java.awt.peer.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import sun.awt.AWTAccessor;
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
class XCheckboxMenuItemPeer extends XMenuItemPeer implements CheckboxMenuItemPeer {
|
class XCheckboxMenuItemPeer extends XMenuItemPeer implements CheckboxMenuItemPeer {
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
* Data members
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* CheckboxMenuItem's fields
|
|
||||||
*/
|
|
||||||
private final static Field f_state;
|
|
||||||
static {
|
|
||||||
f_state = SunToolkit.getField(CheckboxMenuItem.class, "state");
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
*
|
*
|
||||||
* Construction
|
* Construction
|
||||||
@ -74,16 +59,8 @@ class XCheckboxMenuItemPeer extends XMenuItemPeer implements CheckboxMenuItemPee
|
|||||||
*
|
*
|
||||||
************************************************/
|
************************************************/
|
||||||
boolean getTargetState() {
|
boolean getTargetState() {
|
||||||
MenuItem target = getTarget();
|
return AWTAccessor.getCheckboxMenuItemAccessor()
|
||||||
if (target == null) {
|
.getState((CheckboxMenuItem)getTarget());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return f_state.getBoolean(target);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
|
@ -29,13 +29,8 @@ import java.awt.*;
|
|||||||
import java.awt.dnd.DropTarget;
|
import java.awt.dnd.DropTarget;
|
||||||
import java.awt.dnd.DropTargetListener;
|
import java.awt.dnd.DropTargetListener;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.awt.image.ColorModel;
|
|
||||||
import java.awt.image.ImageObserver;
|
|
||||||
import java.awt.image.ImageProducer;
|
|
||||||
import java.awt.image.VolatileImage;
|
|
||||||
import java.awt.peer.*;
|
|
||||||
import sun.awt.*;
|
import sun.awt.*;
|
||||||
import java.lang.reflect.*;
|
import sun.awt.AWTAccessor;
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import static sun.awt.X11.XEmbedHelper.*;
|
import static sun.awt.X11.XEmbedHelper.*;
|
||||||
@ -454,16 +449,8 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Field bdataField;
|
|
||||||
static byte[] getBData(KeyEvent e) {
|
static byte[] getBData(KeyEvent e) {
|
||||||
try {
|
return AWTAccessor.getAWTEventAccessor().getBData(e);
|
||||||
if (bdataField == null) {
|
|
||||||
bdataField = SunToolkit.getField(java.awt.AWTEvent.class, "bdata");
|
|
||||||
}
|
|
||||||
return (byte[])bdataField.get(e);
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void forwardKeyEvent(KeyEvent e) {
|
void forwardKeyEvent(KeyEvent e) {
|
||||||
|
@ -29,7 +29,7 @@ import java.awt.*;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher {
|
public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher {
|
||||||
HashMap children = new HashMap();
|
HashMap children = new HashMap();
|
||||||
@ -127,20 +127,8 @@ public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatche
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Field bdata;
|
|
||||||
byte[] getBData(KeyEvent e) {
|
|
||||||
try {
|
|
||||||
if (bdata == null) {
|
|
||||||
bdata = SunToolkit.getField(java.awt.AWTEvent.class, "bdata");
|
|
||||||
}
|
|
||||||
return (byte[])bdata.get(e);
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void forwardKeyEvent(long child, KeyEvent e) {
|
void forwardKeyEvent(long child, KeyEvent e) {
|
||||||
byte[] bdata = getBData(e);
|
byte[] bdata = AWTAccessor.getAWTEventAccessor().getBData(e);
|
||||||
long data = Native.toData(bdata);
|
long data = Native.toData(bdata);
|
||||||
if (data == 0) {
|
if (data == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -27,10 +27,7 @@ package sun.awt.X11;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.peer.ComponentPeer;
|
import java.awt.peer.ComponentPeer;
|
||||||
import java.awt.peer.LightweightPeer;
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import sun.awt.AWTAccessor;
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
import sun.awt.GlobalCursorManager;
|
import sun.awt.GlobalCursorManager;
|
||||||
@ -38,23 +35,6 @@ import sun.awt.SunToolkit;
|
|||||||
|
|
||||||
public final class XGlobalCursorManager extends GlobalCursorManager {
|
public final class XGlobalCursorManager extends GlobalCursorManager {
|
||||||
|
|
||||||
private static Field field_pData;
|
|
||||||
private static Field field_type;
|
|
||||||
private static Class cursorClass;
|
|
||||||
private static Method method_setPData;
|
|
||||||
static {
|
|
||||||
cursorClass = java.awt.Cursor.class;
|
|
||||||
field_pData = SunToolkit.getField(cursorClass, "pData");
|
|
||||||
field_type = SunToolkit.getField(cursorClass, "type");
|
|
||||||
method_setPData = SunToolkit.getMethod(cursorClass, "setPData", new Class[] {long.class});
|
|
||||||
if (field_pData == null || field_type == null || method_setPData == null) {
|
|
||||||
System.out.println("Unable to initialize XGlobalCursorManager: ");
|
|
||||||
Thread.dumpStack();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// cached nativeContainer
|
// cached nativeContainer
|
||||||
private WeakReference<Component> nativeContainer;
|
private WeakReference<Component> nativeContainer;
|
||||||
|
|
||||||
@ -213,8 +193,8 @@ public final class XGlobalCursorManager extends GlobalCursorManager {
|
|||||||
long pData = 0;
|
long pData = 0;
|
||||||
int type = 0;
|
int type = 0;
|
||||||
try {
|
try {
|
||||||
pData = field_pData.getLong(c);
|
pData = AWTAccessor.getCursorAccessor().getPData(c);
|
||||||
type = field_type.getInt(c);
|
type = AWTAccessor.getCursorAccessor().getType(c);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -284,7 +264,7 @@ public final class XGlobalCursorManager extends GlobalCursorManager {
|
|||||||
|
|
||||||
static void setPData(Cursor c, long pData) {
|
static void setPData(Cursor c, long pData) {
|
||||||
try {
|
try {
|
||||||
method_setPData.invoke(c, pData);
|
AWTAccessor.getCursorAccessor().setPData(c, pData);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -28,10 +28,9 @@ import java.awt.*;
|
|||||||
import java.awt.peer.*;
|
import java.awt.peer.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
|
public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
|
||||||
|
|
||||||
@ -67,15 +66,6 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
|
|||||||
private final static int BAR_ITEM_MARGIN_TOP = 2;
|
private final static int BAR_ITEM_MARGIN_TOP = 2;
|
||||||
private final static int BAR_ITEM_MARGIN_BOTTOM = 2;
|
private final static int BAR_ITEM_MARGIN_BOTTOM = 2;
|
||||||
|
|
||||||
//fields
|
|
||||||
private static Field f_helpMenu;
|
|
||||||
private static Field f_menus;
|
|
||||||
|
|
||||||
static {
|
|
||||||
f_helpMenu = SunToolkit.getField(MenuBar.class, "helpMenu");
|
|
||||||
f_menus = SunToolkit.getField(MenuBar.class, "menus");
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
*
|
*
|
||||||
* Mapping data
|
* Mapping data
|
||||||
@ -204,16 +194,12 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
|
|||||||
*/
|
*/
|
||||||
void postInit(XCreateWindowParams params) {
|
void postInit(XCreateWindowParams params) {
|
||||||
super.postInit(params);
|
super.postInit(params);
|
||||||
Vector targetMenuVector = null;
|
// Get menus from the target.
|
||||||
Menu targetHelpMenu = null;
|
Vector targetMenuVector = AWTAccessor.getMenuBarAccessor()
|
||||||
try {
|
.getMenus(menuBarTarget);
|
||||||
// Get menus from the target.
|
Menu targetHelpMenu = AWTAccessor.getMenuBarAccessor()
|
||||||
targetMenuVector = (Vector)f_menus.get(menuBarTarget);
|
.getHelpMenu(menuBarTarget);
|
||||||
targetHelpMenu = (Menu)f_helpMenu.get(menuBarTarget);
|
reloadItems(targetMenuVector);
|
||||||
reloadItems(targetMenuVector);
|
|
||||||
} catch (IllegalAccessException iae) {
|
|
||||||
iae.printStackTrace();
|
|
||||||
}
|
|
||||||
if (targetHelpMenu != null) {
|
if (targetHelpMenu != null) {
|
||||||
addHelpMenu(targetHelpMenu);
|
addHelpMenu(targetHelpMenu);
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,7 @@ import java.awt.*;
|
|||||||
import java.awt.peer.*;
|
import java.awt.peer.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import sun.awt.AWTAccessor;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
public class XMenuItemPeer implements MenuItemPeer {
|
public class XMenuItemPeer implements MenuItemPeer {
|
||||||
|
|
||||||
@ -81,24 +78,6 @@ public class XMenuItemPeer implements MenuItemPeer {
|
|||||||
private final static int SEPARATOR_WIDTH = 20;
|
private final static int SEPARATOR_WIDTH = 20;
|
||||||
private final static int SEPARATOR_HEIGHT = 5;
|
private final static int SEPARATOR_HEIGHT = 5;
|
||||||
|
|
||||||
/*
|
|
||||||
* MenuItem's fields & methods
|
|
||||||
*/
|
|
||||||
private final static Field f_enabled;
|
|
||||||
private final static Field f_label;
|
|
||||||
private final static Field f_shortcut;
|
|
||||||
private final static Method m_getFont;
|
|
||||||
private final static Method m_isItemEnabled;
|
|
||||||
private final static Method m_getActionCommand;
|
|
||||||
static {
|
|
||||||
f_enabled = SunToolkit.getField(MenuItem.class, "enabled");
|
|
||||||
f_label = SunToolkit.getField(MenuItem.class, "label");
|
|
||||||
f_shortcut = SunToolkit.getField(MenuItem.class, "shortcut");
|
|
||||||
|
|
||||||
m_getFont = SunToolkit.getMethod(MenuComponent.class, "getFont_NoClientCode", null);
|
|
||||||
m_getActionCommand = SunToolkit.getMethod(MenuItem.class, "getActionCommandImpl", null);
|
|
||||||
m_isItemEnabled = SunToolkit.getMethod(MenuItem.class, "isItemEnabled", null);
|
|
||||||
}
|
|
||||||
/************************************************
|
/************************************************
|
||||||
*
|
*
|
||||||
* Text Metrics
|
* Text Metrics
|
||||||
@ -216,39 +195,21 @@ public class XMenuItemPeer implements MenuItemPeer {
|
|||||||
if (target == null) {
|
if (target == null) {
|
||||||
return XWindow.getDefaultFont();
|
return XWindow.getDefaultFont();
|
||||||
}
|
}
|
||||||
try {
|
return AWTAccessor.getMenuComponentAccessor().getFont_NoClientCode(target);
|
||||||
return (Font)m_getFont.invoke(target, new Object[0]);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return XWindow.getDefaultFont();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getTargetLabel() {
|
String getTargetLabel() {
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
try {
|
return AWTAccessor.getMenuItemAccessor().getLabel(target);
|
||||||
String label = (String)f_label.get(target);
|
|
||||||
return (label == null) ? "" : label;
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isTargetEnabled() {
|
boolean isTargetEnabled() {
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
return AWTAccessor.getMenuItemAccessor().isEnabled(target);
|
||||||
return f_enabled.getBoolean(target);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -260,40 +221,21 @@ public class XMenuItemPeer implements MenuItemPeer {
|
|||||||
if (target == null) {
|
if (target == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
return AWTAccessor.getMenuItemAccessor().isItemEnabled(target);
|
||||||
return ((Boolean)m_isItemEnabled.invoke(target, new Object[0])).booleanValue();
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getTargetActionCommand() {
|
String getTargetActionCommand() {
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
try {
|
return AWTAccessor.getMenuItemAccessor().getActionCommandImpl(target);
|
||||||
return (String) m_getActionCommand.invoke(target,(Object[]) null);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuShortcut getTargetShortcut() {
|
MenuShortcut getTargetShortcut() {
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
return AWTAccessor.getMenuItemAccessor().getShortcut(target);
|
||||||
return (MenuShortcut)f_shortcut.get(target);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getShortcutText() {
|
String getShortcutText() {
|
||||||
|
@ -27,10 +27,9 @@ package sun.awt.X11;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.peer.*;
|
import java.awt.peer.*;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
public class XMenuPeer extends XMenuItemPeer implements MenuPeer {
|
public class XMenuPeer extends XMenuItemPeer implements MenuPeer {
|
||||||
|
|
||||||
@ -46,16 +45,6 @@ public class XMenuPeer extends XMenuItemPeer implements MenuPeer {
|
|||||||
*/
|
*/
|
||||||
XMenuWindow menuWindow;
|
XMenuWindow menuWindow;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Menu's fields & methods
|
|
||||||
*/
|
|
||||||
private final static Field f_items;
|
|
||||||
|
|
||||||
static {
|
|
||||||
f_items = SunToolkit.getField(Menu.class, "items");
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
*
|
*
|
||||||
* Construction
|
* Construction
|
||||||
@ -153,12 +142,7 @@ public class XMenuPeer extends XMenuItemPeer implements MenuPeer {
|
|||||||
*
|
*
|
||||||
************************************************/
|
************************************************/
|
||||||
Vector getTargetItems() {
|
Vector getTargetItems() {
|
||||||
try {
|
return AWTAccessor.getMenuAccessor().getItems((Menu)getTarget());
|
||||||
return (Vector)f_items.get(getTarget());
|
|
||||||
} catch (IllegalAccessException iae) {
|
|
||||||
iae.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
|
@ -28,15 +28,10 @@ import java.awt.*;
|
|||||||
import java.awt.peer.*;
|
import java.awt.peer.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
|
public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
@ -66,24 +61,6 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
|
|||||||
private final static int CAPTION_MARGIN_TOP = 4;
|
private final static int CAPTION_MARGIN_TOP = 4;
|
||||||
private final static int CAPTION_SEPARATOR_HEIGHT = 6;
|
private final static int CAPTION_SEPARATOR_HEIGHT = 6;
|
||||||
|
|
||||||
/*
|
|
||||||
* Menu's fields & methods
|
|
||||||
*/
|
|
||||||
//Fix for 6184485: Popup menu is not disabled on XToolkit even when calling setEnabled (false)
|
|
||||||
private final static Field f_enabled;
|
|
||||||
//Fix for 6267144: PIT: Popup menu label is not shown, XToolkit
|
|
||||||
private final static Field f_label;
|
|
||||||
private final static Method m_getFont;
|
|
||||||
private final static Field f_items;
|
|
||||||
|
|
||||||
static {
|
|
||||||
f_enabled = SunToolkit.getField(MenuItem.class, "enabled");
|
|
||||||
f_label = SunToolkit.getField(MenuItem.class, "label");
|
|
||||||
f_items = SunToolkit.getField(Menu.class, "items");
|
|
||||||
m_getFont = SunToolkit.getMethod(MenuComponent.class, "getFont_NoClientCode", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
*
|
*
|
||||||
* Construction
|
* Construction
|
||||||
@ -96,7 +73,7 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
|
|||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
*
|
*
|
||||||
* Implementaion of interface methods
|
* Implementation of interface methods
|
||||||
*
|
*
|
||||||
************************************************/
|
************************************************/
|
||||||
/*
|
/*
|
||||||
@ -189,27 +166,16 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
|
|||||||
if (popupMenuTarget == null) {
|
if (popupMenuTarget == null) {
|
||||||
return XWindow.getDefaultFont();
|
return XWindow.getDefaultFont();
|
||||||
}
|
}
|
||||||
try {
|
return AWTAccessor.getMenuComponentAccessor()
|
||||||
return (Font)m_getFont.invoke(popupMenuTarget, new Object[0]);
|
.getFont_NoClientCode(popupMenuTarget);
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return XWindow.getDefaultFont();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Fix for 6267144: PIT: Popup menu label is not shown, XToolkit
|
||||||
String getTargetLabel() {
|
String getTargetLabel() {
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
try {
|
return AWTAccessor.getMenuItemAccessor().getLabel(popupMenuTarget);
|
||||||
String label = (String)f_label.get(popupMenuTarget);
|
|
||||||
return (label == null) ? "" : label;
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Fix for 6184485: Popup menu is not disabled on XToolkit even when calling setEnabled (false)
|
//Fix for 6184485: Popup menu is not disabled on XToolkit even when calling setEnabled (false)
|
||||||
@ -217,21 +183,14 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
|
|||||||
if (popupMenuTarget == null) {
|
if (popupMenuTarget == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
return AWTAccessor.getMenuItemAccessor().isEnabled(popupMenuTarget);
|
||||||
return f_enabled.getBoolean(popupMenuTarget);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector getMenuTargetItems() {
|
Vector getMenuTargetItems() {
|
||||||
try {
|
if (popupMenuTarget == null) {
|
||||||
return (Vector)f_items.get(popupMenuTarget);
|
|
||||||
} catch (IllegalAccessException iae) {
|
|
||||||
iae.printStackTrace();
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return AWTAccessor.getMenuAccessor().getItems(popupMenuTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
|
@ -31,7 +31,6 @@ import java.awt.peer.*;
|
|||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
|
|
||||||
import sun.awt.AWTAccessor;
|
import sun.awt.AWTAccessor;
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
class XScrollPanePeer extends XComponentPeer implements ScrollPanePeer, XScrollbarClient {
|
class XScrollPanePeer extends XComponentPeer implements ScrollPanePeer, XScrollbarClient {
|
||||||
|
|
||||||
|
@ -27,10 +27,9 @@ package sun.awt.X11;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.peer.SystemTrayPeer;
|
import java.awt.peer.SystemTrayPeer;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
import sun.awt.AppContext;
|
import sun.awt.AppContext;
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
|
|
||||||
public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener {
|
public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener {
|
||||||
@ -42,11 +41,6 @@ public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener {
|
|||||||
private volatile boolean available;
|
private volatile boolean available;
|
||||||
private final XMSelection selection = new XMSelection("_NET_SYSTEM_TRAY");
|
private final XMSelection selection = new XMSelection("_NET_SYSTEM_TRAY");
|
||||||
|
|
||||||
private static final Method firePropertyChangeMethod =
|
|
||||||
XToolkit.getMethod(SystemTray.class, "firePropertyChange", new Class[] {String.class, Object.class, Object.class});
|
|
||||||
private static final Method addNotifyMethod = XToolkit.getMethod(TrayIcon.class, "addNotify", null);
|
|
||||||
private static final Method removeNotifyMethod = XToolkit.getMethod(TrayIcon.class, "removeNotify", null);
|
|
||||||
|
|
||||||
private static final int SCREEN = 0;
|
private static final int SCREEN = 0;
|
||||||
private static final String SYSTEM_TRAY_PROPERTY_NAME = "systemTray";
|
private static final String SYSTEM_TRAY_PROPERTY_NAME = "systemTray";
|
||||||
private static final XAtom _NET_SYSTEM_TRAY = XAtom.get("_NET_SYSTEM_TRAY_S" + SCREEN);
|
private static final XAtom _NET_SYSTEM_TRAY = XAtom.get("_NET_SYSTEM_TRAY_S" + SCREEN);
|
||||||
@ -157,44 +151,43 @@ public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener {
|
|||||||
return peerInstance;
|
return peerInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void firePropertyChange(final String propertyName, final Object oldValue, final Object newValue) {
|
private void firePropertyChange(final String propertyName,
|
||||||
|
final Object oldValue,
|
||||||
|
final Object newValue) {
|
||||||
Runnable runnable = new Runnable() {
|
Runnable runnable = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
Object[] args = new Object[] {propertyName, oldValue, newValue};
|
AWTAccessor.getSystemTrayAccessor()
|
||||||
invokeMethod(firePropertyChangeMethod, target, args);
|
.firePropertyChange(target, propertyName, oldValue, newValue);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
invokeOnEachAppContext(runnable);
|
invokeOnEachAppContext(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createTrayPeers() {
|
private void createTrayPeers() {
|
||||||
invokeOnEachTrayIcon(addNotifyMethod);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void removeTrayPeers() {
|
|
||||||
invokeOnEachTrayIcon(removeNotifyMethod);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void invokeOnEachTrayIcon(final Method method) {
|
|
||||||
Runnable runnable = new Runnable() {
|
Runnable runnable = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
TrayIcon[] icons = target.getTrayIcons();
|
TrayIcon[] icons = target.getTrayIcons();
|
||||||
for (TrayIcon ti : icons) {
|
try {
|
||||||
invokeMethod(method, ti, (Object[]) null);
|
for (TrayIcon ti : icons) {
|
||||||
|
AWTAccessor.getTrayIconAccessor().addNotify(ti);
|
||||||
|
}
|
||||||
|
} catch (AWTException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
invokeOnEachAppContext(runnable);
|
invokeOnEachAppContext(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void invokeMethod(Method method, Object obj, Object[] args) {
|
private void removeTrayPeers() {
|
||||||
try{
|
Runnable runnable = new Runnable() {
|
||||||
method.invoke(obj, args);
|
public void run() {
|
||||||
} catch (InvocationTargetException e){
|
TrayIcon[] icons = target.getTrayIcons();
|
||||||
e.printStackTrace();
|
for (TrayIcon ti : icons) {
|
||||||
} catch (IllegalAccessException e) {
|
AWTAccessor.getTrayIconAccessor().removeNotify(ti);
|
||||||
e.printStackTrace();
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
invokeOnEachAppContext(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void invokeOnEachAppContext(Runnable runnable) {
|
private void invokeOnEachAppContext(Runnable runnable) {
|
||||||
|
@ -1008,8 +1008,10 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
|
|||||||
// loading SystemFlavorMap and associated classes.
|
// loading SystemFlavorMap and associated classes.
|
||||||
public void setTransferHandler(TransferHandler newHandler) {
|
public void setTransferHandler(TransferHandler newHandler) {
|
||||||
TransferHandler oldHandler = (TransferHandler)
|
TransferHandler oldHandler = (TransferHandler)
|
||||||
getClientProperty(XTextTransferHelper.getTransferHandlerKey());
|
getClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
|
||||||
putClientProperty(XTextTransferHelper.getTransferHandlerKey(),
|
.getJComponent_TRANSFER_HANDLER());
|
||||||
|
putClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
|
||||||
|
.getJComponent_TRANSFER_HANDLER(),
|
||||||
newHandler);
|
newHandler);
|
||||||
|
|
||||||
firePropertyChange("transferHandler", oldHandler, newHandler);
|
firePropertyChange("transferHandler", oldHandler, newHandler);
|
||||||
|
@ -691,8 +691,10 @@ public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
|
|||||||
// loading SystemFlavorMap and associated classes.
|
// loading SystemFlavorMap and associated classes.
|
||||||
public void setTransferHandler(TransferHandler newHandler) {
|
public void setTransferHandler(TransferHandler newHandler) {
|
||||||
TransferHandler oldHandler = (TransferHandler)
|
TransferHandler oldHandler = (TransferHandler)
|
||||||
getClientProperty(XTextTransferHelper.getTransferHandlerKey());
|
getClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
|
||||||
putClientProperty(XTextTransferHelper.getTransferHandlerKey(),
|
.getJComponent_TRANSFER_HANDLER());
|
||||||
|
putClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
|
||||||
|
.getJComponent_TRANSFER_HANDLER(),
|
||||||
newHandler);
|
newHandler);
|
||||||
|
|
||||||
firePropertyChange("transferHandler", oldHandler, newHandler);
|
firePropertyChange("transferHandler", oldHandler, newHandler);
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package sun.awt.X11;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
class XTextTransferHelper {
|
|
||||||
private static Object transferHandlerKey = null;
|
|
||||||
static Object getTransferHandlerKey() {
|
|
||||||
if (transferHandlerKey == null) {
|
|
||||||
try {
|
|
||||||
Class clazz = Class.forName("javax.swing.ClientPropertyKey");
|
|
||||||
Field field = SunToolkit.getField(clazz, "JComponent_TRANSFER_HANDLER");
|
|
||||||
transferHandlerKey = field.get(null);
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
return null;
|
|
||||||
} catch (ClassNotFoundException cnfe) {
|
|
||||||
cnfe.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return transferHandlerKey;
|
|
||||||
}
|
|
||||||
}
|
|
@ -41,8 +41,6 @@ import java.awt.im.spi.InputMethodDescriptor;
|
|||||||
import java.awt.image.ColorModel;
|
import java.awt.image.ColorModel;
|
||||||
import java.awt.peer.*;
|
import java.awt.peer.*;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.security.PrivilegedAction;
|
import java.security.PrivilegedAction;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -50,10 +48,10 @@ import javax.swing.LookAndFeel;
|
|||||||
import javax.swing.UIDefaults;
|
import javax.swing.UIDefaults;
|
||||||
import sun.awt.*;
|
import sun.awt.*;
|
||||||
import sun.font.FontConfigManager;
|
import sun.font.FontConfigManager;
|
||||||
import sun.font.FontManager;
|
|
||||||
import sun.java2d.SunGraphicsEnvironment;
|
import sun.java2d.SunGraphicsEnvironment;
|
||||||
import sun.misc.PerformanceLogger;
|
import sun.misc.PerformanceLogger;
|
||||||
import sun.print.PrintJob2D;
|
import sun.print.PrintJob2D;
|
||||||
|
import sun.security.action.GetPropertyAction;
|
||||||
import sun.security.action.GetBooleanAction;
|
import sun.security.action.GetBooleanAction;
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
|
|
||||||
@ -113,7 +111,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
private static volatile int screenWidth = -1, screenHeight = -1; // Dimensions of default screen
|
private static volatile int screenWidth = -1, screenHeight = -1; // Dimensions of default screen
|
||||||
static long awt_defaultFg; // Pixel
|
static long awt_defaultFg; // Pixel
|
||||||
private static XMouseInfoPeer xPeer;
|
private static XMouseInfoPeer xPeer;
|
||||||
private static Method m_removeSourceEvents;
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
initSecurityWarning();
|
initSecurityWarning();
|
||||||
@ -131,8 +128,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
initIDs();
|
initIDs();
|
||||||
setBackingStoreType();
|
setBackingStoreType();
|
||||||
}
|
}
|
||||||
m_removeSourceEvents = SunToolkit.getMethod(EventQueue.class, "removeSourceEvents", new Class[] {Object.class, Boolean.TYPE}) ;
|
|
||||||
|
|
||||||
noisyAwtHandler = AccessController.doPrivileged(new GetBooleanAction("sun.awt.noisyerrorhandler"));
|
noisyAwtHandler = AccessController.doPrivileged(new GetBooleanAction("sun.awt.noisyerrorhandler"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +218,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
|
|
||||||
static void initSecurityWarning() {
|
static void initSecurityWarning() {
|
||||||
// Enable warning only for internal builds
|
// Enable warning only for internal builds
|
||||||
String runtime = getSystemProperty("java.runtime.version");
|
String runtime = AccessController.doPrivileged(
|
||||||
|
new GetPropertyAction("java.runtime.version"));
|
||||||
securityWarningEnabled = (runtime != null && runtime.contains("internal"));
|
securityWarningEnabled = (runtime != null && runtime.contains("internal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1101,8 +1097,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
*/
|
*/
|
||||||
public synchronized static boolean getSunAwtDisableGtkFileDialogs() {
|
public synchronized static boolean getSunAwtDisableGtkFileDialogs() {
|
||||||
if (sunAwtDisableGtkFileDialogs == null) {
|
if (sunAwtDisableGtkFileDialogs == null) {
|
||||||
sunAwtDisableGtkFileDialogs =
|
sunAwtDisableGtkFileDialogs = AccessController.doPrivileged(
|
||||||
getBooleanSystemProperty("sun.awt.disableGtkFileDialogs");
|
new GetBooleanAction("sun.awt.disableGtkFileDialogs"));
|
||||||
}
|
}
|
||||||
return sunAwtDisableGtkFileDialogs.booleanValue();
|
return sunAwtDisableGtkFileDialogs.booleanValue();
|
||||||
}
|
}
|
||||||
@ -2090,17 +2086,11 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void removeSourceEvents(EventQueue queue, Object source, boolean removeAllEvents) {
|
static void removeSourceEvents(EventQueue queue,
|
||||||
try {
|
Object source,
|
||||||
m_removeSourceEvents.invoke(queue, source, removeAllEvents);
|
boolean removeAllEvents) {
|
||||||
}
|
AWTAccessor.getEventQueueAccessor()
|
||||||
catch (IllegalAccessException e)
|
.removeSourceEvents(queue, source, removeAllEvents);
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAlwaysOnTopSupported() {
|
public boolean isAlwaysOnTopSupported() {
|
||||||
|
@ -126,10 +126,6 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
|||||||
native void getWindowBounds(long window, long x, long y, long width, long height);
|
native void getWindowBounds(long window, long x, long y, long width, long height);
|
||||||
private native static void initIDs();
|
private native static void initIDs();
|
||||||
|
|
||||||
private static Field isPostedField;
|
|
||||||
private static Field rawCodeField;
|
|
||||||
private static Field primaryLevelUnicodeField;
|
|
||||||
private static Field extendedKeyCodeField;
|
|
||||||
static {
|
static {
|
||||||
initIDs();
|
initIDs();
|
||||||
}
|
}
|
||||||
@ -398,20 +394,11 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
|||||||
|
|
||||||
static Method m_sendMessage;
|
static Method m_sendMessage;
|
||||||
static void sendEvent(final AWTEvent e) {
|
static void sendEvent(final AWTEvent e) {
|
||||||
if (isPostedField == null) {
|
|
||||||
isPostedField = SunToolkit.getField(AWTEvent.class, "isPosted");
|
|
||||||
}
|
|
||||||
// The uses of this method imply that the incoming event is system-generated
|
// The uses of this method imply that the incoming event is system-generated
|
||||||
SunToolkit.setSystemGenerated(e);
|
SunToolkit.setSystemGenerated(e);
|
||||||
PeerEvent pe = new PeerEvent(Toolkit.getDefaultToolkit(), new Runnable() {
|
PeerEvent pe = new PeerEvent(Toolkit.getDefaultToolkit(), new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
AWTAccessor.getAWTEventAccessor().setPosted(e);
|
||||||
isPostedField.setBoolean(e, true);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
assert(false);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
((Component)e.getSource()).dispatchEvent(e);
|
((Component)e.getSource()).dispatchEvent(e);
|
||||||
}
|
}
|
||||||
}, PeerEvent.ULTIMATE_PRIORITY_EVENT);
|
}, PeerEvent.ULTIMATE_PRIORITY_EVENT);
|
||||||
@ -1428,16 +1415,8 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Field bdata;
|
|
||||||
static void setBData(KeyEvent e, byte[] data) {
|
static void setBData(KeyEvent e, byte[] data) {
|
||||||
try {
|
AWTAccessor.getAWTEventAccessor().setBData(e, data);
|
||||||
if (bdata == null) {
|
|
||||||
bdata = SunToolkit.getField(java.awt.AWTEvent.class, "bdata");
|
|
||||||
}
|
|
||||||
bdata.set(e, data);
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
assert false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postKeyEvent(int id, long when, int keyCode, int keyChar,
|
public void postKeyEvent(int id, long when, int keyCode, int keyChar,
|
||||||
@ -1447,15 +1426,6 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
|||||||
{
|
{
|
||||||
long jWhen = XToolkit.nowMillisUTC_offset(when);
|
long jWhen = XToolkit.nowMillisUTC_offset(when);
|
||||||
int modifiers = getModifiers(state, 0, keyCode);
|
int modifiers = getModifiers(state, 0, keyCode);
|
||||||
if (rawCodeField == null) {
|
|
||||||
rawCodeField = XToolkit.getField(KeyEvent.class, "rawCode");
|
|
||||||
}
|
|
||||||
if (primaryLevelUnicodeField == null) {
|
|
||||||
primaryLevelUnicodeField = XToolkit.getField(KeyEvent.class, "primaryLevelUnicode");
|
|
||||||
}
|
|
||||||
if (extendedKeyCodeField == null) {
|
|
||||||
extendedKeyCodeField = XToolkit.getField(KeyEvent.class, "extendedKeyCode");
|
|
||||||
}
|
|
||||||
|
|
||||||
KeyEvent ke = new KeyEvent((Component)getEventSource(), id, jWhen,
|
KeyEvent ke = new KeyEvent((Component)getEventSource(), id, jWhen,
|
||||||
modifiers, keyCode, (char)keyChar, keyLocation);
|
modifiers, keyCode, (char)keyChar, keyLocation);
|
||||||
@ -1463,15 +1433,11 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
|||||||
byte[] data = Native.toBytes(event, eventSize);
|
byte[] data = Native.toBytes(event, eventSize);
|
||||||
setBData(ke, data);
|
setBData(ke, data);
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
rawCodeField.set(ke, rawCode);
|
AWTAccessor.KeyEventAccessor kea = AWTAccessor.getKeyEventAccessor();
|
||||||
primaryLevelUnicodeField.set(ke, (long)unicodeFromPrimaryKeysym);
|
kea.setRawCode(ke, rawCode);
|
||||||
extendedKeyCodeField.set(ke, (long)extendedKeyCode);
|
kea.setPrimaryLevelUnicode(ke, (long)unicodeFromPrimaryKeysym);
|
||||||
} catch (IllegalArgumentException e) {
|
kea.setExtendedKeyCode(ke, (long)extendedKeyCode);
|
||||||
assert(false);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
postEventToEventQueue(ke);
|
postEventToEventQueue(ke);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ package sun.awt.X11;
|
|||||||
|
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.security.PrivilegedAction;
|
import java.security.PrivilegedAction;
|
||||||
|
import sun.security.action.GetPropertyAction;
|
||||||
import sun.misc.*;
|
import sun.misc.*;
|
||||||
|
|
||||||
final public class XlibWrapper
|
final public class XlibWrapper
|
||||||
@ -590,12 +591,8 @@ static native String XSetLocaleModifiers(String modifier_list);
|
|||||||
static final boolean isBuildInternal;
|
static final boolean isBuildInternal;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
String dataModelProp = (String)AccessController.doPrivileged(
|
String dataModelProp = AccessController.doPrivileged(
|
||||||
new PrivilegedAction() {
|
new GetPropertyAction("sun.arch.data.model"));
|
||||||
public Object run() {
|
|
||||||
return System.getProperty("sun.arch.data.model");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
try {
|
try {
|
||||||
dataModel = Integer.parseInt(dataModelProp);
|
dataModel = Integer.parseInt(dataModelProp);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -647,7 +644,8 @@ static native String XSetLocaleModifiers(String modifier_list);
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean getBuildInternal() {
|
private static boolean getBuildInternal() {
|
||||||
String javaVersion = XToolkit.getSystemProperty("java.version");
|
String javaVersion = AccessController.doPrivileged(
|
||||||
|
new GetPropertyAction("java.version"));
|
||||||
return javaVersion != null && javaVersion.contains("internal");
|
return javaVersion != null && javaVersion.contains("internal");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ package sun.awt.windows;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.peer.*;
|
import java.awt.peer.*;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
import sun.awt.Win32GraphicsDevice;
|
import sun.awt.Win32GraphicsDevice;
|
||||||
import sun.awt.PaintEventDispatcher;
|
import sun.awt.PaintEventDispatcher;
|
||||||
|
@ -39,8 +39,6 @@ import java.awt.event.MouseEvent;
|
|||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.awt.event.MouseMotionListener;
|
import java.awt.event.MouseMotionListener;
|
||||||
|
|
||||||
import java.lang.reflect.*;
|
|
||||||
|
|
||||||
import sun.awt.dnd.SunDragSourceContextPeer;
|
import sun.awt.dnd.SunDragSourceContextPeer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,9 +26,7 @@ package sun.awt.windows;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.peer.*;
|
import java.awt.peer.*;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
import sun.awt.AWTAccessor;
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
public class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
|
public class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
|
||||||
|
@ -31,8 +31,6 @@ import java.awt.peer.*;
|
|||||||
|
|
||||||
import java.beans.*;
|
import java.beans.*;
|
||||||
|
|
||||||
import java.lang.reflect.*;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user