World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Development Help

Development Help Help for building applications or diagnosing problems with WWJ

Reply
 
Thread Tools Display Modes
Old 09-12-2008, 11:51 PM   #1
vash
Member
 
Join Date: May 2007
Location: Toulouse
Posts: 92
Default New Java Plugin applet experiment

Hi,
I have modified the "Javascript Location-marks Applet" example using JNLP built-in support available in the new Java Plugin included in the Java SE 6 Update 10.

The applet starts really fast now with this new plugin and it is more stable .

It can be tested here (Firefox 3 or IE 7 and Java SE update 10 is required, you can find it here)

What i have modified :

html code :
Code:
...
<applet id="wwjApplet" name="wwjApplet" mayscript code="gov.nasa.worldwind.examples.applet.WWJApplet" width=100% height=70% >
<param name="jnlp_href" value="wwjapplet.jnlp">
</applet>
...
jnlp code :
Code:
<?xml version="1.0" encoding="utf-8"?>
<jnlp href="wwjapplet.jnlp">
    <information>
        <title>World Wind Java New Plugin Applet Demo</title>
        <vendor>NASA</vendor>
        <homepage href="http://worldwind.arc.nasa.gov"/>
        <description>World Wind Java New Plugin Applet Demo</description>
        <description kind="short">World Wind Java New Plugin Applet Demo</description>
        <offline-allowed/>
    </information>
    <security>
        <all-permissions/>
    </security>

    <resources>
        <j2se href="http://java.sun.com/products/autodl/j2se" version="1.5+" initial-heap-size="512m"
              max-heap-size="512m"/>
        <property name="sun.java2d.noddraw" value="true"/>
        <jar href="http://worldwind.arc.nasa.gov/java/demos/WWJApplet.jar" main="false"/>
        <jar href="http://worldwind.arc.nasa.gov/java/demos/worldwind.jar" main="false"/>
        <extension name="jogl"
                   href="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp"/>
    </resources>
     <applet-desc 
         name="My Applet"
         main-class="gov.nasa.worldwind.examples.applet.WWJApplet"
         width="300"
         height="300">
     <param name="MAYSCRIPT" value="true"/>
     </applet-desc>
</jnlp>
Now you can manage the memory allocated to the applet using the same system than in JNLP :
Code:
...
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.5+" initial-heap-size="512m"
              max-heap-size="512m"/>
...
Moreover the built-in JNLP support avoids WWJ applets from using applet-launcher anymore.
The side effect of this modification is that the javascript code that calls the applet have to be rewritten from :
Code:
document.getElementById('wwjApplet').getSubApplet().method(params);
to
Code:
document.getElementById('wwjApplet').method(params);
__________________
-Nicolas CASTEL- Thales Alenia Space, GMES program, Toulouse, France-

Last edited by vash; 09-12-2008 at 11:54 PM.
vash is offline   Reply With Quote
Old 09-13-2008, 12:58 AM   #2
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
Default

Thanks Nicolas, this is a nice run down of the new Java plugin features. I'll have to look into it
__________________
My World Wind Java Blog & WW.net Plugins page
patmurris is offline   Reply With Quote
Old 10-16-2008, 01:28 AM   #3
vash
Member
 
Join Date: May 2007
Location: Toulouse
Posts: 92
Default

Java 6 update 10 is available now. You could download it on the java se website
__________________
-Nicolas CASTEL- Thales Alenia Space, GMES program, Toulouse, France-
vash is offline   Reply With Quote
Old 10-16-2008, 02:50 AM   #4
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
Default

BTW: is there an html version using the OBJECT tag instead of the APPLET one which is deprecated?
__________________
My World Wind Java Blog & WW.net Plugins page
patmurris is offline   Reply With Quote
Old 10-16-2008, 03:20 AM   #5
TomServo
God. Root. What is difference?
 
TomServo's Avatar
 
Join Date: Sep 2004
Location: Eastern Pennsylvania
Posts: 2,856
Default

Quote:
Originally Posted by vash View Post
Java 6 update 10 is available now. You could download it on the java se website
FINALLY!

Now, to make my website visitors update so I can use the better code.
__________________


Earth is Square blog

PUBLIC NOTICE AS REQUIRED BY LAW: Any use of this forum post, in any manner whatsoever, will increase the amount of disorder in the universe. Although no liability is implied herein, the consumer is warned that this process will ultimately lead to the heat death of the universe.
TomServo is offline   Reply With Quote
Old 01-20-2009, 04:37 AM   #6
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
Default

Here are some notes from Sun's Ken Russell about the new plugin:
Quote:
The Cascade Mountains WWJ applet example converted to a new-style applet is here:

https://jdk6.dev.java.net/plugin2/#DEMOS

and described in detail here:

https://jdk6.dev.java.net/plugin2/jn...PLES_WORLDWIND

Basically, this eliminates the need for the JNLPAppletLauncher, and is a much more
robust technique in general. You can use all of the JNLP APIs you might otherwise
use in a Java Web Start application.

Note that the getWWJApplet() function on that web page caches the applet via
Code:
var theApplet = null;

function getWWJApplet() {
  if (theApplet == null) {
     theApplet = document.getElementById('wwjApplet');
  }
  return theApplet;
}
You can actually have an old-style and a new-style applet in the same applet tag,
for backward compatibility, so:
Code:
<applet archive="..." code="...JNLPAppletLauncher">
   <param ...> <!-- Parameters for JNLPAppletLauncher -->
   <param name="jnlp_href" value="WWJApplet.jnlp">  <!-- Picked up by the new Java Plug-In -->
</applet>
so the JNLPAppletLauncher will be used if the old Java Plug-In is in use, and
the WWJApplet.jnlp will be used if the new Java Plug-In is in use. You can then
make the JavaScript portable with a technique like
Code:
function getWWJApplet() {
  if (theApplet == null) {
     theApplet = document.getElementById('wwjApplet');
  }
  // See if we're using the old Java Plug-In and the JNLPAppletLauncher
  try {
     theApplet = theApplet.getSubApplet();
  } catch (e) {
     // Using new-style applet -- ignore
  }
  return theApplet;
}
__________________
My World Wind Java Blog & WW.net Plugins page

Last edited by patmurris; 01-20-2009 at 04:39 AM.
patmurris is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Portlet + Applet WorldWind Java + BasicDemo = works ;) pred Development Help 41 04-16-2010 06:52 PM
EMF and Applet Java gilou31 Development Help 2 09-10-2008 07:32 AM
need help with worldwind applet blackscholes Development Help 7 11-12-2007 09:45 PM
Build PluginEngine as a Class Library DLL to support binary DLL plugin development gohyongkwang Suggestion Box 1 08-24-2006 06:47 AM
HELP, PLUGIN FREEZES !!!! Unregistered Add-on & Script Development 10 07-10-2006 10:52 AM


All times are GMT +1. The time now is 04:38 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.