From 556d92b63555a085b25e32b1cd55afce24edd07a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 3 Jul 2014 16:21:36 +0200 Subject: Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines --- src/newt/classes/com/jogamp/newt/Display.java | 20 +-- .../classes/com/jogamp/newt/MonitorDevice.java | 6 +- src/newt/classes/com/jogamp/newt/MonitorMode.java | 22 +-- src/newt/classes/com/jogamp/newt/NewtFactory.java | 89 ++++++------ src/newt/classes/com/jogamp/newt/NewtVersion.java | 4 +- src/newt/classes/com/jogamp/newt/Screen.java | 12 +- .../classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 60 ++++---- .../jogamp/newt/awt/applet/JOGLNewtApplet1Run.java | 8 +- .../jogamp/newt/event/DoubleTapScrollGesture.java | 18 +-- .../classes/com/jogamp/newt/event/InputEvent.java | 2 +- .../classes/com/jogamp/newt/event/KeyAdapter.java | 4 +- .../classes/com/jogamp/newt/event/KeyEvent.java | 2 +- .../com/jogamp/newt/event/MouseAdapter.java | 16 +-- .../classes/com/jogamp/newt/event/MouseEvent.java | 2 +- .../classes/com/jogamp/newt/event/NEWTEvent.java | 2 +- .../com/jogamp/newt/event/NEWTEventFiFo.java | 4 +- .../com/jogamp/newt/event/PinchToZoomGesture.java | 6 +- .../com/jogamp/newt/event/TraceKeyAdapter.java | 6 +- .../com/jogamp/newt/event/TraceMouseAdapter.java | 18 +-- .../com/jogamp/newt/event/TraceWindowAdapter.java | 16 +-- .../com/jogamp/newt/event/WindowAdapter.java | 14 +- .../com/jogamp/newt/event/awt/AWTAdapter.java | 10 +- .../com/jogamp/newt/event/awt/AWTKeyAdapter.java | 16 +-- .../com/jogamp/newt/event/awt/AWTMouseAdapter.java | 42 +++--- .../jogamp/newt/event/awt/AWTWindowAdapter.java | 72 +++++----- .../classes/com/jogamp/newt/opengl/GLWindow.java | 152 ++++++++++----------- .../classes/com/jogamp/newt/swt/NewtCanvasSWT.java | 28 ++-- .../classes/com/jogamp/newt/util/MainThread.java | 41 +++--- .../com/jogamp/newt/util/MonitorModeUtil.java | 26 ++-- .../newt/util/applet/JOGLNewtApplet3Run.java | 16 +-- .../newt/util/applet/JOGLNewtAppletBase.java | 61 +++++---- .../jogamp/newt/util/applet/VersionApplet3.java | 30 ++-- 32 files changed, 415 insertions(+), 410 deletions(-) (limited to 'src/newt/classes/com') diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java index 847c9698a..7091060b3 100644 --- a/src/newt/classes/com/jogamp/newt/Display.java +++ b/src/newt/classes/com/jogamp/newt/Display.java @@ -55,10 +55,10 @@ public abstract class Display { /** return true if obj is of type Display and both FQN {@link #getFQName()} equals */ @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof Display) { - Display d = (Display)obj; + final Display d = (Display)obj; return d.getFQName().equals(getFQName()); } return false; @@ -353,7 +353,7 @@ public abstract class Display { protected static final ArrayList> displayList = new ArrayList>(); protected static int displaysActive = 0; - public static void dumpDisplayList(String prefix) { + public static void dumpDisplayList(final String prefix) { synchronized(displayList) { System.err.println(prefix+" DisplayList[] entries: "+displayList.size()+" - "+getThreadName()); final Iterator> ri = displayList.iterator(); @@ -372,7 +372,7 @@ public abstract class Display { * @paran shared if true, only shared instances are found, otherwise also exclusive * @return */ - public static Display getFirstDisplayOf(String type, String name, int fromIndex, boolean shared) { + public static Display getFirstDisplayOf(final String type, final String name, final int fromIndex, final boolean shared) { return getDisplayOfImpl(type, name, fromIndex, 1, shared); } @@ -384,11 +384,11 @@ public abstract class Display { * @paran shared if true, only shared instances are found, otherwise also exclusive * @return */ - public static Display getLastDisplayOf(String type, String name, int fromIndex, boolean shared) { + public static Display getLastDisplayOf(final String type, final String name, final int fromIndex, final boolean shared) { return getDisplayOfImpl(type, name, fromIndex, -1, shared); } - private static Display getDisplayOfImpl(String type, String name, final int fromIndex, final int incr, boolean shared) { + private static Display getDisplayOfImpl(final String type, final String name, final int fromIndex, final int incr, final boolean shared) { synchronized(displayList) { int i = fromIndex >= 0 ? fromIndex : displayList.size() - 1 ; while( ( incr > 0 ) ? i < displayList.size() : i >= 0 ) { @@ -414,7 +414,7 @@ public abstract class Display { return null; } - protected static void addDisplay2List(Display display) { + protected static void addDisplay2List(final Display display) { synchronized(displayList) { // GC before add int i=0; @@ -458,15 +458,15 @@ public abstract class Display { return Thread.currentThread().getName(); } - public static String toHexString(int hex) { + public static String toHexString(final int hex) { return "0x" + Integer.toHexString(hex); } - public static String toHexString(long hex) { + public static String toHexString(final long hex) { return "0x" + Long.toHexString(hex); } - public static int hashCodeNullSafe(Object o) { + public static int hashCodeNullSafe(final Object o) { return ( null != o ) ? o.hashCode() : 0; } } diff --git a/src/newt/classes/com/jogamp/newt/MonitorDevice.java b/src/newt/classes/com/jogamp/newt/MonitorDevice.java index a65675204..126162006 100644 --- a/src/newt/classes/com/jogamp/newt/MonitorDevice.java +++ b/src/newt/classes/com/jogamp/newt/MonitorDevice.java @@ -68,7 +68,7 @@ public abstract class MonitorDevice { protected Rectangle viewportPU; // in pixel units protected Rectangle viewportWU; // in window units - protected MonitorDevice(Screen screen, int nativeId, DimensionImmutable sizeMM, Rectangle viewportPU, Rectangle viewportWU, MonitorMode currentMode, ArrayHashSet supportedModes) { + protected MonitorDevice(final Screen screen, final int nativeId, final DimensionImmutable sizeMM, final Rectangle viewportPU, final Rectangle viewportWU, final MonitorMode currentMode, final ArrayHashSet supportedModes) { this.screen = screen; this.nativeId = nativeId; this.sizeMM = sizeMM; @@ -94,10 +94,10 @@ public abstract class MonitorDevice { *
*/ @Override - public final boolean equals(Object obj) { + public final boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof MonitorDevice) { - MonitorDevice md = (MonitorDevice)obj; + final MonitorDevice md = (MonitorDevice)obj; return md.nativeId == nativeId; } return false; diff --git a/src/newt/classes/com/jogamp/newt/MonitorMode.java b/src/newt/classes/com/jogamp/newt/MonitorMode.java index ba21df22a..09bc06ebd 100644 --- a/src/newt/classes/com/jogamp/newt/MonitorMode.java +++ b/src/newt/classes/com/jogamp/newt/MonitorMode.java @@ -115,14 +115,14 @@ public class MonitorMode implements Comparable { /** Comparator for 2 {@link MonitorMode}s, following comparison order as described in {@link MonitorMode#compareTo(MonitorMode)}, returning the ascending order. */ public static final Comparator monitorModeComparator = new Comparator() { @Override - public int compare(MonitorMode mm1, MonitorMode mm2) { + public int compare(final MonitorMode mm1, final MonitorMode mm2) { return mm1.compareTo(mm2); } }; /** Comparator for 2 {@link MonitorMode}s, following comparison order as described in {@link MonitorMode#compareTo(MonitorMode)}, returning the descending order. */ public static final Comparator monitorModeComparatorInv = new Comparator() { @Override - public int compare(MonitorMode mm1, MonitorMode mm2) { + public int compare(final MonitorMode mm1, final MonitorMode mm2) { return mm2.compareTo(mm1); } }; @@ -144,7 +144,7 @@ public class MonitorMode implements Comparable { public final float refreshRate; public final int hashCode; - public SizeAndRRate(SurfaceSize surfaceSize, float refreshRate, int flags) { + public SizeAndRRate(final SurfaceSize surfaceSize, final float refreshRate, final int flags) { if(null==surfaceSize) { throw new IllegalArgumentException("surfaceSize must be set ("+surfaceSize+")"); } @@ -158,7 +158,7 @@ public class MonitorMode implements Comparable { private final static String STR_DOUBLESCAN = "DoubleScan"; private final static String STR_SEP = ", "; - public static final StringBuilder flags2String(int flags) { + public static final StringBuilder flags2String(final int flags) { final StringBuilder sb = new StringBuilder(); boolean sp = false; if( 0 != ( flags & FLAG_INTERLACE ) ) { @@ -232,7 +232,7 @@ public class MonitorMode implements Comparable { * */ @Override - public final boolean equals(Object obj) { + public final boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof SizeAndRRate) { final SizeAndRRate p = (SizeAndRRate)obj; @@ -288,7 +288,7 @@ public class MonitorMode implements Comparable { private final int rotation; private final int hashCode; - public static boolean isRotationValid(int rotation) { + public static boolean isRotationValid(final int rotation) { return rotation == MonitorMode.ROTATE_0 || rotation == MonitorMode.ROTATE_90 || rotation == MonitorMode.ROTATE_180 || rotation == MonitorMode.ROTATE_270 ; } @@ -297,7 +297,7 @@ public class MonitorMode implements Comparable { * @param sizeAndRRate the surface size and refresh rate mode * @param rotation the screen rotation, measured counter clockwise (CCW) */ - public MonitorMode(int nativeId, SizeAndRRate sizeAndRRate, int rotation) { + public MonitorMode(final int nativeId, final SizeAndRRate sizeAndRRate, final int rotation) { if ( !isRotationValid(rotation) ) { throw new RuntimeException("invalid rotation: "+rotation); } @@ -317,7 +317,7 @@ public class MonitorMode implements Comparable { * @param flags * @param rotation */ - public MonitorMode(SurfaceSize surfaceSize, float refreshRate, int flags, int rotation) { + public MonitorMode(final SurfaceSize surfaceSize, final float refreshRate, final int flags, final int rotation) { this(0, new SizeAndRRate(surfaceSize, refreshRate, flags), rotation); } @@ -416,10 +416,10 @@ public class MonitorMode implements Comparable { * */ @Override - public final boolean equals(Object obj) { + public final boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof MonitorMode) { - MonitorMode sm = (MonitorMode)obj; + final MonitorMode sm = (MonitorMode)obj; return sm.nativeId == this.nativeId && sm.sizeAndRRate.equals(sizeAndRRate) && sm.rotation == this.rotation ; @@ -447,7 +447,7 @@ public class MonitorMode implements Comparable { return hash; } - private final int getRotatedWH(boolean width) { + private final int getRotatedWH(final boolean width) { final DimensionImmutable d = sizeAndRRate.surfaceSize.getResolution(); final boolean swap = MonitorMode.ROTATE_90 == rotation || MonitorMode.ROTATE_270 == rotation ; if ( ( width && swap ) || ( !width && !swap ) ) { diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java index 9685200eb..9606fae08 100644 --- a/src/newt/classes/com/jogamp/newt/NewtFactory.java +++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java @@ -46,6 +46,7 @@ import javax.media.nativewindow.NativeWindow; import javax.media.nativewindow.NativeWindowFactory; import com.jogamp.common.util.IOUtil; +import com.jogamp.common.util.PropertyAccess; import jogamp.newt.Debug; import jogamp.newt.DisplayImpl; @@ -66,7 +67,7 @@ public class NewtFactory { NativeWindowFactory.initSingleton(); // last resort .. { /** See API Doc in {@link Window} ! */ - final String[] paths = Debug.getProperty("newt.window.icons", true, "newt/data/jogamp-16x16.png newt/data/jogamp-32x32.png").split("\\s"); + final String[] paths = PropertyAccess.getProperty("newt.window.icons", true, "newt/data/jogamp-16x16.png newt/data/jogamp-32x32.png").split("\\s"); if( paths.length < 2 ) { throw new IllegalArgumentException("Property 'newt.window.icons' did not specify at least two PNG icons, but "+Arrays.toString(paths)); } @@ -95,9 +96,9 @@ public class NewtFactory { * Shall reference at least two PNG icons, from lower (16x16) to higher (>= 32x32) resolution. *

*/ - public static void setWindowIcons(IOUtil.ClassResources cres) { defaultWindowIcons = cres; } + public static void setWindowIcons(final IOUtil.ClassResources cres) { defaultWindowIcons = cres; } - public static Class getCustomClass(String packageName, String classBaseName) { + public static Class getCustomClass(final String packageName, final String classBaseName) { Class clazz = null; if(packageName!=null && classBaseName!=null) { final String clazzName; @@ -108,7 +109,7 @@ public class NewtFactory { } try { clazz = Class.forName(clazzName); - } catch (Throwable t) { + } catch (final Throwable t) { if(DEBUG_IMPLEMENTATION) { System.err.println("Warning: Failed to find class <"+clazzName+">: "+t.getMessage()); t.printStackTrace(); @@ -125,7 +126,7 @@ public class NewtFactory { * The default is enabled.
* The EventDispatchThread is thread local to the Display instance.
*/ - public static synchronized void setUseEDT(boolean onoff) { + public static synchronized void setUseEDT(final boolean onoff) { useEDT = onoff; } @@ -144,7 +145,7 @@ public class NewtFactory { * see {@link AbstractGraphicsDevice#getConnection()}. Use null for default. * @return the new or reused Display instance */ - public static Display createDisplay(String name) { + public static Display createDisplay(final String name) { return createDisplay(name, true); } @@ -162,7 +163,7 @@ public class NewtFactory { * @param reuse attempt to reuse an existing Display with same name if set true, otherwise create a new instance. * @return the new or reused Display instance */ - public static Display createDisplay(String name, boolean reuse) { + public static Display createDisplay(final String name, final boolean reuse) { return DisplayImpl.create(NativeWindowFactory.getNativeWindowType(true), name, 0, reuse); } @@ -179,7 +180,7 @@ public class NewtFactory { * see {@link AbstractGraphicsDevice#getConnection()}. Use null for default. * @return the new or reused Display instance */ - public static Display createDisplay(String type, String name) { + public static Display createDisplay(final String type, final String name) { return createDisplay(type, name, true); } @@ -198,7 +199,7 @@ public class NewtFactory { * @param reuse attempt to reuse an existing Display with same name if set true, otherwise create a new instance. * @return the new or reused Display instance */ - public static Display createDisplay(String type, String name, boolean reuse) { + public static Display createDisplay(final String type, final String name, final boolean reuse) { return DisplayImpl.create(type, name, 0, reuse); } @@ -212,7 +213,7 @@ public class NewtFactory { * and {@link Display#removeReference()}. *

*/ - public static Screen createScreen(Display display, int index) { + public static Screen createScreen(final Display display, final int index) { return ScreenImpl.create(display, index); } @@ -229,7 +230,7 @@ public class NewtFactory { * and {@link Screen#removeReference()}. *

*/ - public static Window createWindow(CapabilitiesImmutable caps) { + public static Window createWindow(final CapabilitiesImmutable caps) { return createWindowImpl(NativeWindowFactory.getNativeWindowType(true), caps); } @@ -243,7 +244,7 @@ public class NewtFactory { * and {@link Screen#removeReference()}. *

*/ - public static Window createWindow(Screen screen, CapabilitiesImmutable caps) { + public static Window createWindow(final Screen screen, final CapabilitiesImmutable caps) { return WindowImpl.create(null, 0, screen, caps); } @@ -269,7 +270,7 @@ public class NewtFactory { * * @param parentWindowObject either a NativeWindow instance */ - public static Window createWindow(NativeWindow parentWindow, CapabilitiesImmutable caps) { + public static Window createWindow(final NativeWindow parentWindow, final CapabilitiesImmutable caps) { final String type = NativeWindowFactory.getNativeWindowType(true); if( null == parentWindow ) { return createWindowImpl(type, caps); @@ -283,14 +284,14 @@ public class NewtFactory { screen = newtParentWindow.getScreen(); } else { // create a Display/Screen compatible to the NativeWindow - AbstractGraphicsConfiguration parentConfig = parentWindow.getGraphicsConfiguration(); + final AbstractGraphicsConfiguration parentConfig = parentWindow.getGraphicsConfiguration(); if(null!=parentConfig) { - AbstractGraphicsScreen parentScreen = parentConfig.getScreen(); - AbstractGraphicsDevice parentDevice = parentScreen.getDevice(); - Display display = NewtFactory.createDisplay(type, parentDevice.getHandle(), true); + final AbstractGraphicsScreen parentScreen = parentConfig.getScreen(); + final AbstractGraphicsDevice parentDevice = parentScreen.getDevice(); + final Display display = NewtFactory.createDisplay(type, parentDevice.getHandle(), true); screen = NewtFactory.createScreen(display, parentScreen.getIndex()); } else { - Display display = NewtFactory.createDisplay(type, null, true); // local display + final Display display = NewtFactory.createDisplay(type, null, true); // local display screen = NewtFactory.createScreen(display, 0); // screen 0 } } @@ -304,9 +305,9 @@ public class NewtFactory { return win; } - private static Window createWindowImpl(String type, CapabilitiesImmutable caps) { - Display display = NewtFactory.createDisplay(type, null, true); // local display - Screen screen = NewtFactory.createScreen(display, 0); // screen 0 + private static Window createWindowImpl(final String type, final CapabilitiesImmutable caps) { + final Display display = NewtFactory.createDisplay(type, null, true); // local display + final Screen screen = NewtFactory.createScreen(display, 0); // screen 0 return WindowImpl.create(null, 0, screen, caps); } @@ -319,10 +320,10 @@ public class NewtFactory { * @param caps the desired capabilities * @return */ - public static Window createWindow(String displayConnection, int screenIdx, long parentWindowHandle, CapabilitiesImmutable caps) { + public static Window createWindow(final String displayConnection, final int screenIdx, final long parentWindowHandle, final CapabilitiesImmutable caps) { final String type = NativeWindowFactory.getNativeWindowType(true); - Display display = NewtFactory.createDisplay(type, displayConnection, true); - Screen screen = NewtFactory.createScreen(display, screenIdx); + final Display display = NewtFactory.createDisplay(type, displayConnection, true); + final Screen screen = NewtFactory.createScreen(display, screenIdx); return WindowImpl.create(null, parentWindowHandle, screen, caps); } @@ -333,26 +334,26 @@ public class NewtFactory { * * @param undecorated only impacts if the window is in top-level state, while attached to a parent window it's rendered undecorated always */ - public static Window createWindow(Object[] cstrArguments, Screen screen, CapabilitiesImmutable caps) { + public static Window createWindow(final Object[] cstrArguments, final Screen screen, final CapabilitiesImmutable caps) { return WindowImpl.create(cstrArguments, screen, caps); } /** * Instantiate a Display entity using the native handle. */ - public static Display createDisplay(String type, long handle, boolean reuse) { + public static Display createDisplay(final String type, final long handle, final boolean reuse) { return DisplayImpl.create(type, null, handle, reuse); } - public static boolean isScreenCompatible(NativeWindow parent, Screen childScreen) { + public static boolean isScreenCompatible(final NativeWindow parent, final Screen childScreen) { // Get parent's NativeWindow details - AbstractGraphicsConfiguration parentConfig = parent.getGraphicsConfiguration(); - AbstractGraphicsScreen parentScreen = parentConfig.getScreen(); - AbstractGraphicsDevice parentDevice = parentScreen.getDevice(); + final AbstractGraphicsConfiguration parentConfig = parent.getGraphicsConfiguration(); + final AbstractGraphicsScreen parentScreen = parentConfig.getScreen(); + final AbstractGraphicsDevice parentDevice = parentScreen.getDevice(); - DisplayImpl childDisplay = (DisplayImpl) childScreen.getDisplay(); - String parentDisplayName = childDisplay.validateDisplayName(null, parentDevice.getHandle()); - String childDisplayName = childDisplay.getName(); + final DisplayImpl childDisplay = (DisplayImpl) childScreen.getDisplay(); + final String parentDisplayName = childDisplay.validateDisplayName(null, parentDevice.getHandle()); + final String childDisplayName = childDisplay.getName(); if( ! parentDisplayName.equals( childDisplayName ) ) { return false; } @@ -363,23 +364,23 @@ public class NewtFactory { return true; } - public static Screen createCompatibleScreen(NativeWindow parent) { + public static Screen createCompatibleScreen(final NativeWindow parent) { return createCompatibleScreen(parent, null); } - public static Screen createCompatibleScreen(NativeWindow parent, Screen childScreen) { + public static Screen createCompatibleScreen(final NativeWindow parent, final Screen childScreen) { // Get parent's NativeWindow details - AbstractGraphicsConfiguration parentConfig = parent.getGraphicsConfiguration(); - AbstractGraphicsScreen parentScreen = parentConfig.getScreen(); - AbstractGraphicsDevice parentDevice = parentScreen.getDevice(); + final AbstractGraphicsConfiguration parentConfig = parent.getGraphicsConfiguration(); + final AbstractGraphicsScreen parentScreen = parentConfig.getScreen(); + final AbstractGraphicsDevice parentDevice = parentScreen.getDevice(); if(null != childScreen) { // check if child Display/Screen is compatible already - DisplayImpl childDisplay = (DisplayImpl) childScreen.getDisplay(); - String parentDisplayName = childDisplay.validateDisplayName(null, parentDevice.getHandle()); - String childDisplayName = childDisplay.getName(); - boolean displayEqual = parentDisplayName.equals( childDisplayName ); - boolean screenEqual = parentScreen.getIndex() == childScreen.getIndex(); + final DisplayImpl childDisplay = (DisplayImpl) childScreen.getDisplay(); + final String parentDisplayName = childDisplay.validateDisplayName(null, parentDevice.getHandle()); + final String childDisplayName = childDisplay.getName(); + final boolean displayEqual = parentDisplayName.equals( childDisplayName ); + final boolean screenEqual = parentScreen.getIndex() == childScreen.getIndex(); if(DEBUG_IMPLEMENTATION) { System.err.println("NewtFactory.createCompatibleScreen: Display: "+ parentDisplayName+" =? "+childDisplayName+" : "+displayEqual+"; Screen: "+ @@ -393,7 +394,7 @@ public class NewtFactory { // Prep NEWT's Display and Screen according to the parent final String type = NativeWindowFactory.getNativeWindowType(true); - Display display = NewtFactory.createDisplay(type, parentDevice.getHandle(), true); + final Display display = NewtFactory.createDisplay(type, parentDevice.getHandle(), true); return NewtFactory.createScreen(display, parentScreen.getIndex()); } } diff --git a/src/newt/classes/com/jogamp/newt/NewtVersion.java b/src/newt/classes/com/jogamp/newt/NewtVersion.java index e70d63f88..f4cdee487 100644 --- a/src/newt/classes/com/jogamp/newt/NewtVersion.java +++ b/src/newt/classes/com/jogamp/newt/NewtVersion.java @@ -38,7 +38,7 @@ public class NewtVersion extends JogampVersion { protected static volatile NewtVersion jogampCommonVersionInfo; - protected NewtVersion(String packageName, Manifest mf) { + protected NewtVersion(final String packageName, final Manifest mf) { super(packageName, mf); } @@ -56,7 +56,7 @@ public class NewtVersion extends JogampVersion { return jogampCommonVersionInfo; } - public static void main(String args[]) { + public static void main(final String args[]) { System.err.println(VersionUtil.getPlatformInfo()); System.err.println(GlueGenVersion.getInstance()); System.err.println(NativeWindowVersion.getInstance()); diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java index cef254634..0ba557972 100644 --- a/src/newt/classes/com/jogamp/newt/Screen.java +++ b/src/newt/classes/com/jogamp/newt/Screen.java @@ -71,10 +71,10 @@ public abstract class Screen { /** return true if obj is of type Display and both FQN {@link #getFQName()} equals */ @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof Screen) { - Screen s = (Screen)obj; + final Screen s = (Screen)obj; return s.getFQName().equals(getFQName()); } return false; @@ -268,7 +268,7 @@ public abstract class Screen { * @param fromIndex start index, then increasing until found or end of list * * @return */ - public static Screen getFirstScreenOf(Display display, int idx, int fromIndex) { + public static Screen getFirstScreenOf(final Display display, final int idx, final int fromIndex) { return getScreenOfImpl(display, idx, fromIndex, 1); } @@ -279,11 +279,11 @@ public abstract class Screen { * @param fromIndex start index, then decreasing until found or end of list. -1 is interpreted as size - 1. * @return */ - public static Screen getLastScreenOf(Display display, int idx, int fromIndex) { + public static Screen getLastScreenOf(final Display display, final int idx, final int fromIndex) { return getScreenOfImpl(display, idx, fromIndex, -1); } - private static Screen getScreenOfImpl(Display display, int idx, int fromIndex, int incr) { + private static Screen getScreenOfImpl(final Display display, final int idx, final int fromIndex, final int incr) { synchronized(screenList) { int i = fromIndex >= 0 ? fromIndex : screenList.size() - 1 ; while( ( incr > 0 ) ? i < screenList.size() : i >= 0 ) { @@ -307,7 +307,7 @@ public abstract class Screen { return null; } - protected static void addScreen2List(Screen screen) { + protected static void addScreen2List(final Screen screen) { synchronized(screenList) { // GC before add int i=0; diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index 4efd60765..c44584d78 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -147,7 +147,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto /** * Instantiates a NewtCanvas without a NEWT child.
*/ - public NewtCanvasAWT(GraphicsConfiguration gc) { + public NewtCanvasAWT(final GraphicsConfiguration gc) { super(gc); awtMouseAdapter = new AWTMouseAdapter().addTo(this); awtKeyAdapter = new AWTKeyAdapter().addTo(this); @@ -158,7 +158,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto /** * Instantiates a NewtCanvas with a NEWT child. */ - public NewtCanvasAWT(Window child) { + public NewtCanvasAWT(final Window child) { super(); awtMouseAdapter = new AWTMouseAdapter().addTo(this); awtKeyAdapter = new AWTKeyAdapter().addTo(this); @@ -170,7 +170,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto /** * Instantiates a NewtCanvas with a NEWT child. */ - public NewtCanvasAWT(GraphicsConfiguration gc, Window child) { + public NewtCanvasAWT(final GraphicsConfiguration gc, final Window child) { super(gc); awtMouseAdapter = new AWTMouseAdapter().addTo(this); awtKeyAdapter = new AWTKeyAdapter().addTo(this); @@ -180,7 +180,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } @Override - public void setShallUseOffscreenLayer(boolean v) { + public void setShallUseOffscreenLayer(final boolean v) { shallUseOffscreenLayer = v; } @@ -253,11 +253,11 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto }; private final WindowListener clearAWTMenusOnNewtFocus = new WindowAdapter() { @Override - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { updateLayoutSize(); } @Override - public void windowGainedFocus(WindowEvent arg0) { + public void windowGainedFocus(final WindowEvent arg0) { if( isParent() && !isFullscreen() ) { AWTEDTExecutor.singleton.invoke(false, awtClearSelectedMenuPath); } @@ -266,19 +266,19 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto class FocusTraversalKeyListener implements KeyListener { @Override - public void keyPressed(KeyEvent e) { + public void keyPressed(final KeyEvent e) { if( isParent() && !isFullscreen() ) { handleKey(e, false); } } @Override - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( isParent() && !isFullscreen() ) { handleKey(e, true); } } - void handleKey(KeyEvent evt, boolean onRelease) { + void handleKey(final KeyEvent evt, final boolean onRelease) { if(null == keyboardFocusManager) { throw new InternalError("XXX"); } @@ -317,7 +317,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto class FocusPropertyChangeListener implements PropertyChangeListener { @Override - public void propertyChange(PropertyChangeEvent evt) { + public void propertyChange(final PropertyChangeEvent evt) { final Object oldF = evt.getOldValue(); final Object newF = evt.getNewValue(); final boolean isParent = isParent(); @@ -374,7 +374,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto *

* @return the previous attached newt child. */ - public Window setNEWTChild(Window newChild) { + public Window setNEWTChild(final Window newChild) { synchronized(sync) { final Window prevChild = newtChild; if(DEBUG) { @@ -400,7 +400,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto final Window w = newtChild; if( null != w ) { // use NEWT child's size for min/pref size! - java.awt.Dimension minSize = new java.awt.Dimension(w.getWidth(), w.getHeight()); + final java.awt.Dimension minSize = new java.awt.Dimension(w.getWidth(), w.getHeight()); setMinimumSize(minSize); setPreferredSize(minSize); } @@ -421,7 +421,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } @Override - public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) { + public WindowClosingMode setDefaultCloseOperation(final WindowClosingMode op) { return awtWindowClosingProtocol.setDefaultCloseOperation(op); } @@ -435,7 +435,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto * which finally will perform the pending JAWT destruction. *

*/ - public final void setSkipJAWTDestroy(boolean v) { skipJAWTDestroy = v; } + public final void setSkipJAWTDestroy(final boolean v) { skipJAWTDestroy = v; } /** See {@link #setSkipJAWTDestroy(boolean)}. */ public final boolean getSkipJAWTDestroy() { return skipJAWTDestroy; } @@ -524,7 +524,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } ); } - private final void destroyImpl(boolean removeNotify, boolean windowClosing) { + private final void destroyImpl(final boolean removeNotify, final boolean windowClosing) { synchronized(sync) { final java.awt.Container cont = AWTMisc.getContainer(this); if(DEBUG) { @@ -562,7 +562,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } @Override - public void paint(Graphics g) { + public void paint(final Graphics g) { synchronized(sync) { if( validateComponent(true) && !printActive ) { newtChild.windowRepaint(0, 0, getWidth(), getHeight()); @@ -570,13 +570,13 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } @Override - public void update(Graphics g) { + public void update(final Graphics g) { paint(g); } @SuppressWarnings("deprecation") @Override - public void reshape(int x, int y, int width, int height) { + public void reshape(final int x, final int y, final int width, final int height) { synchronized (getTreeLock()) { // super.reshape(..) claims tree lock, so we do extend it's lock over reshape synchronized(sync) { super.reshape(x, y, width, height); @@ -603,7 +603,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } @Override - public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) { + public void setupPrint(final double scaleMatX, final double scaleMatY, final int numSamples, final int tileWidth, final int tileHeight) { printActive = true; final int componentCount = isOpaque() ? 3 : 4; final TileRenderer printRenderer = new TileRenderer(); @@ -720,7 +720,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto }; @Override - public void print(Graphics graphics) { + public void print(final Graphics graphics) { synchronized(sync) { if( !printActive || null == printGLAD ) { throw new IllegalStateException("setupPrint() not called"); @@ -750,7 +750,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto printAWTTiles.resetGraphics2D(); } } - } catch (NoninvertibleTransformException nte) { + } catch (final NoninvertibleTransformException nte) { System.err.println("Caught: Inversion failed of: "+g2d.getTransform()); nte.printStackTrace(); } @@ -760,7 +760,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } - private final boolean validateComponent(boolean attachNewtChild) { + private final boolean validateComponent(final boolean attachNewtChild) { if( Beans.isDesignTime() || !isDisplayable() ) { return false; } @@ -778,7 +778,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto return true; } - private final void configureNewtChild(boolean attach) { + private final void configureNewtChild(final boolean attach) { awtWinAdapter.clear(); awtKeyAdapter.clear(); awtMouseAdapter.clear(); @@ -904,7 +904,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } }; - private final void detachNewtChild(java.awt.Container cont) { + private final void detachNewtChild(final java.awt.Container cont) { if( null == newtChild || null == jawtWindow || !newtChildAttached ) { return; // nop } @@ -951,16 +951,16 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto clazz.getDeclaredMethod("disableBackgroundErase", new Class[] { Canvas.class }); disableBackgroundEraseMethod.setAccessible(true); - } catch (Exception e) { + } catch (final Exception e) { clazz = clazz.getSuperclass(); } } - } catch (Exception e) { + } catch (final Exception e) { } return null; } }); - } catch (Exception e) { + } catch (final Exception e) { } disableBackgroundEraseInitialized = true; if(DEBUG) { @@ -972,7 +972,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto Throwable t=null; try { disableBackgroundEraseMethod.invoke(getToolkit(), new Object[] { this }); - } catch (Exception e) { + } catch (final Exception e) { t = e; } if(DEBUG) { @@ -983,10 +983,10 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto protected static String currentThreadName() { return "["+Thread.currentThread().getName()+", isAWT-EDT "+EventQueue.isDispatchThread()+"]"; } - static String newtWinHandleToHexString(Window w) { + static String newtWinHandleToHexString(final Window w) { return null != w ? toHexString(w.getWindowHandle()) : "nil"; } - static String toHexString(long l) { + static String toHexString(final long l) { return "0x"+Long.toHexString(l); } } 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 9cecca9c5..496bd93eb 100644 --- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java +++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java @@ -146,7 +146,7 @@ public class JOGLNewtApplet1Run extends Applet { glHeight = JOGLNewtAppletBase.str2Int(getParameter("gl_height"), glHeight); glNoDefaultKeyListener = JOGLNewtAppletBase.str2Bool(getParameter("gl_nodefaultkeyListener"), glNoDefaultKeyListener); appletDebugTestBorder = JOGLNewtAppletBase.str2Bool(getParameter("appletDebugTestBorder"), appletDebugTestBorder); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } if(null==glEventListenerClazzName) { @@ -181,7 +181,7 @@ public class JOGLNewtApplet1Run extends Applet { glTrace); try { - GLCapabilities caps = new GLCapabilities(GLProfile.get(glProfileName)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(glProfileName)); caps.setAlphaBits(glAlphaBits); if(0pixels. * @param scaledDoubleTapSlop Distance in pixels between the first touch and second touch to still be considered a double tap. */ - public DoubleTapScrollGesture(int scaledScrollSlop, int scaledDoubleTapSlop) { + public DoubleTapScrollGesture(final int scaledScrollSlop, final int scaledDoubleTapSlop) { scrollSlop = scaledScrollSlop; scrollSlopSquare = scaledScrollSlop * scaledScrollSlop; doubleTapSlop = scaledDoubleTapSlop; @@ -148,7 +150,7 @@ public class DoubleTapScrollGesture implements GestureHandler { } @Override - public void clear(boolean clearStarted) { + public void clear(final boolean clearStarted) { scrollDistance[0] = 0f; scrollDistance[1] = 0f; hitGestureEvent = null; diff --git a/src/newt/classes/com/jogamp/newt/event/InputEvent.java b/src/newt/classes/com/jogamp/newt/event/InputEvent.java index 7889098ea..fbda79d46 100644 --- a/src/newt/classes/com/jogamp/newt/event/InputEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/InputEvent.java @@ -176,7 +176,7 @@ public abstract class InputEvent extends NEWTEvent * @param button the button to test * @return true if the given button is down */ - public final boolean isButtonDown(int button) { + public final boolean isButtonDown(final int button) { return ( modifiers & getButtonMask(button) ) != 0; } diff --git a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java index 5cef734bb..0f147a722 100644 --- a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java @@ -32,10 +32,10 @@ package com.jogamp.newt.event; public abstract class KeyAdapter implements KeyListener { @Override - public void keyPressed(KeyEvent e) { + public void keyPressed(final KeyEvent e) { } @Override - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { } } diff --git a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java index 8cdfb0db3..f29e9eb8c 100644 --- a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java @@ -377,7 +377,7 @@ public class KeyEvent extends InputEvent public short max; /** true if valid for keyChar values as well, otherwise only valid for keyCode and keySym due to collision. */ public final boolean inclKeyChar; - private NonPrintableRange(short min, short max, boolean inclKeyChar) { + private NonPrintableRange(final short min, final short max, final boolean inclKeyChar) { this.min = min; this.max = max; this.inclKeyChar = inclKeyChar; diff --git a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java index 98252fe14..679155d10 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java @@ -31,28 +31,28 @@ package com.jogamp.newt.event; public abstract class MouseAdapter implements MouseListener { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { } @Override - public void mouseEntered(MouseEvent e) { + public void mouseEntered(final MouseEvent e) { } @Override - public void mouseExited(MouseEvent e) { + public void mouseExited(final MouseEvent e) { } @Override - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { } @Override - public void mouseReleased(MouseEvent e) { + public void mouseReleased(final MouseEvent e) { } @Override - public void mouseMoved(MouseEvent e) { + public void mouseMoved(final MouseEvent e) { } @Override - public void mouseDragged(MouseEvent e) { + public void mouseDragged(final MouseEvent e) { } @Override - public void mouseWheelMoved(MouseEvent e) { + public void mouseWheelMoved(final MouseEvent e) { } } diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java index 43cac31bb..982b855a7 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java @@ -124,7 +124,7 @@ public class MouseEvent extends InputEvent return types; } - private PointerType(PointerClass pc) { + private PointerType(final PointerClass pc) { this.pc = pc; } PointerClass pc; diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java index 78bb7420a..a9d9d8bdb 100644 --- a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java @@ -143,7 +143,7 @@ public class NEWTEvent extends java.util.EventObject { return sb.append("NEWTEvent[source:").append(getSource().getClass().getName()).append(", consumed ").append(isConsumed()).append(", when:").append(getWhen()).append(" d ").append((System.currentTimeMillis()-getWhen())).append("ms]"); } - public static String toHexString(short hex) { + public static String toHexString(final short hex) { return "0x" + Integer.toHexString( hex & 0x0000FFFF ); } } diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java index 7dd56ad1e..dd6395354 100644 --- a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java +++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java @@ -32,10 +32,10 @@ import java.util.LinkedList; public class NEWTEventFiFo { - private LinkedList/**/ events = new LinkedList/**/(); + private final LinkedList/**/ events = new LinkedList/**/(); /** Add NEWTEvent to tail */ - public synchronized void put(NEWTEvent event) { + public synchronized void put(final NEWTEvent event) { events.addLast(event); notifyAll(); } diff --git a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java index 1521036d6..9c7a4bcb8 100644 --- a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java +++ b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java @@ -98,7 +98,7 @@ public class PinchToZoomGesture implements GestureHandler { * @param surface the {@link NativeSurface}, which size is used to compute the relative zoom factor * @param allowMorePointer if false, allow only 2 pressed pointers (safe and recommended), otherwise accept other pointer to be pressed. */ - public PinchToZoomGesture(NativeSurface surface, boolean allowMorePointer) { + public PinchToZoomGesture(final NativeSurface surface, final boolean allowMorePointer) { clear(true); this.surface = surface; this.allowMorePointer = allowMorePointer; @@ -124,7 +124,7 @@ public class PinchToZoomGesture implements GestureHandler { } @Override - public void clear(boolean clearStarted) { + public void clear(final boolean clearStarted) { zoomEvent = null; if( clearStarted ) { zoomLastEdgeDist = 0; @@ -155,7 +155,7 @@ public class PinchToZoomGesture implements GestureHandler { return zoom; } /** Set zoom value within [0..2], with 1 as 1:1. */ - public final void setZoom(float zoom) { + public final void setZoom(final float zoom) { this.zoom=zoom; } diff --git a/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java index bbc170958..50eae9626 100644 --- a/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java @@ -36,17 +36,17 @@ public class TraceKeyAdapter implements KeyListener { this.downstream = null; } - public TraceKeyAdapter(KeyListener downstream) { + public TraceKeyAdapter(final KeyListener downstream) { this.downstream = downstream; } @Override - public void keyPressed(KeyEvent e) { + public void keyPressed(final KeyEvent e) { System.err.println(e); if(null!=downstream) { downstream.keyPressed(e); } } @Override - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { System.err.println(e); if(null!=downstream) { downstream.keyReleased(e); } } diff --git a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java index db8376034..e54c3730f 100644 --- a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java @@ -36,47 +36,47 @@ public class TraceMouseAdapter implements MouseListener { this.downstream = null; } - public TraceMouseAdapter(MouseListener downstream) { + public TraceMouseAdapter(final MouseListener downstream) { this.downstream = downstream; } @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseClicked(e); } } @Override - public void mouseEntered(MouseEvent e) { + public void mouseEntered(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseEntered(e); } } @Override - public void mouseExited(MouseEvent e) { + public void mouseExited(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseExited(e); } } @Override - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mousePressed(e); } } @Override - public void mouseReleased(MouseEvent e) { + public void mouseReleased(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseReleased(e); } } @Override - public void mouseMoved(MouseEvent e) { + public void mouseMoved(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseMoved(e); } } @Override - public void mouseDragged(MouseEvent e) { + public void mouseDragged(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseDragged(e); } } @Override - public void mouseWheelMoved(MouseEvent e) { + public void mouseWheelMoved(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseWheelMoved(e); } } diff --git a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java index 7b844f059..299a6ff90 100644 --- a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java @@ -36,42 +36,42 @@ public class TraceWindowAdapter implements WindowListener { this.downstream = null; } - public TraceWindowAdapter(WindowListener downstream) { + public TraceWindowAdapter(final WindowListener downstream) { this.downstream = downstream; } @Override - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowResized(e); } } @Override - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowMoved(e); } } @Override - public void windowDestroyNotify(WindowEvent e) { + public void windowDestroyNotify(final WindowEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowDestroyNotify(e); } } @Override - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowDestroyed(e); } } @Override - public void windowGainedFocus(WindowEvent e) { + public void windowGainedFocus(final WindowEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowGainedFocus(e); } } @Override - public void windowLostFocus(WindowEvent e) { + public void windowLostFocus(final WindowEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowLostFocus(e); } } @Override - public void windowRepaint(WindowUpdateEvent e) { + public void windowRepaint(final WindowUpdateEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowRepaint(e); } } diff --git a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java index ccc627444..c1bae40ea 100644 --- a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java @@ -31,24 +31,24 @@ package com.jogamp.newt.event; public abstract class WindowAdapter implements WindowListener { @Override - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { } @Override - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { } @Override - public void windowDestroyNotify(WindowEvent e) { + public void windowDestroyNotify(final WindowEvent e) { } @Override - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { } @Override - public void windowGainedFocus(WindowEvent e) { + public void windowGainedFocus(final WindowEvent e) { } @Override - public void windowLostFocus(WindowEvent e) { + public void windowLostFocus(final WindowEvent e) { } @Override - public void windowRepaint(WindowUpdateEvent e) { + public void windowRepaint(final WindowUpdateEvent e) { } } diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java index 9b1348288..a49c10a1e 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java @@ -128,7 +128,7 @@ public abstract class AWTAdapter implements java.util.EventListener * where the given {@link NativeSurfaceHolder} impersonates the event's source. * The NEWT EventListener will be called when an event happens.
*/ - protected AWTAdapter(com.jogamp.newt.event.NEWTEventListener newtListener, NativeSurfaceHolder nsProxy) { + protected AWTAdapter(final com.jogamp.newt.event.NEWTEventListener newtListener, final NativeSurfaceHolder nsProxy) { if(null==newtListener) { throw new IllegalArgumentException("Argument newtListener is null"); } @@ -147,7 +147,7 @@ public abstract class AWTAdapter implements java.util.EventListener * where the given {@link com.jogamp.newt.Window NEWT Window}, a {@link NativeSurfaceHolder}, impersonates the event's source. * The NEWT EventListener will be called when an event happens.
*/ - protected AWTAdapter(com.jogamp.newt.event.NEWTEventListener newtListener, com.jogamp.newt.Window newtProxy) { + protected AWTAdapter(final com.jogamp.newt.event.NEWTEventListener newtListener, final com.jogamp.newt.Window newtProxy) { if(null==newtListener) { throw new IllegalArgumentException("Argument newtListener is null"); } @@ -167,7 +167,7 @@ public abstract class AWTAdapter implements java.util.EventListener * This is only supported with EDT enabled! * @throws IllegalStateException if EDT is not enabled */ - protected AWTAdapter(com.jogamp.newt.Window downstream) throws IllegalStateException { + protected AWTAdapter(final com.jogamp.newt.Window downstream) throws IllegalStateException { this(); setDownstream(downstream); } @@ -183,7 +183,7 @@ public abstract class AWTAdapter implements java.util.EventListener * This is only supported with EDT enabled! * @throws IllegalStateException if EDT is not enabled */ - public synchronized AWTAdapter setDownstream(com.jogamp.newt.Window downstream) throws IllegalStateException { + public synchronized AWTAdapter setDownstream(final com.jogamp.newt.Window downstream) throws IllegalStateException { if(null==downstream) { throw new RuntimeException("Argument downstream is null"); } @@ -212,7 +212,7 @@ public abstract class AWTAdapter implements java.util.EventListener return this; } - public final synchronized void setConsumeAWTEvent(boolean v) { + public final synchronized void setConsumeAWTEvent(final boolean v) { this.consumeAWTEvent = v; } diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java index 5ea36bac8..4f11e8772 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java @@ -39,15 +39,15 @@ import jogamp.newt.awt.event.AWTNewtEventFactory; */ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListener { - public AWTKeyAdapter(com.jogamp.newt.event.KeyListener newtListener, NativeSurfaceHolder nsProxy) { + public AWTKeyAdapter(final com.jogamp.newt.event.KeyListener newtListener, final NativeSurfaceHolder nsProxy) { super(newtListener, nsProxy); } - public AWTKeyAdapter(com.jogamp.newt.event.KeyListener newtListener, com.jogamp.newt.Window newtProxy) { + public AWTKeyAdapter(final com.jogamp.newt.event.KeyListener newtListener, final com.jogamp.newt.Window newtProxy) { super(newtListener, newtProxy); } - public AWTKeyAdapter(com.jogamp.newt.Window downstream) { + public AWTKeyAdapter(final com.jogamp.newt.Window downstream) { super(downstream); } @@ -56,19 +56,19 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe } @Override - public synchronized AWTAdapter addTo(java.awt.Component awtComponent) { + public synchronized AWTAdapter addTo(final java.awt.Component awtComponent) { awtComponent.addKeyListener(this); return this; } @Override - public synchronized AWTAdapter removeFrom(java.awt.Component awtComponent) { + public synchronized AWTAdapter removeFrom(final java.awt.Component awtComponent) { awtComponent.removeKeyListener(this); return this; } @Override - public synchronized void keyPressed(java.awt.event.KeyEvent e) { + public synchronized void keyPressed(final java.awt.event.KeyEvent e) { if( !isSetup ) { return; } final com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(com.jogamp.newt.event.KeyEvent.EVENT_KEY_PRESSED, e, nsHolder); if( consumeAWTEvent ) { @@ -80,7 +80,7 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe } @Override - public synchronized void keyReleased(java.awt.event.KeyEvent e) { + public synchronized void keyReleased(final java.awt.event.KeyEvent e) { if( !isSetup ) { return; } final com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED, e, nsHolder); if( consumeAWTEvent ) { @@ -92,7 +92,7 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe } @Override - public synchronized void keyTyped(java.awt.event.KeyEvent e) { + public synchronized void keyTyped(final java.awt.event.KeyEvent e) { if( !isSetup ) { return; } if( consumeAWTEvent ) { e.consume(); diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java index 53fe70bf7..d9531cd5f 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java @@ -36,15 +36,15 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener { - public AWTMouseAdapter(com.jogamp.newt.event.MouseListener newtListener, NativeSurfaceHolder nsProxy) { + public AWTMouseAdapter(final com.jogamp.newt.event.MouseListener newtListener, final NativeSurfaceHolder nsProxy) { super(newtListener, nsProxy); } - public AWTMouseAdapter(com.jogamp.newt.event.MouseListener newtListener, com.jogamp.newt.Window newtProxy) { + public AWTMouseAdapter(final com.jogamp.newt.event.MouseListener newtListener, final com.jogamp.newt.Window newtProxy) { super(newtListener, newtProxy); } - public AWTMouseAdapter(com.jogamp.newt.Window downstream) { + public AWTMouseAdapter(final com.jogamp.newt.Window downstream) { super(downstream); } @@ -53,7 +53,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized AWTAdapter addTo(java.awt.Component awtComponent) { + public synchronized AWTAdapter addTo(final java.awt.Component awtComponent) { awtComponent.addMouseListener(this); awtComponent.addMouseMotionListener(this); awtComponent.addMouseWheelListener(this); @@ -61,7 +61,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized AWTAdapter removeFrom(java.awt.Component awtComponent) { + public synchronized AWTAdapter removeFrom(final java.awt.Component awtComponent) { awtComponent.removeMouseListener(this); awtComponent.removeMouseMotionListener(this); awtComponent.removeMouseWheelListener(this); @@ -69,9 +69,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseClicked(java.awt.event.MouseEvent e) { + public synchronized void mouseClicked(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -81,9 +81,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseEntered(java.awt.event.MouseEvent e) { + public synchronized void mouseEntered(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -93,9 +93,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseExited(java.awt.event.MouseEvent e) { + public synchronized void mouseExited(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -105,9 +105,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mousePressed(java.awt.event.MouseEvent e) { + public synchronized void mousePressed(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -117,9 +117,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseReleased(java.awt.event.MouseEvent e) { + public synchronized void mouseReleased(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -129,9 +129,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseDragged(java.awt.event.MouseEvent e) { + public synchronized void mouseDragged(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -141,9 +141,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseMoved(java.awt.event.MouseEvent e) { + public synchronized void mouseMoved(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -153,9 +153,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseWheelMoved(java.awt.event.MouseWheelEvent e) { + public synchronized void mouseWheelMoved(final java.awt.event.MouseWheelEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java index 698fe86f4..65d927157 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java @@ -40,15 +40,15 @@ public class AWTWindowAdapter { WindowClosingListener windowClosingListener; - public AWTWindowAdapter(com.jogamp.newt.event.WindowListener newtListener, NativeSurfaceHolder nsProxy) { + public AWTWindowAdapter(final com.jogamp.newt.event.WindowListener newtListener, final NativeSurfaceHolder nsProxy) { super(newtListener, nsProxy); } - public AWTWindowAdapter(com.jogamp.newt.event.WindowListener newtListener, com.jogamp.newt.Window newtProxy) { + public AWTWindowAdapter(final com.jogamp.newt.event.WindowListener newtListener, final com.jogamp.newt.Window newtProxy) { super(newtListener, newtProxy); } - public AWTWindowAdapter(com.jogamp.newt.Window downstream) { + public AWTWindowAdapter(final com.jogamp.newt.Window downstream) { super(downstream); } @@ -57,8 +57,8 @@ public class AWTWindowAdapter } @Override - public synchronized AWTAdapter addTo(java.awt.Component awtComponent) { - java.awt.Window win = getWindow(awtComponent); + public synchronized AWTAdapter addTo(final java.awt.Component awtComponent) { + final java.awt.Window win = getWindow(awtComponent); awtComponent.addComponentListener(this); awtComponent.addFocusListener(this); if( null != win && null == windowClosingListener ) { @@ -71,8 +71,8 @@ public class AWTWindowAdapter return this; } - public synchronized AWTAdapter removeWindowClosingFrom(java.awt.Component awtComponent) { - java.awt.Window win = getWindow(awtComponent); + public synchronized AWTAdapter removeWindowClosingFrom(final java.awt.Component awtComponent) { + final java.awt.Window win = getWindow(awtComponent); if( null != win && null != windowClosingListener ) { win.removeWindowListener(windowClosingListener); } @@ -80,7 +80,7 @@ public class AWTWindowAdapter } @Override - public synchronized AWTAdapter removeFrom(java.awt.Component awtComponent) { + public synchronized AWTAdapter removeFrom(final java.awt.Component awtComponent) { awtComponent.removeFocusListener(this); awtComponent.removeComponentListener(this); removeWindowClosingFrom(awtComponent); @@ -101,9 +101,9 @@ public class AWTWindowAdapter } @Override - public synchronized void focusGained(java.awt.event.FocusEvent e) { + public synchronized void focusGained(final java.awt.event.FocusEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if(DEBUG_IMPLEMENTATION) { System.err.println("AWT: focusGained: "+e+" -> "+event); } @@ -113,9 +113,9 @@ public class AWTWindowAdapter } @Override - public synchronized void focusLost(java.awt.event.FocusEvent e) { + public synchronized void focusLost(final java.awt.event.FocusEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if(DEBUG_IMPLEMENTATION) { System.err.println("AWT: focusLost: "+e+" -> "+event); } @@ -125,9 +125,9 @@ public class AWTWindowAdapter } @Override - public synchronized void componentResized(java.awt.event.ComponentEvent e) { + public synchronized void componentResized(final java.awt.event.ComponentEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if(DEBUG_IMPLEMENTATION) { final java.awt.Component c = e.getComponent(); final java.awt.Dimension sz = c.getSize(); @@ -149,9 +149,9 @@ public class AWTWindowAdapter } @Override - public synchronized void componentMoved(java.awt.event.ComponentEvent e) { + public synchronized void componentMoved(final java.awt.event.ComponentEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if(DEBUG_IMPLEMENTATION) { System.err.println("AWT: componentMoved: "+e+" -> "+event); } @@ -161,7 +161,7 @@ public class AWTWindowAdapter } @Override - public synchronized void componentShown(java.awt.event.ComponentEvent e) { + public synchronized void componentShown(final java.awt.event.ComponentEvent e) { if( !isSetup ) { return; } final java.awt.Component comp = e.getComponent(); if(DEBUG_IMPLEMENTATION) { @@ -180,7 +180,7 @@ public class AWTWindowAdapter } @Override - public synchronized void componentHidden(java.awt.event.ComponentEvent e) { + public synchronized void componentHidden(final java.awt.event.ComponentEvent e) { if( !isSetup ) { return; } final java.awt.Component comp = e.getComponent(); if(DEBUG_IMPLEMENTATION) { @@ -199,54 +199,54 @@ public class AWTWindowAdapter } @Override - public synchronized void windowActivated(java.awt.event.WindowEvent e) { + public synchronized void windowActivated(final java.awt.event.WindowEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if( EventProcRes.DISPATCH == processEvent(false, event) ) { ((com.jogamp.newt.event.WindowListener)newtListener).windowGainedFocus(event); } } @Override - public synchronized void windowClosed(java.awt.event.WindowEvent e) { } + public synchronized void windowClosed(final java.awt.event.WindowEvent e) { } @Override - public synchronized void windowClosing(java.awt.event.WindowEvent e) { } + public synchronized void windowClosing(final java.awt.event.WindowEvent e) { } @Override - public synchronized void windowDeactivated(java.awt.event.WindowEvent e) { + public synchronized void windowDeactivated(final java.awt.event.WindowEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if( EventProcRes.DISPATCH == processEvent(false, event) ) { ((com.jogamp.newt.event.WindowListener)newtListener).windowLostFocus(event); } } @Override - public synchronized void windowDeiconified(java.awt.event.WindowEvent e) { } + public synchronized void windowDeiconified(final java.awt.event.WindowEvent e) { } @Override - public synchronized void windowIconified(java.awt.event.WindowEvent e) { } + public synchronized void windowIconified(final java.awt.event.WindowEvent e) { } @Override - public synchronized void windowOpened(java.awt.event.WindowEvent e) { } + public synchronized void windowOpened(final java.awt.event.WindowEvent e) { } class WindowClosingListener implements java.awt.event.WindowListener { @Override - public void windowClosing(java.awt.event.WindowEvent e) { + public void windowClosing(final java.awt.event.WindowEvent e) { synchronized( AWTWindowAdapter.this ) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if( EventProcRes.DISPATCH == processEvent(true, event) ) { ((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyNotify(event); } } } @Override - public void windowClosed(java.awt.event.WindowEvent e) { + public void windowClosed(final java.awt.event.WindowEvent e) { synchronized( AWTWindowAdapter.this ) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if( EventProcRes.DISPATCH == processEvent(true, event) ) { ((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyed(event); } @@ -254,15 +254,15 @@ public class AWTWindowAdapter } @Override - public void windowActivated(java.awt.event.WindowEvent e) { } + public void windowActivated(final java.awt.event.WindowEvent e) { } @Override - public void windowDeactivated(java.awt.event.WindowEvent e) { } + public void windowDeactivated(final java.awt.event.WindowEvent e) { } @Override - public void windowDeiconified(java.awt.event.WindowEvent e) { } + public void windowDeiconified(final java.awt.event.WindowEvent e) { } @Override - public void windowIconified(java.awt.event.WindowEvent e) { } + public void windowIconified(final java.awt.event.WindowEvent e) { } @Override - public void windowOpened(java.awt.event.WindowEvent e) { } + public void windowOpened(final java.awt.event.WindowEvent e) { } } } diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index 992cc4284..b9c4e35f2 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -115,7 +115,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind /** * Constructor. Do not call this directly -- use {@link #create()} instead. */ - protected GLWindow(Window window) { + protected GLWindow(final Window window) { super(null, null, false /* always handle device lifecycle ourselves */); this.window = (WindowImpl) window; this.window.setWindowDestroyNotifyAction( new Runnable() { @@ -125,12 +125,12 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } } ); window.addWindowListener(new WindowAdapter() { @Override - public void windowRepaint(WindowUpdateEvent e) { + public void windowRepaint(final WindowUpdateEvent e) { defaultWindowRepaintOp(); } @Override - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { defaultWindowResizedOp(getSurfaceWidth(), getSurfaceHeight()); } @@ -152,7 +152,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind *

* The default Display will be reused if already instantiated. */ - public static GLWindow create(GLCapabilitiesImmutable caps) { + public static GLWindow create(final GLCapabilitiesImmutable caps) { return new GLWindow(NewtFactory.createWindow(caps)); } @@ -164,7 +164,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind * and {@link Screen#removeReference()}. *

*/ - public static GLWindow create(Screen screen, GLCapabilitiesImmutable caps) { + public static GLWindow create(final Screen screen, final GLCapabilitiesImmutable caps) { return new GLWindow(NewtFactory.createWindow(screen, caps)); } @@ -175,7 +175,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind * and {@link Screen#removeReference()}. *

*/ - public static GLWindow create(Window window) { + public static GLWindow create(final Window window) { return new GLWindow(window); } @@ -192,7 +192,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind * and {@link Screen#removeReference()}. *

*/ - public static GLWindow create(NativeWindow parentNativeWindow, GLCapabilitiesImmutable caps) { + public static GLWindow create(final NativeWindow parentNativeWindow, final GLCapabilitiesImmutable caps) { return new GLWindow(NewtFactory.createWindow(parentNativeWindow, caps)); } @@ -205,7 +205,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) { + public WindowClosingMode setDefaultCloseOperation(final WindowClosingMode op) { return window.setDefaultCloseOperation(op); } @@ -214,7 +214,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind // @Override - public CapabilitiesChooser setCapabilitiesChooser(CapabilitiesChooser chooser) { + public CapabilitiesChooser setCapabilitiesChooser(final CapabilitiesChooser chooser) { return window.setCapabilitiesChooser(chooser); } @@ -250,7 +250,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void setTitle(String title) { + public final void setTitle(final String title) { window.setTitle(title); } @@ -265,7 +265,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void setPointerVisible(boolean mouseVisible) { + public final void setPointerVisible(final boolean mouseVisible) { window.setPointerVisible(mouseVisible); } @@ -285,17 +285,17 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void confinePointer(boolean grab) { + public final void confinePointer(final boolean grab) { window.confinePointer(grab); } @Override - public final void setUndecorated(boolean value) { + public final void setUndecorated(final boolean value) { window.setUndecorated(value); } @Override - public final void warpPointer(int x, int y) { + public final void warpPointer(final int x, final int y) { window.warpPointer(x, y); } @Override @@ -304,7 +304,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void setAlwaysOnTop(boolean value) { + public final void setAlwaysOnTop(final boolean value) { window.setAlwaysOnTop(value); } @@ -314,12 +314,12 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void setFocusAction(FocusRunnable focusAction) { + public final void setFocusAction(final FocusRunnable focusAction) { window.setFocusAction(focusAction); } @Override - public void setKeyboardFocusHandler(KeyListener l) { + public void setKeyboardFocusHandler(final KeyListener l) { window.setKeyboardFocusHandler(l); } @@ -329,7 +329,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void requestFocus(boolean wait) { + public final void requestFocus(final boolean wait) { window.requestFocus(wait); } @@ -414,21 +414,21 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void setPosition(int x, int y) { + public final void setPosition(final int x, final int y) { window.setPosition(x, y); } @Override - public void setTopLevelPosition(int x, int y) { + public void setTopLevelPosition(final int x, final int y) { window.setTopLevelPosition(x, y); } @Override - public final boolean setFullscreen(boolean fullscreen) { + public final boolean setFullscreen(final boolean fullscreen) { return window.setFullscreen(fullscreen); } @Override - public boolean setFullscreen(List monitors) { + public boolean setFullscreen(final List monitors) { return window.setFullscreen(monitors); } @@ -449,17 +449,17 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, int hints) { + public final ReparentOperation reparentWindow(final NativeWindow newParent, final int x, final int y, final int hints) { return window.reparentWindow(newParent, x, y, hints); } @Override - public final boolean removeChild(NativeWindow win) { + public final boolean removeChild(final NativeWindow win) { return window.removeChild(win); } @Override - public final boolean addChild(NativeWindow win) { + public final boolean addChild(final NativeWindow win) { return window.addChild(win); } @@ -473,30 +473,30 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public void setWindowDestroyNotifyAction(Runnable r) { + public void setWindowDestroyNotifyAction(final Runnable r) { window.setWindowDestroyNotifyAction(r); } @Override - public final void setVisible(boolean visible) { + public final void setVisible(final boolean visible) { window.setVisible(visible); } @Override - public void setVisible(boolean wait, boolean visible) { + public void setVisible(final boolean wait, final boolean visible) { window.setVisible(wait, visible); } @Override - public final void setSize(int width, int height) { + public final void setSize(final int width, final int height) { window.setSize(width, height); } @Override - public final void setSurfaceSize(int pixelWidth, int pixelHeight) { + public final void setSurfaceSize(final int pixelWidth, final int pixelHeight) { window.setSurfaceSize(pixelWidth, pixelHeight); } @Override - public void setTopLevelSize(int width, int height) { + public void setTopLevelSize(final int width, final int height) { window.setTopLevelSize(width, height); } @@ -506,7 +506,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public Point getLocationOnScreen(Point storage) { + public Point getLocationOnScreen(final Point storage) { return window.getLocationOnScreen(storage); } @@ -514,7 +514,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind protected class GLLifecycleHook implements WindowImpl.LifecycleHook { @Override - public void preserveGLStateAtDestroy(boolean value) { + public void preserveGLStateAtDestroy(final boolean value) { GLWindow.this.preserveGLStateAtDestroy(value); } @@ -526,7 +526,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind @Override public synchronized void destroyActionInLock() { if(Window.DEBUG_IMPLEMENTATION) { - String msg = "GLWindow.destroy() "+WindowImpl.getThreadName()+", start"; + final String msg = "GLWindow.destroy() "+WindowImpl.getThreadName()+", start"; System.err.println(msg); //Exception e1 = new Exception(msg); //e1.printStackTrace(); @@ -552,7 +552,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public synchronized void setVisibleActionPost(boolean visible, boolean nativeWindowCreated) { + public synchronized void setVisibleActionPost(final boolean visible, final boolean nativeWindowCreated) { long t0; if(Window.DEBUG_IMPLEMENTATION) { t0 = System.nanoTime(); @@ -624,7 +624,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind if( anim.isAnimating() && null != animThread ) { try { animThread.stop(); - } catch(Throwable t) { + } catch(final Throwable t) { if( DEBUG ) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -705,7 +705,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind // NEWTEventConsumer // @Override - public boolean consumeEvent(NEWTEvent event) { + public boolean consumeEvent(final NEWTEvent event) { return window.consumeEvent(event); } @@ -713,27 +713,27 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind // Window completion // @Override - public final void windowRepaint(int x, int y, int width, int height) { + public final void windowRepaint(final int x, final int y, final int width, final int height) { window.windowRepaint(x, y, width, height); } @Override - public final void enqueueEvent(boolean wait, com.jogamp.newt.event.NEWTEvent event) { + public final void enqueueEvent(final boolean wait, final com.jogamp.newt.event.NEWTEvent event) { window.enqueueEvent(wait, event); } @Override - public final void runOnEDTIfAvail(boolean wait, final Runnable task) { + public final void runOnEDTIfAvail(final boolean wait, final Runnable task) { window.runOnEDTIfAvail(wait, task); } @Override - public void sendWindowEvent(int eventType) { + public void sendWindowEvent(final int eventType) { window.sendWindowEvent(eventType); } @Override - public final WindowListener getWindowListener(int index) { + public final WindowListener getWindowListener(final int index) { return window.getWindowListener(index); } @@ -743,22 +743,22 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void removeWindowListener(WindowListener l) { + public final void removeWindowListener(final WindowListener l) { window.removeWindowListener(l); } @Override - public final void addWindowListener(WindowListener l) { + public final void addWindowListener(final WindowListener l) { window.addWindowListener(l); } @Override - public final void addWindowListener(int index, WindowListener l) throws IndexOutOfBoundsException { + public final void addWindowListener(final int index, final WindowListener l) throws IndexOutOfBoundsException { window.addWindowListener(index, l); } @Override - public final void setKeyboardVisible(boolean visible) { + public final void setKeyboardVisible(final boolean visible) { window.setKeyboardVisible(visible); } @@ -768,22 +768,22 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void addKeyListener(KeyListener l) { + public final void addKeyListener(final KeyListener l) { window.addKeyListener(l); } @Override - public final void addKeyListener(int index, KeyListener l) { + public final void addKeyListener(final int index, final KeyListener l) { window.addKeyListener(index, l); } @Override - public final void removeKeyListener(KeyListener l) { + public final void removeKeyListener(final KeyListener l) { window.removeKeyListener(l); } @Override - public final KeyListener getKeyListener(int index) { + public final KeyListener getKeyListener(final int index) { return window.getKeyListener(index); } @@ -793,22 +793,22 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void addMouseListener(MouseListener l) { + public final void addMouseListener(final MouseListener l) { window.addMouseListener(l); } @Override - public final void addMouseListener(int index, MouseListener l) { + public final void addMouseListener(final int index, final MouseListener l) { window.addMouseListener(index, l); } @Override - public final void removeMouseListener(MouseListener l) { + public final void removeMouseListener(final MouseListener l) { window.removeMouseListener(l); } @Override - public final MouseListener getMouseListener(int index) { + public final MouseListener getMouseListener(final int index) { return window.getMouseListener(index); } @@ -818,7 +818,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public void setDefaultGesturesEnabled(boolean enable) { + public void setDefaultGesturesEnabled(final boolean enable) { window.setDefaultGesturesEnabled(enable); } @Override @@ -826,27 +826,27 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind return window.areDefaultGesturesEnabled(); } @Override - public final void addGestureHandler(GestureHandler gh) { + public final void addGestureHandler(final GestureHandler gh) { window.addGestureHandler(gh); } @Override - public final void addGestureHandler(int index, GestureHandler gh) { + public final void addGestureHandler(final int index, final GestureHandler gh) { window.addGestureHandler(index, gh); } @Override - public final void removeGestureHandler(GestureHandler gh) { + public final void removeGestureHandler(final GestureHandler gh) { window.removeGestureHandler(gh); } @Override - public final void addGestureListener(GestureHandler.GestureListener gl) { + public final void addGestureListener(final GestureHandler.GestureListener gl) { window.addGestureListener(-1, gl); } @Override - public final void addGestureListener(int index, GestureHandler.GestureListener gl) { + public final void addGestureListener(final int index, final GestureHandler.GestureListener gl) { window.addGestureListener(index, gl); } @Override - public final void removeGestureListener(GestureHandler.GestureListener gl) { + public final void removeGestureListener(final GestureHandler.GestureListener gl) { window.removeGestureListener(gl); } @@ -881,22 +881,22 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) { + public final void removeSurfaceUpdatedListener(final SurfaceUpdatedListener l) { window.removeSurfaceUpdatedListener(l); } @Override - public final void addSurfaceUpdatedListener(SurfaceUpdatedListener l) { + public final void addSurfaceUpdatedListener(final SurfaceUpdatedListener l) { window.addSurfaceUpdatedListener(l); } @Override - public final void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException { + public final void addSurfaceUpdatedListener(final int index, final SurfaceUpdatedListener l) throws IndexOutOfBoundsException { window.addSurfaceUpdatedListener(index, l); } @Override - public final void surfaceUpdated(Object updater, NativeSurface ns, long when) { + public final void surfaceUpdated(final Object updater, final NativeSurface ns, final long when) { window.surfaceUpdated(updater, ns, when); } @@ -930,7 +930,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind /** * A most simple JOGL AWT test entry */ - public static void main(String args[]) { + public static void main(final String args[]) { final boolean forceES2; final boolean forceES3; final boolean forceGL3; @@ -984,45 +984,45 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind final GLCapabilitiesImmutable caps = new GLCapabilities( glp ); System.err.println("Requesting: "+caps); - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); glWindow.setSize(128, 128); glWindow.addGLEventListener(new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + public void init(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); System.err.println(JoglVersion.getGLInfo(gl, null)); System.err.println("Requested: "+drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities()); System.err.println("Chosen : "+drawable.getChosenGLCapabilities()); System.err.println("GL impl. class "+gl.getClass().getName()); if( gl.isGL4ES3() ) { - GL4ES3 _gl = gl.getGL4ES3(); + final GL4ES3 _gl = gl.getGL4ES3(); System.err.println("GL4ES3 retrieved, impl. class "+_gl.getClass().getName()); } if( gl.isGL3() ) { - GL3 _gl = gl.getGL3(); + final GL3 _gl = gl.getGL3(); System.err.println("GL3 retrieved, impl. class "+_gl.getClass().getName()); } if( gl.isGLES3() ) { - GLES3 _gl = gl.getGLES3(); + final GLES3 _gl = gl.getGLES3(); System.err.println("GLES3 retrieved, impl. class "+_gl.getClass().getName()); } if( gl.isGLES2() ) { - GLES2 _gl = gl.getGLES2(); + final GLES2 _gl = gl.getGLES2(); System.err.println("GLES2 retrieved, impl. class "+_gl.getClass().getName()); } } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { } }); diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java index 674d467f9..76af2d0ec 100644 --- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java +++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java @@ -121,7 +121,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { * @param style additional styles to SWT#NO_BACKGROUND * @param child optional preassigned {@link #Window}, maybe null */ - public NewtCanvasSWT(final Composite parent, final int style, Window child) { + public NewtCanvasSWT(final Composite parent, final int style, final Window child) { super(parent, style | SWT.NO_BACKGROUND); SWTAccessor.setRealized(this, true); @@ -138,7 +138,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { final Listener listener = new Listener () { @Override - public void handleEvent (Event event) { + public void handleEvent (final Event event) { switch (event.type) { case SWT.Paint: if( DEBUG ) { @@ -339,7 +339,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } @Override - public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) { + public WindowClosingMode setDefaultCloseOperation(final WindowClosingMode op) { return newtChildCloseOp = op; // TODO: implement ?! } @@ -392,11 +392,11 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } @Override - public boolean setParent(Composite parent) { + public boolean setParent(final Composite parent) { return super.setParent(parent); } - /* package */ void configureNewtChild(boolean attach) { + /* package */ void configureNewtChild(final boolean attach) { newtChildReady = attach; if( null != newtChild ) { newtChild.setKeyboardFocusHandler(null); @@ -409,7 +409,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } } - void reparentWindow(boolean add) { + void reparentWindow(final boolean add) { if( null == newtChild ) { return; // nop } @@ -469,7 +469,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { private final long nativeWindowHandle; private final InsetsImmutable insets; // only required to allow proper client position calculation on OSX - public SWTNativeWindow(AbstractGraphicsConfiguration config, long nativeWindowHandle) { + public SWTNativeWindow(final AbstractGraphicsConfiguration config, final long nativeWindowHandle) { this.config = config; this.nativeWindowHandle = nativeWindowHandle; if( SWTAccessor.isOSX ) { @@ -503,14 +503,14 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } @Override - public void addSurfaceUpdatedListener(SurfaceUpdatedListener l) { } + public void addSurfaceUpdatedListener(final SurfaceUpdatedListener l) { } @Override - public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException { + public void addSurfaceUpdatedListener(final int index, final SurfaceUpdatedListener l) throws IndexOutOfBoundsException { } @Override - public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) { } + public void removeSurfaceUpdatedListener(final SurfaceUpdatedListener l) { } @Override public long getSurfaceHandle() { @@ -566,7 +566,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } @Override - public void surfaceUpdated(Object updater, NativeSurface ns, long when) { } + public void surfaceUpdated(final Object updater, final NativeSurface ns, final long when) { } @Override public void destroy() { } @@ -597,7 +597,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } @Override - public Point getLocationOnScreen(Point point) { + public Point getLocationOnScreen(final Point point) { final Point los; // client window location on screen if( SWTAccessor.isOSX ) { // let getLOS provide the point where the child window may be placed @@ -625,10 +625,10 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } }; - static String newtWinHandleToHexString(Window w) { + static String newtWinHandleToHexString(final Window w) { return null != w ? toHexString(w.getWindowHandle()) : "nil"; } - static String toHexString(long l) { + static String toHexString(final long l) { return "0x"+Long.toHexString(l); } } diff --git a/src/newt/classes/com/jogamp/newt/util/MainThread.java b/src/newt/classes/com/jogamp/newt/util/MainThread.java index 049320b21..80da1ce3b 100644 --- a/src/newt/classes/com/jogamp/newt/util/MainThread.java +++ b/src/newt/classes/com/jogamp/newt/util/MainThread.java @@ -45,6 +45,7 @@ import java.util.List; import javax.media.nativewindow.NativeWindowFactory; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; import jogamp.newt.Debug; @@ -104,7 +105,7 @@ public class MainThread { NativeWindowFactory.initSingleton(); NEWTJNILibLoader.loadNEWT(); HINT_USE_MAIN_THREAD = !NativeWindowFactory.isAWTAvailable() || - Debug.getBooleanProperty("newt.MainThread.force", true); + PropertyAccess.getBooleanProperty("newt.MainThread.force", true); osType = Platform.getOSType(); isMacOSX = osType == Platform.OSType.MACOS; rootThreadGroup = getRootThreadGroup(); @@ -125,7 +126,7 @@ public class MainThread { return rootGroup; } - private static final Thread[] getAllThreads(int[] count) { + private static final Thread[] getAllThreads(final int[] count) { int tn; Thread[] threads = new Thread[ rootThreadGroup.activeCount() ]; while ( ( tn = rootThreadGroup.enumerate( threads, true ) ) == threads.length ) { @@ -135,9 +136,9 @@ public class MainThread { return threads; } private static final List getNonDaemonThreads() { - List res = new ArrayList(); - int[] tn = { 0 }; - Thread[] threads = getAllThreads(tn); + final List res = new ArrayList(); + final int[] tn = { 0 }; + final Thread[] threads = getAllThreads(tn); for(int i = tn[0] - 1; i >= 0; i--) { final Thread thread = threads[i]; try { @@ -145,16 +146,16 @@ public class MainThread { res.add(thread); if(DEBUG) System.err.println("XXX0: "+thread.getName()+", "+thread); } - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); } } return res; } - private static final int getNonDaemonThreadCount(List ignoreThreads) { + private static final int getNonDaemonThreadCount(final List ignoreThreads) { int res = 0; - int[] tn = { 0 }; - Thread[] threads = getAllThreads(tn); + final int[] tn = { 0 }; + final Thread[] threads = getAllThreads(tn); for(int i = tn[0] - 1; i >= 0; i--) { final Thread thread = threads[i]; @@ -163,7 +164,7 @@ public class MainThread { res++; if(DEBUG) System.err.println("MainAction.run(): non daemon thread: "+thread); } - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); } } @@ -177,7 +178,7 @@ public class MainThread { private final Method mainClassMain; private List nonDaemonThreadsAtStart; - public UserApp(String mainClassName, String[] mainClassArgs) throws SecurityException, NoSuchMethodException, ClassNotFoundException { + public UserApp(final String mainClassName, final String[] mainClassArgs) throws SecurityException, NoSuchMethodException, ClassNotFoundException { super(); this.mainClassName=mainClassName; this.mainClassArgs=mainClassArgs; @@ -204,10 +205,10 @@ public class MainThread { try { if(DEBUG) System.err.println("MainAction.run(): "+Thread.currentThread().getName()+" invoke "+mainClassName); mainClassMain.invoke(null, new Object[] { mainClassArgs } ); - } catch (InvocationTargetException ite) { + } catch (final InvocationTargetException ite) { ite.getTargetException().printStackTrace(); return; - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); return; } @@ -219,7 +220,7 @@ public class MainThread { if(DEBUG) System.err.println("MainAction.run(): post user app, non daemon threads alive: "+ndtr); try { Thread.sleep(1000); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -237,7 +238,7 @@ public class MainThread { if(DEBUG) { System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.X"); } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } else { @@ -253,7 +254,7 @@ public class MainThread { * @throws ClassNotFoundException * @throws NoSuchMethodException * @throws SecurityException */ - public static void main(String[] args) throws SecurityException, NoSuchMethodException, ClassNotFoundException { + public static void main(final String[] args) throws SecurityException, NoSuchMethodException, ClassNotFoundException { final Thread cur = Thread.currentThread(); useMainThread = HINT_USE_MAIN_THREAD; @@ -273,8 +274,8 @@ public class MainThread { return; } - String mainClassName=args[0]; - String[] mainClassArgs=new String[args.length-1]; + final String mainClassName=args[0]; + final String[] mainClassArgs=new String[args.length-1]; if(args.length>1) { System.arraycopy(args, 1, mainClassArgs, 0, args.length-1); } @@ -289,7 +290,7 @@ public class MainThread { if ( useMainThread ) { try { cur.setName(cur.getName()+"-MainThread"); - } catch (Exception e) {} + } catch (final Exception e) {} // dispatch user's main thread .. mainAction.start(); @@ -301,7 +302,7 @@ public class MainThread { } ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "runNSApplication", null, null, MainThread.class.getClassLoader()); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } diff --git a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java index e019068f5..e5f8ff17c 100644 --- a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java +++ b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java @@ -43,11 +43,11 @@ import javax.media.nativewindow.util.SurfaceSize; */ public class MonitorModeUtil { - public static int getIndex(List monitorModes, MonitorMode search) { + public static int getIndex(final List monitorModes, final MonitorMode search) { return monitorModes.indexOf(search); } - public static int getIndexByHashCode(List monitorModes, MonitorMode search) { + public static int getIndexByHashCode(final List monitorModes, final MonitorMode search) { if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; i monitorModes, MonitorMode.SizeAndRRate sizeAndRate, int modeId, int rotation) { + public static MonitorMode getByNativeSizeRateIdAndRotation(final List monitorModes, final MonitorMode.SizeAndRRate sizeAndRate, final int modeId, final int rotation) { if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; i monitorModes, boolean ascendingOrder) { + public static void sort(final List monitorModes, final boolean ascendingOrder) { if( ascendingOrder ) { Collections.sort(monitorModes); } else { @@ -85,7 +85,7 @@ public class MonitorModeUtil { * @param surfaceSize * @return modes with exact {@link SurfaceSize}. May return zero sized list for non. */ - public static List filterBySurfaceSize(List monitorModes, SurfaceSize surfaceSize) { + public static List filterBySurfaceSize(final List monitorModes, final SurfaceSize surfaceSize) { final List out = new ArrayList(); if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; null!=monitorModes && i filterByRotation(List monitorModes, int rotation) { + public static List filterByRotation(final List monitorModes, final int rotation) { final List out = new ArrayList(); if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; null!=monitorModes && i filterByBpp(List monitorModes, int bitsPerPixel) { + public static List filterByBpp(final List monitorModes, final int bitsPerPixel) { final List out = new ArrayList(); if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; null!=monitorModes && i filterByFlags(List monitorModes, int flags) { + public static List filterByFlags(final List monitorModes, final int flags) { final List out = new ArrayList(); if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; null!=monitorModes && i filterByResolution(List monitorModes, DimensionImmutable resolution) { + public static List filterByResolution(final List monitorModes, final DimensionImmutable resolution) { final List out = new ArrayList(); if( null!=monitorModes && monitorModes.size()>0 ) { final int resolution_sq = resolution.getHeight()*resolution.getWidth(); @@ -192,14 +192,14 @@ public class MonitorModeUtil { * @param refreshRate * @return modes with nearest refreshRate, or matching ones. May return zero sized list for non. */ - public static List filterByRate(List monitorModes, float refreshRate) { + public static List filterByRate(final List monitorModes, final float refreshRate) { final List out = new ArrayList(); if( null!=monitorModes && monitorModes.size()>0 ) { float mode_dr = Float.MAX_VALUE; int mode_dr_idx = -1; for (int i=0; null!=monitorModes && i getHighestAvailableBpp(List monitorModes) { + public static List getHighestAvailableBpp(final List monitorModes) { if( null!=monitorModes && monitorModes.size()>0 ) { int highest = -1; for (int i=0; null!=monitorModes && i < monitorModes.size(); i++) { @@ -240,7 +240,7 @@ public class MonitorModeUtil { * @param monitorModes * @return modes with highest available refresh rate. May return zero sized list for non. */ - public static List getHighestAvailableRate(List monitorModes) { + public static List getHighestAvailableRate(final List monitorModes) { if( null!=monitorModes && monitorModes.size()>0 ) { float highest = -1; for (int i=0; null!=monitorModes && i < monitorModes.size(); i++) { diff --git a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java index 459db11b2..9a3e79a8f 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java @@ -107,7 +107,7 @@ public class JOGLNewtApplet3Run implements Applet3 { PointImmutable upstreamLocOnScreen; NativeWindow browserWin; - final String getParameter(String name) { + final String getParameter(final String name) { return ctx.getParameter(name); } @@ -132,7 +132,7 @@ public class JOGLNewtApplet3Run implements Applet3 { glHeight = JOGLNewtAppletBase.str2Int(getParameter("gl_height"), glHeight); glUndecorated = JOGLNewtAppletBase.str2Bool(getParameter("gl_undecorated"), glUndecorated); glAlwaysOnTop = JOGLNewtAppletBase.str2Bool(getParameter("gl_alwaysontop"), glAlwaysOnTop); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } glStandalone = Integer.MAX_VALUE>glXd && Integer.MAX_VALUE>glYd && Integer.MAX_VALUE>glWidth && Integer.MAX_VALUE>glHeight; @@ -176,14 +176,14 @@ public class JOGLNewtApplet3Run implements Applet3 { return new NativeWindowDownstream() { @Override - public void setVisible(boolean v) { + public void setVisible(final boolean v) { if( null != glWindow ) { glWindow.setVisible(v); } } @Override - public void setSize(int width, int height) { + public void setSize(final int width, final int height) { upstreamSizePosHook.setWinSize(width, height); if( null != glWindow ) { glWindow.setSize(width, height); @@ -226,7 +226,7 @@ public class JOGLNewtApplet3Run implements Applet3 { } @Override - public void notifyPositionChanged(NativeWindowUpstream nw) { + public void notifyPositionChanged(final NativeWindowUpstream nw) { upstreamSizePosHook.setWinPos(nw.getX(), nw.getY()); if( null != glWindow ) { glWindow.setPosition(nw.getX(), nw.getY()); @@ -236,7 +236,7 @@ public class JOGLNewtApplet3Run implements Applet3 { } @Override - public void init(Applet3Context ctx) { + public void init(final Applet3Context ctx) { if(DEBUG) { System.err.println("JOGLNewtApplet1Run.init() START - "+currentThreadName()); } @@ -255,7 +255,7 @@ public class JOGLNewtApplet3Run implements Applet3 { glTrace = JOGLNewtAppletBase.str2Bool(getParameter("gl_trace"), glTrace); glNoDefaultKeyListener = JOGLNewtAppletBase.str2Bool(getParameter("gl_nodefaultkeyListener"), glNoDefaultKeyListener); glCloseable = JOGLNewtAppletBase.str2Bool(getParameter("gl_closeable"), glCloseable); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } if(null==glEventListenerClazzName) { @@ -282,7 +282,7 @@ public class JOGLNewtApplet3Run implements Applet3 { glWindow.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); glWindow.setDefaultCloseOperation(glCloseable ? WindowClosingMode.DISPOSE_ON_CLOSE : WindowClosingMode.DO_NOTHING_ON_CLOSE); base.init(glWindow); - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } if(DEBUG) { diff --git a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java index eee8ab23e..d40e09d96 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java @@ -54,6 +54,7 @@ import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.event.WindowListener; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.AnimatorBase; /** Shows how to deploy an applet using JOGL. This demo must be @@ -76,12 +77,12 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { boolean isValid = false; NativeWindow parentWin; - public JOGLNewtAppletBase(String glEventListenerClazzName, - int glSwapInterval, - boolean noDefaultKeyListener, - boolean glClosable, - boolean glDebug, - boolean glTrace) { + public JOGLNewtAppletBase(final String glEventListenerClazzName, + final int glSwapInterval, + final boolean noDefaultKeyListener, + final boolean glClosable, + final boolean glDebug, + final boolean glTrace) { this.glEventListenerClazzName=glEventListenerClazzName; this.glSwapInterval=glSwapInterval; @@ -96,19 +97,19 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { public Animator getGLAnimator() { return glAnimator; } public boolean isValid() { return isValid; } - public static boolean str2Bool(String str, boolean def) { + public static boolean str2Bool(final String str, final boolean def) { if(null==str) return def; try { return Boolean.valueOf(str).booleanValue(); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return def; } - public static int str2Int(String str, int def) { + public static int str2Int(final String str, final int def) { if(null==str) return def; try { return Integer.parseInt(str); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return def; } @@ -123,14 +124,14 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { Class clazz = null; try { clazz = Class.forName(clazzName, false, cl); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); } return clazz; } }); instance = clazz.newInstance(); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); throw new RuntimeException("Error while instantiating demo: "+clazzName); } @@ -143,28 +144,28 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { return (GLEventListener) instance; } - public static boolean setField(Object instance, String fieldName, Object value) { + public static boolean setField(final Object instance, final String fieldName, final Object value) { try { - Field f = instance.getClass().getField(fieldName); + final Field f = instance.getClass().getField(fieldName); if(f.getType().isInstance(value)) { f.set(instance, value); return true; } else { System.out.println(instance.getClass()+" '"+fieldName+"' field not assignable with "+value.getClass()+", it's a: "+f.getType()); } - } catch (NoSuchFieldException nsfe) { + } catch (final NoSuchFieldException nsfe) { System.out.println(instance.getClass()+" has no '"+fieldName+"' field"); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); } return false; } - public void init(GLWindow glWindow) { + public void init(final GLWindow glWindow) { init(Thread.currentThread().getThreadGroup(), glWindow); } - public void init(ThreadGroup tg, final GLWindow glWindow) { + public void init(final ThreadGroup tg, final GLWindow glWindow) { isValid = false; this.glWindow = glWindow; glEventListener = createInstance(glEventListenerClazzName); @@ -200,12 +201,12 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { // glAnimator = new FPSAnimator(canvas, 60); glAnimator = new Animator(); - glAnimator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD); // No AWT thread involved! + glAnimator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); // No AWT thread involved! glAnimator.setThreadGroup(tg); glAnimator.add(glWindow); glAnimator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, null); - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } isValid = true; @@ -214,7 +215,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { private final WindowListener reparentHomeListener = new WindowAdapter() { // Closing action: back to parent! @Override - public void windowDestroyNotify(WindowEvent e) { + public void windowDestroyNotify(final WindowEvent e) { if( isValid() && WindowClosingMode.DO_NOTHING_ON_CLOSE == glWindow.getDefaultCloseOperation() && null == glWindow.getParent() && null != parentWin && 0 != parentWin.getWindowHandle() ) { @@ -239,7 +240,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { final Display disp = glWindow.getScreen().getDisplay(); try { pointerIconTest = disp.createPointerIcon(res, 8, 8); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -275,20 +276,20 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { // *********************************************************************************** @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { GL _gl = drawable.getGL(); if(glDebug) { try { _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, _gl, null) ); - } catch (Exception e) {e.printStackTrace();} + } catch (final Exception e) {e.printStackTrace();} } if(glTrace) { try { // Trace .. _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, _gl, new Object[] { System.err } ) ); - } catch (Exception e) {e.printStackTrace();} + } catch (final Exception e) {e.printStackTrace();} } if(glSwapInterval>=0) { @@ -296,13 +297,13 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { } } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { } // *********************************************************************************** @@ -310,7 +311,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { // *********************************************************************************** @Override - public void keyPressed(KeyEvent e) { + public void keyPressed(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; } @@ -384,7 +385,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { } @Override - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { } } diff --git a/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java b/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java index db0e8fc45..1a5c83609 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java @@ -25,8 +25,8 @@ import com.jogamp.opengl.JoglVersion; public class VersionApplet3 implements Applet3 { - public static void main(String[] args) { - VersionApplet3 va = new VersionApplet3(); + public static void main(final String[] args) { + final VersionApplet3 va = new VersionApplet3(); final NativeWindowDownstream nwc = va.createNativeWindow(null, new NativeWindowUpstream() { @Override @@ -50,7 +50,7 @@ public class VersionApplet3 implements Applet3 { return 0; // default } @Override - public void notifySurfaceUpdated(NativeWindowDownstream swappedWin) { + public void notifySurfaceUpdated(final NativeWindowDownstream swappedWin) { // NOP } @Override @@ -80,14 +80,14 @@ public class VersionApplet3 implements Applet3 { return new NativeWindowDownstream() { @Override - public void setVisible(boolean v) { + public void setVisible(final boolean v) { if( null != canvas ) { canvas.setVisible(v); } } @Override - public void setSize(int width, int height) { + public void setSize(final int width, final int height) { if( null != canvas ) { canvas.setSize(width, height); } @@ -129,7 +129,7 @@ public class VersionApplet3 implements Applet3 { } @Override - public void notifyPositionChanged(NativeWindowUpstream nw) { + public void notifyPositionChanged(final NativeWindowUpstream nw) { if( null != canvas ) { canvas.setPosition(nw.getX(), nw.getY()); } @@ -138,7 +138,7 @@ public class VersionApplet3 implements Applet3 { } @Override - public void init(Applet3Context ctx) { + public void init(final Applet3Context ctx) { System.err.println("VersionApplet: init() - begin"); canvas.addGLEventListener(new GLInfo()); System.err.println("VersionApplet: init() - end"); @@ -164,8 +164,8 @@ public class VersionApplet3 implements Applet3 { s = JoglVersion.getInstance().toString(); System.err.println(s); - GLDrawableFactory factory = GLDrawableFactory.getFactory(canvas.getGLProfile()); - List availCaps = factory.getAvailableCapabilities(null); + final GLDrawableFactory factory = GLDrawableFactory.getFactory(canvas.getGLProfile()); + final List availCaps = factory.getAvailableCapabilities(null); for(int i=0; i