/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*/
public LWToolkit() {
}
/*
* This method is called by subclasses to start this toolkit
* by launching the message loop.
*
* This method waits for the toolkit to be completely initialized
* and returns before the message pump is started.
*/
protected final void init() {
new PrivilegedAction<ThreadGroup>() {
public ThreadGroup run() {
}
return currentTG;
}
}
);
public void run() {
shutdown();
}
})
);
toolkitThread.setDaemon(true);
}
/*
* Implemented in subclasses to initialize platform-dependent
* part of the toolkit (open X display connection, create
* toolkit HWND, etc.)
*
* This method is called on the toolkit thread.
*/
protected abstract void platformInit();
/*
* Sends a request to stop the message pump.
*/
public void shutdown() {
}
/*
* Implemented in subclasses to release all the platform-
* dependent resources. Called after the message loop is
* terminated.
*
* Could be called (always called?) on a non-toolkit thread.
*/
protected abstract void platformShutdown();
/*
* Implemented in subclasses to release all the platform
* resources before the application is terminated.
*
* This method is called on the toolkit thread.
*/
protected abstract void platformCleanup();
private synchronized int getRunState() {
return runState;
}
notifyAll();
}
public boolean isTerminating() {
return getRunState() >= STATE_SHUTDOWN;
}
while (getRunState() < state) {
try {
synchronized (this) {
wait();
}
} catch (InterruptedException z) {
// TODO: log
break;
}
}
}
public void run() {
platformInit();
while (getRunState() < STATE_SHUTDOWN) {
try {
break;
}
}
} catch (ThreadDeath td) {
//XXX: if there isn't native code on the stack, the VM just
//kills the thread right away. Do we expect to catch it
//nevertheless?
break;
} catch (Throwable t) {
// TODO: log
}
}
//XXX: if that's a secondary loop, jump back to the STATE_MESSAGELOOP
}
/*
* Process the next message(s) from the native event queue.
*
* Initially, all the LWToolkit implementations were supposed
* to have the similar message loop sequence: check if any events
* available, peek events, wait. However, the later analysis shown
* that X11 and Windows implementations are really different, so
* let the subclasses do whatever they require.
*/
protected abstract void platformRunMessage();
}
// ---- TOPLEVEL PEERS ---- //
/*
* Note that LWWindowPeer implements WindowPeer, FramePeer
* and DialogPeer interfaces.
*/
{
peer.initialize();
return peer;
}
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.SIMPLEWINDOW);
}
}
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.EMBEDDED_FRAME);
}
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.VIEW_EMBEDDED_FRAME);
}
return peer;
}
if (target instanceof CPrinterDialog) {
}
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.DIALOG);
}
return peer;
}
// ---- LIGHTWEIGHT COMPONENT PEERS ---- //
peer.initialize();
return peer;
}
peer.initialize();
return peer;
}
throw new RuntimeException("not implemented");
}
peer.initialize();
return peer;
}
peer.initialize();
return peer;
}
peer.initialize();
return peer;
}
peer.initialize();
return peer;
}
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
peer.initialize();
return peer;
}
throw new RuntimeException("not implemented");
}
peer.initialize();
return peer;
}
peer.initialize();
return peer;
}
peer.initialize();
return peer;
}
peer.initialize();
return peer;
}
// ---- NON-COMPONENT PEERS ---- //
return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getColorModel();
}
public boolean isDesktopSupported() {
return true;
}
return new CDesktopPeer();
}
return dscp;
}
return LWKeyboardFocusManagerPeer.getInstance();
}
if (mouseInfoPeer == null) {
}
return mouseInfoPeer;
}
return new LWMouseInfoPeer();
}
}
public PrintJob getPrintJob(Frame frame, String doctitle, JobAttributes jobAttributes, PageAttributes pageAttributes) {
if (GraphicsEnvironment.isHeadless()) {
throw new IllegalArgumentException();
}
if (printJob.printDialog() == false) {
}
return printJob;
}
throw new RuntimeException("not implemented");
}
public boolean isTraySupported() {
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
}
synchronized (this) {
}
}
return clipboard;
}
protected abstract SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer);
// ---- DELEGATES ---- //
/*
* Creates a delegate for the given peer type (window, frame, dialog, etc.)
*/
// ---- UTILITY METHODS ---- //
/*
* Expose non-public targetToPeer() method.
*/
}
/*
* Expose non-public targetDisposedPeer() method.
*/
}
/*
* Returns the current cursor manager.
*/
}
}
}
}
}
}