diff options
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 218 |
1 files changed, 109 insertions, 109 deletions
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<MouseListener> clonedListeners = (ArrayList<MouseListener>) 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<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone(); - clonedListeners.remove(l); - mouseListeners = clonedListeners; - } - - @Override - public final MouseListener getMouseListener(int index) { - @SuppressWarnings("unchecked") - ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) 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<GestureHandler> cloned = (ArrayList<GestureHandler>) 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<GestureHandler> cloned = (ArrayList<GestureHandler>) 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<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) 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<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) 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<MouseListener> clonedListeners = (ArrayList<MouseListener>) 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<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone(); + clonedListeners.remove(l); + mouseListeners = clonedListeners; + } + + @Override + public final MouseListener getMouseListener(int index) { + @SuppressWarnings("unchecked") + ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) 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<GestureHandler> cloned = (ArrayList<GestureHandler>) 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<GestureHandler> cloned = (ArrayList<GestureHandler>) 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<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) 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<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) 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); |