Skip to content
DukeScript presenters for desktop and mobile platforms
Java HTML Other
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
android
browser
fakeandroidemul
fakeiosemul
generic
iosgeneric
moe
renderer
robovm
src/license
strings
testing
webkit
.dukescript
.gitignore
.travis.yml
README.md
pom.xml

README.md

Presenters

Build Status

The Glue Between Java and JavaScript!

The presenters are the glue between your Java and JavaScript code in your DukeScript application. They make sure that your Java methods with JavaScriptBody annotation can properly pass their parameters to the JavaScript engine and receive results back.

The presenters make your application extremelly portable. By selecting the right presenter when packaging your application you make sure it can run everywhere - on the desktop, on iOS, on Android, in a plugin-less browser, on your Raspberry PI, via JDK's Nashorn script engine & co. Everywhere.

The Default Presenters

The HTML/Java project offers two presenters. One that uses JavaFX WebView and is suitable for running your applications on any desktop that supports Java. Another that uses Nashorn script engine, suitable for testing or execution of headless applications. These two presenters are excellent for normal use and you can stick with them, however we believe those presenters can be made even better.

The aim of the DukeScript Presenters project is to expand the deployment options and sharpen the excellence of presentation by creating additional presenters.

The Mobile Presenters

Any modern application written these days has to consider iOS and Android devices as deployment targets. This is addressed by two presenters developer as part of this project:

The simplest way to use these presenters is to follow the getting started tutorial. The client-ios and client-android subprojects with properly configured presenters will be created for you.

The WebKit Presenter

There is an alternative presenter for your Mac OS X and Linux desktop applications - it avoids overhead of JavaFX and directly talks to native WebKit libraries giving you access to the most recent version of WebKit features and close integration with the underlaying operating system - including native looking fonts and gestures. To use this presenter replace the existing presenter (probably net.java.html.boot.fx) by:

<dependency>
  <groupId>com.dukescript.presenters</groupId>
  <artifactId>webkit</artifactId>
  <version>1.0</version>
</dependency>

Any Browser Presenter

For situations where the native WebKit libraries aren't present, we offer an alternative: launch any browser yourself and let us connect your Java code with it! This is the task for the browser presenter. It starts local server and launches specified browser that connects to the server. To use it specify following in your pom.xml file:

<dependency>
  <groupId>com.dukescript.presenters</groupId>
  <artifactId>browser</artifactId>
  <version>1.0</version>
</dependency>

The actual browser to be launched can be influenced by value of com.dukescript.presenters.browser property. It can have following values:

  • GTK - use Gtk WebKit implementation. Requires presence of appropriate native libraries
  • AWT - use Desktop.browse(java.net.URI) to launch a browser
  • NONE - just launches the server, useful together with com.dukescript.presenters.browserPort property that can specify a fixed port to open the server at
  • any other value is interpreted as a command which is then launched on a command line with one parameter - the URL to connect to

If the property is not specified the system tries GTK mode first, followed by AWT and then tries to execute xdg-open (default LINUX command to launch a browser from a shell script).

The browser presenter has been successfully used to deploy DukeScript application on Raspberry PI.

License

The DukeScript Presenters are licensed under the GPLv3 license with following Classpath exception:

Certain source files distributed by Dukehoff GmbH are subject to the following clarification and special exception to the GPL, but only where Dukehoff GmbH has expressly included in the particular source file's header the words: Dukehoff GmbH designates this particular file as subject to the "Classpath" exception as provided in the README.md file that accompanies this code.

Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination.

As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.

You can’t perform that action at this time.