8031090: [macosx] LWToolkit should not depends from the macosx
Reviewed-by: anthony, pchelko
This commit is contained in:
parent
0d1b63f4cb
commit
b9b2db0eea
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, 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
|
||||||
@ -28,18 +28,17 @@ package sun.lwawt;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.List;
|
import java.awt.List;
|
||||||
import java.awt.datatransfer.*;
|
import java.awt.datatransfer.*;
|
||||||
import java.awt.dnd.*;
|
|
||||||
import java.awt.dnd.peer.*;
|
|
||||||
import java.awt.image.*;
|
import java.awt.image.*;
|
||||||
import java.awt.peer.*;
|
import java.awt.peer.*;
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import sun.awt.*;
|
import sun.awt.*;
|
||||||
import sun.lwawt.macosx.*;
|
|
||||||
import sun.print.*;
|
import sun.print.*;
|
||||||
import sun.security.util.SecurityConstants;
|
import sun.security.util.SecurityConstants;
|
||||||
|
|
||||||
|
import static sun.lwawt.LWWindowPeer.PeerType;
|
||||||
|
|
||||||
public abstract class LWToolkit extends SunToolkit implements Runnable {
|
public abstract class LWToolkit extends SunToolkit implements Runnable {
|
||||||
|
|
||||||
private final static int STATE_NONE = 0;
|
private final static int STATE_NONE = 0;
|
||||||
@ -115,7 +114,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
/*
|
/*
|
||||||
* Sends a request to stop the message pump.
|
* Sends a request to stop the message pump.
|
||||||
*/
|
*/
|
||||||
public void shutdown() {
|
public final void shutdown() {
|
||||||
setRunState(STATE_SHUTDOWN);
|
setRunState(STATE_SHUTDOWN);
|
||||||
platformShutdown();
|
platformShutdown();
|
||||||
}
|
}
|
||||||
@ -146,7 +145,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
notifyAll();
|
notifyAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTerminating() {
|
public final boolean isTerminating() {
|
||||||
return getRunState() >= STATE_SHUTDOWN;
|
return getRunState() >= STATE_SHUTDOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +162,8 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
@Override
|
||||||
|
public final void run() {
|
||||||
setRunState(STATE_INIT);
|
setRunState(STATE_INIT);
|
||||||
platformInit();
|
platformInit();
|
||||||
AWTAutoShutdown.notifyToolkitThreadFree();
|
AWTAutoShutdown.notifyToolkitThreadFree();
|
||||||
@ -215,80 +215,51 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
* Note that LWWindowPeer implements WindowPeer, FramePeer
|
* Note that LWWindowPeer implements WindowPeer, FramePeer
|
||||||
* and DialogPeer interfaces.
|
* and DialogPeer interfaces.
|
||||||
*/
|
*/
|
||||||
private LWWindowPeer createDelegatedPeer(Window target, PlatformComponent platformComponent,
|
protected LWWindowPeer createDelegatedPeer(Window target,
|
||||||
PlatformWindow platformWindow, LWWindowPeer.PeerType peerType)
|
PlatformComponent platformComponent,
|
||||||
{
|
PlatformWindow platformWindow,
|
||||||
|
PeerType peerType) {
|
||||||
LWWindowPeer peer = new LWWindowPeer(target, platformComponent, platformWindow, peerType);
|
LWWindowPeer peer = new LWWindowPeer(target, platformComponent, platformWindow, peerType);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
peer.initialize();
|
peer.initialize();
|
||||||
return peer;
|
return peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LWLightweightFramePeer createDelegatedLwPeer(LightweightFrame target,
|
@Override
|
||||||
PlatformComponent platformComponent,
|
public final FramePeer createLightweightFrame(LightweightFrame target) {
|
||||||
PlatformWindow platformWindow)
|
PlatformComponent platformComponent = createLwPlatformComponent();
|
||||||
{
|
PlatformWindow platformWindow = createPlatformWindow(PeerType.LW_FRAME);
|
||||||
LWLightweightFramePeer peer = new LWLightweightFramePeer(target, platformComponent, platformWindow);
|
LWLightweightFramePeer peer = new LWLightweightFramePeer(target,
|
||||||
|
platformComponent,
|
||||||
|
platformWindow);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
peer.initialize();
|
peer.initialize();
|
||||||
return peer;
|
return peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FramePeer createLightweightFrame(LightweightFrame target) {
|
public final WindowPeer createWindow(Window target) {
|
||||||
PlatformComponent platformComponent = createLwPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.LW_FRAME);
|
PlatformWindow platformWindow = createPlatformWindow(PeerType.SIMPLEWINDOW);
|
||||||
return createDelegatedLwPeer(target, platformComponent, platformWindow);
|
return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.SIMPLEWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WindowPeer createWindow(Window target) {
|
public final FramePeer createFrame(Frame target) {
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.SIMPLEWINDOW);
|
PlatformWindow platformWindow = createPlatformWindow(PeerType.FRAME);
|
||||||
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.SIMPLEWINDOW);
|
return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.FRAME);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FramePeer createFrame(Frame target) {
|
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
|
||||||
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.FRAME);
|
|
||||||
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.FRAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LWWindowPeer createEmbeddedFrame(CEmbeddedFrame target) {
|
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
|
||||||
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.EMBEDDED_FRAME);
|
|
||||||
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.EMBEDDED_FRAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LWWindowPeer createEmbeddedFrame(CViewEmbeddedFrame target) {
|
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
|
||||||
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.VIEW_EMBEDDED_FRAME);
|
|
||||||
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.VIEW_EMBEDDED_FRAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CPrinterDialogPeer createCPrinterDialog(CPrinterDialog target) {
|
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
|
||||||
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG);
|
|
||||||
CPrinterDialogPeer peer = new CPrinterDialogPeer(target, platformComponent, platformWindow);
|
|
||||||
targetCreatedPeer(target, peer);
|
|
||||||
return peer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DialogPeer createDialog(Dialog target) {
|
public DialogPeer createDialog(Dialog target) {
|
||||||
if (target instanceof CPrinterDialog) {
|
|
||||||
return createCPrinterDialog((CPrinterDialog)target);
|
|
||||||
}
|
|
||||||
|
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG);
|
PlatformWindow platformWindow = createPlatformWindow(PeerType.DIALOG);
|
||||||
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.DIALOG);
|
return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.DIALOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileDialogPeer createFileDialog(FileDialog target) {
|
public final FileDialogPeer createFileDialog(FileDialog target) {
|
||||||
FileDialogPeer peer = createFileDialogPeer(target);
|
FileDialogPeer peer = createFileDialogPeer(target);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
return peer;
|
return peer;
|
||||||
@ -297,7 +268,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
// ---- LIGHTWEIGHT COMPONENT PEERS ---- //
|
// ---- LIGHTWEIGHT COMPONENT PEERS ---- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ButtonPeer createButton(Button target) {
|
public final ButtonPeer createButton(Button target) {
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
LWButtonPeer peer = new LWButtonPeer(target, platformComponent);
|
LWButtonPeer peer = new LWButtonPeer(target, platformComponent);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
@ -306,7 +277,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CheckboxPeer createCheckbox(Checkbox target) {
|
public final CheckboxPeer createCheckbox(Checkbox target) {
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
LWCheckboxPeer peer = new LWCheckboxPeer(target, platformComponent);
|
LWCheckboxPeer peer = new LWCheckboxPeer(target, platformComponent);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
@ -315,12 +286,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) {
|
public final ChoicePeer createChoice(Choice target) {
|
||||||
throw new RuntimeException("not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChoicePeer createChoice(Choice target) {
|
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
LWChoicePeer peer = new LWChoicePeer(target, platformComponent);
|
LWChoicePeer peer = new LWChoicePeer(target, platformComponent);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
@ -329,7 +295,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LabelPeer createLabel(Label target) {
|
public final LabelPeer createLabel(Label target) {
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
LWLabelPeer peer = new LWLabelPeer(target, platformComponent);
|
LWLabelPeer peer = new LWLabelPeer(target, platformComponent);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
@ -338,7 +304,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CanvasPeer createCanvas(Canvas target) {
|
public final CanvasPeer createCanvas(Canvas target) {
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
LWCanvasPeer<?, ?> peer = new LWCanvasPeer<>(target, platformComponent);
|
LWCanvasPeer<?, ?> peer = new LWCanvasPeer<>(target, platformComponent);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
@ -347,7 +313,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListPeer createList(List target) {
|
public final ListPeer createList(List target) {
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
LWListPeer peer = new LWListPeer(target, platformComponent);
|
LWListPeer peer = new LWListPeer(target, platformComponent);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
@ -356,22 +322,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MenuPeer createMenu(Menu target) {
|
public final PanelPeer createPanel(Panel target) {
|
||||||
throw new RuntimeException("not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MenuBarPeer createMenuBar(MenuBar target) {
|
|
||||||
throw new RuntimeException("not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MenuItemPeer createMenuItem(MenuItem target) {
|
|
||||||
throw new RuntimeException("not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PanelPeer createPanel(Panel target) {
|
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
LWPanelPeer peer = new LWPanelPeer(target, platformComponent);
|
LWPanelPeer peer = new LWPanelPeer(target, platformComponent);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
@ -380,12 +331,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PopupMenuPeer createPopupMenu(PopupMenu target) {
|
public final ScrollPanePeer createScrollPane(ScrollPane target) {
|
||||||
throw new RuntimeException("not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ScrollPanePeer createScrollPane(ScrollPane target) {
|
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
LWScrollPanePeer peer = new LWScrollPanePeer(target, platformComponent);
|
LWScrollPanePeer peer = new LWScrollPanePeer(target, platformComponent);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
@ -394,7 +340,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScrollbarPeer createScrollbar(Scrollbar target) {
|
public final ScrollbarPeer createScrollbar(Scrollbar target) {
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
LWScrollBarPeer peer = new LWScrollBarPeer(target, platformComponent);
|
LWScrollBarPeer peer = new LWScrollBarPeer(target, platformComponent);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
@ -403,7 +349,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextAreaPeer createTextArea(TextArea target) {
|
public final TextAreaPeer createTextArea(TextArea target) {
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
LWTextAreaPeer peer = new LWTextAreaPeer(target, platformComponent);
|
LWTextAreaPeer peer = new LWTextAreaPeer(target, platformComponent);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
@ -412,7 +358,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextFieldPeer createTextField(TextField target) {
|
public final TextFieldPeer createTextField(TextField target) {
|
||||||
PlatformComponent platformComponent = createPlatformComponent();
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
LWTextFieldPeer peer = new LWTextFieldPeer(target, platformComponent);
|
LWTextFieldPeer peer = new LWTextFieldPeer(target, platformComponent);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
@ -423,56 +369,51 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
// ---- NON-COMPONENT PEERS ---- //
|
// ---- NON-COMPONENT PEERS ---- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ColorModel getColorModel() throws HeadlessException {
|
public final ColorModel getColorModel() throws HeadlessException {
|
||||||
return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getColorModel();
|
return GraphicsEnvironment.getLocalGraphicsEnvironment()
|
||||||
|
.getDefaultScreenDevice()
|
||||||
|
.getDefaultConfiguration().getColorModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDesktopSupported() {
|
public final boolean isDesktopSupported() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DesktopPeer createDesktopPeer(Desktop target) {
|
public final KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {
|
||||||
return new CDesktopPeer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) {
|
|
||||||
DragSourceContextPeer dscp = CDragSourceContextPeer.createDragSourceContextPeer(dge);
|
|
||||||
|
|
||||||
return dscp;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {
|
|
||||||
return LWKeyboardFocusManagerPeer.getInstance();
|
return LWKeyboardFocusManagerPeer.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized MouseInfoPeer getMouseInfoPeer() {
|
public final synchronized MouseInfoPeer getMouseInfoPeer() {
|
||||||
if (mouseInfoPeer == null) {
|
if (mouseInfoPeer == null) {
|
||||||
mouseInfoPeer = createMouseInfoPeerImpl();
|
mouseInfoPeer = createMouseInfoPeerImpl();
|
||||||
}
|
}
|
||||||
return mouseInfoPeer;
|
return mouseInfoPeer;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MouseInfoPeer createMouseInfoPeerImpl() {
|
protected final MouseInfoPeer createMouseInfoPeerImpl() {
|
||||||
return new LWMouseInfoPeer();
|
return new LWMouseInfoPeer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrintJob getPrintJob(Frame frame, String doctitle, Properties props) {
|
@Override
|
||||||
|
public final PrintJob getPrintJob(Frame frame, String doctitle,
|
||||||
|
Properties props) {
|
||||||
return getPrintJob(frame, doctitle, null, null);
|
return getPrintJob(frame, doctitle, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrintJob getPrintJob(Frame frame, String doctitle, JobAttributes jobAttributes, PageAttributes pageAttributes) {
|
@Override
|
||||||
|
public final PrintJob getPrintJob(Frame frame, String doctitle,
|
||||||
|
JobAttributes jobAttributes,
|
||||||
|
PageAttributes pageAttributes) {
|
||||||
if (GraphicsEnvironment.isHeadless()) {
|
if (GraphicsEnvironment.isHeadless()) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintJob2D printJob = new PrintJob2D(frame, doctitle, jobAttributes, pageAttributes);
|
PrintJob2D printJob = new PrintJob2D(frame, doctitle, jobAttributes, pageAttributes);
|
||||||
|
|
||||||
if (printJob.printDialog() == false) {
|
if (!printJob.printDialog()) {
|
||||||
printJob = null;
|
printJob = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,27 +421,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
|
public final Clipboard getSystemClipboard() {
|
||||||
throw new RuntimeException("not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isTraySupported() {
|
|
||||||
throw new RuntimeException("not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SystemTrayPeer createSystemTray(SystemTray target) {
|
|
||||||
throw new RuntimeException("not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TrayIconPeer createTrayIcon(TrayIcon target) {
|
|
||||||
throw new RuntimeException("not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Clipboard getSystemClipboard() {
|
|
||||||
SecurityManager security = System.getSecurityManager();
|
SecurityManager security = System.getSecurityManager();
|
||||||
if (security != null) {
|
if (security != null) {
|
||||||
security.checkPermission(SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION);
|
security.checkPermission(SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION);
|
||||||
@ -514,7 +435,8 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
return clipboard;
|
return clipboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer);
|
protected abstract SecurityWarningWindow createSecurityWarning(
|
||||||
|
Window ownerWindow, LWWindowPeer ownerPeer);
|
||||||
|
|
||||||
// ---- DELEGATES ---- //
|
// ---- DELEGATES ---- //
|
||||||
|
|
||||||
@ -523,7 +445,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
/*
|
/*
|
||||||
* Creates a delegate for the given peer type (window, frame, dialog, etc.)
|
* Creates a delegate for the given peer type (window, frame, dialog, etc.)
|
||||||
*/
|
*/
|
||||||
protected abstract PlatformWindow createPlatformWindow(LWWindowPeer.PeerType peerType);
|
protected abstract PlatformWindow createPlatformWindow(PeerType peerType);
|
||||||
|
|
||||||
protected abstract PlatformComponent createPlatformComponent();
|
protected abstract PlatformComponent createPlatformComponent();
|
||||||
|
|
||||||
@ -557,7 +479,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void grab(final Window w) {
|
public final void grab(final Window w) {
|
||||||
final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
|
final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
|
||||||
if (peer != null) {
|
if (peer != null) {
|
||||||
((LWWindowPeer) peer).grab();
|
((LWWindowPeer) peer).grab();
|
||||||
@ -565,7 +487,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ungrab(final Window w) {
|
public final void ungrab(final Window w) {
|
||||||
final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
|
final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
|
||||||
if (peer != null) {
|
if (peer != null) {
|
||||||
((LWWindowPeer) peer).ungrab(false);
|
((LWWindowPeer) peer).ungrab(false);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, 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
|
||||||
@ -23,17 +23,15 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package sun.lwawt.macosx;
|
package sun.lwawt.macosx;
|
||||||
|
|
||||||
import sun.lwawt.LWToolkit;
|
import java.awt.AWTKeyStroke;
|
||||||
import sun.lwawt.LWWindowPeer;
|
import java.awt.Point;
|
||||||
import sun.lwawt.macosx.CocoaConstants;
|
import java.awt.Toolkit;
|
||||||
import sun.lwawt.macosx.event.NSEvent;
|
|
||||||
|
|
||||||
import sun.awt.EmbeddedFrame;
|
import sun.awt.EmbeddedFrame;
|
||||||
|
import sun.lwawt.LWWindowPeer;
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.*;
|
|
||||||
|
|
||||||
public class CEmbeddedFrame extends EmbeddedFrame {
|
public class CEmbeddedFrame extends EmbeddedFrame {
|
||||||
|
|
||||||
@ -48,7 +46,7 @@ public class CEmbeddedFrame extends EmbeddedFrame {
|
|||||||
|
|
||||||
public void addNotify() {
|
public void addNotify() {
|
||||||
if (getPeer() == null) {
|
if (getPeer() == null) {
|
||||||
LWToolkit toolkit = (LWToolkit)Toolkit.getDefaultToolkit();
|
LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
|
||||||
LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
|
LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
|
||||||
setPeer(peer);
|
setPeer(peer);
|
||||||
responder = new CPlatformResponder(peer, true);
|
responder = new CPlatformResponder(peer, true);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, 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
|
||||||
@ -22,14 +22,17 @@
|
|||||||
* or visit www.oracle.com if you need additional information or have any
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package sun.lwawt.macosx;
|
package sun.lwawt.macosx;
|
||||||
|
|
||||||
import java.awt.AWTKeyStroke;
|
import java.awt.AWTKeyStroke;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
import sun.awt.EmbeddedFrame;
|
import sun.awt.EmbeddedFrame;
|
||||||
import sun.lwawt.LWToolkit;
|
|
||||||
import sun.lwawt.LWWindowPeer;
|
import sun.lwawt.LWWindowPeer;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The CViewEmbeddedFrame class is used in the SWT_AWT bridge.
|
* The CViewEmbeddedFrame class is used in the SWT_AWT bridge.
|
||||||
* This is a part of public API and should not be renamed or moved
|
* This is a part of public API and should not be renamed or moved
|
||||||
@ -48,7 +51,7 @@ public class CViewEmbeddedFrame extends EmbeddedFrame {
|
|||||||
@Override
|
@Override
|
||||||
public void addNotify() {
|
public void addNotify() {
|
||||||
if (getPeer() == null) {
|
if (getPeer() == null) {
|
||||||
LWToolkit toolkit = (LWToolkit) Toolkit.getDefaultToolkit();
|
LWCToolkit toolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
|
||||||
setPeer(toolkit.createEmbeddedFrame(this));
|
setPeer(toolkit.createEmbeddedFrame(this));
|
||||||
}
|
}
|
||||||
super.addNotify();
|
super.addNotify();
|
||||||
|
@ -33,6 +33,7 @@ import java.awt.event.InputEvent;
|
|||||||
import java.awt.event.InvocationEvent;
|
import java.awt.event.InvocationEvent;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.im.InputMethodHighlight;
|
import java.awt.im.InputMethodHighlight;
|
||||||
|
import java.awt.im.spi.InputMethodDescriptor;
|
||||||
import java.awt.peer.*;
|
import java.awt.peer.*;
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@ -50,7 +51,7 @@ import sun.awt.image.MultiResolutionImage;
|
|||||||
|
|
||||||
import sun.util.CoreResourceBundleControl;
|
import sun.util.CoreResourceBundleControl;
|
||||||
|
|
||||||
class NamedCursor extends Cursor {
|
final class NamedCursor extends Cursor {
|
||||||
NamedCursor(String name) {
|
NamedCursor(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
@ -76,6 +77,7 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
|
|
||||||
ResourceBundle platformResources = java.security.AccessController.doPrivileged(
|
ResourceBundle platformResources = java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<ResourceBundle>() {
|
new java.security.PrivilegedAction<ResourceBundle>() {
|
||||||
|
@Override
|
||||||
public ResourceBundle run() {
|
public ResourceBundle run() {
|
||||||
ResourceBundle platformResources = null;
|
ResourceBundle platformResources = null;
|
||||||
try {
|
try {
|
||||||
@ -133,18 +135,20 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
|
|
||||||
private native void loadNativeColors(final int[] systemColors, final int[] appleColors);
|
private native void loadNativeColors(final int[] systemColors, final int[] appleColors);
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void loadSystemColors(final int[] systemColors) {
|
protected void loadSystemColors(final int[] systemColors) {
|
||||||
if (systemColors == null) return;
|
if (systemColors == null) return;
|
||||||
loadNativeColors(systemColors, appleColors);
|
loadNativeColors(systemColors, appleColors);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class AppleSpecificColor extends Color {
|
private static class AppleSpecificColor extends Color {
|
||||||
int index;
|
private final int index;
|
||||||
public AppleSpecificColor(int index) {
|
AppleSpecificColor(int index) {
|
||||||
super(appleColors[index]);
|
super(appleColors[index]);
|
||||||
this.index = index;
|
this.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getRGB() {
|
public int getRGB() {
|
||||||
return appleColors[index];
|
return appleColors[index];
|
||||||
}
|
}
|
||||||
@ -152,7 +156,6 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns Apple specific colors that we may expose going forward.
|
* Returns Apple specific colors that we may expose going forward.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static Color getAppleColor(int color) {
|
public static Color getAppleColor(int color) {
|
||||||
return new AppleSpecificColor(color);
|
return new AppleSpecificColor(color);
|
||||||
@ -192,13 +195,44 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
} else if (peerType == PeerType.LW_FRAME) {
|
} else if (peerType == PeerType.LW_FRAME) {
|
||||||
return new CPlatformLWWindow();
|
return new CPlatformLWWindow();
|
||||||
} else {
|
} else {
|
||||||
assert (peerType == PeerType.SIMPLEWINDOW || peerType == PeerType.DIALOG || peerType == PeerType.FRAME);
|
assert (peerType == PeerType.SIMPLEWINDOW
|
||||||
|
|| peerType == PeerType.DIALOG
|
||||||
|
|| peerType == PeerType.FRAME);
|
||||||
return new CPlatformWindow();
|
return new CPlatformWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LWWindowPeer createEmbeddedFrame(CEmbeddedFrame target) {
|
||||||
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
|
PlatformWindow platformWindow = createPlatformWindow(PeerType.EMBEDDED_FRAME);
|
||||||
|
return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.EMBEDDED_FRAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
LWWindowPeer createEmbeddedFrame(CViewEmbeddedFrame target) {
|
||||||
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
|
PlatformWindow platformWindow = createPlatformWindow(PeerType.VIEW_EMBEDDED_FRAME);
|
||||||
|
return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.VIEW_EMBEDDED_FRAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CPrinterDialogPeer createCPrinterDialog(CPrinterDialog target) {
|
||||||
|
PlatformComponent platformComponent = createPlatformComponent();
|
||||||
|
PlatformWindow platformWindow = createPlatformWindow(PeerType.DIALOG);
|
||||||
|
CPrinterDialogPeer peer = new CPrinterDialogPeer(target, platformComponent, platformWindow);
|
||||||
|
targetCreatedPeer(target, peer);
|
||||||
|
return peer;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer) {
|
public DialogPeer createDialog(Dialog target) {
|
||||||
|
if (target instanceof CPrinterDialog) {
|
||||||
|
return createCPrinterDialog((CPrinterDialog)target);
|
||||||
|
}
|
||||||
|
return super.createDialog(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SecurityWarningWindow createSecurityWarning(Window ownerWindow,
|
||||||
|
LWWindowPeer ownerPeer) {
|
||||||
return new CWarningWindow(ownerWindow, ownerPeer);
|
return new CWarningWindow(ownerWindow, ownerPeer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,13 +284,11 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
PopupMenuPeer peer = new CPopupMenu(target);
|
PopupMenuPeer peer = new CPopupMenu(target);
|
||||||
targetCreatedPeer(target, peer);
|
targetCreatedPeer(target, peer);
|
||||||
return peer;
|
return peer;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SystemTrayPeer createSystemTray(SystemTray target) {
|
public SystemTrayPeer createSystemTray(SystemTray target) {
|
||||||
SystemTrayPeer peer = new CSystemTray();
|
return new CSystemTray();
|
||||||
return peer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -266,57 +298,64 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
return peer;
|
return peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DesktopPeer createDesktopPeer(Desktop target) {
|
||||||
|
return new CDesktopPeer();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LWCursorManager getCursorManager() {
|
public LWCursorManager getCursorManager() {
|
||||||
return CCursorManager.getInstance();
|
return CCursorManager.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Cursor createCustomCursor(final Image cursor, final Point hotSpot, final String name) throws IndexOutOfBoundsException, HeadlessException {
|
public Cursor createCustomCursor(final Image cursor, final Point hotSpot,
|
||||||
|
final String name)
|
||||||
|
throws IndexOutOfBoundsException, HeadlessException {
|
||||||
return new CCustomCursor(cursor, hotSpot, name);
|
return new CCustomCursor(cursor, hotSpot, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dimension getBestCursorSize(final int preferredWidth, final int preferredHeight) throws HeadlessException {
|
public Dimension getBestCursorSize(final int preferredWidth,
|
||||||
|
final int preferredHeight)
|
||||||
|
throws HeadlessException {
|
||||||
return CCustomCursor.getBestCursorSize(preferredWidth, preferredHeight);
|
return CCustomCursor.getBestCursorSize(preferredWidth, preferredHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void platformCleanup() {
|
protected void platformCleanup() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void platformInit() {
|
protected void platformInit() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void platformRunMessage() {
|
protected void platformRunMessage() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void platformShutdown() {
|
protected void platformShutdown() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class OSXPlatformFont extends sun.awt.PlatformFont
|
class OSXPlatformFont extends sun.awt.PlatformFont
|
||||||
{
|
{
|
||||||
public OSXPlatformFont(String name, int style)
|
OSXPlatformFont(String name, int style)
|
||||||
{
|
{
|
||||||
super(name, style);
|
super(name, style);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
protected char getMissingGlyphCharacter()
|
protected char getMissingGlyphCharacter()
|
||||||
{
|
{
|
||||||
// Follow up for real implementation
|
// Follow up for real implementation
|
||||||
return (char)0xfff8; // see http://developer.apple.com/fonts/LastResortFont/
|
return (char)0xfff8; // see http://developer.apple.com/fonts/LastResortFont/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public FontPeer getFontPeer(String name, int style) {
|
public FontPeer getFontPeer(String name, int style) {
|
||||||
return new OSXPlatformFont(name, style);
|
return new OSXPlatformFont(name, style);
|
||||||
}
|
}
|
||||||
@ -336,7 +375,7 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
@Override
|
@Override
|
||||||
protected void initializeDesktopProperties() {
|
protected void initializeDesktopProperties() {
|
||||||
super.initializeDesktopProperties();
|
super.initializeDesktopProperties();
|
||||||
Map <Object, Object> fontHints = new HashMap<Object, Object>();
|
Map <Object, Object> fontHints = new HashMap<>();
|
||||||
fontHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
fontHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||||
desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, fontHints);
|
desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, fontHints);
|
||||||
@ -357,14 +396,8 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
desktopProperties.put("DnD.Cursor.CopyNoDrop", new NamedCursor("DnD.Cursor.CopyNoDrop"));
|
desktopProperties.put("DnD.Cursor.CopyNoDrop", new NamedCursor("DnD.Cursor.CopyNoDrop"));
|
||||||
desktopProperties.put("DnD.Cursor.MoveNoDrop", new NamedCursor("DnD.Cursor.MoveNoDrop"));
|
desktopProperties.put("DnD.Cursor.MoveNoDrop", new NamedCursor("DnD.Cursor.MoveNoDrop"));
|
||||||
desktopProperties.put("DnD.Cursor.LinkNoDrop", new NamedCursor("DnD.Cursor.LinkNoDrop"));
|
desktopProperties.put("DnD.Cursor.LinkNoDrop", new NamedCursor("DnD.Cursor.LinkNoDrop"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The method returns true if some events were processed during that timeout.
|
|
||||||
* @see sun.awt.SunToolkit#syncNativeQueue(long)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean syncNativeQueue(long timeout) {
|
protected boolean syncNativeQueue(long timeout) {
|
||||||
return nativeSyncQueue(timeout);
|
return nativeSyncQueue(timeout);
|
||||||
@ -388,7 +421,6 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
@Override
|
@Override
|
||||||
public void sync() {
|
public void sync() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -408,6 +440,7 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
* as Num Lock on PC keyboards is called Clear, doesn't lock
|
* as Num Lock on PC keyboards is called Clear, doesn't lock
|
||||||
* anything and is used for entirely different purpose.
|
* anything and is used for entirely different purpose.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException {
|
public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException {
|
||||||
switch (keyCode) {
|
switch (keyCode) {
|
||||||
case KeyEvent.VK_NUM_LOCK:
|
case KeyEvent.VK_NUM_LOCK:
|
||||||
@ -427,10 +460,12 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
//Set to true by default.
|
//Set to true by default.
|
||||||
private static boolean areExtraMouseButtonsEnabled = true;
|
private static boolean areExtraMouseButtonsEnabled = true;
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
|
public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
|
||||||
return areExtraMouseButtonsEnabled;
|
return areExtraMouseButtonsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getNumberOfButtons(){
|
public int getNumberOfButtons(){
|
||||||
return BUTTONS;
|
return BUTTONS;
|
||||||
}
|
}
|
||||||
@ -489,6 +524,7 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
* @see java.awt.MenuShortcut
|
* @see java.awt.MenuShortcut
|
||||||
* @since JDK1.1
|
* @since JDK1.1
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getMenuShortcutKeyMask() {
|
public int getMenuShortcutKeyMask() {
|
||||||
return Event.META_MASK;
|
return Event.META_MASK;
|
||||||
}
|
}
|
||||||
@ -522,8 +558,8 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
? getImageWithResolutionVariant(url, url2x) : super.getImage(url);
|
? getImageWithResolutionVariant(url, url2x) : super.getImage(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
static final String nsImagePrefix = "NSImage://";
|
private static final String nsImagePrefix = "NSImage://";
|
||||||
protected Image checkForNSImage(final String imageName) {
|
private Image checkForNSImage(final String imageName) {
|
||||||
if (imageName == null) return null;
|
if (imageName == null) return null;
|
||||||
if (!imageName.startsWith(nsImagePrefix)) return null;
|
if (!imageName.startsWith(nsImagePrefix)) return null;
|
||||||
return CImage.getCreator().createImageFromName(imageName.substring(nsImagePrefix.length()));
|
return CImage.getCreator().createImageFromName(imageName.substring(nsImagePrefix.length()));
|
||||||
@ -542,8 +578,9 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
synchronized(ret) { return ret[0]; }
|
synchronized(ret) { return ret[0]; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T invokeAndWait(final Callable<T> callable, Component component) throws Exception {
|
public static <T> T invokeAndWait(final Callable<T> callable,
|
||||||
final CallableWrapper<T> wrapper = new CallableWrapper<T>(callable);
|
Component component) throws Exception {
|
||||||
|
final CallableWrapper<T> wrapper = new CallableWrapper<>(callable);
|
||||||
invokeAndWait(wrapper, component);
|
invokeAndWait(wrapper, component);
|
||||||
return wrapper.getResult();
|
return wrapper.getResult();
|
||||||
}
|
}
|
||||||
@ -553,10 +590,11 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
T object;
|
T object;
|
||||||
Exception e;
|
Exception e;
|
||||||
|
|
||||||
public CallableWrapper(final Callable<T> callable) {
|
CallableWrapper(final Callable<T> callable) {
|
||||||
this.callable = callable;
|
this.callable = callable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
object = callable.call();
|
object = callable.call();
|
||||||
@ -571,12 +609,16 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kicks an event over to the appropriate eventqueue and waits for it to finish
|
/**
|
||||||
// To avoid deadlocking, we manually run the NSRunLoop while waiting
|
* Kicks an event over to the appropriate eventqueue and waits for it to
|
||||||
// Any selector invoked using ThreadUtilities performOnMainThread will be processed in doAWTRunLoop
|
* finish To avoid deadlocking, we manually run the NSRunLoop while waiting
|
||||||
// The InvocationEvent will call LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual runloop
|
* Any selector invoked using ThreadUtilities performOnMainThread will be
|
||||||
// Does not dispatch native events while in the loop
|
* processed in doAWTRunLoop The InvocationEvent will call
|
||||||
public static void invokeAndWait(Runnable runnable, Component component) throws InvocationTargetException {
|
* LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual
|
||||||
|
* runloop Does not dispatch native events while in the loop
|
||||||
|
*/
|
||||||
|
public static void invokeAndWait(Runnable runnable, Component component)
|
||||||
|
throws InvocationTargetException {
|
||||||
final long mediator = createAWTRunLoopMediator();
|
final long mediator = createAWTRunLoopMediator();
|
||||||
|
|
||||||
InvocationEvent invocationEvent =
|
InvocationEvent invocationEvent =
|
||||||
@ -611,7 +653,8 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void invokeLater(Runnable event, Component component) throws InvocationTargetException {
|
public static void invokeLater(Runnable event, Component component)
|
||||||
|
throws InvocationTargetException {
|
||||||
final InvocationEvent invocationEvent =
|
final InvocationEvent invocationEvent =
|
||||||
new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event);
|
new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event);
|
||||||
|
|
||||||
@ -640,16 +683,18 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
return getSystemEventQueueImpl();
|
return getSystemEventQueueImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// DnD support
|
// DnD support
|
||||||
|
|
||||||
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
|
@Override
|
||||||
DragSourceContextPeer dscp = CDragSourceContextPeer.createDragSourceContextPeer(dge);
|
public DragSourceContextPeer createDragSourceContextPeer(
|
||||||
|
DragGestureEvent dge) throws InvalidDnDOperationException {
|
||||||
return dscp;
|
return CDragSourceContextPeer.createDragSourceContextPeer(dge);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends DragGestureRecognizer> T createDragGestureRecognizer(Class<T> abstractRecognizerClass, DragSource ds, Component c, int srcActions, DragGestureListener dgl) {
|
@Override
|
||||||
|
public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
|
||||||
|
Class<T> abstractRecognizerClass, DragSource ds, Component c,
|
||||||
|
int srcActions, DragGestureListener dgl) {
|
||||||
DragGestureRecognizer dgr = null;
|
DragGestureRecognizer dgr = null;
|
||||||
|
|
||||||
// Create a new mouse drag gesture recognizer if we have a class match:
|
// Create a new mouse drag gesture recognizer if we have a class match:
|
||||||
@ -663,6 +708,7 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
/**
|
/**
|
||||||
* Returns the default keyboard locale of the underlying operating system
|
* Returns the default keyboard locale of the underlying operating system
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Locale getDefaultKeyboardLocale() {
|
public Locale getDefaultKeyboardLocale() {
|
||||||
Locale locale = CInputMethod.getNativeLocale();
|
Locale locale = CInputMethod.getNativeLocale();
|
||||||
|
|
||||||
@ -673,7 +719,8 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
return locale;
|
return locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.awt.im.spi.InputMethodDescriptor getInputMethodAdapterDescriptor() {
|
@Override
|
||||||
|
public InputMethodDescriptor getInputMethodAdapterDescriptor() {
|
||||||
if (sInputMethodDescriptor == null)
|
if (sInputMethodDescriptor == null)
|
||||||
sInputMethodDescriptor = new CInputMethodDescriptor();
|
sInputMethodDescriptor = new CInputMethodDescriptor();
|
||||||
|
|
||||||
@ -689,12 +736,14 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
* @return style attribute map, or null
|
* @return style attribute map, or null
|
||||||
* @since 1.3
|
* @since 1.3
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Map mapInputMethodHighlight(InputMethodHighlight highlight) {
|
public Map mapInputMethodHighlight(InputMethodHighlight highlight) {
|
||||||
return CInputMethod.mapInputMethodHighlight(highlight);
|
return CInputMethod.mapInputMethodHighlight(highlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns key modifiers used by Swing to set up a focus accelerator key stroke.
|
* Returns key modifiers used by Swing to set up a focus accelerator key
|
||||||
|
* stroke.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getFocusAcceleratorKeyMask() {
|
public int getFocusAcceleratorKeyMask() {
|
||||||
@ -702,8 +751,8 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether specified key modifiers mask can be used to enter a printable
|
* Tests whether specified key modifiers mask can be used to enter a
|
||||||
* character.
|
* printable character.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isPrintableCharacterModifiersMask(int mods) {
|
public boolean isPrintableCharacterModifiersMask(int mods) {
|
||||||
@ -724,15 +773,14 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
* Returns the value of "sun.awt.disableCALayers" property. Default
|
* Returns the value of "sun.awt.disableCALayers" property. Default
|
||||||
* value is {@code false}.
|
* value is {@code false}.
|
||||||
*/
|
*/
|
||||||
public synchronized static boolean getSunAwtDisableCALayers() {
|
public static synchronized boolean getSunAwtDisableCALayers() {
|
||||||
if (sunAwtDisableCALayers == null) {
|
if (sunAwtDisableCALayers == null) {
|
||||||
sunAwtDisableCALayers = AccessController.doPrivileged(
|
sunAwtDisableCALayers = AccessController.doPrivileged(
|
||||||
new GetBooleanAction("sun.awt.disableCALayers"));
|
new GetBooleanAction("sun.awt.disableCALayers"));
|
||||||
}
|
}
|
||||||
return sunAwtDisableCALayers.booleanValue();
|
return sunAwtDisableCALayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns true if the application (one of its windows) owns keyboard focus.
|
* Returns true if the application (one of its windows) owns keyboard focus.
|
||||||
*/
|
*/
|
||||||
@ -757,7 +805,7 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
static void doAWTRunLoop(long mediator, boolean processEvents) {
|
static void doAWTRunLoop(long mediator, boolean processEvents) {
|
||||||
doAWTRunLoopImpl(mediator, processEvents, inAWT);
|
doAWTRunLoopImpl(mediator, processEvents, inAWT);
|
||||||
}
|
}
|
||||||
static private native void doAWTRunLoopImpl(long mediator, boolean processEvents, boolean inAWT);
|
private static native void doAWTRunLoopImpl(long mediator, boolean processEvents, boolean inAWT);
|
||||||
static native void stopAWTRunLoop(long mediator);
|
static native void stopAWTRunLoop(long mediator);
|
||||||
|
|
||||||
private native boolean nativeSyncQueue(long timeout);
|
private native boolean nativeSyncQueue(long timeout);
|
||||||
@ -801,6 +849,7 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSwingBackbufferTranslucencySupported() {
|
public boolean isSwingBackbufferTranslucencySupported() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user