aboutsummaryrefslogtreecommitdiffstats
path: root/netx/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'netx/jogamp')
-rw-r--r--netx/jogamp/applet/Applet3Panel.java103
-rw-r--r--netx/jogamp/plugin/jnlp/NetxApplet3Panel.java4
2 files changed, 81 insertions, 26 deletions
diff --git a/netx/jogamp/applet/Applet3Panel.java b/netx/jogamp/applet/Applet3Panel.java
index 5acad4d..27bb305 100644
--- a/netx/jogamp/applet/Applet3Panel.java
+++ b/netx/jogamp/applet/Applet3Panel.java
@@ -97,7 +97,7 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
*/
private NativeWindowDownstream appletWindow;
- private final MyNativeWindow parentWindow;
+ private final MyNativeWindow browserWindow;
/**
* Applet will allow initialization. Should be
@@ -172,6 +172,11 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
*/
int[] currentAppletSize = { 10, 10 };
+ /**
+ * The current applet position.
+ */
+ int[] currentAppletPos = { 0, 0 };
+
MessageUtils mu = new MessageUtils();
/**
@@ -214,10 +219,12 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
public abstract ClassLoader getAppletClassLoader();
- public Applet3Panel(long nativeWindowHandle, int width, int height, URL documentURL, Hashtable<String, String> parameters) {
+ public Applet3Panel(long nativeWindowHandle, int xpos, int ypos, int width, int height, URL documentURL, Hashtable<String, String> parameters) {
this.documentURL = documentURL;
this.parameters = parameters;
this.updateSizeInParameters(width, height);
+ this.currentAppletPos[0] = xpos;
+ this.currentAppletPos[1] = ypos;
this.currentAppletSize[0] = width;
this.currentAppletSize[1] = height;
{
@@ -249,7 +256,7 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
}
baseURL = _baseURL;
}
- this.parentWindow = new MyNativeWindow(nativeWindowHandle);
+ this.browserWindow = new MyNativeWindow(nativeWindowHandle);
}
class MyNativeWindow implements NativeWindowUpstream {
final long handle;
@@ -269,6 +276,16 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
}
@Override
+ public final int getX() {
+ return Applet3Panel.this.getX();
+ }
+
+ @Override
+ public final int getY() {
+ return Applet3Panel.this.getY();
+ }
+
+ @Override
public final long getWindowHandle() {
return this.handle;
}
@@ -287,6 +304,10 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
public final void notifySurfaceUpdated(NativeWindowDownstream swappedWin) {
// TODO: May hook for composite extension
}
+ @Override
+ public final String toString() {
+ return "PluginWin[0x"+Long.toHexString(handle)+", "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+"]";
+ }
};
public void destroy(boolean notifyApplet, boolean notifyUser) throws java.security.AccessControlException {
@@ -320,7 +341,7 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
return appletWindow;
}
public MyNativeWindow getBrowserWindow() {
- return parentWindow;
+ return browserWindow;
}
public int getStatus() { return status; }
@@ -355,7 +376,7 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
}
@Override
- public final URL getDocumentBase() { // TODO
+ public final URL getDocumentBase() {
return documentURL;
}
@@ -364,29 +385,17 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
return baseURL;
}
- public void updateSizeInParameters(int width, int height) {
+ private void updateSizeInParameters(int width, int height) {
parameters.put("width", Integer.toString(width));
parameters.put("height", Integer.toString(height));
}
+ private void updatePosInParameters(int x, int y) {
+ parameters.put("xpos", Integer.toString(x));
+ parameters.put("ypos", Integer.toString(y));
+ }
@Override
public void resize(int width, int height) {
- appletResize(width, height);
- }
-
- /**
- * Called when the applet wants to be resized.
- *
- * @param width the new requested width for the applet.
- * @param height the new requested height for the applet.
- */
- public void appletResize(int width, int height) {
- updateSizeInParameters(width, height);
- currentAppletSize[0] = width;
- currentAppletSize[1] = height;
- if( null != appletWindow ) {
- appletWindow.setSize(width, height);
- }
/** FIXME
if(loader != null) {
App3Context appCtxt = loader.getAppContext();
@@ -406,6 +415,31 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
}
}));
} */
+ browserSizeChanged(width, height);
+ }
+
+ /**
+ * Called when the applet needs to be resized.
+ */
+ public void browserSizeChanged(int width, int height) {
+ updateSizeInParameters(width, height);
+ currentAppletSize[0] = width;
+ currentAppletSize[1] = height;
+ if( null != appletWindow ) {
+ appletWindow.setSize(width, height);
+ }
+ }
+
+ /**
+ * Called when the applet needs to be informed about about position change.
+ */
+ public void browserPositionChanged(int x, int y) {
+ updatePosInParameters(x, y);
+ currentAppletPos[0] = y;
+ currentAppletPos[1] = y;
+ if( null != appletWindow ) {
+ appletWindow.notifyPositionChanged(browserWindow);
+ }
}
@Override
@@ -451,6 +485,12 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
//
// Internal Impl.
//
+ @Override
+ public String toString() {
+ return getClass().getSimpleName()+"@"+Integer.toHexString(hashCode())+
+ "["+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+
+ ", "+getCode()+" @ "+getCodeBase()+", doc "+getDocumentBase()+"]";
+ }
/**
* Get the code parameter
@@ -492,6 +532,21 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
}
/**
+ * Get the x-pos.
+ */
+ public final int getX() {
+ return currentAppletPos[0];
+ }
+
+
+ /**
+ * Get the y-pos.
+ */
+ public final int getY() {
+ return currentAppletPos[1];
+ }
+
+ /**
* Get the width.
*/
public final int getWidth() {
@@ -812,8 +867,8 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
break;
}
if( null == appletWindow ) {
- appletWindow = applet.createNativeWindow(this, parentWindow);
- if( parentWindow != appletWindow.getParent() ) {
+ appletWindow = applet.createNativeWindow(this, browserWindow);
+ if( browserWindow != appletWindow.getParent() ) {
throw new IllegalArgumentException("Applet's parent doesn't match!");
}
// FIXME loader.getAppContext().registerAppletWindow(appletWindow);
diff --git a/netx/jogamp/plugin/jnlp/NetxApplet3Panel.java b/netx/jogamp/plugin/jnlp/NetxApplet3Panel.java
index 0d79911..c9f0dd1 100644
--- a/netx/jogamp/plugin/jnlp/NetxApplet3Panel.java
+++ b/netx/jogamp/plugin/jnlp/NetxApplet3Panel.java
@@ -73,8 +73,8 @@ public class NetxApplet3Panel extends Applet3Panel implements SplashController {
private static final ConcurrentMap<String, Boolean> appContextCreated =
new ConcurrentHashMap<String, Boolean>();
- public NetxApplet3Panel(long nativeWindowHandle, int width, int height, URL documentURL, PluginParameters params) {
- super(nativeWindowHandle, width, height, documentURL, params.getUnderlyingHashtable());
+ public NetxApplet3Panel(long nativeWindowHandle, int xpos, int ypos, int width, int height, URL documentURL, PluginParameters params) {
+ super(nativeWindowHandle, xpos, ypos, width, height, documentURL, params.getUnderlyingHashtable());
this.pluginParameters = params;
this.initialized = false;