1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/ko/kosample/client-web/nbactions.xml Tue Apr 26 08:04:12 2016 +0200
1.3 @@ -0,0 +1,110 @@
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-2015 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 + <packagings>
1.28 + <packaging>jar</packaging>
1.29 + </packagings>
1.30 + <goals>
1.31 + <goal>package</goal>
1.32 + <goal>bck2brwsr:show</goal>
1.33 + </goals>
1.34 + <properties>
1.35 + <skipTests>true</skipTests>
1.36 + </properties>
1.37 + </action>
1.38 + <action>
1.39 + <actionName>debug</actionName>
1.40 + <packagings>
1.41 + <packaging>jar</packaging>
1.42 + </packagings>
1.43 + <goals>
1.44 + <goal>package</goal>
1.45 + <goal>bck2brwsr:show</goal>
1.46 + </goals>
1.47 + <properties>
1.48 + <skipTests>true</skipTests>
1.49 + <bck2brwsr.obfuscationlevel>NONE</bck2brwsr.obfuscationlevel>
1.50 + <jpda.listen>maven</jpda.listen>
1.51 + </properties>
1.52 + </action>
1.53 + <action>
1.54 + <actionName>CUSTOM-bck2brwsr-show</actionName>
1.55 + <displayName>Run in a Browser</displayName>
1.56 + <goals>
1.57 + <goal>package</goal>
1.58 + <goal>bck2brwsr:show</goal>
1.59 + </goals>
1.60 + <properties>
1.61 + <skipTests>true</skipTests>
1.62 + <bck2brwsr.obfuscationlevel>NONE</bck2brwsr.obfuscationlevel>
1.63 + </properties>
1.64 + </action>
1.65 + <action>
1.66 + <actionName>CUSTOM-bck2brwsr-web</actionName>
1.67 + <displayName>Package for website</displayName>
1.68 + <goals>
1.69 + <goal>clean</goal>
1.70 + <goal>package</goal>
1.71 + </goals>
1.72 + </action>
1.73 + <action>
1.74 + <actionName>CUSTOM-teavm-show</actionName>
1.75 + <displayName>Run in a Browser via TeaVM</displayName>
1.76 + <goals>
1.77 + <goal>package</goal>
1.78 + <goal>bck2brwsr:show</goal>
1.79 + </goals>
1.80 + <activatedProfiles>
1.81 + <activatedProfile>teavm</activatedProfile>
1.82 + </activatedProfiles>
1.83 + <properties>
1.84 + <skipTests>true</skipTests>
1.85 + </properties>
1.86 + </action>
1.87 + <action>
1.88 + <actionName>CUSTOM-teavm-show</actionName>
1.89 + <displayName>Debug in a Browser via TeaVM</displayName>
1.90 + <goals>
1.91 + <goal>package</goal>
1.92 + <goal>bck2brwsr:show</goal>
1.93 + </goals>
1.94 + <activatedProfiles>
1.95 + <activatedProfile>teavm</activatedProfile>
1.96 + </activatedProfiles>
1.97 + <properties>
1.98 + <skipTests>true</skipTests>
1.99 + <teavm.debug>true</teavm.debug>
1.100 + </properties>
1.101 + </action>
1.102 + <action>
1.103 + <actionName>CUSTOM-teavm-web</actionName>
1.104 + <displayName>Package for website via TeaVM</displayName>
1.105 + <goals>
1.106 + <goal>clean</goal>
1.107 + <goal>package</goal>
1.108 + </goals>
1.109 + <activatedProfiles>
1.110 + <activatedProfile>teavm</activatedProfile>
1.111 + </activatedProfiles>
1.112 + </action>
1.113 +</actions>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/ko/kosample/client-web/pom.xml Tue Apr 26 08:04:12 2016 +0200
2.3 @@ -0,0 +1,299 @@
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 + <parent>
2.10 + <groupId>org.apidesign.bck2brwsr</groupId>
2.11 + <artifactId>kosample-pom</artifactId>
2.12 + <version>1.0-SNAPSHOT</version>
2.13 + </parent>
2.14 +
2.15 + <groupId>org.apidesign.bck2brwsr</groupId>
2.16 + <artifactId>kosample-web</artifactId>
2.17 + <version>1.0-SNAPSHOT</version>
2.18 + <packaging>jar</packaging>
2.19 +
2.20 + <name>kosample Client for Web</name>
2.21 +
2.22 + <properties>
2.23 + <netbeans.compile.on.save>none</netbeans.compile.on.save>
2.24 + <project.mainclass>org.apidesign.bck2brwsr.kosample.BrowserMain</project.mainclass>
2.25 + <browser.bootstrap>initialize bck2brwsr -->
2.26 +<script type="text/javascript" src="bck2brwsr.js"></script>
2.27 +<script>
2.28 + var vm = bck2brwsr('kosample.js');
2.29 + var c = vm.loadClass('org.apidesign.bck2brwsr.kosample.BrowserMain');
2.30 + c.invoke('main');
2.31 +</script>
2.32 +<!-- end of initialization </browser.bootstrap>
2.33 + </properties>
2.34 + <build>
2.35 + <plugins>
2.36 + <plugin>
2.37 + <groupId>org.netbeans.html</groupId>
2.38 + <artifactId>html4j-maven-plugin</artifactId>
2.39 + <version>${net.java.html.version}</version>
2.40 + <executions>
2.41 + <execution>
2.42 + <id>js-classes</id>
2.43 + <goals>
2.44 + <goal>process-js-annotations</goal>
2.45 + </goals>
2.46 + </execution>
2.47 + </executions>
2.48 + </plugin>
2.49 + <plugin>
2.50 + <groupId>org.apache.maven.plugins</groupId>
2.51 + <artifactId>maven-compiler-plugin</artifactId>
2.52 + <version>2.3.2</version>
2.53 + <configuration>
2.54 + <source>1.7</source>
2.55 + <target>1.7</target>
2.56 + <compilerArguments>
2.57 + <bootclasspath>netbeans.ignore.jdk.bootclasspath</bootclasspath>
2.58 + </compilerArguments>
2.59 + </configuration>
2.60 + </plugin>
2.61 + <plugin>
2.62 + <groupId>org.apache.maven.plugins</groupId>
2.63 + <artifactId>maven-jar-plugin</artifactId>
2.64 + <version>2.4</version>
2.65 + <configuration>
2.66 + <archive>
2.67 + <manifest>
2.68 + <mainClass>${project.mainclass}</mainClass>
2.69 + <addClasspath>true</addClasspath>
2.70 + <classpathPrefix>lib/</classpathPrefix>
2.71 + <useUniqueVersions>false</useUniqueVersions>
2.72 + </manifest>
2.73 + </archive>
2.74 + </configuration>
2.75 + </plugin>
2.76 + <plugin>
2.77 + <groupId>org.apidesign.bck2brwsr</groupId>
2.78 + <artifactId>bck2brwsr-maven-plugin</artifactId>
2.79 + <version>${bck2brwsr.version}</version>
2.80 + <executions>
2.81 + <execution>
2.82 + <goals>
2.83 + <goal>brwsr</goal>
2.84 + <goal>aot</goal>
2.85 + </goals>
2.86 + </execution>
2.87 + </executions>
2.88 + <configuration>
2.89 + <obfuscation>${bck2brwsr.obfuscationlevel}</obfuscation>
2.90 + <directory>${project.build.directory}/${project.build.finalName}-bck2brwsr/public_html/</directory>
2.91 + <startpage>index.html</startpage>
2.92 + <classPathPrefix>lib</classPathPrefix>
2.93 + <mainJavaScript>${project.build.directory}/kosample.js</mainJavaScript>
2.94 + <exports>
2.95 + <export>${project.mainclass}</export>
2.96 + </exports>
2.97 + </configuration>
2.98 + </plugin>
2.99 + <plugin>
2.100 + <artifactId>maven-assembly-plugin</artifactId>
2.101 + <version>2.4</version>
2.102 + <executions>
2.103 + <execution>
2.104 + <id>distro-assembly</id>
2.105 + <phase>package</phase>
2.106 + <goals>
2.107 + <goal>single</goal>
2.108 + </goals>
2.109 + <configuration>
2.110 + <descriptors>
2.111 + <descriptor>src/main/assembly/bck2brwsr.xml</descriptor>
2.112 + </descriptors>
2.113 + </configuration>
2.114 + </execution>
2.115 + </executions>
2.116 + </plugin>
2.117 + <plugin>
2.118 + <groupId>org.apache.maven.plugins</groupId>
2.119 + <artifactId>maven-dependency-plugin</artifactId>
2.120 + <version>2.9</version>
2.121 + <executions>
2.122 + <execution>
2.123 + <id>unpack</id>
2.124 + <phase>process-resources</phase>
2.125 + <goals>
2.126 + <goal>unpack-dependencies</goal>
2.127 + </goals>
2.128 + </execution>
2.129 + </executions>
2.130 + <configuration>
2.131 + <type>zip</type>
2.132 + <classifier>webpages</classifier>
2.133 + <overWrite>true</overWrite>
2.134 + <outputDirectory>target/web/pages</outputDirectory>
2.135 + <includes>*/**</includes>
2.136 + </configuration>
2.137 + </plugin>
2.138 + </plugins>
2.139 + </build>
2.140 + <dependencies>
2.141 + <dependency>
2.142 + <groupId>org.apidesign.bck2brwsr</groupId>
2.143 + <artifactId>kosample</artifactId>
2.144 + <version>${project.version}</version>
2.145 + <exclusions>
2.146 + <exclusion>
2.147 + <groupId>org.netbeans.html</groupId>
2.148 + <artifactId>net.java.html.boot.fx</artifactId>
2.149 + </exclusion>
2.150 + </exclusions>
2.151 + </dependency>
2.152 + <dependency>
2.153 + <groupId>org.apidesign.bck2brwsr</groupId>
2.154 + <artifactId>emul</artifactId>
2.155 + <version>${bck2brwsr.version}</version>
2.156 + <classifier>rt</classifier>
2.157 + </dependency>
2.158 + <dependency>
2.159 + <groupId>org.netbeans.html</groupId>
2.160 + <artifactId>net.java.html.boot</artifactId>
2.161 + <version>${net.java.html.version}</version>
2.162 + <exclusions>
2.163 + <exclusion>
2.164 + <artifactId>asm</artifactId>
2.165 + <groupId>org.ow2.asm</groupId>
2.166 + </exclusion>
2.167 + </exclusions>
2.168 + </dependency>
2.169 + <dependency>
2.170 + <groupId>org.apidesign.bck2brwsr</groupId>
2.171 + <artifactId>emul</artifactId>
2.172 + <version>${bck2brwsr.version}</version>
2.173 + <classifier>bck2brwsr</classifier>
2.174 + <scope>provided</scope>
2.175 + </dependency>
2.176 + <dependency>
2.177 + <groupId>org.apidesign.bck2brwsr</groupId>
2.178 + <artifactId>ko-bck2brwsr</artifactId>
2.179 + <version>${bck2brwsr.version}</version>
2.180 + <classifier>bck2brwsr</classifier>
2.181 + <scope>provided</scope>
2.182 + </dependency>
2.183 + <dependency>
2.184 + <groupId>org.apidesign.bck2brwsr</groupId>
2.185 + <artifactId>kosample-js</artifactId>
2.186 + <version>${project.version}</version>
2.187 + <classifier>bck2brwsr</classifier>
2.188 + <scope>provided</scope>
2.189 + <type>jar</type>
2.190 + </dependency>
2.191 + </dependencies>
2.192 + <profiles>
2.193 + <profile>
2.194 + <id>teavm</id>
2.195 + <properties>
2.196 + <teavm.version>0.4.0</teavm.version>
2.197 + <teavm.debug>false</teavm.debug>
2.198 + <browser.bootstrap>initialize TeaVM -->
2.199 +<script type="text/javascript" src="teavm.js"></script>
2.200 +<script>
2.201 + main();
2.202 +</script>
2.203 +<!-- end of initialization </browser.bootstrap>
2.204 + </properties>
2.205 + <dependencies>
2.206 + <!-- needs special compile time dep otherwise TeaVM ignores the JAR -->
2.207 + <dependency>
2.208 + <groupId>org.netbeans.html</groupId>
2.209 + <artifactId>ko4j</artifactId>
2.210 + <version>${net.java.html.version}</version>
2.211 + </dependency>
2.212 + </dependencies>
2.213 + <build>
2.214 + <plugins>
2.215 + <plugin>
2.216 + <groupId>org.teavm</groupId>
2.217 + <artifactId>teavm-maven-plugin</artifactId>
2.218 + <version>${teavm.version}</version>
2.219 + <dependencies>
2.220 + <dependency>
2.221 + <groupId>org.teavm</groupId>
2.222 + <artifactId>teavm-classlib</artifactId>
2.223 + <version>${teavm.version}</version>
2.224 + </dependency>
2.225 + <!-- This module adds html4j support. It mainly includes JavaScriptBuilder support.
2.226 + Also there are some little patches to JCL emulation, that are required to pass TCK -->
2.227 + <dependency>
2.228 + <groupId>org.teavm</groupId>
2.229 + <artifactId>teavm-html4j</artifactId>
2.230 + <version>${teavm.version}</version>
2.231 + </dependency>
2.232 + </dependencies>
2.233 + <executions>
2.234 + <execution>
2.235 + <id>generate-teavm</id>
2.236 + <goals>
2.237 + <goal>compile</goal>
2.238 + </goals>
2.239 + <phase>process-classes</phase>
2.240 + <configuration>
2.241 + <mainClass>${project.mainclass}</mainClass>
2.242 + <debugInformationGenerated>${teavm.debug}</debugInformationGenerated>
2.243 + <sourceMapsGenerated>${teavm.debug}</sourceMapsGenerated>
2.244 + <sourceFilesCopied>${teavm.debug}</sourceFilesCopied>
2.245 + <!-- Whether we want TeaVM to minify (obfuscate) the generated JavaScript -->
2.246 + <minifying>false</minifying>
2.247 + <!-- Don't include main page - we created it by ourselves -->
2.248 + <mainPageIncluded>false</mainPageIncluded>
2.249 + <!-- Merge runtime.js instead of putting as a separate file -->
2.250 + <runtime>MERGED</runtime>
2.251 + <!-- Name of the generated file -->
2.252 + <targetFileName>teavm.js</targetFileName>
2.253 + <targetDirectory>${project.build.directory}/teavm</targetDirectory>
2.254 + <!-- This transformer adds null checks before virtual calls. It is not included
2.255 + by default as we don't always need these null checks
2.256 + <transformers>
2.257 + <param>org.teavm.javascript.NullPointerExceptionTransformer</param>
2.258 + </transformers>
2.259 + -->
2.260 + </configuration>
2.261 + </execution>
2.262 + </executions>
2.263 + </plugin>
2.264 + <plugin>
2.265 + <artifactId>maven-assembly-plugin</artifactId>
2.266 + <version>2.4</version>
2.267 + <executions>
2.268 + <execution>
2.269 + <id>distro-assembly</id>
2.270 + <phase>package</phase>
2.271 + <goals>
2.272 + <goal>single</goal>
2.273 + </goals>
2.274 + <configuration>
2.275 + <descriptors>
2.276 + <descriptor>src/main/assembly/teavm.xml</descriptor>
2.277 + </descriptors>
2.278 + </configuration>
2.279 + </execution>
2.280 + </executions>
2.281 + </plugin>
2.282 + <plugin>
2.283 + <groupId>org.apidesign.bck2brwsr</groupId>
2.284 + <artifactId>bck2brwsr-maven-plugin</artifactId>
2.285 + <version>${bck2brwsr.version}</version>
2.286 + <executions>
2.287 + <execution>
2.288 + <goals>
2.289 + <goal>brwsr</goal>
2.290 + </goals>
2.291 + </execution>
2.292 + </executions>
2.293 + <configuration>
2.294 + <directory>${project.build.directory}/${project.build.finalName}-teavm/public_html/</directory>
2.295 + <startpage>index.html</startpage>
2.296 + </configuration>
2.297 + </plugin>
2.298 + </plugins>
2.299 + </build>
2.300 + </profile>
2.301 + </profiles>
2.302 +</project>
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/ko/kosample/client-web/src/main/assembly/bck2brwsr.xml Tue Apr 26 08:04:12 2016 +0200
3.3 @@ -0,0 +1,55 @@
3.4 +<?xml version="1.0"?>
3.5 +<!--
3.6 +
3.7 + Back 2 Browser Bytecode Translator
3.8 + Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
3.9 +
3.10 + This program is free software: you can redistribute it and/or modify
3.11 + it under the terms of the GNU General Public License as published by
3.12 + the Free Software Foundation, version 2 of the License.
3.13 +
3.14 + This program is distributed in the hope that it will be useful,
3.15 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3.16 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.17 + GNU General Public License for more details.
3.18 +
3.19 + You should have received a copy of the GNU General Public License
3.20 + along with this program. Look for COPYING file in the top folder.
3.21 + If not, see http://opensource.org/licenses/GPL-2.0.
3.22 +
3.23 +-->
3.24 +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3.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">
3.26 +
3.27 + <id>bck2brwsr</id>
3.28 + <formats>
3.29 + <format>zip</format>
3.30 + <format>dir</format>
3.31 + </formats>
3.32 + <baseDirectory>public_html</baseDirectory>
3.33 + <fileSets>
3.34 + <fileSet>
3.35 + <directory>target/web/pages</directory>
3.36 + <outputDirectory>/</outputDirectory>
3.37 + <excludes>
3.38 + <exclude>index.html</exclude>
3.39 + </excludes>
3.40 + </fileSet>
3.41 + <fileSet>
3.42 + <directory>target/web/pages</directory>
3.43 + <outputDirectory>/</outputDirectory>
3.44 + <filtered>true</filtered>
3.45 + <includes>
3.46 + <include>index.html</include>
3.47 + </includes>
3.48 + </fileSet>
3.49 + <fileSet>
3.50 + <directory>${project.build.directory}</directory>
3.51 + <outputDirectory>/</outputDirectory>
3.52 + <includes>
3.53 + <include>*.js</include>
3.54 + <include>lib/*.js</include>
3.55 + </includes>
3.56 + </fileSet>
3.57 + </fileSets>
3.58 +</assembly>
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/ko/kosample/client-web/src/main/assembly/teavm.xml Tue Apr 26 08:04:12 2016 +0200
4.3 @@ -0,0 +1,52 @@
4.4 +<?xml version="1.0"?>
4.5 +<!--
4.6 +
4.7 + Back 2 Browser Bytecode Translator
4.8 + Copyright (C) 2012-2015 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 +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4.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">
4.26 +
4.27 + <id>teavm</id>
4.28 + <formats>
4.29 + <format>zip</format>
4.30 + <format>dir</format>
4.31 + </formats>
4.32 + <baseDirectory>public_html</baseDirectory>
4.33 + <fileSets>
4.34 + <fileSet>
4.35 + <directory>target/web/pages</directory>
4.36 + <outputDirectory>/</outputDirectory>
4.37 + <excludes>
4.38 + <exclude>index.html</exclude>
4.39 + </excludes>
4.40 + </fileSet>
4.41 + <fileSet>
4.42 + <directory>target/web/pages</directory>
4.43 + <outputDirectory>/</outputDirectory>
4.44 + <filtered>true</filtered>
4.45 + <includes>
4.46 + <include>index.html</include>
4.47 + </includes>
4.48 + </fileSet>
4.49 + <fileSet>
4.50 + <directory>${project.build.directory}/teavm/</directory>
4.51 + <outputDirectory>/</outputDirectory>
4.52 + <filtered>false</filtered>
4.53 + </fileSet>
4.54 + </fileSets>
4.55 +</assembly>
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/ko/kosample/client-web/src/main/java/org/apidesign/bck2brwsr/kosample/BrowserMain.java Tue Apr 26 08:04:12 2016 +0200
5.3 @@ -0,0 +1,27 @@
5.4 +/**
5.5 + * Back 2 Browser Bytecode Translator
5.6 + * Copyright (C) 2012-2015 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.kosample;
5.22 +
5.23 +public class BrowserMain {
5.24 + private BrowserMain() {
5.25 + }
5.26 +
5.27 + public static void main(String... args) throws Exception {
5.28 + Main.onPageLoad();
5.29 + }
5.30 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/ko/kosample/client/nbactions.xml Tue Apr 26 08:04:12 2016 +0200
6.3 @@ -0,0 +1,51 @@
6.4 +<?xml version="1.0" encoding="UTF-8"?>
6.5 +<!--
6.6 +
6.7 + Back 2 Browser Bytecode Translator
6.8 + Copyright (C) 2012-2015 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 +<actions>
6.25 + <action>
6.26 + <actionName>run</actionName>
6.27 + <goals>
6.28 + <goal>process-classes</goal>
6.29 + <goal>exec:exec</goal>
6.30 + </goals>
6.31 + </action>
6.32 + <action>
6.33 + <actionName>debug</actionName>
6.34 + <goals>
6.35 + <goal>process-classes</goal>
6.36 + <goal>exec:exec</goal>
6.37 + </goals>
6.38 + <properties>
6.39 + <jpda.listen>true</jpda.listen>
6.40 + <exec.debug.arg>-Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}</exec.debug.arg>
6.41 + </properties>
6.42 + </action>
6.43 + <action>
6.44 + <actionName>CUSTOM-Build Desktop App</actionName>
6.45 + <displayName>Build Desktop App</displayName>
6.46 + <goals>
6.47 + <goal>clean</goal>
6.48 + <goal>package</goal>
6.49 + </goals>
6.50 + <activatedProfiles>
6.51 + <activatedProfile>desktop</activatedProfile>
6.52 + </activatedProfiles>
6.53 + </action>
6.54 +</actions>
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/ko/kosample/client/pom.xml Tue Apr 26 08:04:12 2016 +0200
7.3 @@ -0,0 +1,228 @@
7.4 +<?xml version="1.0"?>
7.5 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7.6 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
7.7 + <modelVersion>4.0.0</modelVersion>
7.8 +
7.9 + <parent>
7.10 + <groupId>org.apidesign.bck2brwsr</groupId>
7.11 + <artifactId>kosample-pom</artifactId>
7.12 + <version>1.0-SNAPSHOT</version>
7.13 + </parent>
7.14 +
7.15 + <groupId>org.apidesign.bck2brwsr</groupId>
7.16 + <artifactId>kosample</artifactId>
7.17 + <version>1.0-SNAPSHOT</version>
7.18 + <packaging>bundle</packaging>
7.19 +
7.20 + <name>kosample General Client Code</name>
7.21 +
7.22 + <properties>
7.23 + <netbeans.compile.on.save>all</netbeans.compile.on.save>
7.24 + <project.mainclass>org.apidesign.bck2brwsr.kosample.Main</project.mainclass>
7.25 + <exec.java.bin>${java.home}/bin/java</exec.java.bin>
7.26 + <exec.debug.arg>-Ddebug=false</exec.debug.arg>
7.27 + </properties>
7.28 + <build>
7.29 + <plugins>
7.30 + <plugin>
7.31 + <groupId>org.apache.felix</groupId>
7.32 + <artifactId>maven-bundle-plugin</artifactId>
7.33 + <version>2.4.0</version>
7.34 + <extensions>true</extensions>
7.35 + <configuration>
7.36 + <instructions>
7.37 + <Export-Package>org.apidesign.bck2brwsr.kosample</Export-Package>
7.38 + <Bundle-SymbolicName>org.apidesign.bck2brwsr.kosample</Bundle-SymbolicName>
7.39 + </instructions>
7.40 + </configuration>
7.41 + </plugin>
7.42 + <plugin>
7.43 + <groupId>org.apache.maven.plugins</groupId>
7.44 + <artifactId>maven-compiler-plugin</artifactId>
7.45 + <version>2.3.2</version>
7.46 + <configuration>
7.47 + <source>1.7</source>
7.48 + <target>1.7</target>
7.49 + </configuration>
7.50 + </plugin>
7.51 + <plugin>
7.52 + <groupId>org.apache.maven.plugins</groupId>
7.53 + <artifactId>maven-jar-plugin</artifactId>
7.54 + <version>2.4</version>
7.55 + <configuration>
7.56 + <archive>
7.57 + <manifest>
7.58 + <mainClass>${project.mainclass}</mainClass>
7.59 + <addClasspath>true</addClasspath>
7.60 + <classpathPrefix>lib/</classpathPrefix>
7.61 + <useUniqueVersions>false</useUniqueVersions>
7.62 + </manifest>
7.63 + </archive>
7.64 + </configuration>
7.65 + </plugin>
7.66 + <plugin>
7.67 + <artifactId>maven-source-plugin</artifactId>
7.68 + <version>2.2.1</version>
7.69 + <executions>
7.70 + <execution>
7.71 + <id>attach-sources</id>
7.72 + <phase>post-integration-test</phase>
7.73 + <goals>
7.74 + <goal>jar-no-fork</goal>
7.75 + </goals>
7.76 + </execution>
7.77 + </executions>
7.78 + </plugin>
7.79 + <plugin>
7.80 + <groupId>org.codehaus.mojo</groupId>
7.81 + <artifactId>exec-maven-plugin</artifactId>
7.82 + <version>1.2.1</version>
7.83 + <configuration>
7.84 + <executable>${exec.java.bin}</executable>
7.85 + <classpathScope>test</classpathScope>
7.86 + <arguments>
7.87 + <argument>-classpath</argument>
7.88 + <classpath/>
7.89 + <argument>-javaagent:${project.build.directory}/springloaded.jar</argument>
7.90 + <argument>-noverify</argument>
7.91 + <argument>-Dbrowser.rootdir=${basedir}/src/main/webapp/</argument>
7.92 + <argument>-Dnetbeans.inspect.port=${netbeans.inspect.port}</argument>
7.93 + <argument>${exec.debug.arg}</argument>
7.94 + <argument>${project.mainclass}</argument>
7.95 + </arguments>
7.96 + </configuration>
7.97 + </plugin>
7.98 + <plugin>
7.99 + <groupId>org.apache.maven.plugins</groupId>
7.100 + <artifactId>maven-dependency-plugin</artifactId>
7.101 + <version>2.10</version>
7.102 + <executions>
7.103 + <execution>
7.104 + <id>copy</id>
7.105 + <phase>package</phase>
7.106 + <goals>
7.107 + <goal>copy</goal>
7.108 + </goals>
7.109 + <configuration>
7.110 + <artifactItems>
7.111 + <artifactItem>
7.112 + <groupId>org.springframework</groupId>
7.113 + <artifactId>springloaded</artifactId>
7.114 + <version>1.2.3.RELEASE</version>
7.115 + <type>jar</type>
7.116 + <overWrite>false</overWrite>
7.117 + <destFileName>springloaded.jar</destFileName>
7.118 + </artifactItem>
7.119 + </artifactItems>
7.120 + <outputDirectory>${project.build.directory}</outputDirectory>
7.121 + </configuration>
7.122 + </execution>
7.123 + </executions>
7.124 + </plugin>
7.125 + <plugin>
7.126 + <artifactId>maven-assembly-plugin</artifactId>
7.127 + <version>2.4</version>
7.128 + <executions>
7.129 + <execution>
7.130 + <id>web-pages</id>
7.131 + <phase>package</phase>
7.132 + <goals>
7.133 + <goal>single</goal>
7.134 + </goals>
7.135 + <configuration>
7.136 + <descriptors>
7.137 + <descriptor>src/main/assembly/webpages.xml</descriptor>
7.138 + </descriptors>
7.139 + </configuration>
7.140 + </execution>
7.141 + </executions>
7.142 + </plugin>
7.143 + </plugins>
7.144 + </build>
7.145 + <dependencies>
7.146 + <dependency>
7.147 + <groupId>org.netbeans.html</groupId>
7.148 + <artifactId>net.java.html</artifactId>
7.149 + <version>${net.java.html.version}</version>
7.150 + </dependency>
7.151 + <dependency>
7.152 + <groupId>org.netbeans.html</groupId>
7.153 + <artifactId>net.java.html.json</artifactId>
7.154 + <version>${net.java.html.version}</version>
7.155 + </dependency>
7.156 + <dependency>
7.157 + <groupId>org.netbeans.html</groupId>
7.158 + <artifactId>net.java.html.boot</artifactId>
7.159 + <version>${net.java.html.version}</version>
7.160 + </dependency>
7.161 + <dependency>
7.162 + <groupId>org.netbeans.html</groupId>
7.163 + <artifactId>net.java.html.sound</artifactId>
7.164 + <version>${net.java.html.version}</version>
7.165 + </dependency>
7.166 + <dependency>
7.167 + <groupId>org.netbeans.html</groupId>
7.168 + <artifactId>ko4j</artifactId>
7.169 + <version>${net.java.html.version}</version>
7.170 + <scope>runtime</scope>
7.171 + </dependency>
7.172 + <dependency>
7.173 + <groupId>org.testng</groupId>
7.174 + <artifactId>testng</artifactId>
7.175 + <scope>test</scope>
7.176 + </dependency>
7.177 + <dependency>
7.178 + <groupId>org.netbeans.html</groupId>
7.179 + <artifactId>net.java.html.boot.script</artifactId>
7.180 + <version>${net.java.html.version}</version>
7.181 + <scope>test</scope>
7.182 + <type>jar</type>
7.183 + </dependency>
7.184 + <dependency>
7.185 + <groupId>org.apidesign.bck2brwsr</groupId>
7.186 + <artifactId>kosample-js</artifactId>
7.187 + <version>${project.version}</version>
7.188 + </dependency>
7.189 + <dependency>
7.190 + <groupId>org.netbeans.html</groupId>
7.191 + <artifactId>net.java.html.boot.fx</artifactId>
7.192 + <version>${net.java.html.version}</version>
7.193 + <scope>provided</scope>
7.194 + </dependency>
7.195 + </dependencies>
7.196 + <profiles>
7.197 + <profile>
7.198 + <id>desktop</id>
7.199 + <dependencies>
7.200 + <dependency>
7.201 + <groupId>org.netbeans.html</groupId>
7.202 + <artifactId>net.java.html.boot.fx</artifactId>
7.203 + <version>${net.java.html.version}</version>
7.204 + <scope>runtime</scope>
7.205 + </dependency>
7.206 + </dependencies>
7.207 + <build>
7.208 + <plugins>
7.209 + <plugin>
7.210 + <artifactId>maven-assembly-plugin</artifactId>
7.211 + <version>2.4</version>
7.212 + <executions>
7.213 + <execution>
7.214 + <id>distro-assembly</id>
7.215 + <phase>package</phase>
7.216 + <goals>
7.217 + <goal>single</goal>
7.218 + </goals>
7.219 + <configuration>
7.220 + <descriptors>
7.221 + <descriptor>src/main/assembly/javafx.xml</descriptor>
7.222 + </descriptors>
7.223 + </configuration>
7.224 + </execution>
7.225 + </executions>
7.226 + </plugin>
7.227 + </plugins>
7.228 + </build>
7.229 + </profile>
7.230 + </profiles>
7.231 +</project>
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/ko/kosample/client/src/main/assembly/javafx.xml Tue Apr 26 08:04:12 2016 +0200
8.3 @@ -0,0 +1,51 @@
8.4 +<?xml version="1.0"?>
8.5 +<!--
8.6 +
8.7 + Back 2 Browser Bytecode Translator
8.8 + Copyright (C) 2012-2015 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>javafx</id>
8.28 + <formats>
8.29 + <format>zip</format>
8.30 + </formats>
8.31 + <baseDirectory>${project.build.finalName}-app</baseDirectory>
8.32 + <dependencySets>
8.33 + <dependencySet>
8.34 + <useProjectArtifact>false</useProjectArtifact>
8.35 + <scope>runtime</scope>
8.36 + <outputDirectory>lib</outputDirectory>
8.37 + </dependencySet>
8.38 + </dependencySets>
8.39 + <files>
8.40 + <file>
8.41 + <source>${project.build.directory}/${project.build.finalName}.jar</source>
8.42 + <outputDirectory>/</outputDirectory>
8.43 + </file>
8.44 + </files>
8.45 + <fileSets>
8.46 + <fileSet>
8.47 + <directory>src/main/webapp/</directory>
8.48 + <outputDirectory>/</outputDirectory>
8.49 + <includes>
8.50 + <include>pages/**</include>
8.51 + </includes>
8.52 + </fileSet>
8.53 + </fileSets>
8.54 +</assembly>
8.55 \ No newline at end of file
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/ko/kosample/client/src/main/assembly/webpages.xml Tue Apr 26 08:04:12 2016 +0200
9.3 @@ -0,0 +1,36 @@
9.4 +<?xml version="1.0"?>
9.5 +<!--
9.6 +
9.7 + Back 2 Browser Bytecode Translator
9.8 + Copyright (C) 2012-2015 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>webpages</id>
9.28 + <formats>
9.29 + <format>zip</format>
9.30 + </formats>
9.31 + <baseDirectory>/</baseDirectory>
9.32 + <fileSets>
9.33 + <fileSet>
9.34 + <directory>src/main/webapp/pages</directory>
9.35 + <outputDirectory>/</outputDirectory>
9.36 + <filtered>false</filtered>
9.37 + </fileSet>
9.38 + </fileSets>
9.39 +</assembly>
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/ko/kosample/client/src/main/java/org/apidesign/bck2brwsr/kosample/DataModel.java Tue Apr 26 08:04:12 2016 +0200
10.3 @@ -0,0 +1,79 @@
10.4 +/**
10.5 + * Back 2 Browser Bytecode Translator
10.6 + * Copyright (C) 2012-2015 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.kosample;
10.22 +
10.23 +import net.java.html.json.ComputedProperty;
10.24 +import net.java.html.json.Function;
10.25 +import net.java.html.json.Model;
10.26 +import net.java.html.json.Property;
10.27 +import org.apidesign.bck2brwsr.kosample.js.Dialogs;
10.28 +
10.29 +/** Model annotation generates class Data with
10.30 + * one message property, boolean property and read only words property
10.31 + */
10.32 +@Model(className = "Data", targetId="", properties = {
10.33 + @Property(name = "message", type = String.class),
10.34 + @Property(name = "rotating", type = boolean.class)
10.35 +})
10.36 +final class DataModel {
10.37 + @ComputedProperty static java.util.List<String> words(String message) {
10.38 + String[] arr = new String[6];
10.39 + String[] words = message == null ? new String[0] : message.split(" ", 6);
10.40 + for (int i = 0; i < 6; i++) {
10.41 + arr[i] = words.length > i ? words[i] : "!";
10.42 + }
10.43 + return java.util.Arrays.asList(arr);
10.44 + }
10.45 +
10.46 + @Function static void turnAnimationOn(Data model) {
10.47 + model.setRotating(true);
10.48 + }
10.49 +
10.50 + @Function static void turnAnimationOff(final Data model) {
10.51 + Dialogs.confirmByUser("Really turn off?", new Runnable() {
10.52 + @Override
10.53 + public void run() {
10.54 + model.setRotating(false);
10.55 + }
10.56 + });
10.57 + }
10.58 +
10.59 + @Function static void rotate5s(final Data model) {
10.60 + model.setRotating(true);
10.61 + java.util.Timer timer = new java.util.Timer("Rotates a while");
10.62 + timer.schedule(new java.util.TimerTask() {
10.63 + @Override
10.64 + public void run() {
10.65 + model.setRotating(false);
10.66 + }
10.67 + }, 5000);
10.68 + }
10.69 +
10.70 + @Function static void showScreenSize(Data model) {
10.71 + model.setMessage(Dialogs.screenSize());
10.72 + }
10.73 + private static Data ui;
10.74 + /**
10.75 + * Called when the page is ready.
10.76 + */
10.77 + static void onPageLoad() throws Exception {
10.78 + ui = new Data();
10.79 + ui.setMessage("Hello World from HTML and Java!");
10.80 + ui.applyBindings();
10.81 + }
10.82 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/ko/kosample/client/src/main/java/org/apidesign/bck2brwsr/kosample/Main.java Tue Apr 26 08:04:12 2016 +0200
11.3 @@ -0,0 +1,42 @@
11.4 +/**
11.5 + * Back 2 Browser Bytecode Translator
11.6 + * Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
11.7 + *
11.8 + * This program is free software: you can redistribute it and/or modify
11.9 + * it under the terms of the GNU General Public License as published by
11.10 + * the Free Software Foundation, version 2 of the License.
11.11 + *
11.12 + * This program is distributed in the hope that it will be useful,
11.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11.15 + * GNU General Public License for more details.
11.16 + *
11.17 + * You should have received a copy of the GNU General Public License
11.18 + * along with this program. Look for COPYING file in the top folder.
11.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
11.20 + */
11.21 +package org.apidesign.bck2brwsr.kosample;
11.22 +
11.23 +import net.java.html.boot.BrowserBuilder;
11.24 +
11.25 +public final class Main {
11.26 + private Main() {
11.27 + }
11.28 +
11.29 + public static void main(String... args) throws Exception {
11.30 + BrowserBuilder.newBrowser().
11.31 + loadPage("pages/index.html").
11.32 + loadClass(Main.class).
11.33 + invoke("onPageLoad", args).
11.34 + showAndWait();
11.35 + System.exit(0);
11.36 + }
11.37 +
11.38 + /**
11.39 + * Called when the page is ready.
11.40 + */
11.41 + public static void onPageLoad() throws Exception {
11.42 + DataModel.onPageLoad();
11.43 + }
11.44 +
11.45 +}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/ko/kosample/client/src/main/webapp/pages/index.html Tue Apr 26 08:04:12 2016 +0200
12.3 @@ -0,0 +1,91 @@
12.4 +<!--
12.5 +
12.6 + Back 2 Browser Bytecode Translator
12.7 + Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
12.8 +
12.9 + This program is free software: you can redistribute it and/or modify
12.10 + it under the terms of the GNU General Public License as published by
12.11 + the Free Software Foundation, version 2 of the License.
12.12 +
12.13 + This program is distributed in the hope that it will be useful,
12.14 + but WITHOUT ANY WARRANTY; without even the implied warranty of
12.15 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12.16 + GNU General Public License for more details.
12.17 +
12.18 + You should have received a copy of the GNU General Public License
12.19 + along with this program. Look for COPYING file in the top folder.
12.20 + If not, see http://opensource.org/licenses/GPL-2.0.
12.21 +
12.22 +-->
12.23 +<!DOCTYPE html>
12.24 +<html>
12.25 + <head>
12.26 + <title></title>
12.27 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
12.28 + <style type="text/css">
12.29 + @-webkit-keyframes spin {
12.30 + 0% { -webkit-transform: rotate(0deg); }
12.31 + 100% { -webkit-transform: rotate(360deg); }
12.32 + }
12.33 + @keyframes spin {
12.34 + 0% { transform: rotate(0deg); }
12.35 + 100% { transform: rotate(360deg); }
12.36 + }
12.37 +
12.38 + input {
12.39 + width: 100%;
12.40 + }
12.41 +
12.42 + .rotate {
12.43 + -webkit-animation-name: spin;
12.44 + -webkit-animation-duration: 3s;
12.45 + -webkit-animation-iteration-count: infinite;
12.46 + -webkit-animation-direction: alternate;
12.47 + animation-name: spin;
12.48 + animation-duration: 3s;
12.49 + animation-iteration-count: infinite;
12.50 + animation-direction: alternate;
12.51 + }
12.52 +
12.53 + #scene {
12.54 + position: relative;
12.55 + top: 60px;
12.56 + text-align: center;
12.57 + }
12.58 +
12.59 + #words span {
12.60 + border: 1px solid #ccc;
12.61 + background: rgba(255,255,155,0.8);
12.62 + text-align: center;
12.63 + font-size: 30px;
12.64 + -webkit-box-shadow: inset 0 0 40px rgba(0,0,0,0.4);
12.65 + box-shadow: inset 0 0 40px rgba(0,0,0,0.4);
12.66 + position: absolute;
12.67 + }
12.68 +
12.69 + #words span:nth-child(1) { left: 45%; top: 0px; }
12.70 + #words span:nth-child(2) { left: 25%; top: 100px; }
12.71 + #words span:nth-child(3) { left: 65%; top: 100px; }
12.72 + #words span:nth-child(4) { left: 10%; top: 200px; }
12.73 + #words span:nth-child(5) { left: 45%; top: 200px; }
12.74 + #words span:nth-child(6) { left: 80%; top: 200px; }
12.75 +
12.76 + </style>
12.77 + </head>
12.78 + <body>
12.79 + <h1>Words Demo</h1>
12.80 + <input data-bind="textInput: message">
12.81 + <br>
12.82 + <button data-bind="enable: !rotating(), click: $root.turnAnimationOn">Start</button>
12.83 + <button data-bind="enable: rotating, click: $root.turnAnimationOff">Stop</button>
12.84 + <button data-bind="enable: !rotating(), click: $root.rotate5s">Rotate Few Seconds</button>
12.85 + <button data-bind="click: $root.showScreenSize">Screen Size!</button>
12.86 +
12.87 + <div id="scene">
12.88 + <span id="words" data-bind="foreach: words">
12.89 + <span data-bind="text: $data, css: { 'rotate' : $root.rotating } "></span>
12.90 + </span>
12.91 + </div>
12.92 +<!-- ${browser.bootstrap} -->
12.93 + </body>
12.94 +</html>
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/ko/kosample/client/src/test/java/org/apidesign/bck2brwsr/kosample/DataModelTest.java Tue Apr 26 08:04:12 2016 +0200
13.3 @@ -0,0 +1,33 @@
13.4 +/**
13.5 + * Back 2 Browser Bytecode Translator
13.6 + * Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
13.7 + *
13.8 + * This program is free software: you can redistribute it and/or modify
13.9 + * it under the terms of the GNU General Public License as published by
13.10 + * the Free Software Foundation, version 2 of the License.
13.11 + *
13.12 + * This program is distributed in the hope that it will be useful,
13.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13.15 + * GNU General Public License for more details.
13.16 + *
13.17 + * You should have received a copy of the GNU General Public License
13.18 + * along with this program. Look for COPYING file in the top folder.
13.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
13.20 + */
13.21 +package org.apidesign.bck2brwsr.kosample;
13.22 +
13.23 +import static org.testng.Assert.*;
13.24 +import org.testng.annotations.Test;
13.25 +
13.26 +public class DataModelTest {
13.27 + @Test public void testUIModelWithoutUI() {
13.28 + Data model = new Data();
13.29 + model.setMessage("Hello World!");
13.30 +
13.31 + java.util.List<String> arr = model.getWords();
13.32 + assertEquals(arr.size(), 6, "Six words always");
13.33 + assertEquals("Hello", arr.get(0), "Hello is the first word");
13.34 + assertEquals("World!", arr.get(1), "World is the second word");
13.35 + }
13.36 +}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/ko/kosample/js/pom.xml Tue Apr 26 08:04:12 2016 +0200
14.3 @@ -0,0 +1,92 @@
14.4 +<?xml version="1.0" encoding="UTF-8"?>
14.5 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
14.6 + <modelVersion>4.0.0</modelVersion>
14.7 + <parent>
14.8 + <groupId>org.apidesign.bck2brwsr</groupId>
14.9 + <artifactId>kosample-pom</artifactId>
14.10 + <version>1.0-SNAPSHOT</version>
14.11 + </parent>
14.12 +
14.13 + <groupId>org.apidesign.bck2brwsr</groupId>
14.14 + <artifactId>kosample-js</artifactId>
14.15 + <version>1.0-SNAPSHOT</version>
14.16 + <packaging>bundle</packaging>
14.17 +
14.18 + <name>kosample JavaScript Libraries</name>
14.19 +
14.20 + <properties>
14.21 + <netbeans.compile.on.save>none</netbeans.compile.on.save>
14.22 + </properties>
14.23 + <build>
14.24 + <plugins>
14.25 + <plugin>
14.26 + <groupId>org.apache.felix</groupId>
14.27 + <artifactId>maven-bundle-plugin</artifactId>
14.28 + <version>2.4.0</version>
14.29 + <extensions>true</extensions>
14.30 + <configuration>
14.31 + <instructions>
14.32 + <Export-Package>org.apidesign.bck2brwsr.kosample.js</Export-Package>
14.33 + <Bundle-SymbolicName>org.apidesign.bck2brwsr.kosample.js</Bundle-SymbolicName>
14.34 + </instructions>
14.35 + </configuration>
14.36 + </plugin>
14.37 + <plugin>
14.38 + <groupId>org.netbeans.html</groupId>
14.39 + <artifactId>html4j-maven-plugin</artifactId>
14.40 + <version>${net.java.html.version}</version>
14.41 + <executions>
14.42 + <execution>
14.43 + <id>js-classes</id>
14.44 + <goals>
14.45 + <goal>process-js-annotations</goal>
14.46 + </goals>
14.47 + </execution>
14.48 + </executions>
14.49 + </plugin>
14.50 + <plugin>
14.51 + <groupId>org.apache.maven.plugins</groupId>
14.52 + <artifactId>maven-compiler-plugin</artifactId>
14.53 + <version>2.3.2</version>
14.54 + <configuration>
14.55 + <source>1.7</source>
14.56 + <target>1.7</target>
14.57 + </configuration>
14.58 + </plugin>
14.59 + <plugin>
14.60 + <groupId>org.apidesign.bck2brwsr</groupId>
14.61 + <artifactId>bck2brwsr-maven-plugin</artifactId>
14.62 + <version>${bck2brwsr.version}</version>
14.63 + <executions>
14.64 + <execution>
14.65 + <goals>
14.66 + <goal>library</goal>
14.67 + </goals>
14.68 + </execution>
14.69 + </executions>
14.70 + <configuration>
14.71 + <obfuscation>NONE</obfuscation>
14.72 + </configuration>
14.73 + </plugin>
14.74 + </plugins>
14.75 + </build>
14.76 + <dependencies>
14.77 + <dependency>
14.78 + <groupId>org.netbeans.html</groupId>
14.79 + <artifactId>net.java.html.boot</artifactId>
14.80 + <version>${net.java.html.version}</version>
14.81 + </dependency>
14.82 + <dependency>
14.83 + <groupId>org.testng</groupId>
14.84 + <artifactId>testng</artifactId>
14.85 + <scope>test</scope>
14.86 + </dependency>
14.87 + <dependency>
14.88 + <groupId>org.netbeans.html</groupId>
14.89 + <artifactId>net.java.html.boot.script</artifactId>
14.90 + <version>${net.java.html.version}</version>
14.91 + <scope>test</scope>
14.92 + <type>jar</type>
14.93 + </dependency>
14.94 + </dependencies>
14.95 +</project>
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/ko/kosample/js/src/main/java/org/apidesign/bck2brwsr/kosample/js/Dialogs.java Tue Apr 26 08:04:12 2016 +0200
15.3 @@ -0,0 +1,57 @@
15.4 +/**
15.5 + * Back 2 Browser Bytecode Translator
15.6 + * Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
15.7 + *
15.8 + * This program is free software: you can redistribute it and/or modify
15.9 + * it under the terms of the GNU General Public License as published by
15.10 + * the Free Software Foundation, version 2 of the License.
15.11 + *
15.12 + * This program is distributed in the hope that it will be useful,
15.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
15.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15.15 + * GNU General Public License for more details.
15.16 + *
15.17 + * You should have received a copy of the GNU General Public License
15.18 + * along with this program. Look for COPYING file in the top folder.
15.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
15.20 + */
15.21 +package org.apidesign.bck2brwsr.kosample.js;
15.22 +
15.23 +import net.java.html.js.JavaScriptBody;
15.24 +
15.25 +/** Use {@link JavaScriptBody} annotation on methods to
15.26 + * directly interact with JavaScript. See
15.27 + * http://bits.netbeans.org/html+java/1.2/net/java/html/js/package-summary.html
15.28 + * to understand how.
15.29 + */
15.30 +public final class Dialogs {
15.31 + private Dialogs() {
15.32 + }
15.33 +
15.34 + /** Shows confirmation dialog to the user.
15.35 + *
15.36 + * @param msg the message
15.37 + * @param callback called back when the use accepts (can be null)
15.38 + */
15.39 + @JavaScriptBody(
15.40 + args = { "msg", "callback" },
15.41 + javacall = true,
15.42 + body = "if (confirm(msg)) {\n"
15.43 + + " callback.@java.lang.Runnable::run()();\n"
15.44 + + "}\n"
15.45 + )
15.46 + public static native void confirmByUser(String msg, Runnable callback);
15.47 +
15.48 + @JavaScriptBody(
15.49 + args = {}, body =
15.50 + "var w = window,\n" +
15.51 + " d = document,\n" +
15.52 + " e = d.documentElement,\n" +
15.53 + " g = d.getElementsByTagName('body')[0],\n" +
15.54 + " x = w.innerWidth || e.clientWidth || g.clientWidth,\n" +
15.55 + " y = w.innerHeight|| e.clientHeight|| g.clientHeight;\n" +
15.56 + "\n" +
15.57 + "return 'Screen size is ' + x + ' times ' + y;\n"
15.58 + )
15.59 + public static native String screenSize();
15.60 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/ko/kosample/js/src/test/java/org/apidesign/bck2brwsr/kosample/js/JsInteractionTest.java Tue Apr 26 08:04:12 2016 +0200
16.3 @@ -0,0 +1,57 @@
16.4 +/**
16.5 + * Back 2 Browser Bytecode Translator
16.6 + * Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
16.7 + *
16.8 + * This program is free software: you can redistribute it and/or modify
16.9 + * it under the terms of the GNU General Public License as published by
16.10 + * the Free Software Foundation, version 2 of the License.
16.11 + *
16.12 + * This program is distributed in the hope that it will be useful,
16.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16.15 + * GNU General Public License for more details.
16.16 + *
16.17 + * You should have received a copy of the GNU General Public License
16.18 + * along with this program. Look for COPYING file in the top folder.
16.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
16.20 + */
16.21 +package org.apidesign.bck2brwsr.kosample.js;
16.22 +
16.23 +import java.io.Closeable;
16.24 +import net.java.html.boot.script.Scripts;
16.25 +import org.netbeans.html.boot.spi.Fn;
16.26 +import static org.testng.Assert.assertEquals;
16.27 +import org.testng.annotations.AfterMethod;
16.28 +import org.testng.annotations.BeforeMethod;
16.29 +import org.testng.annotations.Test;
16.30 +
16.31 +/** Tests for behavior of @JavaScriptBody methods. Set your JavaScript
16.32 + * environment up (for example define <code>alert</code> or use some
16.33 + * emulation library like <em>env.js</em>), register script presenter
16.34 + * and then you can call methods that deal with JavaScript in your tests.
16.35 + */
16.36 +public class JsInteractionTest {
16.37 + private Closeable jsEngine;
16.38 + @BeforeMethod public void initializeJSEngine() throws Exception {
16.39 + jsEngine = Fn.activate(Scripts.createPresenter());
16.40 + }
16.41 +
16.42 + @AfterMethod public void shutdownJSEngine() throws Exception {
16.43 + jsEngine.close();
16.44 + }
16.45 + @Test public void testCallbackFromJavaScript() throws Exception {
16.46 + class R implements Runnable {
16.47 + int called;
16.48 +
16.49 + @Override
16.50 + public void run() {
16.51 + called++;
16.52 + }
16.53 + }
16.54 + R callback = new R();
16.55 +
16.56 + Dialogs.confirmByUser("Hello", callback);
16.57 +
16.58 + assertEquals(callback.called, 1, "One immediate callback");
16.59 + }
16.60 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/ko/kosample/pom.xml Tue Apr 26 08:04:12 2016 +0200
17.3 @@ -0,0 +1,59 @@
17.4 +<?xml version="1.0" encoding="UTF-8"?>
17.5 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
17.6 + <modelVersion>4.0.0</modelVersion>
17.7 + <parent>
17.8 + <artifactId>ko</artifactId>
17.9 + <groupId>org.apidesign.bck2brwsr</groupId>
17.10 + <version>1.0-SNAPSHOT</version>
17.11 + </parent>
17.12 +
17.13 + <groupId>org.apidesign.bck2brwsr</groupId>
17.14 + <artifactId>kosample-pom</artifactId>
17.15 + <version>1.0-SNAPSHOT</version>
17.16 + <packaging>pom</packaging>
17.17 +
17.18 + <name>kosample</name>
17.19 + <modules>
17.20 + <module>client</module>
17.21 + <module>client-web</module>
17.22 + <module>js</module>
17.23 + </modules>
17.24 + <properties>
17.25 + <bck2brwsr.version>${project.version}</bck2brwsr.version>
17.26 + <bck2brwsr.obfuscationlevel>FULL</bck2brwsr.obfuscationlevel>
17.27 + <jersey.version>2.13</jersey.version>
17.28 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17.29 + </properties>
17.30 + <dependencyManagement>
17.31 + <dependencies>
17.32 + <dependency>
17.33 + <groupId>org.testng</groupId>
17.34 + <artifactId>testng</artifactId>
17.35 + <scope>test</scope>
17.36 + <version>6.8.8</version>
17.37 + </dependency>
17.38 + </dependencies>
17.39 + </dependencyManagement>
17.40 + <build>
17.41 + <plugins>
17.42 + <plugin>
17.43 + <groupId>org.apache.maven.plugins</groupId>
17.44 + <artifactId>maven-enforcer-plugin</artifactId>
17.45 + <version>1.3.1</version>
17.46 + <executions>
17.47 + <execution>
17.48 + <id>enforce-versions</id>
17.49 + <goals>
17.50 + <goal>enforce</goal>
17.51 + </goals>
17.52 + <configuration>
17.53 + <rules>
17.54 + <DependencyConvergence />
17.55 + </rules>
17.56 + </configuration>
17.57 + </execution>
17.58 + </executions>
17.59 + </plugin>
17.60 + </plugins>
17.61 + </build>
17.62 +</project>
18.1 --- a/ko/pom.xml Tue Apr 26 07:59:10 2016 +0200
18.2 +++ b/ko/pom.xml Tue Apr 26 08:04:12 2016 +0200
18.3 @@ -14,5 +14,6 @@
18.4 <modules>
18.5 <module>bck2brwsr</module>
18.6 <module>fx</module>
18.7 + <module>kosample</module>
18.8 </modules>
18.9 </project>