From c0ece5ebd634662f99f3217bb749e2c4795f9de6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 11 Jun 2010 00:14:35 +0200 Subject: NEWT Add: addListener(int index, Listener l) ; getListener(int index) ; NEWTEvent attachments NEWT Add: addListener(int index, Listener l) ; getListener(int index) ; NEWTEvent attachments for listener to listener communication via object passing. This methodology is similar to the 'Atom' attachment of native systems. It is preferred to a 'consume()/isConsumed()' pattern, since it is less flexible and would 'endanger' system events. TODO: Listener[] getListeners() doesn't work and was always buggy. --- src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes/com') diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java index 8cc12ca89..fcd662048 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java @@ -66,8 +66,15 @@ public class GLDrawableHelper { } public synchronized void addGLEventListener(GLEventListener listener) { + addGLEventListener(-1, listener); + } + + public synchronized void addGLEventListener(int index, GLEventListener listener) { + if(0>index) { + index = listeners.size(); + } List newListeners = (List) ((ArrayList) listeners).clone(); - newListeners.add(listener); + newListeners.add(index, listener); listeners = newListeners; } -- cgit v1.2.3