in

WebFX – Java to JavaScript

[ad_1]

WebFX offers a new way to develop modern web-based Java applications with rich desktop-like GUIs. Is there such a thing?


This is because WebFX is a JavaFX application transpiler powered by GWT that allows transpiling JavaFX applications into traditional self-contained pure JavaScript web apps without requiring plugins or servers to run in the browser. Is possible.

This means that if you’re working with legacy JavaFX applications, or developing with JavaFX improved as Openjfx, you can now port your applications to the web without rewriting them.

Of course, that’s due to the magic of the transpiler. I covered that concept in “A Compiler Writing Playground”.

Another example is with Typescript adding optional typing to Javascript (see also Sorbet – Making Ruby Statically Typed for that). It is statically typed and serves as a better superset. The TypeScript compiler analyzes and compiles TypeScript code into JavaScript so that it can be run in any browser.

Fable is another X-to-Javascript transpiler. Fable transpiles F# to ES2015 JavaScript, so code written in F# can run wherever JavaScript runs (browser, Node.js). js, Electron, React Native, or in general V8.

So you can convert between seemingly incompatible applications and languages.

At the core of WebFX is the WebFX Kit, a modified version of OpenJFX that can be transpiled. It patches the upper layers of OpenJFX (which contains the main JavaFX features and APIs) to be compatible with GWT, and the lower layers (the graphics rendering pipeline) to the scene graph DOM mapper (which is ultimately rendered). DOM). by the browser).

Of course, removing the Javascript barrier allows you to focus on writing applications in pure Java. What does this remind you of? Oh, yes. . Verdin.

Vaadin originally used GWT internally to compile Java code to JavaScript. not anymore. Starting with version 10, compiled into web components, through the client-side JavaScript engine, events fired on the browser side are propagated to the server side, which decides how to handle them. The sideline goes by the name of Vaadin Flow. Put that thought on hold for a moment, because there’s a reason to mention it.

However, WebFX does not require the presence of a server, which is one of its greatest advantages. A standard self-contained JS package is a much simpler, more scalable, and more reliable execution model.

Another advantage is that it is multi-platform. In addition to the web platform, WebFX applications can also run on desktop and mobile using the Gluon toolchain and generate native executables.

This ability to create applications for different platforms clearly reminded me of Jetpack Compose Multiplatform, an extension of JetBrains’ Jetpack Compose UI framework. This allows you to build Android, Desktop, and Web UI using the same artifacts from a single codebase. It runs on top of Kotlin Multiplatform, an SDK for cross-platform development from JetBrains, a technology that supports code sharing.

However, to generate native executables in WebFx you also need Gluon and the extension GraalVM. When using the GluonFX plugin (for Maven and Gradle) in JavaFX applications, developers provide a way to create native images for Java and JavaFX projects targeting all platforms (desktop, mobile, embedded) Utilizes Gluon Substrate. Under the hood, Gluon Substrate leverages the GraalVM project.

Since the project is still in the incubation stage, there are some limitations such as limited JavaFX coverage, WebFX bugs, GWT compilation errors, etc. However, despite the limitations, real applications can already be developed. For example, the website for this project was developed using his WebFX and showcases the technology through a series of animated cards.

Third-party apps are also quietly appearing. For example, ‘Modality’ is a free and open source hospitality oriented booking system that uses WebFX but has a server backend Vert. x provides an interface between the client app and the backend service, providing a SPA.

Of course, WebFX is open source. So in our Github repository you can find all the relevant code and demo code to get a head start.

webfx logo

For more information

WebFX

Github for WebFx

modality

Related article

Vaadin reaches version 21

Compiler-created playground

To be notified of new articles in I Programmer, sign up for our weekly newsletter, subscribe to our RSS feed, and follow us. twitter, Facebook or Linkedin.

banner


pico book



comment

Or email your comments to: comments@i-programmer.info



[ad_2]

Source link

What do you think?

Leave a Reply

GIPHY App Key not set. Please check settings

    article

    Goodtal Updates List of Top Web Development Companies

    fishing boat fb

    Stanfield Bill Boosts Advances in Outdoor Recreation