Thread: j2s-development] Nested Shells
Brought to you by:
zhourenjian
|
From: Sal F. <sv...@gm...> - 2006-10-13 21:20:04
|
Hi, I'm new to the list. By the way - j2s is really cool, hands down the best Javascript/RIA framework in existence currently, in my opinion. I just hope sourceforge is ready for the traffic, when word spreads and people come flocking to use this great new technology!! I don't understand the people comparing it to GWT. Very different products, GWT's scope and functionality kindof pales in my comparison (and no eclipse integration! yuck!). My question: I noticed nested Shells are not supported yet. Am I missing anything, or is it just not yet implemented? If not are there any plan for implementing the feature yet? I am willing to help implement it. I've become somewhat familiar with j2s sources, using it for several weeks now, but a pointer or two on the 'suggested' approach to implement it would help a little to be sure I don't go off into the weeds. Thanks to the devs that make this library possible - I hope I can help soon. Thanks, - Sal |
|
From: Zhou R. <jo...@sj...> - 2006-10-14 06:07:16
|
Hi Sal,
GWT has its advantages: its generated *.js file size is much smaller
than Java2Script's and its performance is very good. GWT's *.js is
project dependent while Java2Script's *.js is library dependent. And the
motivation of GWT's code generation is "to be as small and as efficient
as possible" while Java2Script's motivation is "to provide same familiar
Java APIs in JavaScript". And there are lots of other differences. In
fact, GWT is great in many designs.
And about nested Shells: if a shell is designed to popup in a method B,
the method B won't block later method C. For example:
public void methodB() {
...
shell.open();
while (...)
...
}
public void callMethod() {
methodA();
methodB();
methodC();
}
methodC will always be called after methodB without blocking of the
shell inside methodB, which is incorrect. And developer should avoid
such method calls by wrapping them into callbacks of methodB.
If you popup shells orderly in the same method scope, Java2Script
compiler will generate JavaScript correctly and shells will popup in
correct order. For example:
public void aMethod() {
...
shell.open();
while (...)
...
...
anotherShell.open();
while (...)
...
}
anotherShell open only after the first shell is closed, which is correct.
You can inspect into the generated JavaScript to get the details.
Concept of nested Shells is considered a problem of "Asynchronous
Programming v.s. Synchronous Programming" in JavaScript. In JavaScript,
no blocking by while loop or Thread.sleep or Object.wait exists. So
synchronous programming should be converted into asynchronous
programming. Java2Script compiler tries to help such conversions but
won't help all. And I think nested Shells may not be implemented in
release 1.0. If you find any possible ways to implement it, please
discuss it on the mail list or implement it.
Regards,
Zhou Renjian
Sal Ferro wrote:
> Hi,
>
> I'm new to the list. By the way - j2s is really cool, hands down the
> best Javascript/RIA framework in existence currently, in my opinion.
> I just hope sourceforge is ready for the traffic, when word spreads
> and people come flocking to use this great new technology!! I don't
> understand the people comparing it to GWT. Very different products,
> GWT's scope and functionality kindof pales in my comparison (and no
> eclipse integration! yuck!).
>
> My question: I noticed nested Shells are not supported yet. Am I
> missing anything, or is it just not yet implemented? If not are there
> any plan for implementing the feature yet? I am willing to
> help implement it.
>
> I've become somewhat familiar with j2s sources, using it for several
> weeks now, but a pointer or two on the 'suggested' approach to
> implement it would help a little to be sure I don't go off into the weeds.
>
> Thanks to the devs that make this library possible - I hope I can help
> soon.
>
> Thanks,
>
> - Sal
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ------------------------------------------------------------------------
>
> _______________________________________________
> j2s-development mailing list
> j2s...@li...
> https://lists.sourceforge.net/lists/listinfo/j2s-development
>
|
|
From: Sal <sv...@gm...> - 2006-10-16 13:37:49
|
Zhou,
Thanks much for the info. I think I may have been a little unclear on the
'nested Shells' comment, I apologize for that.
For example I have this snippet:
Shell child = new Shell(parent);
child.setSize(200, 200);
child.open();
My understanding is that this should put the child shell into the parent
shell. So that they will nest inside of each other, and if the parent shell
is moved, the child shell will also move. They'll appear 'nested' as in -
the 'MDI' type interfaces supported in some Windows apps.
It seems this feature is supported in the Windows-SWT, so I was curious as
to if it will be implemented in j2s.
The reason I am attempting this is because I need all the functionality of a
Shell (title bar, open/close buttons, etc.) but have them as children of
another window which has the same kind of title bar. (And use the same
codebase for the Web/j2s version as the Desktop version).
Thanks much for the help,
- Sal
On 10/14/06, Zhou Renjian <jo...@sj...> wrote:
>
> Hi Sal,
>
> GWT has its advantages: its generated *.js file size is much smaller
> than Java2Script's and its performance is very good. GWT's *.js is
> project dependent while Java2Script's *.js is library dependent. And the
> motivation of GWT's code generation is "to be as small and as efficient
> as possible" while Java2Script's motivation is "to provide same familiar
> Java APIs in JavaScript". And there are lots of other differences. In
> fact, GWT is great in many designs.
>
> And about nested Shells: if a shell is designed to popup in a method B,
> the method B won't block later method C. For example:
> public void methodB() {
> ...
> shell.open();
> while (...)
> ...
> }
> public void callMethod() {
> methodA();
> methodB();
> methodC();
> }
>
> methodC will always be called after methodB without blocking of the
> shell inside methodB, which is incorrect. And developer should avoid
> such method calls by wrapping them into callbacks of methodB.
>
> If you popup shells orderly in the same method scope, Java2Script
> compiler will generate JavaScript correctly and shells will popup in
> correct order. For example:
> public void aMethod() {
> ...
> shell.open();
> while (...)
> ...
> ...
> anotherShell.open();
> while (...)
> ...
> }
> anotherShell open only after the first shell is closed, which is correct.
>
> You can inspect into the generated JavaScript to get the details.
>
> Concept of nested Shells is considered a problem of "Asynchronous
> Programming v.s. Synchronous Programming" in JavaScript. In JavaScript,
> no blocking by while loop or Thread.sleep or Object.wait exists. So
> synchronous programming should be converted into asynchronous
> programming. Java2Script compiler tries to help such conversions but
> won't help all. And I think nested Shells may not be implemented in
> release 1.0. If you find any possible ways to implement it, please
> discuss it on the mail list or implement it.
>
> Regards,
> Zhou Renjian
>
> Sal Ferro wrote:
> > Hi,
> >
> > I'm new to the list. By the way - j2s is really cool, hands down the
> > best Javascript/RIA framework in existence currently, in my opinion.
> > I just hope sourceforge is ready for the traffic, when word spreads
> > and people come flocking to use this great new technology!! I don't
> > understand the people comparing it to GWT. Very different products,
> > GWT's scope and functionality kindof pales in my comparison (and no
> > eclipse integration! yuck!).
> >
> > My question: I noticed nested Shells are not supported yet. Am I
> > missing anything, or is it just not yet implemented? If not are there
> > any plan for implementing the feature yet? I am willing to
> > help implement it.
> >
> > I've become somewhat familiar with j2s sources, using it for several
> > weeks now, but a pointer or two on the 'suggested' approach to
> > implement it would help a little to be sure I don't go off into the
> weeds.
> >
> > Thanks to the devs that make this library possible - I hope I can help
> > soon.
> >
> > Thanks,
> >
> > - Sal
> >
> >
> > ------------------------------------------------------------------------
> >
> >
> -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services,
> security?
> > Get stuff done quickly with pre-integrated technology to make your job
> easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > j2s-development mailing list
> > j2s...@li...
> > https://lists.sourceforge.net/lists/listinfo/j2s-development
> >
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> j2s-development mailing list
> j2s...@li...
> https://lists.sourceforge.net/lists/listinfo/j2s-development
>
|
|
From: Zhou R. <jo...@sj...> - 2006-10-16 14:34:24
|
Hi Sal,
Sorry for misunderstanding about "nested Shells" concept.
For "MDI" type interfaces by SWT, you may add Control listeners to
parent Shell so parent Shell and children Shells can perform as MDI.
Here is a SWT snippet (You can also check it out from
sources/tests/net.sf.j2s.test.swt/src/net/sf/j2s/test/swt/widgets/TestNestedShells.java)
Display display = new Display ();
final Shell shell = new Shell (display);
shell.setText ("hi");
shell.setSize(210, 120);
shell.open ();
final Shell shell2 = new Shell(shell);
shell2.setSize(110, 60);
shell2.open();
shell.addControlListener(new ControlListener() {
int lastX, lastY;
public void controlResized(ControlEvent e) {
}
public void controlMoved(ControlEvent e) {
Point pt = shell.getLocation();
Point pt2 = shell2.getLocation();
shell2.setLocation(pt2.x + pt.x - lastX, pt2.y + pt.y -
lastY);
lastX = pt.x;
lastY = pt.y;
}
});
while (!shell.isDisposed()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
Before you mentioned such a thing, moving and resizing a J2S Shell do
not send out SWT.move and SWT.resize events. It was a bug. And I just
fixed that bug.
So before you can run the above snippet in Java2Script mode, you should
check out the latest code and build the whole things (Following
instructions of setting up Java2Script environment from SVN repository
by the website).
Regards
Sal wrote:
> Zhou,
>
> Thanks much for the info. I think I may have been a little unclear on
> the 'nested Shells' comment, I apologize for that.
>
> For example I have this snippet:
>
> Shell child = new Shell(parent);
> child.setSize(200, 200);
> child.open();
>
> My understanding is that this should put the child shell into the
> parent shell. So that they will nest inside of each other, and if the
> parent shell is moved, the child shell will also move. They'll appear
> 'nested' as in - the 'MDI' type interfaces supported in some Windows
> apps.
>
> It seems this feature is supported in the Windows-SWT, so I was
> curious as to if it will be implemented in j2s.
>
> The reason I am attempting this is because I need all the
> functionality of a Shell (title bar, open/close buttons, etc.) but
> have them as children of another window which has the same kind of
> title bar. (And use the same codebase for the Web/j2s version as the
> Desktop version).
>
> Thanks much for the help,
>
> - Sal
>
>
> On 10/14/06, *Zhou Renjian* <jo...@sj... <mailto:jo...@sj...>> wrote:
>
> Hi Sal,
>
> GWT has its advantages: its generated *.js file size is much smaller
> than Java2Script's and its performance is very good. GWT's *.js is
> project dependent while Java2Script's *.js is library dependent.
> And the
> motivation of GWT's code generation is "to be as small and as
> efficient
> as possible" while Java2Script's motivation is "to provide same
> familiar
> Java APIs in JavaScript". And there are lots of other differences. In
> fact, GWT is great in many designs.
>
> And about nested Shells: if a shell is designed to popup in a
> method B,
> the method B won't block later method C. For example:
> public void methodB() {
> ...
> shell.open();
> while (...)
> ...
> }
> public void callMethod() {
> methodA();
> methodB();
> methodC();
> }
>
> methodC will always be called after methodB without blocking of the
> shell inside methodB, which is incorrect. And developer should avoid
> such method calls by wrapping them into callbacks of methodB.
>
> If you popup shells orderly in the same method scope, Java2Script
> compiler will generate JavaScript correctly and shells will popup in
> correct order. For example:
> public void aMethod() {
> ...
> shell.open();
> while (...)
> ...
> ...
> anotherShell.open();
> while (...)
> ...
> }
> anotherShell open only after the first shell is closed, which is
> correct.
>
> You can inspect into the generated JavaScript to get the details.
>
> Concept of nested Shells is considered a problem of "Asynchronous
> Programming v.s. Synchronous Programming" in JavaScript. In
> JavaScript,
> no blocking by while loop or Thread.sleep or Object.wait exists. So
> synchronous programming should be converted into asynchronous
> programming. Java2Script compiler tries to help such conversions but
> won't help all. And I think nested Shells may not be implemented in
> release 1.0. If you find any possible ways to implement it, please
> discuss it on the mail list or implement it.
>
> Regards,
> Zhou Renjian
>
> Sal Ferro wrote:
> > Hi,
> >
> > I'm new to the list. By the way - j2s is really cool, hands down
> the
> > best Javascript/RIA framework in existence currently, in my opinion.
> > I just hope sourceforge is ready for the traffic, when word spreads
> > and people come flocking to use this great new technology!! I
> don't
> > understand the people comparing it to GWT. Very different products,
> > GWT's scope and functionality kindof pales in my comparison (and no
> > eclipse integration! yuck!).
> >
> > My question: I noticed nested Shells are not supported yet. Am I
> > missing anything, or is it just not yet implemented? If not are
> there
> > any plan for implementing the feature yet? I am willing to
> > help implement it.
> >
> > I've become somewhat familiar with j2s sources, using it for
> several
> > weeks now, but a pointer or two on the 'suggested' approach to
> > implement it would help a little to be sure I don't go off into
> the weeds.
> >
> > Thanks to the devs that make this library possible - I hope I
> can help
> > soon.
> >
> > Thanks,
> >
> > - Sal
> >
>
|
|
From: Sal <sv...@gm...> - 2006-10-23 22:23:42
|
Zhou,
Sorry for my late response, I have actually been actively working on this
issue. Your information was very helpful - thank you much for the
asssistance!
It seems that the listeners will position the child Shells properly, however
the parent shell will not clip its children shells (as with an MDI
interface). It seems that parenting widgets to a shell is very much
supported in j2s (for example, a 'Button' as a child of a Shell), as well as
clipping these children, so I know the parent->child relationship of windows
is supported currently, it just needs to be enabled for the Shell objects.
As, I'm sure to web browser there is no difference from a Shell object to a
Button, this is probably a J2S implementation detail.
I was going to post a proposal for implementation once I had a better idea
of the code architecture - as I don't want to pollute your list with silly
questions! =) Let me know if you have any thoughts or comments, otherwise I
will continue to look into it,
Thanks much,
- Sal
On 10/16/06, Zhou Renjian <jo...@sj...> wrote:
>
> Hi Sal,
>
> Sorry for misunderstanding about "nested Shells" concept.
>
> For "MDI" type interfaces by SWT, you may add Control listeners to
> parent Shell so parent Shell and children Shells can perform as MDI.
>
> Here is a SWT snippet (You can also check it out from
>
> sources/tests/net.sf.j2s.test.swt/src/net/sf/j2s/test/swt/widgets/TestNestedShells.java)
> Display display = new Display ();
> final Shell shell = new Shell (display);
> shell.setText ("hi");
> shell.setSize(210, 120);
> shell.open ();
> final Shell shell2 = new Shell(shell);
> shell2.setSize(110, 60);
> shell2.open();
> shell.addControlListener(new ControlListener() {
> int lastX, lastY;
> public void controlResized(ControlEvent e) {
> }
> public void controlMoved(ControlEvent e) {
> Point pt = shell.getLocation();
> Point pt2 = shell2.getLocation();
> shell2.setLocation(pt2.x + pt.x - lastX, pt2.y + pt.y -
> lastY);
> lastX = pt.x;
> lastY = pt.y;
> }
> });
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch ()) display.sleep ();
> }
> display.dispose ();
>
> Before you mentioned such a thing, moving and resizing a J2S Shell do
> not send out SWT.move and SWT.resize events. It was a bug. And I just
> fixed that bug.
>
> So before you can run the above snippet in Java2Script mode, you should
> check out the latest code and build the whole things (Following
> instructions of setting up Java2Script environment from SVN repository
> by the website).
>
> Regards
>
> Sal wrote:
> > Zhou,
> >
> > Thanks much for the info. I think I may have been a little unclear on
> > the 'nested Shells' comment, I apologize for that.
> >
> > For example I have this snippet:
> >
> > Shell child = new Shell(parent);
> > child.setSize(200, 200);
> > child.open();
> >
> > My understanding is that this should put the child shell into the
> > parent shell. So that they will nest inside of each other, and if the
> > parent shell is moved, the child shell will also move. They'll appear
> > 'nested' as in - the 'MDI' type interfaces supported in some Windows
> > apps.
> >
> > It seems this feature is supported in the Windows-SWT, so I was
> > curious as to if it will be implemented in j2s.
> >
> > The reason I am attempting this is because I need all the
> > functionality of a Shell (title bar, open/close buttons, etc.) but
> > have them as children of another window which has the same kind of
> > title bar. (And use the same codebase for the Web/j2s version as the
> > Desktop version).
> >
> > Thanks much for the help,
> >
> > - Sal
> >
> >
> > On 10/14/06, *Zhou Renjian* <jo...@sj... <mailto:jo...@sj...>> wrote:
> >
> > Hi Sal,
> >
> > GWT has its advantages: its generated *.js file size is much smaller
> > than Java2Script's and its performance is very good. GWT's *.js is
> > project dependent while Java2Script's *.js is library dependent.
> > And the
> > motivation of GWT's code generation is "to be as small and as
> > efficient
> > as possible" while Java2Script's motivation is "to provide same
> > familiar
> > Java APIs in JavaScript". And there are lots of other differences.
> In
> > fact, GWT is great in many designs.
> >
> > And about nested Shells: if a shell is designed to popup in a
> > method B,
> > the method B won't block later method C. For example:
> > public void methodB() {
> > ...
> > shell.open();
> > while (...)
> > ...
> > }
> > public void callMethod() {
> > methodA();
> > methodB();
> > methodC();
> > }
> >
> > methodC will always be called after methodB without blocking of the
> > shell inside methodB, which is incorrect. And developer should avoid
> > such method calls by wrapping them into callbacks of methodB.
> >
> > If you popup shells orderly in the same method scope, Java2Script
> > compiler will generate JavaScript correctly and shells will popup in
> > correct order. For example:
> > public void aMethod() {
> > ...
> > shell.open();
> > while (...)
> > ...
> > ...
> > anotherShell.open();
> > while (...)
> > ...
> > }
> > anotherShell open only after the first shell is closed, which is
> > correct.
> >
> > You can inspect into the generated JavaScript to get the details.
> >
> > Concept of nested Shells is considered a problem of "Asynchronous
> > Programming v.s. Synchronous Programming" in JavaScript. In
> > JavaScript,
> > no blocking by while loop or Thread.sleep or Object.wait exists. So
> > synchronous programming should be converted into asynchronous
> > programming. Java2Script compiler tries to help such conversions but
> > won't help all. And I think nested Shells may not be implemented in
> > release 1.0. If you find any possible ways to implement it, please
> > discuss it on the mail list or implement it.
> >
> > Regards,
> > Zhou Renjian
> >
> > Sal Ferro wrote:
> > > Hi,
> > >
> > > I'm new to the list. By the way - j2s is really cool, hands down
> > the
> > > best Javascript/RIA framework in existence currently, in my
> opinion.
> > > I just hope sourceforge is ready for the traffic, when word
> spreads
> > > and people come flocking to use this great new technology!! I
> > don't
> > > understand the people comparing it to GWT. Very different
> products,
> > > GWT's scope and functionality kindof pales in my comparison (and
> no
> > > eclipse integration! yuck!).
> > >
> > > My question: I noticed nested Shells are not supported yet. Am I
> > > missing anything, or is it just not yet implemented? If not are
> > there
> > > any plan for implementing the feature yet? I am willing to
> > > help implement it.
> > >
> > > I've become somewhat familiar with j2s sources, using it for
> > several
> > > weeks now, but a pointer or two on the 'suggested' approach to
> > > implement it would help a little to be sure I don't go off into
> > the weeds.
> > >
> > > Thanks to the devs that make this library possible - I hope I
> > can help
> > > soon.
> > >
> > > Thanks,
> > >
> > > - Sal
> > >
> >
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> j2s-development mailing list
> j2s...@li...
> https://lists.sourceforge.net/lists/listinfo/j2s-development
>
|
|
From: Zhou R. <jo...@sj...> - 2006-10-16 17:45:58
|
Hi all, We are very glad to announce our new team member Sal Ferro! Regards, Java2Script Team Sal Ferro wrote: > > Thanks for the warm welcome, I'm glad to be part of the team! I hope > I can be of some help in the near future. I really look forward to > working with j2s, it is great technology. > > I just hope that I do not become too much of a pest on the list! > > Thanks, > > - Sal > > > On 10/14/06, *Soheil Hassas Yeganeh* <soh...@gm... > <mailto:soh...@gm...>> wrote: > > Hi Sal, > > I'm very glad to hear that we are now three! > > Hi Sal, welcome to the team. > > Regards, > Soheil > On 10/14/06, Zhou Renjian <jo...@sj... <mailto:jo...@sj...>> wrote: > > Hi Sal, > > > > Welcome to Java2Script developer team! > > > > You said you want to join and help Java2Script some days ago. As > at time > > there were lots of new AJAX toolkits or frameworks coming up and > lots of > > people were just rushing into and out of these AJAX things, I > replied > > saying you should spend some time on Java2Script first, for the > reason > > that we don't want to accept those rushing developers which may harm > > development in long term. > > > > And considering you are still interested in Java2Script after > days, we > > think your joining will help Java2Script development a lot. So we > > welcome your joining! > > > > Hi, Sal Ferro! Welcome to Java2Script developer team! > > > > > > Regards, > > Java2Script Team - Soheil Hassas Yeganeh & Zhou Renjian > > > > Sal Ferro wrote: > > > Hi, > > > > > > I'm new to the list. By the way - j2s is really cool, hands > down the > > > best Javascript/RIA framework in existence currently, in my > opinion. > > > I just hope sourceforge is ready for the traffic, when word > spreads > > > and people come flocking to use this great new technology!! I > don't > > > understand the people comparing it to GWT. Very different > products, > > > GWT's scope and functionality kindof pales in my comparison > (and no > > > eclipse integration! yuck!). > > > > > > My question: I noticed nested Shells are not supported yet. Am I > > > missing anything, or is it just not yet implemented? If not > are there > > > any plan for implementing the feature yet? I am willing to > > > help implement it. > > > > > > I've become somewhat familiar with j2s sources, using it for > several > > > weeks now, but a pointer or two on the 'suggested' approach to > > > implement it would help a little to be sure I don't go off > into the weeds. > > > > > > Thanks to the devs that make this library possible - I hope I > can help > > > soon. > > > > > > Thanks, > > > > > > - Sal > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > ------------------------------------------------------------------------- > > > > Using Tomcat but need to do more? Need to support web > services, security? > > > Get stuff done quickly with pre-integrated technology to make > your job easier > > > Download IBM WebSphere Application Server v.1.0.1 based on > Apache Geronimo > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642> > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > j2s-development mailing list > > > j2s...@li... > <mailto:j2s...@li...> > > > https://lists.sourceforge.net/lists/listinfo/j2s-development > > > > > > > > > -- Regards, Zhou Renjian http://j2s.sourceforge.net/ Java2Script: Bridge of RCP to RIA Reusing Java codes and tools into JavaScript |