LWToolkit.java revision 4655
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync/*
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync *
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * This code is free software; you can redistribute it and/or modify it
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * under the terms of the GNU General Public License version 2 only, as
97dc19418e21b4b87280756668cf171a4332e498vboxsync * published by the Free Software Foundation. Oracle designates this
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * particular file as subject to the "Classpath" exception as provided
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * by Oracle in the LICENSE file that accompanied this code.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync *
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * This code is distributed in the hope that it will be useful, but WITHOUT
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * version 2 for more details (a copy is included in the LICENSE file that
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * accompanied this code).
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync *
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * You should have received a copy of the GNU General Public License version
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * 2 along with this work; if not, write to the Free Software Foundation,
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync *
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * or visit www.oracle.com if you need additional information or have any
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * questions.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync */
2a047f0d7ee5964456dbc4dec9925031482588abvboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsyncpackage sun.lwawt;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsyncimport java.awt.*;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsyncimport java.awt.List;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsyncimport java.awt.datatransfer.*;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsyncimport java.awt.dnd.*;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsyncimport java.awt.dnd.peer.*;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsyncimport java.awt.image.*;
29890600941d8c492d0c52cc0daefda9bad1b538vboxsyncimport java.awt.peer.*;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsyncimport java.security.*;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsyncimport java.util.*;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsyncimport sun.awt.*;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsyncimport sun.lwawt.macosx.*;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsyncimport sun.print.*;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsyncpublic abstract class LWToolkit extends SunToolkit implements Runnable {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private final static int STATE_NONE = 0;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private final static int STATE_INIT = 1;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private final static int STATE_MESSAGELOOP = 2;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private final static int STATE_SHUTDOWN = 3;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private final static int STATE_CLEANUP = 4;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private final static int STATE_DONE = 5;
97dc19418e21b4b87280756668cf171a4332e498vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private int runState = STATE_NONE;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private Clipboard clipboard;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private MouseInfoPeer mouseInfoPeer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private static Map<PlatformWindow, LWWindowPeer> delegateMap =
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync new HashMap<PlatformWindow, LWWindowPeer>();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public LWToolkit() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
a7327719907518e1a890c41ab95b5a58252afe3cvboxsync /*
a7327719907518e1a890c41ab95b5a58252afe3cvboxsync * This method is called by subclasses to start this toolkit
a7327719907518e1a890c41ab95b5a58252afe3cvboxsync * by launching the message loop.
a7327719907518e1a890c41ab95b5a58252afe3cvboxsync *
a7327719907518e1a890c41ab95b5a58252afe3cvboxsync * This method waits for the toolkit to be completely initialized
a7327719907518e1a890c41ab95b5a58252afe3cvboxsync * and returns before the message pump is started.
a7327719907518e1a890c41ab95b5a58252afe3cvboxsync */
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync protected final void init() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync AWTAutoShutdown.notifyToolkitThreadBusy();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync ThreadGroup mainTG = AccessController.doPrivileged(
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync new PrivilegedAction<ThreadGroup>() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public ThreadGroup run() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync ThreadGroup parentTG = currentTG.getParent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync while (parentTG != null) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync currentTG = parentTG;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync parentTG = currentTG.getParent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
43bb4d90097ef9a9d7fc597315d0869427609694vboxsync return currentTG;
43bb4d90097ef9a9d7fc597315d0869427609694vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync );
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync Runtime.getRuntime().addShutdownHook(
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync new Thread(mainTG, new Runnable() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public void run() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync shutdown();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync waitForRunState(STATE_CLEANUP);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync })
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync );
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync Thread toolkitThread = new Thread(mainTG, this, "AWT-LW");
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync toolkitThread.setDaemon(true);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync toolkitThread.start();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync waitForRunState(STATE_MESSAGELOOP);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync /*
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * Implemented in subclasses to initialize platform-dependent
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * part of the toolkit (open X display connection, create
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * toolkit HWND, etc.)
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync *
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * This method is called on the toolkit thread.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync */
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync protected abstract void platformInit();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync /*
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * Sends a request to stop the message pump.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync */
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public void shutdown() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync setRunState(STATE_SHUTDOWN);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync platformShutdown();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync /*
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * Implemented in subclasses to release all the platform-
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * dependent resources. Called after the message loop is
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * terminated.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync *
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * Could be called (always called?) on a non-toolkit thread.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync */
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync protected abstract void platformShutdown();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync /*
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * Implemented in subclasses to release all the platform
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * resources before the application is terminated.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync *
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * This method is called on the toolkit thread.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync */
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync protected abstract void platformCleanup();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private synchronized int getRunState() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return runState;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private synchronized void setRunState(int state) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync runState = state;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync notifyAll();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public boolean isTerminating() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return getRunState() >= STATE_SHUTDOWN;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private void waitForRunState(int state) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync while (getRunState() < state) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync try {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync synchronized (this) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync wait();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync } catch (InterruptedException z) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync // TODO: log
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync break;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
09e1f0ca3ffdeae53f9e8bce86f9ed3a042e31e1vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public void run() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync setRunState(STATE_INIT);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync platformInit();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync AWTAutoShutdown.notifyToolkitThreadFree();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync setRunState(STATE_MESSAGELOOP);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync while (getRunState() < STATE_SHUTDOWN) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync try {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync platformRunMessage();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync if (Thread.currentThread().isInterrupted()) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync if (AppContext.getAppContext().isDisposed()) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync break;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync } catch (ThreadDeath td) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync //XXX: if there isn't native code on the stack, the VM just
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync //kills the thread right away. Do we expect to catch it
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync //nevertheless?
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync break;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync } catch (Throwable t) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync // TODO: log
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync System.err.println("Exception on the toolkit thread");
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync t.printStackTrace(System.err);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync //XXX: if that's a secondary loop, jump back to the STATE_MESSAGELOOP
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync setRunState(STATE_CLEANUP);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync AWTAutoShutdown.notifyToolkitThreadFree();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync platformCleanup();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync setRunState(STATE_DONE);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync /*
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * Process the next message(s) from the native event queue.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync *
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * Initially, all the LWToolkit implementations were supposed
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * to have the similar message loop sequence: check if any events
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * available, peek events, wait. However, the later analysis shown
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * that X11 and Windows implementations are really different, so
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * let the subclasses do whatever they require.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync */
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync protected abstract void platformRunMessage();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public static LWToolkit getLWToolkit() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return (LWToolkit)Toolkit.getDefaultToolkit();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync // ---- TOPLEVEL PEERS ---- //
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync /*
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * Note that LWWindowPeer implements WindowPeer, FramePeer
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync * and DialogPeer interfaces.
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync */
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync private LWWindowPeer createDelegatedPeer(Window target, PlatformComponent platformComponent,
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformWindow platformWindow)
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync LWWindowPeer peer = new LWWindowPeer(target, platformComponent, platformWindow);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetDelegate(platformWindow, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync peer.initialize();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public WindowPeer createWindow(Window target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.SIMPLEWINDOW);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return createDelegatedPeer(target, platformComponent, platformWindow);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public FramePeer createFrame(Frame target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.FRAME);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return createDelegatedPeer(target, platformComponent, platformWindow);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public LWWindowPeer createEmbeddedFrame(CEmbeddedFrame target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.EMBEDDEDFRAME);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return createDelegatedPeer(target, platformComponent, platformWindow);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync CPrinterDialogPeer createCPrinterDialog(CPrinterDialog target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync CPrinterDialogPeer peer = new CPrinterDialogPeer(target, platformComponent, platformWindow);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public DialogPeer createDialog(Dialog target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync if (target instanceof CPrinterDialog) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return createCPrinterDialog((CPrinterDialog)target);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return createDelegatedPeer(target, platformComponent, platformWindow);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public FileDialogPeer createFileDialog(FileDialog target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync FileDialogPeer peer = createFileDialogPeer(target);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync // ---- LIGHTWEIGHT COMPONENT PEERS ---- //
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public ButtonPeer createButton(Button target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync LWButtonPeer peer = new LWButtonPeer(target, platformComponent);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync peer.initialize();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public CheckboxPeer createCheckbox(Checkbox target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync LWCheckboxPeer peer = new LWCheckboxPeer(target, platformComponent);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync peer.initialize();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync throw new RuntimeException("not implemented");
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public ChoicePeer createChoice(Choice target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync LWChoicePeer peer = new LWChoicePeer(target, platformComponent);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync peer.initialize();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public LabelPeer createLabel(Label target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync LWLabelPeer peer = new LWLabelPeer(target, platformComponent);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync peer.initialize();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public CanvasPeer createCanvas(Canvas target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync LWCanvasPeer peer = new LWCanvasPeer(target, platformComponent);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync peer.initialize();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public ListPeer createList(List target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync LWListPeer peer = new LWListPeer(target, platformComponent);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync peer.initialize();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public MenuPeer createMenu(Menu target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync throw new RuntimeException("not implemented");
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public MenuBarPeer createMenuBar(MenuBar target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync throw new RuntimeException("not implemented");
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public MenuItemPeer createMenuItem(MenuItem target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync throw new RuntimeException("not implemented");
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public PanelPeer createPanel(Panel target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync LWPanelPeer peer = new LWPanelPeer(target, platformComponent);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync peer.initialize();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public PopupMenuPeer createPopupMenu(PopupMenu target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync throw new RuntimeException("not implemented");
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public ScrollPanePeer createScrollPane(ScrollPane target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync LWScrollPanePeer peer = new LWScrollPanePeer(target, platformComponent);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync peer.initialize();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public ScrollbarPeer createScrollbar(Scrollbar target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync LWScrollBarPeer peer = new LWScrollBarPeer(target, platformComponent);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync peer.initialize();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public TextAreaPeer createTextArea(TextArea target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync LWTextAreaPeer peer = new LWTextAreaPeer(target, platformComponent);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync peer.initialize();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public TextFieldPeer createTextField(TextField target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync PlatformComponent platformComponent = createPlatformComponent();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync LWTextFieldPeer peer = new LWTextFieldPeer(target, platformComponent);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync targetCreatedPeer(target, peer);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync peer.initialize();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return peer;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync // ---- NON-COMPONENT PEERS ---- //
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public ColorModel getColorModel() throws HeadlessException {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getColorModel();
e8360046bf56d03d114dcd9c8e273d00e1985f43vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
97dc19418e21b4b87280756668cf171a4332e498vboxsync public boolean isDesktopSupported() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return true;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync protected DesktopPeer createDesktopPeer(Desktop target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return new CDesktopPeer();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync DragSourceContextPeer dscp = CDragSourceContextPeer.createDragSourceContextPeer(dge);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return dscp;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return LWKeyboardFocusManagerPeer.getInstance(manager);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public synchronized MouseInfoPeer getMouseInfoPeer() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync if (mouseInfoPeer == null) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync mouseInfoPeer = createMouseInfoPeerImpl();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return mouseInfoPeer;
fd5b0082a64ec49263419f41ddabf584b78d887evboxsync }
fd5b0082a64ec49263419f41ddabf584b78d887evboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync protected MouseInfoPeer createMouseInfoPeerImpl() {
faff6adca592b2de8725db32b9476cbcb120ba57vboxsync return new LWMouseInfoPeer();
29890600941d8c492d0c52cc0daefda9bad1b538vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public PrintJob getPrintJob(Frame frame, String doctitle, Properties props) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return getPrintJob(frame, doctitle, null, null);
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public PrintJob getPrintJob(Frame frame, String doctitle, JobAttributes jobAttributes, PageAttributes pageAttributes) {
29890600941d8c492d0c52cc0daefda9bad1b538vboxsync if (GraphicsEnvironment.isHeadless()) {
29890600941d8c492d0c52cc0daefda9bad1b538vboxsync throw new IllegalArgumentException();
29890600941d8c492d0c52cc0daefda9bad1b538vboxsync }
29890600941d8c492d0c52cc0daefda9bad1b538vboxsync
29890600941d8c492d0c52cc0daefda9bad1b538vboxsync PrintJob2D printJob = new PrintJob2D(frame, doctitle, jobAttributes, pageAttributes);
29890600941d8c492d0c52cc0daefda9bad1b538vboxsync
29890600941d8c492d0c52cc0daefda9bad1b538vboxsync if (printJob.printDialog() == false) {
29890600941d8c492d0c52cc0daefda9bad1b538vboxsync printJob = null;
29890600941d8c492d0c52cc0daefda9bad1b538vboxsync }
29890600941d8c492d0c52cc0daefda9bad1b538vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync return printJob;
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
0eaa6a2c0d84f972b084f95706e88dbc3d5826c7vboxsync throw new RuntimeException("not implemented");
691aac57c6f10a29a7507143a789f3dca28ed1f3vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public boolean isTraySupported() {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync throw new RuntimeException("not implemented");
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public SystemTrayPeer createSystemTray(SystemTray target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync throw new RuntimeException("not implemented");
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
29890600941d8c492d0c52cc0daefda9bad1b538vboxsync @Override
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync public TrayIconPeer createTrayIcon(TrayIcon target) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync throw new RuntimeException("not implemented");
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync }
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync @Override
97dc19418e21b4b87280756668cf171a4332e498vboxsync public Clipboard getSystemClipboard() {
43bb4d90097ef9a9d7fc597315d0869427609694vboxsync SecurityManager security = System.getSecurityManager();
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync if (security != null) {
65acc9a737d682ad726d06327bf6f6ecc6eb7e83vboxsync security.checkSystemClipboardAccess();
}
synchronized (this) {
if (clipboard == null) {
clipboard = createPlatformClipboard();
}
}
return clipboard;
}
// ---- DELEGATES ---- //
public abstract Clipboard createPlatformClipboard();
/*
* Creates a delegate for the given peer type (window, frame, dialog, etc.)
*/
protected abstract PlatformWindow createPlatformWindow(LWWindowPeer.PeerType peerType);
protected abstract PlatformComponent createPlatformComponent();
protected abstract FileDialogPeer createFileDialogPeer(FileDialog target);
public static void targetDelegate(PlatformWindow delegate, LWWindowPeer peer) {
delegateMap.put(delegate, peer);
}
public static LWWindowPeer delegateToPeer(PlatformWindow delegate) {
return delegateMap.get(delegate);
}
// ---- UTILITY METHODS ---- //
/*
* Expose non-public targetToPeer() method.
*/
public final static Object targetToPeer(Object target) {
return SunToolkit.targetToPeer(target);
}
/*
* Expose non-public targetDisposedPeer() method.
*/
public final static void targetDisposedPeer(Object target, Object peer) {
SunToolkit.targetDisposedPeer(target, peer);
}
/*
* Returns the current cursor manager.
*/
public abstract LWCursorManager getCursorManager();
public static void postEvent(AWTEvent event) {
postEvent(targetToAppContext(event.getSource()), event);
}
// use peer's back buffer to implement non-opaque windows.
@Override
public boolean needUpdateWindow() {
return true;
}
}