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/nativewindow/classes/com | |
parent | 969567663c08597c2c2effe6128f4810ec252513 (diff) |
NEWT API Change 'WindowClosingProtocol': Use 'enum WindowClosingMode' instead of static final int values.
Diffstat (limited to 'src/nativewindow/classes/com')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java | 20 |
1 files changed, 8 insertions, 12 deletions
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; |