0.0.0 • Published 6 years ago

atlas-java v0.0.0

Weekly downloads
2
License
AGPL-3.0
Repository
github
Last release
6 years ago

Java version of the Atlas toolkit

For Java

Version 0.10.0

A fast and easy way to add a graphical user interface to your Java programs.

With the Atlas toolkit, you obtain hybrid programs. Like desktop applications, the same code can handle both front and back ends, and, like web applications, the programs will be reachable from all over the internet.

Hello, World!

Here's how a Hello, World! type program made with the Atlas toolkit looks like:

Little demonstration

  • git clone http://github.com/epeios-q37/atlas-java
  • cd atlas-java/Hello
  • Windows: java -cp .;../Atlas.jar Hello
  • other platforms: java -cp .:../Atlas.jar Hello

For a live demonstration: http://q37.info/runkit/Hello.

Source code:

import info.q37.atlas.*;

class Hello extends Atlas {
 private static String body =
  "<div style=\"display: table; margin: 50px auto auto auto;\">" +
  " <fieldset>" +
  "   <input id=\"input\" maxlength=\"20\" placeholder=\"Enter a name here\"'" +
  "          type=\"text\" data-xdh-onevent=\"Submit\"/>" +
  "   <div style=\"display: flex; justify-content: space-around; margin: 5px auto auto auto;\">" +
  "    <button data-xdh-onevent=\"Submit\">Submit</button>" +
  "    <button data-xdh-onevent=\"Clear\">Clear</button>" +
  "  </div>" +
  " </fieldset>" +
  "</div>";

 @Override
 public void handle(String action, String id)
 {
  switch( action) {
  case "": // Action label corresponding to a new session.
   dom.setLayout("", body);
   break;
  case "Submit":
   dom.alert("Hello, " + dom.getContent("input") + "!" );
   break;
  case "Clear":
   if ( dom.confirm("Are you sure ?") )
    dom.setContent("input", "");
   break;
  }

  dom.focus("input");
 }

 public static void main(String[] args) throws Exception {
  launch(() -> new Hello());
 }
}

TodoMVC

And here's how the Atlas toolkit version of the TodoMVC application looks like:

TodoMVC

For a live demonstration: http://q37.info/runkit/TodoMVC.

Content of the repository

The Atlas directory contains the Java source code of the Atlas toolkit, which is not needed to run the examples.

Atlas.jar is the file you have to reference in the classpath in order to use the Atlas toolkit in your own program.

All other directories are examples.

To run an example, go inside its directory (Blank, Chatroom…) and launch:

  • under Windows : java -cp .;../Atlas.jar <Name> (with semi-colon as classpath separator),
  • under other platforms : java -cp .:../Atlas.jar <Name> (with colon as classpath separator).

where <Name> is the name of the example (Blank, Chatroom…).

The Atlas toolkit is also available for:

For more information about the Atlas toolkit: http://atlastk.org/.