aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-11-04 01:58:32 +0100
committerSven Gothel <[email protected]>2010-11-04 01:58:32 +0100
commit4d56491c3f8e76676e1c860d018bbe991d28ebac (patch)
treef5d9a7f61614b94ad3dd81fc55e323e2f9fed4e0 /src/newt
parenta0e9d6c8382b7275db6fae664be44db6b59671d5 (diff)
Seperated unit tests (newt/awt/headless) and cleaned up some imports and comments
Seperated unit tests (newt/awt/headless) - no more *CORE* tests - junit.run.newt.headless: all NEWT headless (no-AWT) tests, without any AWT classes and with -Djava.awt.headless=true. Disabled for 'isOSX'. - junit.run.newt: all NEWT non AWT tests (same as above), but with full AWT. This test is not enabled via junit.run. Disabled for 'isOSX'. - junit.run.awt: all AWT tests without NEWT - using newt.event.jar to add AWT agnostic NEWT event adapter - junit.run.newt.awt: all NEWT + AWT tests - junit.run: junit.run.newt.headless,junit.run.awt,junit.run.newt.awt - swizzling around a few tests to achieve the above: TEST rules: - A runnable unit test must start with 'Test' - Only pure NEWT tests must have 'NEWT' in their name - AWT tests must have 'AWT' in their name. - AWT + NEWT tests must have '.newt.' in their package name, hence - Pure AWT tests (without NEWT) must not have '.newt.' in their package name
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/event/InputEvent.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/KeyAdapter.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/KeyEvent.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/KeyListener.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/MouseAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/MouseEvent.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/MouseListener.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/NEWTEvent.java4
-rw-r--r--src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java1
-rw-r--r--src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/WindowAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/WindowEvent.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/WindowListener.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java73
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java9
18 files changed, 58 insertions, 65 deletions
diff --git a/src/newt/classes/com/jogamp/newt/event/InputEvent.java b/src/newt/classes/com/jogamp/newt/event/InputEvent.java
index d014de7f3..148787845 100644
--- a/src/newt/classes/com/jogamp/newt/event/InputEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/InputEvent.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public abstract class InputEvent extends NEWTEvent
{
public static final int SHIFT_MASK = 1 << 0;
diff --git a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java
index 9fb208649..93c8409b1 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java
@@ -1,5 +1,6 @@
/**
* Copyright 2010 JogAmp Community. All rights reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -28,8 +29,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public abstract class KeyAdapter implements KeyListener
{
public void keyPressed(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 f5ade47d8..852f77fcb 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public class KeyEvent extends InputEvent
{
public KeyEvent(int eventType, Object source, long when, int modifiers, int keyCode, char keyChar) {
diff --git a/src/newt/classes/com/jogamp/newt/event/KeyListener.java b/src/newt/classes/com/jogamp/newt/event/KeyListener.java
index 5ce3868f5..dae343d80 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyListener.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public interface KeyListener extends NEWTEventListener
{
public void keyPressed(KeyEvent e);
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java
index 7e04bc114..3607ae634 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java
@@ -28,8 +28,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public abstract class MouseAdapter implements MouseListener
{
public void mouseClicked(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 705f558b9..fbe32d41d 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public class MouseEvent extends InputEvent
{
public static final int BUTTON1 = 1;
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseListener.java b/src/newt/classes/com/jogamp/newt/event/MouseListener.java
index b328aeac7..5ec086b94 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseListener.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public interface MouseListener extends NEWTEventListener
{
public void mouseClicked(MouseEvent e);
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
index 61858b083..10673be3d 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,9 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-import java.util.*;
-
/**
* NEWT events are provided for notification purposes ONLY;<br>
* The NEWT will automatically handle the event semantics internally, regardless of whether a program is receiving these events or not.<br>
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java
index 4aa17bc02..fe224bba6 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java
@@ -28,7 +28,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
import java.util.LinkedList;
public class NEWTEventFiFo
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java
index 90d00383d..677136573 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public interface NEWTEventListener extends java.util.EventListener
{
}
diff --git a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java
index 17d8df80b..14ee633a0 100644
--- a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java
@@ -28,8 +28,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public class TraceMouseAdapter implements MouseListener {
MouseListener downstream;
diff --git a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java
index 3545a42d4..88b165a8d 100644
--- a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java
@@ -28,8 +28,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public class TraceWindowAdapter implements WindowListener {
WindowListener downstream;
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java
index e57138c54..a1ad43a13 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java
@@ -28,8 +28,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public abstract class WindowAdapter implements WindowListener
{
public void windowResized(WindowEvent e) {
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowEvent.java b/src/newt/classes/com/jogamp/newt/event/WindowEvent.java
index 5221b3664..2742e0d95 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowEvent.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
/**
* NEWT Window events are provided for notification purposes ONLY.<br>
* NEWT will automatically handle component moves and resizes internally, regardless of whether a program is receiving these events or not. <br>
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowListener.java b/src/newt/classes/com/jogamp/newt/event/WindowListener.java
index 174d4a414..0d201a2a4 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowListener.java
@@ -34,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public interface WindowListener extends NEWTEventListener {
/** Window is resized, your application shall respect the new window dimension. A repaint is recommended. */
public void windowResized(WindowEvent 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 c7b4f7b84..c136946ac 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
@@ -28,13 +28,12 @@
package com.jogamp.newt.event.awt;
-import com.jogamp.newt.util.EDTUtil;
import com.jogamp.newt.impl.Debug;
/**
* Convenient adapter forwarding AWT events to NEWT via the event listener model.<br>
* <p>
- * You may attach an instance of this adapter to an AWT Component. When an event happen,
+ * You may attach an instance of this adapter to an AWT Component. When an event happens,
* it is converted to a NEWT event and the given NEWT listener is being called.<br></p>
* <p>
* This adapter fullfills three use cases. First as a plain utility to write code AWT agnostic,
@@ -47,56 +46,68 @@ import com.jogamp.newt.impl.Debug;
* or to an AWT component, e.g. {@link java.awt.Component}.<br></p>
* <p>
* Common:<br>
- * <code>
- javax.media.opengl.GLEvenListener demo1 = new javax.media.opengl.GLEvenListener() { ... } ;<br>
- com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ;<br>
- * </code> </p>
+ * <pre>
+ // your demo/render code
+ javax.media.opengl.GLEvenListener demo1 = new javax.media.opengl.GLEvenListener() { ... } ;
+
+ // your AWT agnostic NEWT mouse listener code
+ com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ;
+ * </pre> </p>
* <p>
- * NEWT Usage:<br>
- * <code>
- GLWindow glWindow = GLWindow.create();<br>
- glWindow.addGLEventListener(demo1);<br>
- glWindow.addMouseListener(mouseListener);<br>
- * </code> </p>
+ * Default NEWT use case, without using the AWTAdapter:<br>
+ * <pre>
+ // the NEWT GLAutoDrawable and Window
+ GLWindow glWindow = GLWindow.create();
+
+ // attach the renderer demo1
+ glWindow.addGLEventListener(demo1);
+
+ // attach the NEWT mouse event listener to glWindow
+ glWindow.addMouseListener(mouseListener);
+ * </pre> </p>
* <p>
- * AWT Usage:<br>
- * <code>
- GLCanvas glCanvas = new GLCanvas();<br>
- glCanvas.addGLEventListener(demo1);<br>
- <br>
- new AWTMouseAdapter(mouseListener).addTo(glCanvas);<br>
- * </code> </p>
+ * AWT use case, AWTAdapter used as an AWT event translator and forwarder to your NEWT listener:<br>
+ * <pre>
+ // the AWT GLAutoDrawable and Canvas
+ GLCanvas glCanvas = new GLCanvas();
+
+ // attach the renderer demo1
+ glCanvas.addGLEventListener(demo1);
+
+ // attach the AWTMouseAdapter to glCanvas, which translates and forwards events to the NEWT mouseListener
+ new AWTMouseAdapter(mouseListener).addTo(glCanvas);
+ * </pre> </p>
* <p>
- * AWT Usage (previous form in detail):<br>
- * <code>
- AWTMouseAdapter mouseAdapter = new AWTMouseAdapter(mouseListener);<br>
- glCanvas.addMouseListener(mouseAdapter);<br>
- glCanvas.addMouseMotionListener(mouseAdapter);<br>
- * </code> </p>
+ * Previous code in detail:<br>
+ * <pre>
+ AWTMouseAdapter mouseAdapter = new AWTMouseAdapter(mouseListener);
+ glCanvas.addMouseListener(mouseAdapter);
+ glCanvas.addMouseMotionListener(mouseAdapter);
+ * </pre> </p>
*
* <p>
- * Second is just a litte variation, where we pass a NEWT Window <br>
- * to impersonate as the source of the event.<br></p>
+ * Second use case is just a litte variation of the previous use case, where we pass a NEWT Window <br>
+ * to be used as the source of the event.<br></p>
* <p>
- * <code>
+ * <pre>
com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ;<br>
Component comp = ... ; // the AWT component<br>
GLWindow glWindow = GLWindow.create(); // the NEWT component<br>
<br>
new AWTMouseAdapter(mouseListener, glWindow).addTo(comp);<br>
- * </code> </p>
+ * </pre> </p>
*
* Last but not least, the AWTAdapter maybe used as a general AWT event forwarder to NEWT.<br>
*
* <p>
- * <code>
+ * <pre>
com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ;<br>
Component comp = ... ; // the AWT component<br>
GLWindow glWindow = GLWindow.create(); // the NEWT component<br>
glWindow.addMouseListener(mouseListener); // add the custom EventListener to the NEWT component<br>
<br>
new AWTMouseAdapter(glWindow).addTo(comp); // forward all AWT events to glWindow, as NEWT events<br>
- * </code> </p>
+ * </pre> </p>
*
* @see #attachTo
*/
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java
index 44ad3586e..68f2b3e0f 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java
@@ -28,8 +28,6 @@
package com.jogamp.newt.event.awt;
-import java.awt.KeyboardFocusManager;
-
/**
* Specialized parent/client adapter,
* where the NEWT child window really gets resized,
diff --git a/src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java b/src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java
index 0fdfd44fe..c5460ef40 100644
--- a/src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java
+++ b/src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java
@@ -143,8 +143,13 @@ public class DefaultEDTUtil implements EDTUtil {
task.run();
wait = false; // running in same thread (EDT) -> no wait
if(stop && edt.tasks.size()>0) {
- Throwable t = new Throwable("Warning: EDT about (2) to stop, having remaining tasks: "+edt.tasks.size()+" - "+edt);
- t.printStackTrace();
+ String msg = "Warning: EDT about (2) to stop, having remaining tasks: "+edt.tasks.size()+" - "+edt;
+ if(DEBUG) {
+ Throwable t = new Throwable(msg);
+ t.printStackTrace();
+ } else {
+ System.err.println(msg);
+ }
}
} else {
synchronized(edt.tasks) {