29package com.jogamp.newt.event.awt;
31import com.jogamp.nativewindow.NativeSurfaceHolder;
33import jogamp.newt.Debug;
116public abstract class AWTAdapter implements java.util.EventListener
123 boolean consumeAWTEvent;
132 if(
null==newtListener) {
133 throw new IllegalArgumentException(
"Argument newtListener is null");
136 throw new IllegalArgumentException(
"Argument nwProxy is null");
138 this.newtListener = newtListener;
139 this.newtWindow =
null;
140 this.nsHolder = nsProxy;
141 this.consumeAWTEvent =
false;
150 protected AWTAdapter(
final com.jogamp.newt.event.NEWTEventListener newtListener,
final com.jogamp.newt.Window newtProxy) {
151 if(
null==newtListener) {
152 throw new IllegalArgumentException(
"Argument newtListener is null");
154 if(
null==newtProxy) {
155 throw new IllegalArgumentException(
"Argument newtProxy is null");
157 this.newtListener = newtListener;
158 this.newtWindow = newtProxy;
159 this.nsHolder = newtProxy;
160 this.consumeAWTEvent =
false;
170 protected AWTAdapter(
final com.jogamp.newt.Window downstream)
throws IllegalStateException {
177 this.consumeAWTEvent =
false;
187 if(
null==downstream) {
188 throw new RuntimeException(
"Argument downstream is null");
190 this.newtListener =
null;
191 this.newtWindow = downstream;
192 this.nsHolder = downstream;
194 throw new IllegalStateException(
"EDT not enabled");
207 this.newtListener =
null;
208 this.newtWindow =
null;
209 this.nsHolder =
null;
210 this.isSetup =
false;
211 this.consumeAWTEvent =
false;
216 this.consumeAWTEvent = v;
267 static enum EventProcRes {
295 EventProcRes processEvent(
final boolean wait,
final com.jogamp.newt.event.NEWTEvent event) {
296 if(
null != newtListener) {
297 return EventProcRes.DISPATCH;
299 if(
null != newtWindow ) {
301 return EventProcRes.ENQUEUED;
303 return EventProcRes.NOP;
abstract EDTUtil getEDTUtil()
abstract Display getDisplay()
Convenient adapter forwarding AWT events to NEWT via the event listener model.
final synchronized void setConsumeAWTEvent(final boolean v)
static final boolean DEBUG_IMPLEMENTATION
synchronized AWTAdapter setDownstream(final com.jogamp.newt.Window downstream)
Setup a pipeline adapter, AWT EventListener.
abstract AWTAdapter addTo(java.awt.Component awtComponent)
Due to the fact that some NEWT com.jogamp.newt.event.NEWTEventListener are mapped to more than one ja...
AWTAdapter(final com.jogamp.newt.Window downstream)
Create a pipeline adapter, AWT EventListener.
AWTAdapter(final com.jogamp.newt.event.NEWTEventListener newtListener, final com.jogamp.newt.Window newtProxy)
Create a proxy adapter, wrapping around an NEWT EventListener, exposed as an AWT EventListener,...
AWTAdapter(final com.jogamp.newt.event.NEWTEventListener newtListener, final NativeSurfaceHolder nsProxy)
Create a proxy adapter, wrapping around an NEWT EventListener, exposed as an AWT EventListener,...
final synchronized com.jogamp.newt.event.NEWTEventListener getNewtEventListener()
Returns the NEWT event-listener if instance is used as an NativeSurfaceHolder proxy or NEWT window pr...
synchronized AWTAdapter clear()
Removes all references, downstream and NEWT-EventListener.
abstract AWTAdapter removeFrom(java.awt.Component awtComponent)
final synchronized NativeSurfaceHolder getNativeSurfaceHolder()
Returns the NativeSurfaceHolder acting as downstream, NEWT window proxy or as an NativeSurfaceHolder ...
final synchronized com.jogamp.newt.Window getNewtWindow()
Returns the NEWT Window acting as downstream or as a NEWT window proxy.
Accessor interface for implementing classes with ownership of a NativeSurface via an is-a or has-a re...
Specifying NEWT's Window functionality:
void enqueueEvent(boolean wait, com.jogamp.newt.event.NEWTEvent event)
Enqueues a NEWT event.