Keeping old name for static demo-calculator, as its build products are referenced by Hudson jobs
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 24 Dec 2012 08:04:45 +0100
changeset 3755751fe604e6b
parent 374 e5b4bd29f268
child 376 059cb07ac9b3
child 379 441a8274083d
Keeping old name for static demo-calculator, as its build products are referenced by Hudson jobs
javaquery/demo-calculator-dynamic/nbactions.xml
javaquery/demo-calculator-dynamic/pom.xml
javaquery/demo-calculator-dynamic/src/main/java/org/apidesign/bck2brwsr/mavenhtml/App.java
javaquery/demo-calculator-dynamic/src/main/resources/org/apidesign/bck2brwsr/mavenhtml/Calculator.xhtml
javaquery/demo-calculator/nbactions.xml
javaquery/demo-calculator/pom.xml
javaquery/demo-calculator/src/main/java/org/apidesign/bck2brwsr/mavenhtml/App.java
javaquery/demo-calculator/src/main/resources/org/apidesign/bck2brwsr/mavenhtml/Calculator.xhtml
javaquery/demo-static-calculator/nbactions.xml
javaquery/demo-static-calculator/pom.xml
javaquery/demo-static-calculator/src/main/java/org/apidesign/bck2brwsr/mavenhtml/App.java
javaquery/demo-static-calculator/src/main/resources/org/apidesign/bck2brwsr/mavenhtml/Calculator.xhtml
javaquery/pom.xml
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/javaquery/demo-calculator-dynamic/nbactions.xml	Mon Dec 24 08:04:45 2012 +0100
     1.3 @@ -0,0 +1,29 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<!--
     1.6 +
     1.7 +    Back 2 Browser Bytecode Translator
     1.8 +    Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     1.9 +
    1.10 +    This program is free software: you can redistribute it and/or modify
    1.11 +    it under the terms of the GNU General Public License as published by
    1.12 +    the Free Software Foundation, version 2 of the License.
    1.13 +
    1.14 +    This program is distributed in the hope that it will be useful,
    1.15 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.17 +    GNU General Public License for more details.
    1.18 +
    1.19 +    You should have received a copy of the GNU General Public License
    1.20 +    along with this program. Look for COPYING file in the top folder.
    1.21 +    If not, see http://opensource.org/licenses/GPL-2.0.
    1.22 +
    1.23 +-->
    1.24 +<actions>
    1.25 +        <action>
    1.26 +            <actionName>run</actionName>
    1.27 +            <goals>
    1.28 +                <goal>process-classes</goal>
    1.29 +                <goal>org.apidesign.bck2brwsr:mojo:0.3-SNAPSHOT:brwsr</goal>
    1.30 +            </goals>
    1.31 +        </action>
    1.32 +    </actions>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/javaquery/demo-calculator-dynamic/pom.xml	Mon Dec 24 08:04:45 2012 +0100
     2.3 @@ -0,0 +1,58 @@
     2.4 +<?xml version="1.0"?>
     2.5 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     2.6 +  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     2.7 +  <modelVersion>4.0.0</modelVersion>
     2.8 +
     2.9 +  <groupId>org.apidesign.bck2brwsr</groupId>
    2.10 +  <artifactId>demo.calculator</artifactId>
    2.11 +  <version>0.3-SNAPSHOT</version>
    2.12 +  <packaging>jar</packaging>
    2.13 +
    2.14 +  <name>JavaQuery Demo - Calculator</name>
    2.15 +  <url>http://maven.apache.org</url>
    2.16 +
    2.17 +  <properties>
    2.18 +    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    2.19 +  </properties>
    2.20 +  <build>
    2.21 +      <plugins>
    2.22 +            <plugin>
    2.23 +                <groupId>org.apidesign.bck2brwsr</groupId>
    2.24 +                <artifactId>mojo</artifactId>
    2.25 +                <version>0.3-SNAPSHOT</version>
    2.26 +                <executions>
    2.27 +                    <execution>
    2.28 +                        <goals>
    2.29 +                            <goal>brwsr</goal>
    2.30 +                        </goals>
    2.31 +                    </execution>
    2.32 +                </executions>
    2.33 +                <configuration>
    2.34 +                    <startpage>org/apidesign/bck2brwsr/mavenhtml/Calculator.xhtml</startpage>
    2.35 +                </configuration>
    2.36 +            </plugin>
    2.37 +         <plugin>
    2.38 +            <groupId>org.apache.maven.plugins</groupId>
    2.39 +            <artifactId>maven-compiler-plugin</artifactId>
    2.40 +            <version>2.3.2</version>
    2.41 +            <configuration>
    2.42 +               <source>1.7</source>
    2.43 +               <target>1.7</target>
    2.44 +            </configuration>
    2.45 +         </plugin>
    2.46 +      </plugins>
    2.47 +  </build>
    2.48 +
    2.49 +  <dependencies>
    2.50 +    <dependency>
    2.51 +      <groupId>org.apidesign.bck2brwsr</groupId>
    2.52 +      <artifactId>emul</artifactId>
    2.53 +      <version>0.3-SNAPSHOT</version>
    2.54 +    </dependency>
    2.55 +    <dependency>
    2.56 +      <groupId>org.apidesign.bck2brwsr</groupId>
    2.57 +      <artifactId>javaquery.api</artifactId>
    2.58 +      <version>0.3-SNAPSHOT</version>
    2.59 +    </dependency>
    2.60 +  </dependencies>
    2.61 +</project>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/javaquery/demo-calculator-dynamic/src/main/java/org/apidesign/bck2brwsr/mavenhtml/App.java	Mon Dec 24 08:04:45 2012 +0100
     3.3 @@ -0,0 +1,88 @@
     3.4 +/**
     3.5 + * Back 2 Browser Bytecode Translator
     3.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     3.7 + *
     3.8 + * This program is free software: you can redistribute it and/or modify
     3.9 + * it under the terms of the GNU General Public License as published by
    3.10 + * the Free Software Foundation, version 2 of the License.
    3.11 + *
    3.12 + * This program is distributed in the hope that it will be useful,
    3.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.15 + * GNU General Public License for more details.
    3.16 + *
    3.17 + * You should have received a copy of the GNU General Public License
    3.18 + * along with this program. Look for COPYING file in the top folder.
    3.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
    3.20 + */
    3.21 +package org.apidesign.bck2brwsr.mavenhtml;
    3.22 +
    3.23 +import org.apidesign.bck2brwsr.htmlpage.api.OnClick;
    3.24 +import org.apidesign.bck2brwsr.htmlpage.api.Page;
    3.25 +
    3.26 +/** HTML5 & Java demo showing the power of 
    3.27 + * <a href="http://wiki.apidesign.org/wiki/AnnotationProcessor">annotation processors</a>
    3.28 + * as well as other goodies.
    3.29 + * 
    3.30 + * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    3.31 + */
    3.32 +@Page(xhtml="Calculator.xhtml")
    3.33 +public class App {
    3.34 +    private static double memory;
    3.35 +    private static String operation;
    3.36 +    
    3.37 +    @OnClick(id="clear")
    3.38 +    static void clear() {
    3.39 +        memory = 0;
    3.40 +        operation = null;
    3.41 +        Calculator.DISPLAY.setValue("0");
    3.42 +    }
    3.43 +    
    3.44 +    @OnClick(id= { "plus", "minus", "mul", "div" })
    3.45 +    static void applyOp(String op) {
    3.46 +        memory = getValue();
    3.47 +        operation = op;
    3.48 +        Calculator.DISPLAY.setValue("0");
    3.49 +    }
    3.50 +    
    3.51 +    @OnClick(id="result")
    3.52 +    static void computeTheValue() {
    3.53 +        switch (operation) {
    3.54 +            case "plus": setValue(memory + getValue()); break;
    3.55 +            case "minus": setValue(memory - getValue()); break;
    3.56 +            case "mul": setValue(memory * getValue()); break;
    3.57 +            case "div": setValue(memory / getValue()); break;
    3.58 +            default: throw new IllegalStateException(operation);
    3.59 +        }
    3.60 +    }
    3.61 +    
    3.62 +    @OnClick(id={"n0", "n1", "n2", "n3", "n4", "n5", "n6", "n7", "n8", "n9"}) 
    3.63 +    static void addDigit(String digit) {
    3.64 +        digit = digit.substring(1);
    3.65 +        String v = Calculator.DISPLAY.getValue();
    3.66 +        if (getValue() == 0.0) {
    3.67 +            Calculator.DISPLAY.setValue(digit);
    3.68 +        } else {
    3.69 +            Calculator.DISPLAY.setValue(v + digit);
    3.70 +        }
    3.71 +    }
    3.72 +    
    3.73 +    private static void setValue(double v) {
    3.74 +        StringBuilder sb = new StringBuilder();
    3.75 +        sb.append(v);
    3.76 +        if (sb.toString().endsWith(".0")) {
    3.77 +            final int l = sb.length();
    3.78 +            sb.delete(l - 2, l);
    3.79 +        }
    3.80 +        Calculator.DISPLAY.setValue(sb.toString());
    3.81 +    }
    3.82 +
    3.83 +    private static double getValue() {
    3.84 +        try {
    3.85 +            return Double.parseDouble(Calculator.DISPLAY.getValue());
    3.86 +        } catch (NumberFormatException ex) {
    3.87 +            Calculator.DISPLAY.setValue("err");
    3.88 +            return 0.0;
    3.89 +        }
    3.90 +    }
    3.91 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/javaquery/demo-calculator-dynamic/src/main/resources/org/apidesign/bck2brwsr/mavenhtml/Calculator.xhtml	Mon Dec 24 08:04:45 2012 +0100
     4.3 @@ -0,0 +1,158 @@
     4.4 +<?xml version="1.0" encoding="UTF-8"?>
     4.5 +<!--
     4.6 +
     4.7 +    Back 2 Browser Bytecode Translator
     4.8 +    Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     4.9 +
    4.10 +    This program is free software: you can redistribute it and/or modify
    4.11 +    it under the terms of the GNU General Public License as published by
    4.12 +    the Free Software Foundation, version 2 of the License.
    4.13 +
    4.14 +    This program is distributed in the hope that it will be useful,
    4.15 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.16 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.17 +    GNU General Public License for more details.
    4.18 +
    4.19 +    You should have received a copy of the GNU General Public License
    4.20 +    along with this program. Look for COPYING file in the top folder.
    4.21 +    If not, see http://opensource.org/licenses/GPL-2.0.
    4.22 +
    4.23 +-->
    4.24 +<!DOCTYPE html>
    4.25 +<html xmlns="http://www.w3.org/1999/xhtml">
    4.26 +    <head>
    4.27 +        <title>Simple Calculator in HTML5 and Java</title>
    4.28 +
    4.29 +        <style type="text/css">
    4.30 +        body {color: #ffffff; background-color: #121e31; font-family: Monospaced}
    4.31 +        pre {color: #ffffff; background-color: #121e31; font-family: Monospaced}
    4.32 +        table {color: #ffffff; background-color: #121e31; font-family: Monospaced}
    4.33 +        .string {color: #e2ce00}
    4.34 +        a {color: #e2ce00}
    4.35 +        .ST1 {color: #0000cc; font-family: Monospaced; font-weight: bold}
    4.36 +        .ST0 {color: #0000ff}
    4.37 +        .comment {color: #428bdd}
    4.38 +        .keyword-directive {color: #f8bb00}
    4.39 +        .tag {color: #f8bb00}
    4.40 +        .ST0 {color: #628fb5; background-color: #1b3450}
    4.41 +        .sgml-comment {color: #808080}
    4.42 +        .value {color: #99006b}
    4.43 +        .argument {color: #007c00}
    4.44 +        .sgml-declaration {color: #bf9221}
    4.45 +        </style>    
    4.46 +        </head>
    4.47 +    <body>
    4.48 +        <h1>Java and HTML5 - Together at Last!</h1>
    4.49 +        <table border="0" cellspacing="2">
    4.50 +            <tbody>
    4.51 +                <tr>
    4.52 +                    <td colspan="4"><input id="display" value="0" 
    4.53 +                            style="text-align: right"/>
    4.54 +                </td>
    4.55 +                </tr>
    4.56 +                <tr>
    4.57 +                    <td><button id="n1">1</button></td>
    4.58 +                    <td><button id="n2">2</button></td>
    4.59 +                    <td><button id="n3">3</button></td>
    4.60 +                    <td><button id="plus">+</button></td>
    4.61 +                </tr>
    4.62 +                <tr>
    4.63 +                    <td><button id="n4">4</button></td>
    4.64 +                    <td><button id="n5">5</button></td>
    4.65 +                    <td><button id="n6">6</button></td>
    4.66 +                    <td><button id="minus">-</button></td>
    4.67 +                </tr>
    4.68 +                <tr>
    4.69 +                    <td><button id="n7">7</button></td>
    4.70 +                    <td><button id="n8">8</button></td>
    4.71 +                    <td><button id="n9">9</button></td>
    4.72 +                    <td><button id="mul">*</button></td>
    4.73 +                </tr>
    4.74 +                <tr>
    4.75 +                    <td><button id="clear">C</button></td>
    4.76 +                    <td><button id="n0">0</button></td>
    4.77 +                    <td><button id="result">=</button></td>
    4.78 +                    <td><button id="div">/</button></td>
    4.79 +                </tr>
    4.80 +            </tbody>
    4.81 +        </table>
    4.82 +
    4.83 +        <script src="/bck2brwsr.js"></script>
    4.84 +        <script src="/vm.js"></script>
    4.85 +        <script type="text/javascript">
    4.86 +            vm.loadClass('org.apidesign.bck2brwsr.mavenhtml.Calculator');
    4.87 +        </script>
    4.88 +        
    4.89 +        <hr/>
    4.90 +    <pre>
    4.91 +    <span class="keyword-directive">package</span> org.apidesign.bck2brwsr.mavenhtml;
    4.92 +
    4.93 +    <span class="keyword-directive">import</span> org.apidesign.bck2brwsr.htmlpage.api.OnClick;
    4.94 +    <span class="keyword-directive">import</span> org.apidesign.bck2brwsr.htmlpage.api.Page;
    4.95 +
    4.96 +    <span class="comment">/**</span> <span class="comment">HTML5</span><span class="comment"> &amp; </span><span class="comment">Java</span> <span class="comment">demo</span> <span class="comment">showing</span> <span class="comment">the</span> <span class="comment">power</span> <span class="comment">of</span> <a href="http://wiki.apidesign.org/wiki/AnnotationProcessor">annotation processors</a>
    4.97 +    <span class="comment"> * </span><span class="comment">as</span> <span class="comment">well</span> <span class="comment">as</span> <span class="comment">other</span> <span class="comment">goodies</span><span class="comment">, including type-safe association between</span>
    4.98 +    <span class="comment"> * </span><span class="comment">an XHTML page and Java.</span>
    4.99 +    <span class="comment"> * </span>
   4.100 +    <span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">Jaroslav</span> <span class="comment">Tulach</span> <span class="ST0">&lt;jaroslav.tulach@apidesign.org&gt;</span>
   4.101 +     <span class="comment">*/</span>
   4.102 +    @Page(xhtml=<span class="string">&quot;</span><span class="string">Calculator.xhtml</span><span class="string">&quot;</span>)
   4.103 +    <span class="keyword-directive">public</span> <span class="keyword-directive">class</span> App {
   4.104 +        <span class="keyword-directive">private</span> <span class="keyword-directive">static</span> <span class="keyword-directive">double</span> memory;
   4.105 +        <span class="keyword-directive">private</span> <span class="keyword-directive">static</span> String operation;
   4.106 +
   4.107 +        @OnClick(id=<span class="string">&quot;</span><span class="string">clear</span><span class="string">&quot;</span>)
   4.108 +        <span class="keyword-directive">static</span> <span class="keyword-directive">void</span> clear() {
   4.109 +            memory = <span class="number">0</span>;
   4.110 +            operation = <span class="keyword-directive">null</span>;
   4.111 +            Calculator.DISPLAY.setValue(<span class="string">&quot;</span><span class="string">0</span><span class="string">&quot;</span>);
   4.112 +        }
   4.113 +
   4.114 +        @OnClick(id= { <span class="string">&quot;</span><span class="string">plus</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">minus</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">mul</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">div</span><span class="string">&quot;</span> })
   4.115 +        <span class="keyword-directive">static</span> <span class="keyword-directive">void</span> applyOp(String op) {
   4.116 +            memory = getValue();
   4.117 +            operation = op;
   4.118 +            Calculator.DISPLAY.setValue(<span class="string">&quot;</span><span class="string">0</span><span class="string">&quot;</span>);
   4.119 +        }
   4.120 +
   4.121 +        @OnClick(id=<span class="string">&quot;</span><span class="string">result</span><span class="string">&quot;</span>)
   4.122 +        <span class="keyword-directive">static</span> <span class="keyword-directive">void</span> computeTheValue() {
   4.123 +            <span class="keyword-directive">switch</span> (operation) {
   4.124 +                <span class="keyword-directive">case</span> <span class="string">&quot;</span><span class="string">plus</span><span class="string">&quot;</span>: setValue(memory + getValue()); <span class="keyword-directive">break</span>;
   4.125 +                <span class="keyword-directive">case</span> <span class="string">&quot;</span><span class="string">minus</span><span class="string">&quot;</span>: setValue(memory - getValue()); <span class="keyword-directive">break</span>;
   4.126 +                <span class="keyword-directive">case</span> <span class="string">&quot;</span><span class="string">mul</span><span class="string">&quot;</span>: setValue(memory * getValue()); <span class="keyword-directive">break</span>;
   4.127 +                <span class="keyword-directive">case</span> <span class="string">&quot;</span><span class="string">div</span><span class="string">&quot;</span>: setValue(memory / getValue()); <span class="keyword-directive">break</span>;
   4.128 +                <span class="keyword-directive">default</span>: <span class="keyword-directive">throw</span> <span class="keyword-directive">new</span> IllegalStateException(operation);
   4.129 +            }
   4.130 +        }
   4.131 +
   4.132 +        @OnClick(id={<span class="string">&quot;</span><span class="string">n0</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n1</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n2</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n3</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n4</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n5</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n6</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n7</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n8</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n9</span><span class="string">&quot;</span>}) 
   4.133 +        <span class="keyword-directive">static</span> <span class="keyword-directive">void</span> addDigit(String digit) {
   4.134 +            digit = digit.substring(<span class="number">1</span>);
   4.135 +            String v = Calculator.DISPLAY.getValue();
   4.136 +            <span class="keyword-directive">if</span> (getValue() == <span class="number">0.0</span>) {
   4.137 +                Calculator.DISPLAY.setValue(digit);
   4.138 +            } <span class="keyword-directive">else</span> {
   4.139 +                Calculator.DISPLAY.setValue(v + digit);
   4.140 +            }
   4.141 +        }
   4.142 +
   4.143 +        <span class="keyword-directive">private</span> <span class="keyword-directive">static</span> <span class="keyword-directive">void</span> setValue(<span class="keyword-directive">double</span> v) {
   4.144 +            StringBuilder sb = <span class="keyword-directive">new</span> StringBuilder();
   4.145 +            sb.append(v);
   4.146 +            Calculator.DISPLAY.setValue(sb.toString());
   4.147 +        }
   4.148 +
   4.149 +        <span class="keyword-directive">private</span> <span class="keyword-directive">static</span> <span class="keyword-directive">double</span> getValue() {
   4.150 +            <span class="keyword-directive">try</span> {
   4.151 +                <span class="keyword-directive">return</span> Double.parseDouble(Calculator.DISPLAY.getValue());
   4.152 +            } <span class="keyword-directive">catch</span> (NumberFormatException ex) {
   4.153 +                Calculator.DISPLAY.setValue(<span class="string">&quot;</span><span class="string">err</span><span class="string">&quot;</span>);
   4.154 +                <span class="keyword-directive">return</span> <span class="number">0.0</span>;
   4.155 +            }
   4.156 +        }
   4.157 +    }
   4.158 +
   4.159 +    </pre>
   4.160 +    </body>
   4.161 +</html>
     5.1 --- a/javaquery/demo-calculator/nbactions.xml	Mon Dec 24 07:57:33 2012 +0100
     5.2 +++ b/javaquery/demo-calculator/nbactions.xml	Mon Dec 24 08:04:45 2012 +0100
     5.3 @@ -23,7 +23,7 @@
     5.4              <actionName>run</actionName>
     5.5              <goals>
     5.6                  <goal>process-classes</goal>
     5.7 -                <goal>org.apidesign.bck2brwsr:mojo:0.3-SNAPSHOT:brwsr</goal>
     5.8 +                <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
     5.9              </goals>
    5.10          </action>
    5.11      </actions>
     6.1 --- a/javaquery/demo-calculator/pom.xml	Mon Dec 24 07:57:33 2012 +0100
     6.2 +++ b/javaquery/demo-calculator/pom.xml	Mon Dec 24 08:04:45 2012 +0100
     6.3 @@ -4,11 +4,11 @@
     6.4    <modelVersion>4.0.0</modelVersion>
     6.5  
     6.6    <groupId>org.apidesign.bck2brwsr</groupId>
     6.7 -  <artifactId>demo.calculator</artifactId>
     6.8 +  <artifactId>demo.static.calculator</artifactId>
     6.9    <version>0.3-SNAPSHOT</version>
    6.10    <packaging>jar</packaging>
    6.11  
    6.12 -  <name>JavaQuery Demo - Calculator</name>
    6.13 +  <name>JavaQuery Demo - Calculator - Static Compilation</name>
    6.14    <url>http://maven.apache.org</url>
    6.15  
    6.16    <properties>
    6.17 @@ -16,19 +16,34 @@
    6.18    </properties>
    6.19    <build>
    6.20        <plugins>
    6.21 +          <plugin>
    6.22 +              <groupId>org.apidesign.bck2brwsr</groupId>
    6.23 +              <artifactId>mojo</artifactId>
    6.24 +              <version>0.3-SNAPSHOT</version>
    6.25 +              <executions>
    6.26 +                  <execution>
    6.27 +                      <goals>
    6.28 +                          <goal>j2js</goal>
    6.29 +                      </goals>
    6.30 +                  </execution>
    6.31 +              </executions>
    6.32 +          </plugin>
    6.33              <plugin>
    6.34 -                <groupId>org.apidesign.bck2brwsr</groupId>
    6.35 -                <artifactId>mojo</artifactId>
    6.36 -                <version>0.3-SNAPSHOT</version>
    6.37 +                <groupId>org.codehaus.mojo</groupId>
    6.38 +                <artifactId>exec-maven-plugin</artifactId>
    6.39 +                <version>1.2.1</version>
    6.40                  <executions>
    6.41                      <execution>
    6.42                          <goals>
    6.43 -                            <goal>brwsr</goal>
    6.44 +                            <goal>exec</goal>
    6.45                          </goals>
    6.46                      </execution>
    6.47                  </executions>
    6.48                  <configuration>
    6.49 -                    <startpage>org/apidesign/bck2brwsr/mavenhtml/Calculator.xhtml</startpage>
    6.50 +                    <executable>xdg-open</executable>
    6.51 +                    <arguments>
    6.52 +                        <argument>${project.build.directory}/classes/org/apidesign/bck2brwsr/mavenhtml/Calculator.xhtml</argument>
    6.53 +                    </arguments>
    6.54                  </configuration>
    6.55              </plugin>
    6.56           <plugin>
     7.1 --- a/javaquery/demo-calculator/src/main/resources/org/apidesign/bck2brwsr/mavenhtml/Calculator.xhtml	Mon Dec 24 07:57:33 2012 +0100
     7.2 +++ b/javaquery/demo-calculator/src/main/resources/org/apidesign/bck2brwsr/mavenhtml/Calculator.xhtml	Mon Dec 24 08:04:45 2012 +0100
     7.3 @@ -77,11 +77,7 @@
     7.4              </tbody>
     7.5          </table>
     7.6  
     7.7 -        <script src="/bck2brwsr.js"></script>
     7.8 -        <script src="/vm.js"></script>
     7.9 -        <script type="text/javascript">
    7.10 -            vm.loadClass('org.apidesign.bck2brwsr.mavenhtml.Calculator');
    7.11 -        </script>
    7.12 +        <script src="bootjava.js"/>
    7.13          
    7.14          <hr/>
    7.15      <pre>
     8.1 --- a/javaquery/demo-static-calculator/nbactions.xml	Mon Dec 24 07:57:33 2012 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,29 +0,0 @@
     8.4 -<?xml version="1.0" encoding="UTF-8"?>
     8.5 -<!--
     8.6 -
     8.7 -    Back 2 Browser Bytecode Translator
     8.8 -    Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     8.9 -
    8.10 -    This program is free software: you can redistribute it and/or modify
    8.11 -    it under the terms of the GNU General Public License as published by
    8.12 -    the Free Software Foundation, version 2 of the License.
    8.13 -
    8.14 -    This program is distributed in the hope that it will be useful,
    8.15 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.16 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8.17 -    GNU General Public License for more details.
    8.18 -
    8.19 -    You should have received a copy of the GNU General Public License
    8.20 -    along with this program. Look for COPYING file in the top folder.
    8.21 -    If not, see http://opensource.org/licenses/GPL-2.0.
    8.22 -
    8.23 --->
    8.24 -<actions>
    8.25 -        <action>
    8.26 -            <actionName>run</actionName>
    8.27 -            <goals>
    8.28 -                <goal>process-classes</goal>
    8.29 -                <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
    8.30 -            </goals>
    8.31 -        </action>
    8.32 -    </actions>
     9.1 --- a/javaquery/demo-static-calculator/pom.xml	Mon Dec 24 07:57:33 2012 +0100
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,73 +0,0 @@
     9.4 -<?xml version="1.0"?>
     9.5 -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     9.6 -  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     9.7 -  <modelVersion>4.0.0</modelVersion>
     9.8 -
     9.9 -  <groupId>org.apidesign.bck2brwsr</groupId>
    9.10 -  <artifactId>demo.static.calculator</artifactId>
    9.11 -  <version>0.3-SNAPSHOT</version>
    9.12 -  <packaging>jar</packaging>
    9.13 -
    9.14 -  <name>JavaQuery Demo - Calculator - Static Compilation</name>
    9.15 -  <url>http://maven.apache.org</url>
    9.16 -
    9.17 -  <properties>
    9.18 -    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    9.19 -  </properties>
    9.20 -  <build>
    9.21 -      <plugins>
    9.22 -          <plugin>
    9.23 -              <groupId>org.apidesign.bck2brwsr</groupId>
    9.24 -              <artifactId>mojo</artifactId>
    9.25 -              <version>0.3-SNAPSHOT</version>
    9.26 -              <executions>
    9.27 -                  <execution>
    9.28 -                      <goals>
    9.29 -                          <goal>j2js</goal>
    9.30 -                      </goals>
    9.31 -                  </execution>
    9.32 -              </executions>
    9.33 -          </plugin>
    9.34 -            <plugin>
    9.35 -                <groupId>org.codehaus.mojo</groupId>
    9.36 -                <artifactId>exec-maven-plugin</artifactId>
    9.37 -                <version>1.2.1</version>
    9.38 -                <executions>
    9.39 -                    <execution>
    9.40 -                        <goals>
    9.41 -                            <goal>exec</goal>
    9.42 -                        </goals>
    9.43 -                    </execution>
    9.44 -                </executions>
    9.45 -                <configuration>
    9.46 -                    <executable>xdg-open</executable>
    9.47 -                    <arguments>
    9.48 -                        <argument>${project.build.directory}/classes/org/apidesign/bck2brwsr/mavenhtml/Calculator.xhtml</argument>
    9.49 -                    </arguments>
    9.50 -                </configuration>
    9.51 -            </plugin>
    9.52 -         <plugin>
    9.53 -            <groupId>org.apache.maven.plugins</groupId>
    9.54 -            <artifactId>maven-compiler-plugin</artifactId>
    9.55 -            <version>2.3.2</version>
    9.56 -            <configuration>
    9.57 -               <source>1.7</source>
    9.58 -               <target>1.7</target>
    9.59 -            </configuration>
    9.60 -         </plugin>
    9.61 -      </plugins>
    9.62 -  </build>
    9.63 -
    9.64 -  <dependencies>
    9.65 -    <dependency>
    9.66 -      <groupId>org.apidesign.bck2brwsr</groupId>
    9.67 -      <artifactId>emul</artifactId>
    9.68 -      <version>0.3-SNAPSHOT</version>
    9.69 -    </dependency>
    9.70 -    <dependency>
    9.71 -      <groupId>org.apidesign.bck2brwsr</groupId>
    9.72 -      <artifactId>javaquery.api</artifactId>
    9.73 -      <version>0.3-SNAPSHOT</version>
    9.74 -    </dependency>
    9.75 -  </dependencies>
    9.76 -</project>
    10.1 --- a/javaquery/demo-static-calculator/src/main/java/org/apidesign/bck2brwsr/mavenhtml/App.java	Mon Dec 24 07:57:33 2012 +0100
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,88 +0,0 @@
    10.4 -/**
    10.5 - * Back 2 Browser Bytecode Translator
    10.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    10.7 - *
    10.8 - * This program is free software: you can redistribute it and/or modify
    10.9 - * it under the terms of the GNU General Public License as published by
   10.10 - * the Free Software Foundation, version 2 of the License.
   10.11 - *
   10.12 - * This program is distributed in the hope that it will be useful,
   10.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   10.15 - * GNU General Public License for more details.
   10.16 - *
   10.17 - * You should have received a copy of the GNU General Public License
   10.18 - * along with this program. Look for COPYING file in the top folder.
   10.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
   10.20 - */
   10.21 -package org.apidesign.bck2brwsr.mavenhtml;
   10.22 -
   10.23 -import org.apidesign.bck2brwsr.htmlpage.api.OnClick;
   10.24 -import org.apidesign.bck2brwsr.htmlpage.api.Page;
   10.25 -
   10.26 -/** HTML5 & Java demo showing the power of 
   10.27 - * <a href="http://wiki.apidesign.org/wiki/AnnotationProcessor">annotation processors</a>
   10.28 - * as well as other goodies.
   10.29 - * 
   10.30 - * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
   10.31 - */
   10.32 -@Page(xhtml="Calculator.xhtml")
   10.33 -public class App {
   10.34 -    private static double memory;
   10.35 -    private static String operation;
   10.36 -    
   10.37 -    @OnClick(id="clear")
   10.38 -    static void clear() {
   10.39 -        memory = 0;
   10.40 -        operation = null;
   10.41 -        Calculator.DISPLAY.setValue("0");
   10.42 -    }
   10.43 -    
   10.44 -    @OnClick(id= { "plus", "minus", "mul", "div" })
   10.45 -    static void applyOp(String op) {
   10.46 -        memory = getValue();
   10.47 -        operation = op;
   10.48 -        Calculator.DISPLAY.setValue("0");
   10.49 -    }
   10.50 -    
   10.51 -    @OnClick(id="result")
   10.52 -    static void computeTheValue() {
   10.53 -        switch (operation) {
   10.54 -            case "plus": setValue(memory + getValue()); break;
   10.55 -            case "minus": setValue(memory - getValue()); break;
   10.56 -            case "mul": setValue(memory * getValue()); break;
   10.57 -            case "div": setValue(memory / getValue()); break;
   10.58 -            default: throw new IllegalStateException(operation);
   10.59 -        }
   10.60 -    }
   10.61 -    
   10.62 -    @OnClick(id={"n0", "n1", "n2", "n3", "n4", "n5", "n6", "n7", "n8", "n9"}) 
   10.63 -    static void addDigit(String digit) {
   10.64 -        digit = digit.substring(1);
   10.65 -        String v = Calculator.DISPLAY.getValue();
   10.66 -        if (getValue() == 0.0) {
   10.67 -            Calculator.DISPLAY.setValue(digit);
   10.68 -        } else {
   10.69 -            Calculator.DISPLAY.setValue(v + digit);
   10.70 -        }
   10.71 -    }
   10.72 -    
   10.73 -    private static void setValue(double v) {
   10.74 -        StringBuilder sb = new StringBuilder();
   10.75 -        sb.append(v);
   10.76 -        if (sb.toString().endsWith(".0")) {
   10.77 -            final int l = sb.length();
   10.78 -            sb.delete(l - 2, l);
   10.79 -        }
   10.80 -        Calculator.DISPLAY.setValue(sb.toString());
   10.81 -    }
   10.82 -
   10.83 -    private static double getValue() {
   10.84 -        try {
   10.85 -            return Double.parseDouble(Calculator.DISPLAY.getValue());
   10.86 -        } catch (NumberFormatException ex) {
   10.87 -            Calculator.DISPLAY.setValue("err");
   10.88 -            return 0.0;
   10.89 -        }
   10.90 -    }
   10.91 -}
    11.1 --- a/javaquery/demo-static-calculator/src/main/resources/org/apidesign/bck2brwsr/mavenhtml/Calculator.xhtml	Mon Dec 24 07:57:33 2012 +0100
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,154 +0,0 @@
    11.4 -<?xml version="1.0" encoding="UTF-8"?>
    11.5 -<!--
    11.6 -
    11.7 -    Back 2 Browser Bytecode Translator
    11.8 -    Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    11.9 -
   11.10 -    This program is free software: you can redistribute it and/or modify
   11.11 -    it under the terms of the GNU General Public License as published by
   11.12 -    the Free Software Foundation, version 2 of the License.
   11.13 -
   11.14 -    This program is distributed in the hope that it will be useful,
   11.15 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.16 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11.17 -    GNU General Public License for more details.
   11.18 -
   11.19 -    You should have received a copy of the GNU General Public License
   11.20 -    along with this program. Look for COPYING file in the top folder.
   11.21 -    If not, see http://opensource.org/licenses/GPL-2.0.
   11.22 -
   11.23 --->
   11.24 -<!DOCTYPE html>
   11.25 -<html xmlns="http://www.w3.org/1999/xhtml">
   11.26 -    <head>
   11.27 -        <title>Simple Calculator in HTML5 and Java</title>
   11.28 -
   11.29 -        <style type="text/css">
   11.30 -        body {color: #ffffff; background-color: #121e31; font-family: Monospaced}
   11.31 -        pre {color: #ffffff; background-color: #121e31; font-family: Monospaced}
   11.32 -        table {color: #ffffff; background-color: #121e31; font-family: Monospaced}
   11.33 -        .string {color: #e2ce00}
   11.34 -        a {color: #e2ce00}
   11.35 -        .ST1 {color: #0000cc; font-family: Monospaced; font-weight: bold}
   11.36 -        .ST0 {color: #0000ff}
   11.37 -        .comment {color: #428bdd}
   11.38 -        .keyword-directive {color: #f8bb00}
   11.39 -        .tag {color: #f8bb00}
   11.40 -        .ST0 {color: #628fb5; background-color: #1b3450}
   11.41 -        .sgml-comment {color: #808080}
   11.42 -        .value {color: #99006b}
   11.43 -        .argument {color: #007c00}
   11.44 -        .sgml-declaration {color: #bf9221}
   11.45 -        </style>    
   11.46 -        </head>
   11.47 -    <body>
   11.48 -        <h1>Java and HTML5 - Together at Last!</h1>
   11.49 -        <table border="0" cellspacing="2">
   11.50 -            <tbody>
   11.51 -                <tr>
   11.52 -                    <td colspan="4"><input id="display" value="0" 
   11.53 -                            style="text-align: right"/>
   11.54 -                </td>
   11.55 -                </tr>
   11.56 -                <tr>
   11.57 -                    <td><button id="n1">1</button></td>
   11.58 -                    <td><button id="n2">2</button></td>
   11.59 -                    <td><button id="n3">3</button></td>
   11.60 -                    <td><button id="plus">+</button></td>
   11.61 -                </tr>
   11.62 -                <tr>
   11.63 -                    <td><button id="n4">4</button></td>
   11.64 -                    <td><button id="n5">5</button></td>
   11.65 -                    <td><button id="n6">6</button></td>
   11.66 -                    <td><button id="minus">-</button></td>
   11.67 -                </tr>
   11.68 -                <tr>
   11.69 -                    <td><button id="n7">7</button></td>
   11.70 -                    <td><button id="n8">8</button></td>
   11.71 -                    <td><button id="n9">9</button></td>
   11.72 -                    <td><button id="mul">*</button></td>
   11.73 -                </tr>
   11.74 -                <tr>
   11.75 -                    <td><button id="clear">C</button></td>
   11.76 -                    <td><button id="n0">0</button></td>
   11.77 -                    <td><button id="result">=</button></td>
   11.78 -                    <td><button id="div">/</button></td>
   11.79 -                </tr>
   11.80 -            </tbody>
   11.81 -        </table>
   11.82 -
   11.83 -        <script src="bootjava.js"/>
   11.84 -        
   11.85 -        <hr/>
   11.86 -    <pre>
   11.87 -    <span class="keyword-directive">package</span> org.apidesign.bck2brwsr.mavenhtml;
   11.88 -
   11.89 -    <span class="keyword-directive">import</span> org.apidesign.bck2brwsr.htmlpage.api.OnClick;
   11.90 -    <span class="keyword-directive">import</span> org.apidesign.bck2brwsr.htmlpage.api.Page;
   11.91 -
   11.92 -    <span class="comment">/**</span> <span class="comment">HTML5</span><span class="comment"> &amp; </span><span class="comment">Java</span> <span class="comment">demo</span> <span class="comment">showing</span> <span class="comment">the</span> <span class="comment">power</span> <span class="comment">of</span> <a href="http://wiki.apidesign.org/wiki/AnnotationProcessor">annotation processors</a>
   11.93 -    <span class="comment"> * </span><span class="comment">as</span> <span class="comment">well</span> <span class="comment">as</span> <span class="comment">other</span> <span class="comment">goodies</span><span class="comment">, including type-safe association between</span>
   11.94 -    <span class="comment"> * </span><span class="comment">an XHTML page and Java.</span>
   11.95 -    <span class="comment"> * </span>
   11.96 -    <span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">Jaroslav</span> <span class="comment">Tulach</span> <span class="ST0">&lt;jaroslav.tulach@apidesign.org&gt;</span>
   11.97 -     <span class="comment">*/</span>
   11.98 -    @Page(xhtml=<span class="string">&quot;</span><span class="string">Calculator.xhtml</span><span class="string">&quot;</span>)
   11.99 -    <span class="keyword-directive">public</span> <span class="keyword-directive">class</span> App {
  11.100 -        <span class="keyword-directive">private</span> <span class="keyword-directive">static</span> <span class="keyword-directive">double</span> memory;
  11.101 -        <span class="keyword-directive">private</span> <span class="keyword-directive">static</span> String operation;
  11.102 -
  11.103 -        @OnClick(id=<span class="string">&quot;</span><span class="string">clear</span><span class="string">&quot;</span>)
  11.104 -        <span class="keyword-directive">static</span> <span class="keyword-directive">void</span> clear() {
  11.105 -            memory = <span class="number">0</span>;
  11.106 -            operation = <span class="keyword-directive">null</span>;
  11.107 -            Calculator.DISPLAY.setValue(<span class="string">&quot;</span><span class="string">0</span><span class="string">&quot;</span>);
  11.108 -        }
  11.109 -
  11.110 -        @OnClick(id= { <span class="string">&quot;</span><span class="string">plus</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">minus</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">mul</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">div</span><span class="string">&quot;</span> })
  11.111 -        <span class="keyword-directive">static</span> <span class="keyword-directive">void</span> applyOp(String op) {
  11.112 -            memory = getValue();
  11.113 -            operation = op;
  11.114 -            Calculator.DISPLAY.setValue(<span class="string">&quot;</span><span class="string">0</span><span class="string">&quot;</span>);
  11.115 -        }
  11.116 -
  11.117 -        @OnClick(id=<span class="string">&quot;</span><span class="string">result</span><span class="string">&quot;</span>)
  11.118 -        <span class="keyword-directive">static</span> <span class="keyword-directive">void</span> computeTheValue() {
  11.119 -            <span class="keyword-directive">switch</span> (operation) {
  11.120 -                <span class="keyword-directive">case</span> <span class="string">&quot;</span><span class="string">plus</span><span class="string">&quot;</span>: setValue(memory + getValue()); <span class="keyword-directive">break</span>;
  11.121 -                <span class="keyword-directive">case</span> <span class="string">&quot;</span><span class="string">minus</span><span class="string">&quot;</span>: setValue(memory - getValue()); <span class="keyword-directive">break</span>;
  11.122 -                <span class="keyword-directive">case</span> <span class="string">&quot;</span><span class="string">mul</span><span class="string">&quot;</span>: setValue(memory * getValue()); <span class="keyword-directive">break</span>;
  11.123 -                <span class="keyword-directive">case</span> <span class="string">&quot;</span><span class="string">div</span><span class="string">&quot;</span>: setValue(memory / getValue()); <span class="keyword-directive">break</span>;
  11.124 -                <span class="keyword-directive">default</span>: <span class="keyword-directive">throw</span> <span class="keyword-directive">new</span> IllegalStateException(operation);
  11.125 -            }
  11.126 -        }
  11.127 -
  11.128 -        @OnClick(id={<span class="string">&quot;</span><span class="string">n0</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n1</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n2</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n3</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n4</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n5</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n6</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n7</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n8</span><span class="string">&quot;</span>, <span class="string">&quot;</span><span class="string">n9</span><span class="string">&quot;</span>}) 
  11.129 -        <span class="keyword-directive">static</span> <span class="keyword-directive">void</span> addDigit(String digit) {
  11.130 -            digit = digit.substring(<span class="number">1</span>);
  11.131 -            String v = Calculator.DISPLAY.getValue();
  11.132 -            <span class="keyword-directive">if</span> (getValue() == <span class="number">0.0</span>) {
  11.133 -                Calculator.DISPLAY.setValue(digit);
  11.134 -            } <span class="keyword-directive">else</span> {
  11.135 -                Calculator.DISPLAY.setValue(v + digit);
  11.136 -            }
  11.137 -        }
  11.138 -
  11.139 -        <span class="keyword-directive">private</span> <span class="keyword-directive">static</span> <span class="keyword-directive">void</span> setValue(<span class="keyword-directive">double</span> v) {
  11.140 -            StringBuilder sb = <span class="keyword-directive">new</span> StringBuilder();
  11.141 -            sb.append(v);
  11.142 -            Calculator.DISPLAY.setValue(sb.toString());
  11.143 -        }
  11.144 -
  11.145 -        <span class="keyword-directive">private</span> <span class="keyword-directive">static</span> <span class="keyword-directive">double</span> getValue() {
  11.146 -            <span class="keyword-directive">try</span> {
  11.147 -                <span class="keyword-directive">return</span> Double.parseDouble(Calculator.DISPLAY.getValue());
  11.148 -            } <span class="keyword-directive">catch</span> (NumberFormatException ex) {
  11.149 -                Calculator.DISPLAY.setValue(<span class="string">&quot;</span><span class="string">err</span><span class="string">&quot;</span>);
  11.150 -                <span class="keyword-directive">return</span> <span class="number">0.0</span>;
  11.151 -            }
  11.152 -        }
  11.153 -    }
  11.154 -
  11.155 -    </pre>
  11.156 -    </body>
  11.157 -</html>
    12.1 --- a/javaquery/pom.xml	Mon Dec 24 07:57:33 2012 +0100
    12.2 +++ b/javaquery/pom.xml	Mon Dec 24 08:04:45 2012 +0100
    12.3 @@ -14,6 +14,6 @@
    12.4      <modules>
    12.5          <module>api</module>
    12.6          <module>demo-calculator</module>
    12.7 -        <module>demo-static-calculator</module>
    12.8 +        <module>demo-calculator-dynamic</module>
    12.9      </modules>
   12.10  </project>