Skip to content

Commit 6c3ea07

Browse files
author
sebastigurin
committed
1 parent 822aef5 commit 6c3ea07

File tree

5 files changed

+69
-31
lines changed

5 files changed

+69
-31
lines changed

incubator/net.sf.j2s.doc.user-guide/j2s-user-guide/build.xml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@author: sgurin
55
-->
66

7-
<project default="create-eclipse-help" basedir="..">
7+
<project name="j2s-ser-guide" default="create-eclipse-help" basedir="..">
88

99
<property name="current-loc" location="." />
1010
<property name="workspace" location=".." />
@@ -27,10 +27,18 @@
2727
<!-- XSLT Chunking Properties -->
2828
<property name="base.dir" value="${htmldir}"/>
2929

30-
<target name="clean" depends="clean-temporary-artifacts" description="Cleans up generated files.">
30+
31+
<target name="clean-generated-formats" description="Cleans up generated files in renderizaton to html and pdf with db2* docbook tools.">
32+
<delete dir="${docbooksource}/dist" />
33+
<delete file="${docbooksource}/j2s-user-guide.pdf" />
34+
</target>
35+
36+
37+
<target name="clean-eclipse-help" depends="clean-temporary-artifacts" description="Cleans up generated files.">
3138
<delete dir="${htmldir}" />
3239
<delete file="${current-loc}/toc.xml" />
3340
<delete file="${current-loc}/plugin.xml" />
41+
3442
</target>
3543

3644
<target name="clean-temporary-artifacts" description="Cleans up generated files.">
@@ -48,7 +56,7 @@
4856
<xinclude in="${docbooksource}/j2s-user-guide.xml" out="${docbooksource-tmp}/j2s-user-guide-combined.xml" />
4957
</target>
5058

51-
<target name="create-eclipse-help" depends="clean, depends, merge">
59+
<target name="create-eclipse-help" depends="clean-eclipse-help, depends, merge">
5260

5361
<xslt force="true" style="${docbookdir}" in="${docbooksource-tmp}/j2s-user-guide-combined.xml" out="xslt-output.xml">
5462
<factory name="${xalan}" />

incubator/net.sf.j2s.doc.user-guide/j2s-user-guide/chap-j2s-plugin.xml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
1-
21
<!--
3-
42
Copyright (C) 2010 Sebastián Gurin. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free
53
Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover
64
Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". @author: sgurin
75
-->
86

97
<chapter id="chap-j2s-plugin">
108

11-
12-
<!-- <chapterinfo>-->
13-
<!-- <edition>The J2S plugin</edition>-->
14-
<!-- <keywordset>-->
15-
<!-- <keyword>plugin</keyword>-->
16-
<!-- <keyword>plugin usage</keyword>-->
17-
<!-- </keywordset>-->
18-
<!-- </chapterinfo>-->
19-
20-
219
<title>The J2S plugin</title>
2210

2311
<epigraph>
@@ -264,6 +252,26 @@ By using Hotspot, I think it is much more convenient for me to develop JavaScrip
264252

265253

266254

255+
<section><title>Libraries in Java2Script</title>
256+
<para>
257+
In this section we will detail mechanisms provided by Java2Script plugin for using and distributing java software.
258+
How java software components can be distributed so other Java2Script users can use them in their J2S porojects.
259+
</para>
260+
261+
<para>Suppose you develop a very useful software component in Java2Script and now you want to distribute so other can use it in their own java2script projects.
262+
In normal java project we normally put our .class files inside a .jar (Java ARchive) file, and distribute the .jar. That is enought, but not in a
263+
java2script project where, besides .class files you must also can distribute generated javascript files.</para>
264+
265+
<para>Of course you can always distribute your library sources, and let the users import the osources into their own projects, perhaps in differents sourcefolders,
266+
but that is generally a good idea when you want to encapsulate your library api and implementation.</para>
267+
268+
<para>Fortunately, Java2Script provide with flexible mechanism of library definition. Also as we will see, Java2Script support for defining
269+
how the library must loaded</para>
270+
<para>TODO: talk about j2slib and how swt, junit etc are inside. TODO: talk about .package file and how a lib can be loaded.</para>
271+
272+
</section>
273+
274+
267275

268276
<section><title>Command line API</title><para>TODO: document here the expiremental support for j2s console api. ?</para></section>
269277

incubator/net.sf.j2s.doc.user-guide/j2s-user-guide/chap-j2s-sources.xml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,13 +297,30 @@
297297

298298

299299
</section>
300-
301-
302-
<section><title>Exporting the plugin</title><para>
303-
So you make your changes and now you want to redistribute the plugin. As with any other
300+
301+
302+
303+
304+
<section>
305+
<title>Exporting the plugin</title>
306+
<para>
307+
So you make your changes and now you want to redistribute the plugin. As with any other
304308
Eclipse plugin, you have to export it as an eclipse plugin. It is very easy, </para>
305-
309+
<para>TODO</para>
306310
</section>
307-
308311

312+
313+
314+
<section>
315+
<title>How to Extend the Java2Script compiler</title>
316+
<para>Now that you know how to install and run Java2Script from the sources, and know how to export your own version of Java2Script,
317+
we will describe a mechanism supported by Java2Script eclipse plugin that will let us extend the compiler easily, without modifying
318+
the compiler sources and without having to learn all compiler related classes internals for doing it. </para>
319+
320+
<para>http://j2s.sourceforge.net/articles/tutorial-extended-compiler.html </para>
321+
<para>http://blog.java2script.org/2006/10/31/extending-java2script-compiler/</para>
322+
<para>TODO</para>
323+
</section>
324+
325+
309326
</chapter>

incubator/net.sf.j2s.doc.user-guide/j2s-user-guide/chap-java-to-js-translation.xml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
<para>Now that the user knows the basics of using the Java2Script plugin, int this chapter we will examine
4848
the generated code and how Java2Script translate java sources to javascript and how we can use
49-
this code in our html documents</para>
49+
this code in our html documents for lowding our translated java applications.</para>
5050

5151

5252

@@ -57,7 +57,7 @@
5757

5858
<para>A java to javascript code translator like J2S must translate each possible java statement
5959
to its javascript equivalent. There are some constructions that are very similar in both languages like,
60-
for, if, while, do, and other expressions. But there are java contructions like class, method, interface,
60+
<code>for, if, while, do</code>, and other expressions. But there are Java language constructions like class, method, interface,
6161
that are not present in javascript. So the compiler has also to add artificial support for these. </para>
6262

6363
<figure>
@@ -74,12 +74,12 @@
7474

7575

7676

77-
<section id="examining-generated-js-files"><title>Examining generated javascript files</title>
77+
<section id="examining-generated-js-files"><title>Generated JavaScript files</title>
7878

79-
<para>In this section we will examine the generated javascript files and also the generated HTML
79+
<para>In this section we will examine the generated JavaScript files and also the generated HTML
8080
document for a basic understanding
81-
of how java code is translated to javascript and how that javascript can be loaded and executed
82-
from an html document. </para>
81+
of how java code is translated to JavaScript and how that JavaScript can be loaded and executed
82+
from an HTML document. </para>
8383

8484
<para>Consider the following simple java class that contains one static method and one
8585
instance method:</para>
@@ -405,9 +405,13 @@ classes and give as a context from where to call java classes</para>
405405

406406

407407
<section id="chap-java-to-js-translation-sec-types">
408-
<title>Types</title><para>Explain how j2s emulates java types.
408+
<title>Types</title>
409+
410+
<para>Explain how j2s emulates java types.
409411
ej: string and characters are all javascript strings,
410412
long, int short, double, float are all javascript numbers. arrays are javascript arrays</para>
413+
414+
<para>Java2Script also wrapps some exceptions that can occurr </para>
411415
</section>
412416

413417

@@ -417,8 +421,9 @@ classes and give as a context from where to call java classes</para>
417421

418422

419423
<section id="chap-java-to-js-translation-sec-exceptions">
420-
<title>Exceptions</title><para>Explain exceptions and how to separate native javascript
421-
exceptions from java exceptions</para>
424+
<title>Exceptions</title>
425+
426+
<para>Explain exceptions and how to separate native javascript exceptions from java exceptions</para>
422427
</section>
423428

424429

incubator/net.sf.j2s.doc.user-guide/j2s-user-guide/j2s-user-guide.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@
108108
&chapAboutThisDocument;
109109
&chapIntro;
110110
&chapGettingStarted;
111-
&chapJavaToJsTranslation;
112111
&chapj2sPlugin;
113112
&chapJavaSupport;
114113
&chapIntegratedLibs;
115114
&chapj2sCompilerDirectives;
115+
&chapJavaToJsTranslation;
116116
&chapWorkingWithNativeCode;
117117
&chapClientServerComunication;
118118

0 commit comments

Comments
 (0)