From 3614f908d0f6ae1174a85dbd44a2bad4df2ea8a6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 18 Nov 2013 13:43:42 +0100 Subject: NEWT WindowImpl: Move consumePointerEvent(..) below doPointerEvent(..) to easy editing/review --- src/newt/classes/jogamp/newt/WindowImpl.java | 218 +++++++++++++-------------- 1 file changed, 109 insertions(+), 109 deletions(-) (limited to 'src/newt/classes/jogamp') diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 99e863a0e..51740cb8d 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -2751,115 +2751,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer doEvent(enqueue, wait, e); // actual mouse event } - @Override - public final void addMouseListener(MouseListener l) { - addMouseListener(-1, l); - } - - @Override - public final void addMouseListener(int index, MouseListener l) { - if(l == null) { - return; - } - @SuppressWarnings("unchecked") - ArrayList clonedListeners = (ArrayList) mouseListeners.clone(); - if(0>index) { - index = clonedListeners.size(); - } - clonedListeners.add(index, l); - mouseListeners = clonedListeners; - } - - @Override - public final void removeMouseListener(MouseListener l) { - if (l == null) { - return; - } - @SuppressWarnings("unchecked") - ArrayList clonedListeners = (ArrayList) mouseListeners.clone(); - clonedListeners.remove(l); - mouseListeners = clonedListeners; - } - - @Override - public final MouseListener getMouseListener(int index) { - @SuppressWarnings("unchecked") - ArrayList clonedListeners = (ArrayList) mouseListeners.clone(); - if(0>index) { - index = clonedListeners.size()-1; - } - return clonedListeners.get(index); - } - - @Override - public final MouseListener[] getMouseListeners() { - return mouseListeners.toArray(new MouseListener[mouseListeners.size()]); - } - - @Override - public final void setDefaultGesturesEnabled(boolean enable) { - defaultGestureHandlerEnabled = enable; - } - @Override - public final boolean areDefaultGesturesEnabled() { - return defaultGestureHandlerEnabled; - } - - @Override - public final void addGestureHandler(GestureHandler gh) { - addGestureHandler(-1, gh); - } - @Override - public final void addGestureHandler(int index, GestureHandler gh) { - if(gh == null) { - return; - } - @SuppressWarnings("unchecked") - ArrayList cloned = (ArrayList) pointerGestureHandler.clone(); - if(0>index) { - index = cloned.size(); - } - cloned.add(index, gh); - pointerGestureHandler = cloned; - } - @Override - public final void removeGestureHandler(GestureHandler gh) { - if (gh == null) { - return; - } - @SuppressWarnings("unchecked") - ArrayList cloned = (ArrayList) pointerGestureHandler.clone(); - cloned.remove(gh); - pointerGestureHandler = cloned; - } - @Override - public final void addGestureListener(GestureHandler.GestureListener gl) { - addGestureListener(-1, gl); - } - @Override - public final void addGestureListener(int index, GestureHandler.GestureListener gl) { - if(gl == null) { - return; - } - @SuppressWarnings("unchecked") - ArrayList cloned = (ArrayList) gestureListeners.clone(); - if(0>index) { - index = cloned.size(); - } - cloned.add(index, gl); - gestureListeners = cloned; - } - @Override - public final void removeGestureListener(GestureHandler.GestureListener gl) { - if (gl == null) { - return; - } - @SuppressWarnings("unchecked") - ArrayList cloned = (ArrayList) gestureListeners.clone(); - cloned.remove(gl); - gestureListeners= cloned; - } - private static int step(int lower, int edge, int value) { return value < edge ? lower : value; } @@ -3088,6 +2979,115 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } + @Override + public final void addMouseListener(MouseListener l) { + addMouseListener(-1, l); + } + + @Override + public final void addMouseListener(int index, MouseListener l) { + if(l == null) { + return; + } + @SuppressWarnings("unchecked") + ArrayList clonedListeners = (ArrayList) mouseListeners.clone(); + if(0>index) { + index = clonedListeners.size(); + } + clonedListeners.add(index, l); + mouseListeners = clonedListeners; + } + + @Override + public final void removeMouseListener(MouseListener l) { + if (l == null) { + return; + } + @SuppressWarnings("unchecked") + ArrayList clonedListeners = (ArrayList) mouseListeners.clone(); + clonedListeners.remove(l); + mouseListeners = clonedListeners; + } + + @Override + public final MouseListener getMouseListener(int index) { + @SuppressWarnings("unchecked") + ArrayList clonedListeners = (ArrayList) mouseListeners.clone(); + if(0>index) { + index = clonedListeners.size()-1; + } + return clonedListeners.get(index); + } + + @Override + public final MouseListener[] getMouseListeners() { + return mouseListeners.toArray(new MouseListener[mouseListeners.size()]); + } + + @Override + public final void setDefaultGesturesEnabled(boolean enable) { + defaultGestureHandlerEnabled = enable; + } + @Override + public final boolean areDefaultGesturesEnabled() { + return defaultGestureHandlerEnabled; + } + + @Override + public final void addGestureHandler(GestureHandler gh) { + addGestureHandler(-1, gh); + } + @Override + public final void addGestureHandler(int index, GestureHandler gh) { + if(gh == null) { + return; + } + @SuppressWarnings("unchecked") + ArrayList cloned = (ArrayList) pointerGestureHandler.clone(); + if(0>index) { + index = cloned.size(); + } + cloned.add(index, gh); + pointerGestureHandler = cloned; + } + @Override + public final void removeGestureHandler(GestureHandler gh) { + if (gh == null) { + return; + } + @SuppressWarnings("unchecked") + ArrayList cloned = (ArrayList) pointerGestureHandler.clone(); + cloned.remove(gh); + pointerGestureHandler = cloned; + } + @Override + public final void addGestureListener(GestureHandler.GestureListener gl) { + addGestureListener(-1, gl); + } + @Override + public final void addGestureListener(int index, GestureHandler.GestureListener gl) { + if(gl == null) { + return; + } + @SuppressWarnings("unchecked") + ArrayList cloned = (ArrayList) gestureListeners.clone(); + if(0>index) { + index = cloned.size(); + } + cloned.add(index, gl); + gestureListeners = cloned; + } + @Override + public final void removeGestureListener(GestureHandler.GestureListener gl) { + if (gl == null) { + return; + } + @SuppressWarnings("unchecked") + ArrayList cloned = (ArrayList) gestureListeners.clone(); + cloned.remove(gl); + gestureListeners= cloned; + } + private final void dispatchMouseEvent(MouseEvent e) { for(int i = 0; !e.isConsumed() && i < mouseListeners.size(); i++ ) { MouseListener l = mouseListeners.get(i); -- cgit v1.2.3