Hello,
-- well, in my opinion "porting large existing java libraries" is one of the strengths of GWT and in my experience it works really well in this.
Were to find informations.
Well, JSInterop is the way for the part "use the exposed, public classes from Javascript."
and the talk of Julien Dramaix at GWTcon https://drive.google.com/file/d/0BwVGJUurq6uVR1Y5anV5TC1SQkk/edit
For the part of transpiling the library you need more or less to transform the library in a GWT module, i think you need
to follow
http://www.gwtproject.org/doc/latest/DevGuideOrganizingProjects.html , where you will find essentially what a module is and what <super-source> is intended to (in case you need) and http://www.gwtproject.org/doc/latest/RefJreEmulation.html that covers the emulated jre.
I'm biased about that but a few years ago we wrote a post on this subject
old but still not completely useless.
Cheers,
Alberto.
On Fri, Dec 18, 2015 at 3:48 PM Andreas Plesch <andreasplesch@gmail.com> wrote:
Hello,--
I came across GWT when I was looking for a way to use a large java math library on the client with javascript. GWT may be targeted as building web apps from the ground up using java rather than porting large existing java libraries but from what I see there have been such ports nonetheless.
The library is called SRM and makes a lot of classes and methods available which can be used to compute sophisticated and well defined 3d coordinate transformations.
Here is a typical example of how it would be used in a small application.
import SRM.*;
public class CdToCcConv
{
public static void main (String args[])
{
System.out.println("*** Sample program using SRM Java API to convert a 3D coordinate");
System.out.println("*** from a Celestiodetic SRF to a Celestiocentric SRF.");
// Declare reference variables for the CD_3D and CC_3D SRFs
SRF_Celestiodetic CdSrf = null;
SRF_Celestiocentric CcSrf = null;
try
{
// Create a Celestiodetic SRF with WGS 1984 and Identity transformation
CdSrf = new SRF_Celestiodetic(SRM_ORM_Code.ORMCOD_WGS_1984,
SRM_RT_Code.RTCOD_WGS_1984_IDENTITY);
// Create a Celestiocentric SRF with WGS 1984 and Identity transformation
CcSrf = new SRF_Celestiocentric(SRM_ORM_Code.ORMCOD_WGS_1984,
SRM_RT_Code.RTCOD_WGS_1984_IDENTITY);
// Create a 3D Celestiodetic coordinate with
// longitude => 10.0 degrees (note: this input parameter is converted to radians)
// latitude => 20.0 degrees (note: this input parameter is converted to radians)
// ellipsoidal height => 100.0 meters
Coord3D_Celestiodetic CdCoord =
(Coord3D_Celestiodetic)CdSrf.createCoordinate3D(Math.toRadians(10.0),
Math.toRadians(20.0),
100.0);
// Instantiate a 3D Celestiocentric coordinate
// This is an alternative method for instantiate a 3D coordinate
Coord3D_Celestiocentric CcCoord = new Coord3D_Celestiocentric(CcSrf);
// print out the SRF parameter values and the coordinate component values
System.out.println("CdSrf parameter => \n" + CdSrf);
System.out.println("CcSrf parameter => \n" + CcSrf);
System.out.println("CdCoord components (source) => \n" + CdCoord);
// convert the 3D Celestiodetic coordinate to 3D Celestiocentric coordinate
SRM_Coordinate_Valid_Region_Code valRegion =
CcSrf.changeCoordinateSRF(CdCoord, CcCoord);
// print out the values of the resulting 3D Celestiocentric coordinate
System.out.println("CcCoord components (destination) => \n" + CcCoord + " is " + valRegion);
}
catch (SrmException ex)
{
// catch SrmException and print out the error code and text.
System.out.println("Exception caught=> " + ex.what() + ", " + ex);
}
}
}
What I would like is use the exposed, public classes from Javascript. I would envision javascript objects (classes) with the same name and methods as in java.
I have a compiled .jar archive and also the source code. It has about 60k lines of code. It only imports java.util.* . There is no UI, just a well defined API.
Would it be feasible to use GWT to transpile to javascript ? If yes, how would I go about it ? I do not want to develop a new web app but use the library in an existing code base. I could not really find a similar example but perhaps there is one ?
I can provide more background if directed to what I should look for. Any tip welcome,
Andreas
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment