Java library for prototyping web applications
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Atlas.java
Atlas.js
CHANGELOG.md
DOM.java
GUI.java
LICENSE
README.md
package.json

README.md

Java binding of the Atlas toolkit

Java logo

The Atlas toolkit is a library which facilitates the prototyping of web applications.

Hello World!

Little demonstration

import info.q37.atlas.*;
import java.util.HashMap;

class Hello extends Atlas {
	public void handle( DOM dom, String action, String id )
	{
		String html = 
		"<div class=\"vcenter-out\">" +
		" <div class=\"vcenter-in\">" +
		"  <fieldset>" +
		"   <label>Name:</label>" +
		"   <input id=\"input\" maxlength=\"20\" placeholder=\"Enter a name here\"'" +
		"	 type=\"text\" data-xdh-onevent=\"input|Typing\"/>" +
		"   <button data-xdh-onevent=\"Clear\">Clear</button>" +
		"   <hr/>" +
		"   <h1>" +
		"    <span>Hello </span>" +
		"    <span style=\"font-style: italic;\" id=\"name\"></span>" +
		"    <span>!</span>" +
		"   </h1>" +
		"  </fieldset>" +
		" </div>" +
		"</div>";

		if ( "Connect".equals( action ) ) {
			dom.setLayout("", html);
		} else if ("Typing".equals( action ) ) {
			dom.setContent("name", dom.getContent(id));
		} else if ( "Clear".equals( action ) ) {
			if ( dom.confirm( "Are you sure ?" ) )
				dom.setContents( new HashMap<String,String> ()
					{{ put( "input", ""); put( "name", ""); }} );
		} else {
			throw new RuntimeException( "Unknown action '" + action + "' !!!");
		}
	}
	public static void main(String[] args) throws Exception {
		String head = 
			"<title>\"Hello, World !\" example</title>" +
			"<style type=\"text/css\">" +
			" html, body { height: 100%; padding: 0; margin: 0; }" +
			" .vcenter-out, .hcenter { display: table; height: 100%; margin: auto; }" +
			" .vcenter-in { display: table-cell; vertical-align: middle; }" +
			"</style>";

		launch("Connect", head, "Hello", GUI.DEFAULT, args );

		for (;;)
			new Hello();
	}
}
  • Get the Atlas.jar file (https://q37.info/download/assets/Atlas.jar),
  • in the same directory, create a Hello.java file with above source code, or get it directly here : https://q37.info/download/assets/Hello.java,
  • compile this file : javac -cp Atlas.jar Hello.java,
  • launch :
    • under Windows : java -cp .;Atlas.jar Hello (with semi-colon as classpath separator),
    • under other platforms : java -cp .:Atlas.jar Hello (with colon as classpath separator).

What's next ?

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

TodoMVC

See https://github.com/epeios-q37/todomvc-java.