Bck2Brwsr project is completely independent of net.java.html model
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 29 Apr 2013 13:56:16 +0200
branchmodel
changeset 10550d7b63408a1e
parent 1054 fef28d5bee88
child 1056 efb74eaf43c4
Bck2Brwsr project is completely independent of net.java.html
javaquery/api/pom.xml
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/BrwsrCntxt.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/BrwsrCntxtPrvdr.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/Knockout.java
javaquery/api/src/test/java/org/apidesign/bck2brwsr/htmlpage/Bck2BrwsrKnockoutTest.java
javaquery/demo-twitter/bck2brwsr-assembly.xml
javaquery/demo-twitter/pom.xml
javaquery/demo-twitter/src/main/assembly/bck2brwsr.xml
javaquery/demo-twitter/src/main/assembly/fxbrwsr.xml
javaquery/demo-twitter/src/main/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClient.java
javaquery/demo-twitter/src/test/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClientTest.java
javaquery/demo-twitter/src/test/java/org/apidesign/bck2brwsr/demo/twitter/TwitterProtocolTest.java
     1.1 --- a/javaquery/api/pom.xml	Mon Apr 29 10:04:53 2013 +0200
     1.2 +++ b/javaquery/api/pom.xml	Mon Apr 29 13:56:16 2013 +0200
     1.3 @@ -78,17 +78,6 @@
     1.4        <artifactId>launcher.http</artifactId>
     1.5        <version>${project.version}</version>
     1.6        <scope>test</scope>
     1.7 -    </dependency>
     1.8 -    <dependency>
     1.9 -      <groupId>org.apidesign.html</groupId>
    1.10 -      <artifactId>net.java.html.json</artifactId>
    1.11 -      <version>0.1-SNAPSHOT</version>
    1.12 -    </dependency>
    1.13 -    <dependency>
    1.14 -      <groupId>org.apidesign.html</groupId>
    1.15 -      <artifactId>net.java.html.json.tck</artifactId>
    1.16 -      <version>0.1-SNAPSHOT</version>
    1.17 -      <scope>test</scope>
    1.18 -    </dependency>
    1.19 +    </dependency>    
    1.20    </dependencies>
    1.21  </project>
     2.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/BrwsrCntxt.java	Mon Apr 29 10:04:53 2013 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,103 +0,0 @@
     2.4 -/**
     2.5 - * Back 2 Browser Bytecode Translator
     2.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     2.7 - *
     2.8 - * This program is free software: you can redistribute it and/or modify
     2.9 - * it under the terms of the GNU General Public License as published by
    2.10 - * the Free Software Foundation, version 2 of the License.
    2.11 - *
    2.12 - * This program is distributed in the hope that it will be useful,
    2.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.15 - * GNU General Public License for more details.
    2.16 - *
    2.17 - * You should have received a copy of the GNU General Public License
    2.18 - * along with this program. Look for COPYING file in the top folder.
    2.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    2.20 - */
    2.21 -
    2.22 -package org.apidesign.bck2brwsr.htmlpage;
    2.23 -
    2.24 -import net.java.html.json.Context;
    2.25 -import org.apidesign.html.json.spi.ContextBuilder;
    2.26 -import org.apidesign.html.json.spi.FunctionBinding;
    2.27 -import org.apidesign.html.json.spi.JSONCall;
    2.28 -import org.apidesign.html.json.spi.PropertyBinding;
    2.29 -import org.apidesign.html.json.spi.Technology;
    2.30 -import org.apidesign.html.json.spi.Transfer;
    2.31 -
    2.32 -/**
    2.33 - *
    2.34 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    2.35 - */
    2.36 -public final class BrwsrCntxt implements Technology<Object>, Transfer {
    2.37 -    private BrwsrCntxt() {}
    2.38 -    
    2.39 -    public static final Context DEFAULT;
    2.40 -    static {
    2.41 -        BrwsrCntxt c = new BrwsrCntxt();
    2.42 -        DEFAULT = ContextBuilder.create().withTechnology(c).withTransfer(c).build();
    2.43 -    }
    2.44 -    
    2.45 -    @Override
    2.46 -    public void extract(Object obj, String[] props, Object[] values) {
    2.47 -        ConvertTypes.extractJSON(obj, props, values);
    2.48 -    }
    2.49 -
    2.50 -    @Override
    2.51 -    public void loadJSON(final JSONCall call) {
    2.52 -        class R implements Runnable {
    2.53 -            Object[] arr = { null };
    2.54 -            @Override
    2.55 -            public void run() {
    2.56 -                call.notifySuccess(arr[0]);
    2.57 -            }
    2.58 -        }
    2.59 -        R r = new R();
    2.60 -        if (call.isJSONP()) {
    2.61 -            String me = ConvertTypes.createJSONP(r.arr, r);
    2.62 -            ConvertTypes.loadJSON(call.composeURL(me), r.arr, r, me);
    2.63 -        } else {
    2.64 -            ConvertTypes.loadJSON(call.composeURL(null), r.arr, r, null);
    2.65 -        }
    2.66 -    }
    2.67 -
    2.68 -    @Override
    2.69 -    public Object wrapModel(Object model) {
    2.70 -        return model;
    2.71 -    }
    2.72 -
    2.73 -    @Override
    2.74 -    public void bind(PropertyBinding b, Object model, Object data) {
    2.75 -        Knockout.bind(data, b, b.getPropertyName(), 
    2.76 -            "getValue__Ljava_lang_Object_2", 
    2.77 -            b.isReadOnly() ? null : "setValue__VLjava_lang_Object_2", 
    2.78 -            false, false
    2.79 -        );
    2.80 -    }
    2.81 -
    2.82 -    @Override
    2.83 -    public void valueHasMutated(Object data, String propertyName) {
    2.84 -        Knockout.valueHasMutated(data, propertyName);
    2.85 -    }
    2.86 -
    2.87 -    @Override
    2.88 -    public void expose(FunctionBinding fb, Object model, Object d) {
    2.89 -        Knockout.expose(d, fb, fb.getFunctionName(), "call__VLjava_lang_Object_2Ljava_lang_Object_2");
    2.90 -    }
    2.91 -
    2.92 -    @Override
    2.93 -    public void applyBindings(Object data) {
    2.94 -        Knockout.applyBindings(data);
    2.95 -    }
    2.96 -
    2.97 -    @Override
    2.98 -    public Object wrapArray(Object[] arr) {
    2.99 -        return arr;
   2.100 -    }
   2.101 -
   2.102 -    @Override
   2.103 -    public <M> M toModel(Class<M> modelClass, Object data) {
   2.104 -        return modelClass.cast(data);
   2.105 -    }
   2.106 -}
     3.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/BrwsrCntxtPrvdr.java	Mon Apr 29 10:04:53 2013 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,40 +0,0 @@
     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.htmlpage;
    3.22 -
    3.23 -import net.java.html.json.Context;
    3.24 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
    3.25 -import org.apidesign.html.json.spi.ContextProvider;
    3.26 -import org.openide.util.lookup.ServiceProvider;
    3.27 -
    3.28 -/**
    3.29 - *
    3.30 - * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    3.31 - */
    3.32 -@ServiceProvider(service = ContextProvider.class)
    3.33 -public final class BrwsrCntxtPrvdr implements ContextProvider {
    3.34 -    @Override
    3.35 -    public Context findContext(Class<?> requestor) {
    3.36 -        return bck2BrwsrVM() ? BrwsrCntxt.DEFAULT : null;
    3.37 -    }
    3.38 -    
    3.39 -    @JavaScriptBody(args = {  }, body = "return true;")
    3.40 -    private static boolean bck2BrwsrVM() {
    3.41 -        return false;
    3.42 -    }
    3.43 -}
     4.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/Knockout.java	Mon Apr 29 10:04:53 2013 +0200
     4.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/Knockout.java	Mon Apr 29 13:56:16 2013 +0200
     4.3 @@ -61,9 +61,9 @@
     4.4          valueHasMutated(model, prop);
     4.5      }
     4.6      @JavaScriptBody(args = { "self", "prop" }, body =
     4.7 -        "var p = self[prop]; if (p) p.valueHasMutated();"
     4.8 +        "self[prop].valueHasMutated();"
     4.9      )
    4.10 -    public static void valueHasMutated(Object self, String prop) {
    4.11 +    public void valueHasMutated(Object self, String prop) {
    4.12      }
    4.13      
    4.14  
    4.15 @@ -87,7 +87,7 @@
    4.16          + "}\n"
    4.17          + "bindings[prop] = ko['computed'](bnd);"
    4.18      )
    4.19 -    static void bind(
    4.20 +    private static void bind(
    4.21          Object bindings, Object model, String prop, String getter, String setter, boolean primitive, boolean array
    4.22      ) {
    4.23      }
    4.24 @@ -95,13 +95,13 @@
    4.25      @JavaScriptBody(args = { "bindings", "model", "prop", "sig" }, body = 
    4.26          "bindings[prop] = function(data, ev) { model[sig](data, ev); };"
    4.27      )
    4.28 -    static void expose(
    4.29 +    private static void expose(
    4.30          Object bindings, Object model, String prop, String sig
    4.31      ) {
    4.32      }
    4.33      
    4.34      @JavaScriptBody(args = { "bindings" }, body = "ko.applyBindings(bindings);")
    4.35 -    static void applyBindings(Object bindings) {}
    4.36 +    private static void applyBindings(Object bindings) {}
    4.37      
    4.38      private static void applyImpl(
    4.39          String[] propsGettersAndSetters,
     5.1 --- a/javaquery/api/src/test/java/org/apidesign/bck2brwsr/htmlpage/Bck2BrwsrKnockoutTest.java	Mon Apr 29 10:04:53 2013 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,73 +0,0 @@
     5.4 -/**
     5.5 - * Back 2 Browser Bytecode Translator
     5.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     5.7 - *
     5.8 - * This program is free software: you can redistribute it and/or modify
     5.9 - * it under the terms of the GNU General Public License as published by
    5.10 - * the Free Software Foundation, version 2 of the License.
    5.11 - *
    5.12 - * This program is distributed in the hope that it will be useful,
    5.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.15 - * GNU General Public License for more details.
    5.16 - *
    5.17 - * You should have received a copy of the GNU General Public License
    5.18 - * along with this program. Look for COPYING file in the top folder.
    5.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    5.20 - */
    5.21 -package org.apidesign.bck2brwsr.htmlpage;
    5.22 -
    5.23 -import java.util.Map;
    5.24 -import net.java.html.json.Context;
    5.25 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
    5.26 -import org.apidesign.bck2brwsr.vmtest.VMTest;
    5.27 -import org.apidesign.html.json.tck.KnockoutTCK;
    5.28 -import org.openide.util.lookup.ServiceProvider;
    5.29 -import org.testng.annotations.Factory;
    5.30 -
    5.31 -/**
    5.32 - *
    5.33 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    5.34 - */
    5.35 -@ServiceProvider(service = KnockoutTCK.class)
    5.36 -public final class Bck2BrwsrKnockoutTest extends KnockoutTCK {
    5.37 -    @Factory public static Object[] create() {
    5.38 -        return VMTest.newTests().
    5.39 -            withClasses(testClasses()).
    5.40 -            withLaunchers("bck2brwsr").
    5.41 -            build();
    5.42 -    }
    5.43 -    
    5.44 -    @Override
    5.45 -    public Context createContext() {
    5.46 -        return BrwsrCntxt.DEFAULT;
    5.47 -    }
    5.48 -
    5.49 -
    5.50 -    
    5.51 -    @Override
    5.52 -    public Object createJSON(Map<String, Object> values) {
    5.53 -        Object json = createJSON();
    5.54 -        
    5.55 -        for (Map.Entry<String, Object> entry : values.entrySet()) {
    5.56 -            putValue(json, entry.getKey(), entry.getValue());
    5.57 -        }
    5.58 -        return json;
    5.59 -    }
    5.60 -
    5.61 -    @JavaScriptBody(args = {}, body = "return new Object();")
    5.62 -    private static native Object createJSON();
    5.63 -
    5.64 -    @JavaScriptBody(args = { "json", "key", "value" }, body = "json[key] = value;")
    5.65 -    private static native void putValue(Object json, String key, Object value);
    5.66 -
    5.67 -    @Override
    5.68 -    public Object executeScript(String script, Object[] arguments) {
    5.69 -        return execScript(script, arguments);
    5.70 -    }
    5.71 -    
    5.72 -    @JavaScriptBody(args = { "s", "args" }, body = 
    5.73 -        "var f = new Function(s); return f.apply(null, args);"
    5.74 -    )
    5.75 -    private static native Object execScript(String s, Object[] arguments);
    5.76 -}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/javaquery/demo-twitter/bck2brwsr-assembly.xml	Mon Apr 29 13:56:16 2013 +0200
     6.3 @@ -0,0 +1,62 @@
     6.4 +<?xml version="1.0"?>
     6.5 +<!--
     6.6 +
     6.7 +    Back 2 Browser Bytecode Translator
     6.8 +    Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     6.9 +
    6.10 +    This program is free software: you can redistribute it and/or modify
    6.11 +    it under the terms of the GNU General Public License as published by
    6.12 +    the Free Software Foundation, version 2 of the License.
    6.13 +
    6.14 +    This program is distributed in the hope that it will be useful,
    6.15 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.16 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6.17 +    GNU General Public License for more details.
    6.18 +
    6.19 +    You should have received a copy of the GNU General Public License
    6.20 +    along with this program. Look for COPYING file in the top folder.
    6.21 +    If not, see http://opensource.org/licenses/GPL-2.0.
    6.22 +
    6.23 +-->
    6.24 +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    6.25 +  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    6.26 +  
    6.27 +  <id>bck2brwsr</id>
    6.28 +  <formats>
    6.29 +      <format>zip</format>
    6.30 +  </formats>
    6.31 +  <baseDirectory>public_html</baseDirectory>
    6.32 +  <dependencySets>
    6.33 +    <dependencySet>
    6.34 +        <useProjectArtifact>false</useProjectArtifact>
    6.35 +        <scope>runtime</scope>
    6.36 +        <outputDirectory>lib</outputDirectory>
    6.37 +        <includes>
    6.38 +            <include>*:jar</include>
    6.39 +            <include>*:rt</include>
    6.40 +        </includes>
    6.41 +    </dependencySet>
    6.42 +  </dependencySets> 
    6.43 +  <fileSets>
    6.44 +      <fileSet>
    6.45 +          <directory>${project.build.directory}/classes/org/apidesign/bck2brwsr/demo/twitter/</directory>
    6.46 +          <includes>
    6.47 +              <include>**/*</include>
    6.48 +          </includes>
    6.49 +          <excludes>
    6.50 +              <exclude>**/*.class</exclude>
    6.51 +          </excludes>
    6.52 +          <outputDirectory>/</outputDirectory>
    6.53 +      </fileSet>
    6.54 +  </fileSets>
    6.55 +  <files>
    6.56 +    <file>
    6.57 +      <source>${project.build.directory}/${project.build.finalName}.jar</source>
    6.58 +      <outputDirectory>/</outputDirectory>
    6.59 +    </file>
    6.60 +    <file>
    6.61 +      <source>${project.build.directory}/bck2brwsr.js</source>
    6.62 +      <outputDirectory>/</outputDirectory>
    6.63 +    </file>
    6.64 +  </files>
    6.65 +</assembly>
    6.66 \ No newline at end of file
     7.1 --- a/javaquery/demo-twitter/pom.xml	Mon Apr 29 10:04:53 2013 +0200
     7.2 +++ b/javaquery/demo-twitter/pom.xml	Mon Apr 29 13:56:16 2013 +0200
     7.3 @@ -12,10 +12,10 @@
     7.4    <version>0.7-SNAPSHOT</version>
     7.5    <packaging>jar</packaging>
     7.6  
     7.7 -  <name>Fx/Bck2Brwsr's Twttr</name>
     7.8 +  <name>Bck2Brwsr's Twttr</name>
     7.9    <description>
    7.10        Rewrite of knockoutjs example to use model written in Java and
    7.11 -      execute using FxBrwsr or Bck2Brwsr.
    7.12 +      execute using Bck2Brwsr virtual machine.
    7.13    </description>
    7.14  
    7.15    <repositories>
    7.16 @@ -45,71 +45,91 @@
    7.17    <properties>
    7.18      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    7.19      <bck2brwsr.obfuscationlevel>MINIMAL</bck2brwsr.obfuscationlevel>
    7.20 -    <brwsr.startpage>org/apidesign/bck2brwsr/demo/twitter/index.html</brwsr.startpage>
    7.21    </properties>
    7.22    <build>
    7.23        <plugins>
    7.24 -          <plugin>
    7.25 -              <groupId>org.apidesign.bck2brwsr</groupId>
    7.26 -              <artifactId>bck2brwsr-maven-plugin</artifactId>
    7.27 -              <version>${project.version}</version>
    7.28 -              <executions>
    7.29 -                  <execution>
    7.30 -                      <goals>
    7.31 -                          <goal>brwsr</goal>
    7.32 -                      </goals>
    7.33 -                  </execution>
    7.34 -              </executions>
    7.35 -              <configuration>
    7.36 -                  <startpage>${brwsr.startpage}</startpage>
    7.37 -                  <launcher>${brwsr}</launcher>
    7.38 -              </configuration>
    7.39 -          </plugin>
    7.40 -          <plugin>
    7.41 -              <groupId>org.apache.maven.plugins</groupId>
    7.42 -              <artifactId>maven-compiler-plugin</artifactId>
    7.43 -              <version>2.3.2</version>
    7.44 -              <configuration>
    7.45 -                  <source>1.7</source>
    7.46 -                  <target>1.7</target>
    7.47 -              </configuration>
    7.48 -          </plugin>
    7.49 -          <plugin>
    7.50 -              <groupId>org.apache.maven.plugins</groupId>
    7.51 -              <artifactId>maven-surefire-plugin</artifactId>
    7.52 -              <version>2.14.1</version>
    7.53 -              <configuration>
    7.54 -                  <systemPropertyVariables>
    7.55 -                      <vmtest.brwsrs>${brwsr}</vmtest.brwsrs>
    7.56 -                  </systemPropertyVariables>
    7.57 -              </configuration>
    7.58 -          </plugin>
    7.59 -          <plugin>
    7.60 -              <groupId>org.apache.maven.plugins</groupId>
    7.61 -              <artifactId>maven-jar-plugin</artifactId>
    7.62 -              <version>2.4</version>
    7.63 -              <configuration>
    7.64 -                  <archive>
    7.65 -                      <manifest>
    7.66 -                          <addClasspath>true</addClasspath>
    7.67 -                          <classpathPrefix>lib/</classpathPrefix>
    7.68 -                      </manifest>
    7.69 -                  </archive>
    7.70 -              </configuration>
    7.71 -          </plugin>
    7.72 -          <plugin>
    7.73 -              <groupId>org.apache.maven.plugins</groupId>
    7.74 -              <artifactId>maven-deploy-plugin</artifactId>
    7.75 -              <version>2.7</version>
    7.76 -              <configuration>
    7.77 -                  <skip>true</skip>
    7.78 -              </configuration>
    7.79 -          </plugin>      
    7.80 +            <plugin>
    7.81 +                <groupId>org.apidesign.bck2brwsr</groupId>
    7.82 +                <artifactId>bck2brwsr-maven-plugin</artifactId>
    7.83 +                <version>${project.version}</version>
    7.84 +                <executions>
    7.85 +                    <execution>
    7.86 +                        <goals>
    7.87 +                            <goal>brwsr</goal>
    7.88 +                            <goal>j2js</goal>
    7.89 +                        </goals>
    7.90 +                    </execution>
    7.91 +                </executions>
    7.92 +                <configuration>
    7.93 +                    <startpage>org/apidesign/bck2brwsr/demo/twitter/index.html</startpage>
    7.94 +                    <javascript>${project.build.directory}/bck2brwsr.js</javascript>
    7.95 +                    <obfuscation>${bck2brwsr.obfuscationlevel}</obfuscation>
    7.96 +                </configuration>
    7.97 +            </plugin>
    7.98 +         <plugin>
    7.99 +            <groupId>org.apache.maven.plugins</groupId>
   7.100 +            <artifactId>maven-compiler-plugin</artifactId>
   7.101 +            <version>2.3.2</version>
   7.102 +            <configuration>
   7.103 +               <source>1.7</source>
   7.104 +               <target>1.7</target>
   7.105 +            </configuration>
   7.106 +         </plugin>
   7.107 +         <plugin>
   7.108 +             <groupId>org.apache.maven.plugins</groupId>
   7.109 +             <artifactId>maven-jar-plugin</artifactId>
   7.110 +             <version>2.4</version>
   7.111 +             <configuration>
   7.112 +                 <archive>
   7.113 +                     <manifest>
   7.114 +                         <addClasspath>true</addClasspath>
   7.115 +                         <classpathPrefix>lib/</classpathPrefix>
   7.116 +                     </manifest>
   7.117 +                 </archive>
   7.118 +             </configuration>
   7.119 +         </plugin>
   7.120 +         <plugin>
   7.121 +           <groupId>org.apache.maven.plugins</groupId>
   7.122 +           <artifactId>maven-deploy-plugin</artifactId>
   7.123 +           <version>2.7</version>
   7.124 +           <configuration>
   7.125 +             <skip>true</skip>
   7.126 +           </configuration>
   7.127 +         </plugin>      
   7.128 +         <plugin>
   7.129 +             <artifactId>maven-assembly-plugin</artifactId>
   7.130 +             <version>2.4</version>
   7.131 +             <executions>
   7.132 +                 <execution>
   7.133 +                     <id>distro-assembly</id>
   7.134 +                     <phase>package</phase>
   7.135 +                     <goals>
   7.136 +                         <goal>single</goal>
   7.137 +                     </goals>
   7.138 +                     <configuration>
   7.139 +                         <descriptors>
   7.140 +                             <descriptor>bck2brwsr-assembly.xml</descriptor>
   7.141 +                         </descriptors>
   7.142 +                     </configuration>
   7.143 +                 </execution>
   7.144 +             </executions>                
   7.145 +         </plugin>      
   7.146        </plugins>
   7.147    </build>
   7.148  
   7.149    <dependencies>
   7.150      <dependency>
   7.151 +      <groupId>org.apidesign.bck2brwsr</groupId>
   7.152 +      <artifactId>emul</artifactId>
   7.153 +      <version>${project.version}</version>
   7.154 +      <classifier>rt</classifier>
   7.155 +    </dependency>
   7.156 +    <dependency>
   7.157 +      <groupId>org.apidesign.bck2brwsr</groupId>
   7.158 +      <artifactId>javaquery.api</artifactId>
   7.159 +      <version>${project.version}</version>
   7.160 +    </dependency>
   7.161 +    <dependency>
   7.162        <groupId>org.testng</groupId>
   7.163        <artifactId>testng</artifactId>
   7.164        <version>6.5.2</version>
   7.165 @@ -121,149 +141,5 @@
   7.166        <version>${project.version}</version>
   7.167        <scope>test</scope>
   7.168      </dependency>
   7.169 -    <dependency>
   7.170 -      <groupId>org.apidesign.html</groupId>
   7.171 -      <artifactId>net.java.html.json</artifactId>
   7.172 -      <version>0.1-SNAPSHOT</version>
   7.173 -      <type>jar</type>
   7.174 -    </dependency>
   7.175    </dependencies>
   7.176 -  <profiles>
   7.177 -      <profile>
   7.178 -          <id>fxbrwsr</id>
   7.179 -          <activation>
   7.180 -              <activeByDefault>true</activeByDefault>
   7.181 -          </activation>
   7.182 -          <properties>
   7.183 -              <brwsr>fxbrwsr</brwsr>
   7.184 -          </properties>
   7.185 -          <build>
   7.186 -            <plugins>
   7.187 -                <plugin>
   7.188 -                    <groupId>org.apache.maven.plugins</groupId>
   7.189 -                    <artifactId>maven-jar-plugin</artifactId>
   7.190 -                    <version>2.4</version>
   7.191 -                    <configuration>
   7.192 -                        <archive>
   7.193 -                            <manifest>
   7.194 -                                <mainClass>org.apidesign.bck2brwsr.launcher.FXBrwsrLauncher</mainClass>
   7.195 -                                <addClasspath>true</addClasspath>
   7.196 -                                <classpathPrefix>lib/</classpathPrefix>
   7.197 -                            </manifest>
   7.198 -                            <manifestEntries>
   7.199 -                                <StartPage>${brwsr.startpage}</StartPage>
   7.200 -                            </manifestEntries>
   7.201 -                        </archive>
   7.202 -                    </configuration>
   7.203 -                </plugin>
   7.204 -                <plugin>
   7.205 -                    <artifactId>maven-assembly-plugin</artifactId>
   7.206 -                    <version>2.4</version>
   7.207 -                    <executions>
   7.208 -                        <execution>
   7.209 -                            <id>distro-assembly</id>
   7.210 -                            <phase>package</phase>
   7.211 -                            <goals>
   7.212 -                                <goal>single</goal>
   7.213 -                            </goals>
   7.214 -                            <configuration>
   7.215 -                                <descriptors>
   7.216 -                                    <descriptor>src/main/assembly/fxbrwsr.xml</descriptor>
   7.217 -                                </descriptors>
   7.218 -                            </configuration>
   7.219 -                        </execution>
   7.220 -                    </executions>                
   7.221 -                </plugin>      
   7.222 -            </plugins>
   7.223 -          </build>
   7.224 -          <dependencies>
   7.225 -              <dependency>
   7.226 -                  <groupId>org.apidesign.html</groupId>
   7.227 -                  <artifactId>ko-fx</artifactId>
   7.228 -                  <version>0.1-SNAPSHOT</version>
   7.229 -              </dependency>
   7.230 -              <dependency>
   7.231 -                  <groupId>${project.groupId}</groupId>
   7.232 -                  <artifactId>launcher.fx</artifactId>
   7.233 -                  <version>${project.version}</version>
   7.234 -                  <scope>runtime</scope>
   7.235 -              </dependency>
   7.236 -          </dependencies>
   7.237 -      </profile>
   7.238 -      <profile>
   7.239 -          <id>bck2brwsr</id>
   7.240 -          <activation>
   7.241 -              <property>
   7.242 -                  <name>brwsr</name>
   7.243 -                  <value>bck2brwsr</value>
   7.244 -              </property>
   7.245 -          </activation>
   7.246 -          <build>
   7.247 -              <plugins>
   7.248 -                  <plugin>
   7.249 -                      <groupId>org.apidesign.bck2brwsr</groupId>
   7.250 -                      <artifactId>bck2brwsr-maven-plugin</artifactId>
   7.251 -                      <executions>
   7.252 -                          <execution>
   7.253 -                              <goals>
   7.254 -                                  <goal>j2js</goal>
   7.255 -                              </goals>
   7.256 -                          </execution>
   7.257 -                      </executions>
   7.258 -                      <configuration>
   7.259 -                          <javascript>${project.build.directory}/bck2brwsr.js</javascript>
   7.260 -                          <obfuscation>${bck2brwsr.obfuscationlevel}</obfuscation>
   7.261 -                      </configuration>
   7.262 -                  </plugin>
   7.263 -                  <plugin>
   7.264 -                      <groupId>org.apache.maven.plugins</groupId>
   7.265 -                      <artifactId>maven-compiler-plugin</artifactId>
   7.266 -                      <configuration>
   7.267 -                          <compilerArguments>
   7.268 -                              <bootclasspath>netbeans.ignore.jdk.bootclasspath</bootclasspath>
   7.269 -                          </compilerArguments>
   7.270 -                      </configuration>
   7.271 -                  </plugin>
   7.272 -                  <plugin>
   7.273 -                      <artifactId>maven-assembly-plugin</artifactId>
   7.274 -                      <version>2.4</version>
   7.275 -                      <executions>
   7.276 -                          <execution>
   7.277 -                              <id>distro-assembly</id>
   7.278 -                              <phase>package</phase>
   7.279 -                              <goals>
   7.280 -                                  <goal>single</goal>
   7.281 -                              </goals>
   7.282 -                              <configuration>
   7.283 -                                  <descriptors>
   7.284 -                                      <descriptor>src/main/assembly/bck2brwsr.xml</descriptor>
   7.285 -                                  </descriptors>
   7.286 -                              </configuration>
   7.287 -                          </execution>
   7.288 -                      </executions>                
   7.289 -                  </plugin>      
   7.290 -              </plugins>
   7.291 -          </build>
   7.292 -          <dependencies>
   7.293 -              <dependency>
   7.294 -                  <groupId>org.apidesign.bck2brwsr</groupId>
   7.295 -                  <artifactId>emul</artifactId>
   7.296 -                  <version>${project.version}</version>
   7.297 -                  <classifier>rt</classifier>
   7.298 -              </dependency>
   7.299 -              <dependency>
   7.300 -                  <groupId>org.apidesign.bck2brwsr</groupId>
   7.301 -                  <artifactId>javaquery.api</artifactId>
   7.302 -                  <version>${project.version}</version>
   7.303 -                  <scope>runtime</scope>
   7.304 -              </dependency>
   7.305 -              <dependency>
   7.306 -                  <groupId>${project.groupId}</groupId>
   7.307 -                  <artifactId>launcher.http</artifactId>
   7.308 -                  <version>${project.version}</version>
   7.309 -                  <scope>test</scope>
   7.310 -              </dependency>
   7.311 -          </dependencies>
   7.312 -      </profile>
   7.313 -  </profiles>
   7.314  </project>
     8.1 --- a/javaquery/demo-twitter/src/main/assembly/bck2brwsr.xml	Mon Apr 29 10:04:53 2013 +0200
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,62 +0,0 @@
     8.4 -<?xml version="1.0"?>
     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 -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    8.25 -  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    8.26 -  
    8.27 -  <id>bck2brwsr</id>
    8.28 -  <formats>
    8.29 -      <format>zip</format>
    8.30 -  </formats>
    8.31 -  <baseDirectory>public_html</baseDirectory>
    8.32 -  <dependencySets>
    8.33 -    <dependencySet>
    8.34 -        <useProjectArtifact>false</useProjectArtifact>
    8.35 -        <scope>runtime</scope>
    8.36 -        <outputDirectory>lib</outputDirectory>
    8.37 -        <includes>
    8.38 -            <include>*:jar</include>
    8.39 -            <include>*:rt</include>
    8.40 -        </includes>
    8.41 -    </dependencySet>
    8.42 -  </dependencySets> 
    8.43 -  <fileSets>
    8.44 -      <fileSet>
    8.45 -          <directory>${project.build.directory}/classes/org/apidesign/bck2brwsr/demo/twitter/</directory>
    8.46 -          <includes>
    8.47 -              <include>**/*</include>
    8.48 -          </includes>
    8.49 -          <excludes>
    8.50 -              <exclude>**/*.class</exclude>
    8.51 -          </excludes>
    8.52 -          <outputDirectory>/</outputDirectory>
    8.53 -      </fileSet>
    8.54 -  </fileSets>
    8.55 -  <files>
    8.56 -    <file>
    8.57 -      <source>${project.build.directory}/${project.build.finalName}.jar</source>
    8.58 -      <outputDirectory>/</outputDirectory>
    8.59 -    </file>
    8.60 -    <file>
    8.61 -      <source>${project.build.directory}/bck2brwsr.js</source>
    8.62 -      <outputDirectory>/</outputDirectory>
    8.63 -    </file>
    8.64 -  </files>
    8.65 -</assembly>
    8.66 \ No newline at end of file
     9.1 --- a/javaquery/demo-twitter/src/main/assembly/fxbrwsr.xml	Mon Apr 29 10:04:53 2013 +0200
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,42 +0,0 @@
     9.4 -<?xml version="1.0"?>
     9.5 -<!--
     9.6 -
     9.7 -    Back 2 Browser Bytecode Translator
     9.8 -    Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     9.9 -
    9.10 -    This program is free software: you can redistribute it and/or modify
    9.11 -    it under the terms of the GNU General Public License as published by
    9.12 -    the Free Software Foundation, version 2 of the License.
    9.13 -
    9.14 -    This program is distributed in the hope that it will be useful,
    9.15 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.16 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9.17 -    GNU General Public License for more details.
    9.18 -
    9.19 -    You should have received a copy of the GNU General Public License
    9.20 -    along with this program. Look for COPYING file in the top folder.
    9.21 -    If not, see http://opensource.org/licenses/GPL-2.0.
    9.22 -
    9.23 --->
    9.24 -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    9.25 -  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    9.26 -  
    9.27 -  <id>fxbrwsr</id>
    9.28 -  <formats>
    9.29 -      <format>zip</format>
    9.30 -  </formats>
    9.31 -  <baseDirectory>${project.build.finalName}-fxbrwsr</baseDirectory>
    9.32 -  <dependencySets>
    9.33 -    <dependencySet>
    9.34 -        <useProjectArtifact>false</useProjectArtifact>
    9.35 -        <scope>runtime</scope>
    9.36 -        <outputDirectory>lib</outputDirectory>
    9.37 -    </dependencySet>
    9.38 -  </dependencySets> 
    9.39 -  <files>
    9.40 -    <file>
    9.41 -      <source>${project.build.directory}/${project.build.finalName}.jar</source>
    9.42 -      <outputDirectory>/</outputDirectory>
    9.43 -    </file>
    9.44 -  </files>
    9.45 -</assembly>
    9.46 \ No newline at end of file
    10.1 --- a/javaquery/demo-twitter/src/main/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClient.java	Mon Apr 29 10:04:53 2013 +0200
    10.2 +++ b/javaquery/demo-twitter/src/main/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClient.java	Mon Apr 29 13:56:16 2013 +0200
    10.3 @@ -19,19 +19,16 @@
    10.4  
    10.5  import java.util.Arrays;
    10.6  import java.util.List;
    10.7 -import net.java.html.json.ComputedProperty;
    10.8 -import net.java.html.json.Context;
    10.9 -import net.java.html.json.Function;
   10.10 -import net.java.html.json.Model;
   10.11 -import net.java.html.json.OnPropertyChange;
   10.12 -import net.java.html.json.OnReceive;
   10.13 -import net.java.html.json.Property;
   10.14 +import org.apidesign.bck2brwsr.htmlpage.api.*;
   10.15 +import org.apidesign.bck2brwsr.htmlpage.api.Page;
   10.16 +import org.apidesign.bck2brwsr.htmlpage.api.Property;
   10.17 +import org.apidesign.bck2brwsr.htmlpage.api.ComputedProperty;
   10.18  
   10.19  /** Controller class for access to Twitter.
   10.20   * 
   10.21   * @author Jaroslav Tulach
   10.22   */
   10.23 -@Model(className="TwitterModel", properties={
   10.24 +@Page(xhtml="index.html", className="TwitterModel", properties={
   10.25      @Property(name="savedLists", type=Tweeters.class, array = true),
   10.26      @Property(name="activeTweetersName", type=String.class),
   10.27      @Property(name="activeTweeters", type=String.class, array = true),
   10.28 @@ -109,9 +106,8 @@
   10.29          model.queryTweets("http://search.twitter.com", sb.toString());
   10.30      }
   10.31      
   10.32 -    private static final Context DEFAULT = Context.findDefault(TwitterClient.class);
   10.33      static {
   10.34 -        final TwitterModel model = new TwitterModel(DEFAULT);
   10.35 +        final TwitterModel model = new TwitterModel();
   10.36          final List<Tweeters> svdLst = model.getSavedLists();
   10.37          svdLst.add(newTweeters("API Design", "JaroslavTulach"));
   10.38          svdLst.add(newTweeters("Celebrities", "JohnCleese", "MCHammer", "StephenFry", "algore", "StevenSanderson"));
   10.39 @@ -147,19 +143,19 @@
   10.40              !activeTweeters.contains(userNameToAdd);
   10.41      }
   10.42      
   10.43 -    @Function
   10.44 +    @OnFunction
   10.45      static void deleteList(TwitterModel model) {
   10.46          final List<Tweeters> sl = model.getSavedLists();
   10.47          sl.remove(findByName(sl, model.getActiveTweetersName()));
   10.48          if (sl.isEmpty()) {
   10.49 -            final Tweeters t = new Tweeters(DEFAULT);
   10.50 +            final Tweeters t = new Tweeters();
   10.51              t.setName("New");
   10.52              sl.add(t);
   10.53          }
   10.54          model.setActiveTweetersName(sl.get(0).getName());
   10.55      }
   10.56      
   10.57 -    @Function
   10.58 +    @OnFunction
   10.59      static void saveChanges(TwitterModel model) {
   10.60          Tweeters t = findByName(model.getSavedLists(), model.getActiveTweetersName());
   10.61          int indx = model.getSavedLists().indexOf(t);
   10.62 @@ -170,12 +166,12 @@
   10.63          }
   10.64      }
   10.65      
   10.66 -    @Function
   10.67 +    @OnFunction
   10.68      static void addUser(TwitterModel model) {
   10.69          String n = model.getUserNameToAdd();
   10.70          model.getActiveTweeters().add(n);
   10.71      }
   10.72 -    @Function
   10.73 +    @OnFunction
   10.74      static void removeUser(String data, TwitterModel model) {
   10.75          model.getActiveTweeters().remove(data);
   10.76      }
   10.77 @@ -186,11 +182,11 @@
   10.78                  return l;
   10.79              }
   10.80          }
   10.81 -        return list.isEmpty() ? new Tweeters(DEFAULT) : list.get(0);
   10.82 +        return list.isEmpty() ? new Tweeters() : list.get(0);
   10.83      }
   10.84      
   10.85      private static Tweeters newTweeters(String listName, String... userNames) {
   10.86 -        Tweeters t = new Tweeters(DEFAULT);
   10.87 +        Tweeters t = new Tweeters();
   10.88          t.setName(listName);
   10.89          t.getUserNames().addAll(Arrays.asList(userNames));
   10.90          return t;
    11.1 --- a/javaquery/demo-twitter/src/test/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClientTest.java	Mon Apr 29 10:04:53 2013 +0200
    11.2 +++ b/javaquery/demo-twitter/src/test/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClientTest.java	Mon Apr 29 13:56:16 2013 +0200
    11.3 @@ -18,7 +18,6 @@
    11.4  package org.apidesign.bck2brwsr.demo.twitter;
    11.5  
    11.6  import java.util.List;
    11.7 -import net.java.html.json.Context;
    11.8  import static org.testng.Assert.*;
    11.9  import org.testng.annotations.BeforeMethod;
   11.10  import org.testng.annotations.Test;
   11.11 @@ -33,12 +32,12 @@
   11.12  
   11.13      @BeforeMethod
   11.14      public void initModel() {
   11.15 -        model = new TwitterModel(Context.EMPTY);
   11.16 +        model = new TwitterModel().applyBindings();
   11.17      }
   11.18  
   11.19      @Test public void testIsValidToAdd() {
   11.20          model.setUserNameToAdd("Joe");
   11.21 -        Tweeters t = new Tweeters(Context.EMPTY);
   11.22 +        Tweeters t = new Tweeters();
   11.23          t.setName("test");
   11.24          model.getSavedLists().add(t);
   11.25          model.setActiveTweetersName("test");
    12.1 --- a/javaquery/demo-twitter/src/test/java/org/apidesign/bck2brwsr/demo/twitter/TwitterProtocolTest.java	Mon Apr 29 10:04:53 2013 +0200
    12.2 +++ b/javaquery/demo-twitter/src/test/java/org/apidesign/bck2brwsr/demo/twitter/TwitterProtocolTest.java	Mon Apr 29 13:56:16 2013 +0200
    12.3 @@ -17,7 +17,6 @@
    12.4   */
    12.5  package org.apidesign.bck2brwsr.demo.twitter;
    12.6  
    12.7 -import net.java.html.json.Context;
    12.8  import org.apidesign.bck2brwsr.vmtest.BrwsrTest;
    12.9  import org.apidesign.bck2brwsr.vmtest.Http;
   12.10  import org.apidesign.bck2brwsr.vmtest.VMTest;
   12.11 @@ -74,7 +73,7 @@
   12.12      ))
   12.13      @BrwsrTest public void readFromTwttr() throws InterruptedException {
   12.14          if (page == null) {
   12.15 -            page = new TwitterModel(Context.findDefault(TwitterProtocolTest.class));
   12.16 +            page = new TwitterModel();
   12.17              page.applyBindings();
   12.18              page.queryTweets("", "q=xyz");
   12.19          }