diff options
author | Sven Gothel <[email protected]> | 2011-08-02 18:37:23 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-08-02 18:37:23 +0200 |
commit | 8c8940308c1be5e547b4a2456e8bb5c674fce9f9 (patch) | |
tree | 37fb8f1072a81ba7879a9f3c1442b3dc25734fdc /src | |
parent | d62d5e771052957ba2628532235d344c8d65e718 (diff) |
Hide NEWT AWT Event implementation details to jogamp.newt.awt.event
Diffstat (limited to 'src')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 4 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java | 8 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java | 2 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java | 2 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java | 2 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java (renamed from src/newt/classes/com/jogamp/newt/event/awt/AWTNewtEventFactory.java) | 14 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java (renamed from src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java) | 31 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/awt/event/NewtFactoryAWT.java (renamed from src/newt/classes/com/jogamp/newt/awt/NewtFactoryAWT.java) | 2 |
8 files changed, 42 insertions, 23 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index 3c16abbea..80dcdba47 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -45,12 +45,14 @@ import javax.media.nativewindow.awt.AWTWindowClosingProtocol; import jogamp.nativewindow.awt.AWTMisc; import com.jogamp.newt.event.awt.AWTAdapter; -import com.jogamp.newt.event.awt.AWTParentWindowAdapter; import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.Window; import com.jogamp.newt.event.WindowAdapter; import com.jogamp.newt.event.WindowListener; import jogamp.newt.Debug; +import jogamp.newt.awt.event.AWTParentWindowAdapter; +import jogamp.newt.awt.event.NewtFactoryAWT; + import javax.swing.MenuSelectionManager; public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProtocol { 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 e24002659..8991203d5 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java @@ -162,6 +162,14 @@ public abstract class AWTAdapter implements java.util.EventListener } } + public final com.jogamp.newt.Window getNewtWindow() { + return newtWindow; + } + + public final com.jogamp.newt.event.NEWTEventListener getNewtEventListener() { + return newtListener; + } + /** * Due to the fact that some NEWT {@link com.jogamp.newt.event.NEWTEventListener} * are mapped to more than one {@link java.util.EventListener}, 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 8fe6ff63a..7b0f6ba97 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java @@ -28,6 +28,8 @@ package com.jogamp.newt.event.awt; +import jogamp.newt.awt.event.AWTNewtEventFactory; + public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListener { public AWTKeyAdapter(com.jogamp.newt.event.KeyListener newtListener) { 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 bd421073a..5dcd4d962 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java @@ -28,6 +28,8 @@ package com.jogamp.newt.event.awt; +import jogamp.newt.awt.event.AWTNewtEventFactory; + public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener { public AWTMouseAdapter(com.jogamp.newt.event.MouseListener newtListener) { 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 85fe5407b..ae7474c73 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java @@ -28,6 +28,8 @@ package com.jogamp.newt.event.awt; +import jogamp.newt.awt.event.AWTNewtEventFactory; + public class AWTWindowAdapter extends AWTAdapter implements java.awt.event.ComponentListener, java.awt.event.WindowListener, java.awt.event.FocusListener diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java index dcd33abc9..b9c8d2c7b 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTNewtEventFactory.java +++ b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java @@ -26,11 +26,11 @@ * or implied, of JogAmp Community. */ -package com.jogamp.newt.event.awt; +package jogamp.newt.awt.event; import com.jogamp.common.util.IntIntHashMap; -class AWTNewtEventFactory { +public class AWTNewtEventFactory { protected static final IntIntHashMap eventTypeAWT2NEWT; @@ -90,7 +90,7 @@ class AWTNewtEventFactory { return 0; } - static final com.jogamp.newt.event.WindowEvent createWindowEvent(java.awt.event.WindowEvent event, com.jogamp.newt.Window newtSource) { + public static final com.jogamp.newt.event.WindowEvent createWindowEvent(java.awt.event.WindowEvent event, com.jogamp.newt.Window newtSource) { int type = eventTypeAWT2NEWT.get(event.getID()); if(0xFFFFFFFF != type) { return new com.jogamp.newt.event.WindowEvent(type, ((null==newtSource)?(Object)event.getComponent():(Object)newtSource), System.currentTimeMillis()); @@ -98,7 +98,7 @@ class AWTNewtEventFactory { return null; // no mapping .. } - static final com.jogamp.newt.event.WindowEvent createWindowEvent(java.awt.event.ComponentEvent event, com.jogamp.newt.Window newtSource) { + public static final com.jogamp.newt.event.WindowEvent createWindowEvent(java.awt.event.ComponentEvent event, com.jogamp.newt.Window newtSource) { int type = eventTypeAWT2NEWT.get(event.getID()); if(0xFFFFFFFF != type) { return new com.jogamp.newt.event.WindowEvent(type, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, System.currentTimeMillis()); @@ -106,7 +106,7 @@ class AWTNewtEventFactory { return null; // no mapping .. } - static final com.jogamp.newt.event.WindowEvent createWindowEvent(java.awt.event.FocusEvent event, com.jogamp.newt.Window newtSource) { + public static final com.jogamp.newt.event.WindowEvent createWindowEvent(java.awt.event.FocusEvent event, com.jogamp.newt.Window newtSource) { int type = eventTypeAWT2NEWT.get(event.getID()); if(0xFFFFFFFF != type) { return new com.jogamp.newt.event.WindowEvent(type, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, System.currentTimeMillis()); @@ -114,7 +114,7 @@ class AWTNewtEventFactory { return null; // no mapping .. } - static final com.jogamp.newt.event.MouseEvent createMouseEvent(java.awt.event.MouseEvent event, com.jogamp.newt.Window newtSource) { + public static final com.jogamp.newt.event.MouseEvent createMouseEvent(java.awt.event.MouseEvent event, com.jogamp.newt.Window newtSource) { int type = eventTypeAWT2NEWT.get(event.getID()); if(0xFFFFFFFF != type) { int rotation = 0; @@ -131,7 +131,7 @@ class AWTNewtEventFactory { return null; // no mapping .. } - static final com.jogamp.newt.event.KeyEvent createKeyEvent(java.awt.event.KeyEvent event, com.jogamp.newt.Window newtSource) { + public static final com.jogamp.newt.event.KeyEvent createKeyEvent(java.awt.event.KeyEvent event, com.jogamp.newt.Window newtSource) { int type = eventTypeAWT2NEWT.get(event.getID()); if(0xFFFFFFFF != type) { return new com.jogamp.newt.event.KeyEvent( diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java index 68f2b3e0f..517a67df0 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java +++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java @@ -26,7 +26,10 @@ * or implied, of JogAmp Community. */ -package com.jogamp.newt.event.awt; +package jogamp.newt.awt.event; + +import com.jogamp.newt.event.awt.AWTAdapter; +import com.jogamp.newt.event.awt.AWTWindowAdapter; /** * Specialized parent/client adapter, @@ -69,20 +72,20 @@ public class AWTParentWindowAdapter if(DEBUG_IMPLEMENTATION) { System.err.println("AWT: componentResized: "+comp); } - if(newtWindow.isValid()) { - newtWindow.runOnEDTIfAvail(false, new Runnable() { + if(getNewtWindow().isValid()) { + getNewtWindow().runOnEDTIfAvail(false, new Runnable() { public void run() { int cw = comp.getWidth(); int ch = comp.getHeight(); if( 0 < cw * ch ) { - if( newtWindow.getWidth() != cw || newtWindow.getHeight() != ch ) { - newtWindow.setSize(cw, ch); - if(comp.isVisible() != newtWindow.isVisible()) { - newtWindow.setVisible(comp.isVisible()); + if( getNewtWindow().getWidth() != cw || getNewtWindow().getHeight() != ch ) { + getNewtWindow().setSize(cw, ch); + if(comp.isVisible() != getNewtWindow().isVisible()) { + getNewtWindow().setVisible(comp.isVisible()); } } - } else if(newtWindow.isVisible()) { - newtWindow.setVisible(false); + } else if(getNewtWindow().isVisible()) { + getNewtWindow().setVisible(false); } }}); } @@ -101,7 +104,7 @@ public class AWTParentWindowAdapter } public void hierarchyChanged(java.awt.event.HierarchyEvent e) { - if( null == newtListener ) { + if( null == getNewtEventListener() ) { long bits = e.getChangeFlags(); final java.awt.Component changed = e.getChanged(); if( 0 != ( java.awt.event.HierarchyEvent.SHOWING_CHANGED & bits ) ) { @@ -109,11 +112,11 @@ public class AWTParentWindowAdapter if(DEBUG_IMPLEMENTATION) { System.err.println("AWT: hierarchyChanged SHOWING_CHANGED: showing "+showing+", "+changed); } - if(newtWindow.isValid()) { - newtWindow.runOnEDTIfAvail(false, new Runnable() { + if(getNewtWindow().isValid()) { + getNewtWindow().runOnEDTIfAvail(false, new Runnable() { public void run() { - if(newtWindow.isVisible() != showing) { - newtWindow.setVisible(showing); + if(getNewtWindow().isVisible() != showing) { + getNewtWindow().setVisible(showing); } }}); } diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtFactoryAWT.java b/src/newt/classes/jogamp/newt/awt/event/NewtFactoryAWT.java index e1370f05e..aa98d3a37 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtFactoryAWT.java +++ b/src/newt/classes/jogamp/newt/awt/event/NewtFactoryAWT.java @@ -27,7 +27,7 @@ */ -package com.jogamp.newt.awt; +package jogamp.newt.awt.event; import javax.media.nativewindow.*; |