dragome / dragome-sdk

Dragome is a tool for creating client side web applications in pure Java (JVM) language.
http://www.dragome.com
Other
80 stars 20 forks source link
binding bytecode compiler dynamic-proxies gui java jvm reflection

Join the chat at https://gitter.im/dragome-sdk/

What is Dragome?

Dragome is an open source tool for creating client side web applications in pure Java (JVM) language.
Based on bytecode to javascript compilation, you can execute applications written in Java directly on browsers.
You may use your favorite IDE, your favorite Java frameworks and tools because Dragome is totally transparent.


See it in action: how Eclipse and Chrome interact on debug mode and production mode.

ScreenShot

Also take a look at these example applications


Why Dragome

Also see Dragome Todos for more info about the future


Dragome SDK modules

Dragome SDK can be divided into following six major parts:

Execution modes

Dragome provides two execution modes, production mode for executing everything in client side, and debug mode that executes all in Java Virtual Machine without compiling to javascript and make remotes updates to browser DOM.


SDKs comparison

Features Dragome GWT
Generates js from bytecode (produced by several JVM languages) java source code
Requirements for debug Any modern browser, no plugin required for IDE or browser IDE plugin and Browser plugin, not available for all browsers
JDK changes impact Almost no impact because bytecode rarely changes Big impact in every new JDK version because java syntax changes frequently
Incremental compiler yes -
Java 8 Lambda expressions, Stream API, default methods, and static interface methods available not supported
Continuation yes (through javaflow) -
Reflection yes -
Dynamic Proxies yes -
Bytecode instrumentation yes -
DOM level debug yes -
Code permutations - yes
Split compiling - yes
Template Engine yes -
Two-way databinding for UI yes -
Make async calls with no callbacks yes -
Decouple from HTML/CSS using abstractions yes -

Learn how to bind components in Dragome in 5'


Start working with Dragome

Using maven archetype

mvn archetype:generate -DarchetypeGroupId=com.dragome -DarchetypeArtifactId=simple-webapp-archetype -DarchetypeVersion=1.0 -DgroupId={your-package-name} -DartifactId={your-app-name}

Using maven dependency in your project

<dependency>
  <groupId>com.dragome</groupId>
  <artifactId>dragome-sdk</artifactId>
  <version>0.95.1-beta1</version>
  <type>pom</type>
</dependency>

Clone and build

How to build the SDK


Setup example application

Setup your application


How is programming web apps with Dragome?

pure Java, pure HTML, runs as js inside browser!

Debug your application in Java with your favorite IDE

ScreenShot


Want to contribute?


Take a look at the following source code:

This is the complete source code for a simple hello world application using a service.

For more details see Hello World Application

Service definition

public interface HelloWorldService
{
    public abstract String getGreetingsFor(String name);
}

Service implementation

public class HelloWolrdServiceImpl implements HelloWorldService
{
    public String getGreetingsFor(String name)
    {
        return "Hello " + name + "! (" + new Date() + ")";
    }
}

Service consumer - GUI

public class HelloWorldPage extends DragomeVisualActivity
{
    HelloWorldService helloWorldService= serviceFactory.createSyncService(HelloWorldService.class);

    public void build()
    {
        final VisualLabel<String> label= new VisualLabelImpl<String>("message");
        final VisualButton button= new VisualButtonImpl("button", v -> label.setValue(helloWorldService.getGreetingsFor("World")));
        mainPanel.addChild(label);
        mainPanel.addChild(button);
    }
}

HTML

<html>
<head>
<script type="text/javascript" src="https://github.com/dragome/dragome-sdk/raw/master/dragome/dragome.js"></script>
</head>

<body>
    Message: <b data-template="message">text</b> <br>
    <button data-template="button">Say hello!</button>
</body>

</html>