aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-05-02 01:20:46 +0200
committerSven Gothel <[email protected]>2012-05-02 01:20:46 +0200
commit935523a8c58efced1c0845bd60e08e2acb9e5aee (patch)
tree3719897e3c2804abff130e299858df7c09f84588
parent969567663c08597c2c2effe6128f4810ec252513 (diff)
NEWT API Change 'WindowClosingProtocol': Use 'enum WindowClosingMode' instead of static final int values.
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java5
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java5
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java20
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java39
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java12
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java8
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java4
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java6
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java6
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java16
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java8
13 files changed, 79 insertions, 78 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index ea191810e..a8d3c03a8 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -66,6 +66,7 @@ import javax.media.nativewindow.AbstractGraphicsScreen;
import javax.media.nativewindow.GraphicsConfigurationFactory;
import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.NativeWindowFactory;
+import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
import javax.media.opengl.GL;
import javax.media.opengl.GLAnimatorControl;
@@ -386,11 +387,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
return ( null != drawable ) ? drawable.isRealized() : false;
}
- public int getDefaultCloseOperation() {
+ public WindowClosingMode getDefaultCloseOperation() {
return awtWindowClosingProtocol.getDefaultCloseOperation();
}
- public int setDefaultCloseOperation(int op) {
+ public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
return awtWindowClosingProtocol.setDefaultCloseOperation(op);
}
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 5ca81a4b9..db3f189cb 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -60,6 +60,7 @@ import javax.swing.JPanel;
import javax.media.nativewindow.WindowClosingProtocol;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeSurface;
+import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
import javax.media.opengl.DefaultGLCapabilitiesChooser;
import javax.media.opengl.GL;
@@ -596,11 +597,11 @@ public void reshape(int x, int y, int width, int height) {
awtWindowClosingProtocol.addClosingListenerOneShot();
}
- public int getDefaultCloseOperation() {
+ public WindowClosingMode getDefaultCloseOperation() {
return awtWindowClosingProtocol.getDefaultCloseOperation();
}
- public int setDefaultCloseOperation(int op) {
+ public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
return awtWindowClosingProtocol.setDefaultCloseOperation(op);
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java
index df32f5942..d78b4ac15 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java
@@ -43,7 +43,7 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol {
private Runnable closingOperation;
private volatile boolean closingListenerSet = false;
private Object closingListenerLock = new Object();
- private int defaultCloseOperation = DISPOSE_ON_CLOSE;
+ private WindowClosingMode defaultCloseOperation = WindowClosingMode.DISPOSE_ON_CLOSE;
private boolean defaultCloseOperationSetByUser = false;
public AWTWindowClosingProtocol(Component comp, Runnable closingOperation) {
@@ -54,9 +54,9 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol {
class WindowClosingAdapter extends WindowAdapter {
@Override
public void windowClosing(WindowEvent e) {
- int op = AWTWindowClosingProtocol.this.getDefaultCloseOperation();
+ final WindowClosingMode op = AWTWindowClosingProtocol.this.getDefaultCloseOperation();
- if( DISPOSE_ON_CLOSE == op ) {
+ if( WindowClosingMode.DISPOSE_ON_CLOSE == op ) {
// we have to issue this call right away,
// otherwise the window gets destroyed
closingOperation.run();
@@ -111,27 +111,23 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol {
/**
*
- * @return the user set close operation if set by {@link #setDefaultCloseOperation(int) setDefaultCloseOperation(int)},
+ * @return the user set close operation if set by {@link #setDefaultCloseOperation(WindowClosingMode) setDefaultCloseOperation(int)},
* otherwise return the AWT/Swing close operation value translated to
* a {@link WindowClosingProtocol} value .
*/
- public final int getDefaultCloseOperation() {
- int op = -1;
+ public final WindowClosingMode getDefaultCloseOperation() {
synchronized(closingListenerLock) {
if(defaultCloseOperationSetByUser) {
- op = defaultCloseOperation;
+ return defaultCloseOperation;
}
}
- if(0 <= op) {
- return op;
- }
// User didn't determine the behavior, use underlying AWT behavior
return AWTMisc.getNWClosingOperation(comp);
}
- public final int setDefaultCloseOperation(int op) {
+ public final WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
synchronized(closingListenerLock) {
- int _op = defaultCloseOperation;
+ final WindowClosingMode _op = defaultCloseOperation;
defaultCloseOperation = op;
defaultCloseOperationSetByUser = true;
return _op;
diff --git a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java b/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
index 949aee79c..884c916e4 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
@@ -32,35 +32,38 @@ package javax.media.nativewindow;
* Protocol for handling window closing events.
* <p>
* The implementation shall obey either the user value set by this interface,<br>
- * an underlying toolkit set user value or it's default, eg. {@link #DO_NOTHING_ON_CLOSE DO_NOTHING_ON_CLOSE} within an AWT environment.<br>
+ * an underlying toolkit set user value or it's default, eg. {@link WindowClosingMode#DO_NOTHING_ON_CLOSE DO_NOTHING_ON_CLOSE} within an AWT environment.<br>
* If none of the above determines the operation,
- * this protocol default behavior {@link #DISPOSE_ON_CLOSE DISPOSE_ON_CLOSE} shall be used.</p>
+ * this protocol default behavior {@link WindowClosingMode#DISPOSE_ON_CLOSE DISPOSE_ON_CLOSE} shall be used.</p>
*/
public interface WindowClosingProtocol {
- /**
- * Dispose resources on native window close operation.<br>
- * This is the default behavior in case no underlying toolkit defines otherwise.
- */
- int DISPOSE_ON_CLOSE = 1;
+ public enum WindowClosingMode {
+ /**
+ * Do nothing on native window close operation.<br>
+ * This is the default behavior within an AWT environment.
+ */
+ DO_NOTHING_ON_CLOSE,
+
+ /**
+ * Dispose resources on native window close operation.<br>
+ * This is the default behavior in case no underlying toolkit defines otherwise.
+ */
+ DISPOSE_ON_CLOSE;
+ }
- /**
- * Do nothing on native window close operation.<br>
- * This is the default behavior within an AWT environment.
- */
- int DO_NOTHING_ON_CLOSE = 0;
/**
* @return the current close operation value
- * @see #DISPOSE_ON_CLOSE
- * @see #DO_NOTHING_ON_CLOSE
+ * @see WindowClosingMode#DISPOSE_ON_CLOSE
+ * @see WindowClosingMode#DO_NOTHING_ON_CLOSE
*/
- int getDefaultCloseOperation();
+ WindowClosingMode getDefaultCloseOperation();
/**
* @param op the new close operation value
* @return the previous close operation value
- * @see #DISPOSE_ON_CLOSE
- * @see #DO_NOTHING_ON_CLOSE
+ * @see WindowClosingMode#DISPOSE_ON_CLOSE
+ * @see WindowClosingMode#DO_NOTHING_ON_CLOSE
*/
- int setDefaultCloseOperation(int op);
+ WindowClosingMode setDefaultCloseOperation(WindowClosingMode op);
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
index 834d8a703..d77cd75ef 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
@@ -75,22 +75,22 @@ public class AWTMisc {
MenuSelectionManager.defaultManager().clearSelectedPath();
}
- public static int AWT2NWClosingOperation(int awtClosingOperation) {
+ public static WindowClosingProtocol.WindowClosingMode AWT2NWClosingOperation(int awtClosingOperation) {
switch (awtClosingOperation) {
case WindowConstants.DISPOSE_ON_CLOSE:
case WindowConstants.EXIT_ON_CLOSE:
- return WindowClosingProtocol.DISPOSE_ON_CLOSE;
+ return WindowClosingProtocol.WindowClosingMode.DISPOSE_ON_CLOSE;
case WindowConstants.DO_NOTHING_ON_CLOSE:
case WindowConstants.HIDE_ON_CLOSE:
- return WindowClosingProtocol.DO_NOTHING_ON_CLOSE;
+ return WindowClosingProtocol.WindowClosingMode.DO_NOTHING_ON_CLOSE;
default:
throw new NativeWindowException("Unhandled AWT Closing Operation: " + awtClosingOperation);
}
}
- public static int getNWClosingOperation(Component c) {
- JFrame jf = getJFrame(c);
- int op = (null != jf) ? jf.getDefaultCloseOperation() : WindowConstants.DO_NOTHING_ON_CLOSE ;
+ public static WindowClosingProtocol.WindowClosingMode getNWClosingOperation(Component c) {
+ final JFrame jf = getJFrame(c);
+ final int op = (null != jf) ? jf.getDefaultCloseOperation() : WindowConstants.DO_NOTHING_ON_CLOSE ;
return AWT2NWClosingOperation(op);
}
}
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index c0d8f97b3..9af4a02ae 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -74,7 +74,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
private boolean shallUseOffscreenLayer = false;
private Window newtChild = null;
private boolean isOnscreen = true;
- private int newtChildCloseOp;
+ private WindowClosingMode newtChildCloseOp;
private AWTAdapter awtAdapter = null;
private AWTAdapter awtMouseAdapter = null;
private AWTAdapter awtKeyAdapter = null;
@@ -283,11 +283,11 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
* or {@link #addNotify()} hasn't been called yet.*/
public NativeWindow getNativeWindow() { return jawtWindow; }
- public int getDefaultCloseOperation() {
+ public WindowClosingMode getDefaultCloseOperation() {
return awtWindowClosingProtocol.getDefaultCloseOperation();
}
- public int setDefaultCloseOperation(int op) {
+ public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
return awtWindowClosingProtocol.setDefaultCloseOperation(op);
}
@@ -319,7 +319,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
awtAdapter = new AWTParentWindowAdapter(jawtWindow, newtChild).addTo(this);
newtChild.addWindowListener(clearAWTMenusOnNewtFocus);
newtChild.setFocusAction(focusAction); // enable AWT focus traversal
- newtChildCloseOp = newtChild.setDefaultCloseOperation(WindowClosingProtocol.DO_NOTHING_ON_CLOSE);
+ newtChildCloseOp = newtChild.setDefaultCloseOperation(WindowClosingMode.DO_NOTHING_ON_CLOSE);
awtWindowClosingProtocol.addClosingListenerOneShot();
keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
keyboardFocusManager.addPropertyChangeListener("focusOwner", focusPropertyChangeListener);
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
index 82562636b..d06aca039 100755
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
@@ -36,7 +36,7 @@ import java.awt.event.KeyListener;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
-import javax.media.nativewindow.WindowClosingProtocol;
+import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
import javax.media.opengl.FPSCounter;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;
@@ -187,7 +187,7 @@ public class JOGLNewtApplet1Run extends Applet {
glWindow.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err);
glWindow.setUndecorated(glUndecorated);
glWindow.setAlwaysOnTop(glAlwaysOnTop);
- glWindow.setDefaultCloseOperation(glCloseable ? WindowClosingProtocol.DISPOSE_ON_CLOSE : WindowClosingProtocol.DO_NOTHING_ON_CLOSE);
+ glWindow.setDefaultCloseOperation(glCloseable ? WindowClosingMode.DISPOSE_ON_CLOSE : WindowClosingMode.DO_NOTHING_ON_CLOSE);
container.setLayout(new BorderLayout());
if(appletDebugTestBorder) {
container.add(new Button("North"), BorderLayout.NORTH);
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
index f6b9b6583..082c01c23 100755
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
@@ -32,7 +32,7 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.WindowClosingProtocol;
+import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
import javax.media.opengl.FPSCounter;
import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
@@ -164,7 +164,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
// Closing action: back to parent!
@Override
public void windowDestroyNotify(WindowEvent e) {
- if( WindowClosingProtocol.DO_NOTHING_ON_CLOSE == glWindow.getDefaultCloseOperation() ) {
+ if( WindowClosingMode.DO_NOTHING_ON_CLOSE == glWindow.getDefaultCloseOperation() ) {
if(null == glWindow.getParent()) {
// we may be called directly by the native EDT
new Thread(new Runnable() {
@@ -298,7 +298,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
} else {
glWindow.reparentWindow(null);
if(glClosable) {
- glWindow.setDefaultCloseOperation(WindowClosingProtocol.DISPOSE_ON_CLOSE);
+ glWindow.setDefaultCloseOperation(WindowClosingMode.DISPOSE_ON_CLOSE);
}
}
}
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index efdcf4c12..34e0df64f 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -94,7 +94,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC
@Override
public void windowDestroyNotify(WindowEvent e) {
- if( DISPOSE_ON_CLOSE == GLWindow.this.getDefaultCloseOperation() ) {
+ if( WindowClosingMode.DISPOSE_ON_CLOSE == GLWindow.this.getDefaultCloseOperation() ) {
// Is an animator thread perform rendering?
if (GLWindow.this.helper.isExternalAnimatorRunning()) {
// Pause animations before initiating safe destroy.
@@ -176,11 +176,11 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC
//----------------------------------------------------------------------
// WindowClosingProtocol implementation
//
- public int getDefaultCloseOperation() {
+ public WindowClosingMode getDefaultCloseOperation() {
return window.getDefaultCloseOperation();
}
- public int setDefaultCloseOperation(int op) {
+ public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
return window.setDefaultCloseOperation(op);
}
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index b3a3e54ec..143e7c1ed 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -385,17 +385,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// WindowClosingProtocol implementation
//
private Object closingListenerLock = new Object();
- private int defaultCloseOperation = DISPOSE_ON_CLOSE;
+ private WindowClosingMode defaultCloseOperation = WindowClosingMode.DISPOSE_ON_CLOSE;
- public int getDefaultCloseOperation() {
+ public WindowClosingMode getDefaultCloseOperation() {
synchronized (closingListenerLock) {
return defaultCloseOperation;
}
}
- public int setDefaultCloseOperation(int op) {
+ public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
synchronized (closingListenerLock) {
- int _op = defaultCloseOperation;
+ WindowClosingMode _op = defaultCloseOperation;
defaultCloseOperation = op;
return _op;
}
@@ -2476,7 +2476,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
/**
* Triggered by implementation's WM events or programmatically
*
- * @param force if true, overrides {@link #setDefaultCloseOperation(int)} with {@link WindowClosingProtocol#DISPOSE_ON_CLOSE}
+ * @param force if true, overrides {@link #setDefaultCloseOperation(WindowClosingMode)} with {@link WindowClosingProtocol#DISPOSE_ON_CLOSE}
* and hence force destruction. Otherwise is follows the user settings.
* @return true if this window is no more valid and hence has been destroyed, otherwise false.
*/
@@ -2485,13 +2485,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("Window.windowDestroyNotify(force: "+force+") START "+getThreadName()+": "+this);
}
if(force) {
- setDefaultCloseOperation(WindowClosingProtocol.DISPOSE_ON_CLOSE);
+ setDefaultCloseOperation(WindowClosingMode.DISPOSE_ON_CLOSE);
}
// send synced destroy notifications
enqueueWindowEvent(true, WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
- if(handleDestroyNotify && DISPOSE_ON_CLOSE == getDefaultCloseOperation()) {
+ if(handleDestroyNotify && WindowClosingMode.DISPOSE_ON_CLOSE == getDefaultCloseOperation()) {
destroy();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java
index 63fcfa97f..d63f0d2a7 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java
@@ -36,7 +36,7 @@ import java.awt.Frame;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
-import javax.media.nativewindow.WindowClosingProtocol;
+import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
@@ -71,8 +71,8 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
//
// close with op: DO_NOTHING_ON_CLOSE -> NOP (default)
//
- int op = glCanvas.getDefaultCloseOperation();
- Assert.assertEquals(WindowClosingProtocol.DO_NOTHING_ON_CLOSE, op);
+ WindowClosingMode op = glCanvas.getDefaultCloseOperation();
+ Assert.assertEquals(WindowClosingMode.DO_NOTHING_ON_CLOSE, op);
Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false)); // nop
Thread.sleep(100);
@@ -84,9 +84,9 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
//
// close with op (GLCanvas): DISPOSE_ON_CLOSE -> dispose
//
- glCanvas.setDefaultCloseOperation(WindowClosingProtocol.DISPOSE_ON_CLOSE);
+ glCanvas.setDefaultCloseOperation(WindowClosingMode.DISPOSE_ON_CLOSE);
op = glCanvas.getDefaultCloseOperation();
- Assert.assertEquals(WindowClosingProtocol.DISPOSE_ON_CLOSE, op);
+ Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op);
Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false)); // no frame close
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, false));
@@ -123,8 +123,8 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
// close with op: DO_NOTHING_ON_CLOSE -> NOP / HIDE (default)
//
Assert.assertEquals(JFrame.HIDE_ON_CLOSE, frame.getDefaultCloseOperation());
- int op = glCanvas.getDefaultCloseOperation();
- Assert.assertEquals(WindowClosingProtocol.DO_NOTHING_ON_CLOSE, op);
+ WindowClosingMode op = glCanvas.getDefaultCloseOperation();
+ Assert.assertEquals(WindowClosingMode.DO_NOTHING_ON_CLOSE, op);
Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false)); // nop
Thread.sleep(100);
@@ -145,7 +145,7 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Assert.assertEquals(JFrame.DISPOSE_ON_CLOSE, frame.getDefaultCloseOperation());
op = glCanvas.getDefaultCloseOperation();
- Assert.assertEquals(WindowClosingProtocol.DISPOSE_ON_CLOSE, op);
+ Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op);
Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true));
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, false));
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java
index b20e81805..1657fcbe9 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java
@@ -33,7 +33,7 @@ import java.lang.reflect.InvocationTargetException;
import org.junit.Test;
import org.junit.Assert;
-import javax.media.nativewindow.WindowClosingProtocol;
+import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
@@ -60,15 +60,15 @@ public class TestWindowClosingProtocol02NEWT extends UITestCase {
Assert.assertEquals(true, glWindow.isVisible());
// CHECK DEFAULT ..
- int op = glWindow.getDefaultCloseOperation();
- Assert.assertEquals(WindowClosingProtocol.DISPOSE_ON_CLOSE, op);
+ WindowClosingMode op = glWindow.getDefaultCloseOperation();
+ Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op);
//
// close with op: DO_NOTHING_ON_CLOSE -> NOP
//
- glWindow.setDefaultCloseOperation(WindowClosingProtocol.DO_NOTHING_ON_CLOSE);
+ glWindow.setDefaultCloseOperation(WindowClosingMode.DO_NOTHING_ON_CLOSE);
op = glWindow.getDefaultCloseOperation();
- Assert.assertEquals(WindowClosingProtocol.DO_NOTHING_ON_CLOSE, op);
+ Assert.assertEquals(WindowClosingMode.DO_NOTHING_ON_CLOSE, op);
Assert.assertEquals(true, AWTRobotUtil.closeWindow(glWindow, false)); // nop
Assert.assertEquals(true, glWindow.isNativeValid());
@@ -78,9 +78,9 @@ public class TestWindowClosingProtocol02NEWT extends UITestCase {
//
// close with op (GLCanvas): DISPOSE_ON_CLOSE -> dispose
//
- glWindow.setDefaultCloseOperation(WindowClosingProtocol.DISPOSE_ON_CLOSE);
+ glWindow.setDefaultCloseOperation(WindowClosingMode.DISPOSE_ON_CLOSE);
op = glWindow.getDefaultCloseOperation();
- Assert.assertEquals(WindowClosingProtocol.DISPOSE_ON_CLOSE, op);
+ Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op);
Assert.assertEquals(true, AWTRobotUtil.closeWindow(glWindow, true));
Assert.assertEquals(false, glWindow.isNativeValid());
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java
index 3b1acce6a..65068e9e8 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java
@@ -37,7 +37,7 @@ import java.lang.reflect.InvocationTargetException;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
-import javax.media.nativewindow.WindowClosingProtocol;
+import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
@@ -82,8 +82,8 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase {
// close with op: DO_NOTHING_ON_CLOSE -> NOP / HIDE (default)
//
Assert.assertEquals(JFrame.HIDE_ON_CLOSE, frame.getDefaultCloseOperation());
- int op = newtCanvas.getDefaultCloseOperation();
- Assert.assertEquals(WindowClosingProtocol.DO_NOTHING_ON_CLOSE, op);
+ WindowClosingMode op = newtCanvas.getDefaultCloseOperation();
+ Assert.assertEquals(WindowClosingMode.DO_NOTHING_ON_CLOSE, op);
Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false));
Assert.assertEquals(true, frame.isDisplayable());
@@ -108,7 +108,7 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase {
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Assert.assertEquals(JFrame.DISPOSE_ON_CLOSE, frame.getDefaultCloseOperation());
op = newtCanvas.getDefaultCloseOperation();
- Assert.assertEquals(WindowClosingProtocol.DISPOSE_ON_CLOSE, op);
+ Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op);
Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true));
Assert.assertEquals(false, frame.isDisplayable());