diff options
author | Sven Gothel <[email protected]> | 2012-05-02 01:20:46 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-05-02 01:20:46 +0200 |
commit | 935523a8c58efced1c0845bd60e08e2acb9e5aee (patch) | |
tree | 3719897e3c2804abff130e299858df7c09f84588 /src/newt | |
parent | 969567663c08597c2c2effe6128f4810ec252513 (diff) |
NEWT API Change 'WindowClosingProtocol': Use 'enum WindowClosingMode' instead of static final int values.
Diffstat (limited to 'src/newt')
5 files changed, 19 insertions, 19 deletions
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(); } |