Bugs item #927394, was opened at 2004-04-01 12:18
Message generated for change (Comment added) made by mlemaudit
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379133&aid=927394&group_id=23629

Category: Applet
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nathana�l Mazuir (mlemaudit)
Assigned to: Michael T Howard (michaelthoward)
Summary: package confusion ?

Initial Comment:
It seems that there is a little problem with some Jmol 
classes (CVS HEAD) :

1- In the package "org.openscience.jmol.applet" :

- The package declaration line is missing in the 
Jvm12.java file.


2- In the default package (i.e. in the src folder) :

- The Jvm12 Constructor is not visible from the default 
package.


Proposal to fix the problem :

1- Move these files to the "org.openscience.jmol.applet" 
package :

- JmolApplet.java
- JmolAppletControl.java
- JmolAppletRegistry.java

2- Add the missing package declaration line to all the 
files within the "org.openscience.jmol.applet" package.

Yours.
M.

----------------------------------------------------------------------

>Comment By: Nathana�l Mazuir (mlemaudit)
Date: 2004-04-01 15:06

Message:
Logged In: YES 
user_id=935018

Hello Miguel.

> JmolApplet and JmolAppletControl are in the root for a good
> reason. When a person wants to create an instance of the
> applet they need to put the classname in their HTML file. By
> putting these in the root someone can say
>   <applet code="JmolApplet" ... >
> 
> instead of
>   <applet code="org.openscience.jmol.applet.JmolApplet" ...>

I see.

> I think there is significant benefit in simplifying the code
> for the applet users. 
> 
> Does that make sense? 

Yes, it does.

> I would like to move the JmolAppletRegistry into the
> jmol.applet package, but I do not know how to import a 
> class
> that does not exist in a package. 
> 
> Any suggestions? 

Well as I'm still a beginner in Java development, I do not think 
that I am fully qualified to give you advices about Java 
programming. ;-)

That fact is that it would be "cleaner" if all the applet relative 
code were stored in the applet package.

Concerning the way to "import a class that does not exist in a 
package"... well, I have to confess that I do not clearly 
understand your question.

If you are talking about the fact that Jvm12 is not visible from 
the default package, I think that a simple way to make it 
visible is to change the Jvm12 constructor's access modifier 
from nothing (default option) to public.
Is it a good solution? I'm not sure. This point should probably 
discuss with Egon or Christoph, because there is a probably 
good reason why this constructor is package visible only.

...

Maybe it's a stupid idea, but why don't you use some kind 
of "launcher"?

Let me explain this idea:

Let's imagine that the classes JmolApplet, JmolAppletControl, 
and JmolAppletRegistry are in the org.openscience.jmol.applet 
package.
The Jvm12 constructor's visibility is solved without modifying 
the access modifier (leaving the default package visibility).

The only problem is that the applet user will have to write:
   <applet code="org.openscience.jmol.applet.JmolApplet" ...>

Which is not as easy as:
   <applet code="JmolApplet" ... >

Isn't it possible to solve this difficulty, by creating a new 
class in the default package?
This class' job would be to "launch" the real applet class (i.e. 
the org.openscience.jmol.applet.JmolApplet) with the 
appropriate parameters.
As long as package names prevents from class names 
collision, you could name this "launch" class "JmolApplet" to 
keep compatibility with old html pages and to prevent from 
users complaints. ;-)
Actually this class would be an interface between the real 
JmolApplet class and the html pages.


Finally, you would have:

In the "default" package:
 - JmolApplet.java (the launcher)

In the "org.openscience.jmol.applet" package:
 - JmolApplet.java (the original one)
 - JmolAppletControl.java
 - JmolAppletRegistry.java
 - Jvm12.java

I don't know if this makes more sense than the actual solution.
I don't know if it is a good or a bad idea.
And... don't ask me how should be written this launcher, I 
have absolutely no idea. ;-)


Yours.
M.

----------------------------------------------------------------------

Comment By: Michael T Howard (michaelthoward)
Date: 2004-04-01 13:02

Message:
Logged In: YES 
user_id=608250

Very good points. And thank you for filing this. 

I have fixed and checked in the changes to Jvm12

JmolApplet and JmolAppletControl are in the root for a good
reason. When a person wants to create an instance of the
applet they need to put the classname in their HTML file. By
putting these in the root someone can say
  <applet code="JmolApplet" ... >

instead of
  <applet code="org.openscience.jmol.applet.JmolApplet" ...>

I think there is significant benefit in simplifying the code
for the applet users. 

Does that make sense? 

I would like to move the JmolAppletRegistry into the
jmol.applet package, but I do not know how to import a class
that does not exist in a package. 

Any suggestions? 

Thanks again for taking the time to file this. 
Miguel


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379133&aid=927394&group_id=23629


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Jmol-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to