1.1 --- a/pom.xml Wed Jul 31 17:04:32 2013 +0200
1.2 +++ b/pom.xml Tue Sep 24 21:08:15 2013 +0200
1.3 @@ -20,6 +20,8 @@
1.4 <module>twitter</module>
1.5 <module>chat</module>
1.6 <module>chess</module>
1.7 + <module>spinningcube</module>
1.8 + <module>words</module>
1.9 </modules>
1.10 <licenses>
1.11 <license>
1.12 @@ -79,4 +81,4 @@
1.13 </plugin>
1.14 </plugins>
1.15 </build>
1.16 -</project>
1.17 \ No newline at end of file
1.18 +</project>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/spinningcube/nbactions-iOS.xml Tue Sep 24 21:08:15 2013 +0200
2.3 @@ -0,0 +1,51 @@
2.4 +<?xml version="1.0" encoding="UTF-8"?>
2.5 +<!--
2.6 +
2.7 + The MIT License (MIT)
2.8 +
2.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
2.10 +
2.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
2.12 + of this software and associated documentation files (the "Software"), to deal
2.13 + in the Software without restriction, including without limitation the rights
2.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2.15 + copies of the Software, and to permit persons to whom the Software is
2.16 + furnished to do so, subject to the following conditions:
2.17 +
2.18 + The above copyright notice and this permission notice shall be included in
2.19 + all copies or substantial portions of the Software.
2.20 +
2.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2.27 + THE SOFTWARE.
2.28 +
2.29 +-->
2.30 +<actions>
2.31 + <action>
2.32 + <actionName>run</actionName>
2.33 + <goals>
2.34 + <goal>package</goal>
2.35 + <goal>org.netbeans.ios:ios-maven-plugin:0.2:deploy</goal>
2.36 + </goals>
2.37 + <properties>
2.38 + <skipTests>true</skipTests>
2.39 + </properties>
2.40 + </action>
2.41 + <action>
2.42 + <actionName>debug</actionName>
2.43 + <goals>
2.44 + <goal>package</goal>
2.45 + <goal>org.netbeans.ios:ios-maven-plugin:0.2:deploy</goal>
2.46 + </goals>
2.47 + <properties>
2.48 + <skipTests>true</skipTests>
2.49 + <jpda.listen>true</jpda.listen>
2.50 + <jpdaAddress>${jpda.address}</jpdaAddress>
2.51 + <runMode>Debug</runMode>
2.52 + </properties>
2.53 + </action>
2.54 +</actions>
2.55 \ No newline at end of file
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/spinningcube/nbactions.xml Tue Sep 24 21:08:15 2013 +0200
3.3 @@ -0,0 +1,45 @@
3.4 +<?xml version="1.0" encoding="UTF-8"?>
3.5 +<!--
3.6 +
3.7 + The MIT License (MIT)
3.8 +
3.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
3.10 +
3.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
3.12 + of this software and associated documentation files (the "Software"), to deal
3.13 + in the Software without restriction, including without limitation the rights
3.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3.15 + copies of the Software, and to permit persons to whom the Software is
3.16 + furnished to do so, subject to the following conditions:
3.17 +
3.18 + The above copyright notice and this permission notice shall be included in
3.19 + all copies or substantial portions of the Software.
3.20 +
3.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3.27 + THE SOFTWARE.
3.28 +
3.29 +-->
3.30 +<actions>
3.31 + <action>
3.32 + <actionName>run</actionName>
3.33 + <goals>
3.34 + <goal>process-classes</goal>
3.35 + <goal>exec:java</goal>
3.36 + </goals>
3.37 + </action>
3.38 + <action>
3.39 + <actionName>debug</actionName>
3.40 + <goals>
3.41 + <goal>process-classes</goal>
3.42 + <goal>exec:java</goal>
3.43 + </goals>
3.44 + <properties>
3.45 + <jpda.listen>maven</jpda.listen>
3.46 + </properties>
3.47 + </action>
3.48 +</actions>
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/spinningcube/pom.xml Tue Sep 24 21:08:15 2013 +0200
4.3 @@ -0,0 +1,148 @@
4.4 +<?xml version="1.0" encoding="UTF-8"?>
4.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">
4.6 + <modelVersion>4.0.0</modelVersion>
4.7 + <parent>
4.8 + <artifactId>demo</artifactId>
4.9 + <groupId>org.apidesign.html</groupId>
4.10 + <version>1.0-SNAPSHOT</version>
4.11 + </parent>
4.12 +
4.13 + <groupId>org.apidesign.demo</groupId>
4.14 + <artifactId>spinningcube</artifactId>
4.15 + <version>1.0-SNAPSHOT</version>
4.16 + <packaging>jar</packaging>
4.17 +
4.18 + <name>Spinning_Cube</name>
4.19 +
4.20 + <pluginRepositories>
4.21 + <pluginRepository>
4.22 + <id>ios</id>
4.23 + <name>NetBeans iOS Maven Plugin</name>
4.24 + <url>http://beetle.cz.oracle.com/~jtulach/maven/</url>
4.25 + <snapshots>
4.26 + </snapshots>
4.27 + </pluginRepository>
4.28 + </pluginRepositories>
4.29 +
4.30 + <properties>
4.31 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4.32 + <net.java.html.version>0.4</net.java.html.version>
4.33 + <project.mainclass>org.apidesign.demo.spinningcube.Main</project.mainclass>
4.34 + <netbeans.compile.on.save>none</netbeans.compile.on.save>
4.35 + </properties>
4.36 + <build>
4.37 + <plugins>
4.38 + <plugin>
4.39 + <groupId>org.apache.maven.plugins</groupId>
4.40 + <artifactId>maven-compiler-plugin</artifactId>
4.41 + <version>2.3.2</version>
4.42 + <configuration>
4.43 + <source>1.7</source>
4.44 + <target>1.7</target>
4.45 + </configuration>
4.46 + </plugin>
4.47 + <plugin>
4.48 + <groupId>org.apache.maven.plugins</groupId>
4.49 + <artifactId>maven-jar-plugin</artifactId>
4.50 + <version>2.4</version>
4.51 + <configuration>
4.52 + <archive>
4.53 + <manifest>
4.54 + <mainClass>${project.mainclass}</mainClass>
4.55 + <addClasspath>true</addClasspath>
4.56 + <classpathPrefix>lib/</classpathPrefix>
4.57 + </manifest>
4.58 + </archive>
4.59 + </configuration>
4.60 + </plugin>
4.61 + <plugin>
4.62 + <groupId>org.codehaus.mojo</groupId>
4.63 + <artifactId>exec-maven-plugin</artifactId>
4.64 + <version>1.2.1</version>
4.65 + <configuration>
4.66 + <systemProperties>
4.67 + <systemProperty>
4.68 + <key>browser.rootdir</key>
4.69 + <value>${basedir}/src/main/webapp/</value>
4.70 + </systemProperty>
4.71 + </systemProperties>
4.72 + <mainClass>${project.mainclass}</mainClass>
4.73 + </configuration>
4.74 + </plugin>
4.75 + <plugin>
4.76 + <artifactId>maven-assembly-plugin</artifactId>
4.77 + <version>2.4</version>
4.78 + <executions>
4.79 + <execution>
4.80 + <id>distro-assembly</id>
4.81 + <phase>package</phase>
4.82 + <goals>
4.83 + <goal>single</goal>
4.84 + </goals>
4.85 + <configuration>
4.86 + <descriptors>
4.87 + <descriptor>src/main/assembly/html.java.net.xml</descriptor>
4.88 + </descriptors>
4.89 + </configuration>
4.90 + </execution>
4.91 + </executions>
4.92 + </plugin>
4.93 + </plugins>
4.94 + </build>
4.95 + <dependencies>
4.96 + <dependency>
4.97 + <groupId>org.apidesign.html</groupId>
4.98 + <artifactId>net.java.html.json</artifactId>
4.99 + <version>${net.java.html.version}</version>
4.100 + </dependency>
4.101 + <dependency>
4.102 + <groupId>org.apidesign.html</groupId>
4.103 + <artifactId>net.java.html.boot</artifactId>
4.104 + <version>${net.java.html.version}</version>
4.105 + </dependency>
4.106 + <dependency>
4.107 + <groupId>org.apidesign.html</groupId>
4.108 + <artifactId>ko-fx</artifactId>
4.109 + <version>${net.java.html.version}</version>
4.110 + <scope>runtime</scope>
4.111 + </dependency>
4.112 + <dependency>
4.113 + <groupId>org.apidesign.html</groupId>
4.114 + <artifactId>boot-fx</artifactId>
4.115 + <version>${net.java.html.version}</version>
4.116 + <scope>runtime</scope>
4.117 + </dependency>
4.118 + <dependency>
4.119 + <groupId>org.testng</groupId>
4.120 + <artifactId>testng</artifactId>
4.121 + <version>6.7</version>
4.122 + <scope>test</scope>
4.123 + </dependency>
4.124 + </dependencies>
4.125 + <profiles>
4.126 + <profile>
4.127 + <id>iOS</id>
4.128 + <activation>
4.129 + <os>
4.130 + <family>mac</family>
4.131 + <name>Mac OS X</name>
4.132 + </os>
4.133 + </activation>
4.134 + <build>
4.135 + <plugins>
4.136 + <plugin>
4.137 + <groupId>org.netbeans.ios</groupId>
4.138 + <artifactId>ios-maven-plugin</artifactId>
4.139 + <version>0.2</version>
4.140 + <configuration>
4.141 + <jarfile>${project.build.directory}/${project.build.finalName}.jar</jarfile>
4.142 + <title>${project.name}</title>
4.143 + <mainclass>${project.mainclass}</mainclass>
4.144 + <resourcesDir>src/main/webapp/</resourcesDir>
4.145 + </configuration>
4.146 + </plugin>
4.147 + </plugins>
4.148 + </build>
4.149 + </profile>
4.150 + </profiles>
4.151 +</project>
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/spinningcube/src/main/assembly/html.java.net.xml Tue Sep 24 21:08:15 2013 +0200
5.3 @@ -0,0 +1,57 @@
5.4 +<?xml version="1.0"?>
5.5 +<!--
5.6 +
5.7 + The MIT License (MIT)
5.8 +
5.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
5.10 +
5.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
5.12 + of this software and associated documentation files (the "Software"), to deal
5.13 + in the Software without restriction, including without limitation the rights
5.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5.15 + copies of the Software, and to permit persons to whom the Software is
5.16 + furnished to do so, subject to the following conditions:
5.17 +
5.18 + The above copyright notice and this permission notice shall be included in
5.19 + all copies or substantial portions of the Software.
5.20 +
5.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5.27 + THE SOFTWARE.
5.28 +
5.29 +-->
5.30 +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5.31 + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
5.32 +
5.33 + <id>html.java.net</id>
5.34 + <formats>
5.35 + <format>zip</format>
5.36 + </formats>
5.37 + <baseDirectory>${project.build.finalName}-app</baseDirectory>
5.38 + <dependencySets>
5.39 + <dependencySet>
5.40 + <useProjectArtifact>false</useProjectArtifact>
5.41 + <scope>runtime</scope>
5.42 + <outputDirectory>lib</outputDirectory>
5.43 + </dependencySet>
5.44 + </dependencySets>
5.45 + <files>
5.46 + <file>
5.47 + <source>${project.build.directory}/${project.build.finalName}.jar</source>
5.48 + <outputDirectory>/</outputDirectory>
5.49 + </file>
5.50 + </files>
5.51 + <fileSets>
5.52 + <fileSet>
5.53 + <directory>src/main/webapp/</directory>
5.54 + <outputDirectory>/</outputDirectory>
5.55 + <includes>
5.56 + <include>pages/**</include>
5.57 + </includes>
5.58 + </fileSet>
5.59 + </fileSets>
5.60 +</assembly>
5.61 \ No newline at end of file
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/spinningcube/src/main/java/org/apidesign/demo/spinningcube/DataModel.java Tue Sep 24 21:08:15 2013 +0200
6.3 @@ -0,0 +1,46 @@
6.4 +/**
6.5 + * The MIT License (MIT)
6.6 + *
6.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
6.8 + *
6.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
6.10 + * of this software and associated documentation files (the "Software"), to deal
6.11 + * in the Software without restriction, including without limitation the rights
6.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6.13 + * copies of the Software, and to permit persons to whom the Software is
6.14 + * furnished to do so, subject to the following conditions:
6.15 + *
6.16 + * The above copyright notice and this permission notice shall be included in
6.17 + * all copies or substantial portions of the Software.
6.18 + *
6.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
6.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
6.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
6.25 + * THE SOFTWARE.
6.26 + */
6.27 +package org.apidesign.demo.spinningcube;
6.28 +
6.29 +import net.java.html.json.ComputedProperty;
6.30 +import net.java.html.json.Model;
6.31 +import net.java.html.json.Property;
6.32 +
6.33 +/** Model with one message and cube with six sides.
6.34 + *
6.35 + * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
6.36 + */
6.37 +@Model(className = "Data", properties = {
6.38 + @Property(name = "message", type = String.class),
6.39 +})
6.40 +final class DataModel {
6.41 + @ComputedProperty static String[] sides(String message) {
6.42 + String[] arr = new String[6];
6.43 + String[] words = message == null ? new String[0] : message.split(" ", 6);
6.44 + for (int i = 0; i < 6; i++) {
6.45 + arr[i] = words.length > i ? words[i] : "!";
6.46 + }
6.47 + return arr;
6.48 + }
6.49 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/spinningcube/src/main/java/org/apidesign/demo/spinningcube/Main.java Tue Sep 24 21:08:15 2013 +0200
7.3 @@ -0,0 +1,58 @@
7.4 +/**
7.5 + * The MIT License (MIT)
7.6 + *
7.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
7.8 + *
7.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
7.10 + * of this software and associated documentation files (the "Software"), to deal
7.11 + * in the Software without restriction, including without limitation the rights
7.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7.13 + * copies of the Software, and to permit persons to whom the Software is
7.14 + * furnished to do so, subject to the following conditions:
7.15 + *
7.16 + * The above copyright notice and this permission notice shall be included in
7.17 + * all copies or substantial portions of the Software.
7.18 + *
7.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
7.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
7.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
7.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
7.25 + * THE SOFTWARE.
7.26 + */
7.27 +package org.apidesign.demo.spinningcube;
7.28 +
7.29 +import net.java.html.boot.BrowserBuilder;
7.30 +
7.31 +
7.32 +/** Bootstrap and initialization.
7.33 + *
7.34 + * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
7.35 + */
7.36 +public final class Main {
7.37 + private Main() {
7.38 + }
7.39 +
7.40 + /** Launches the browser */
7.41 + public static void main(String... args) throws Exception {
7.42 + try {
7.43 + Class.forName("java.lang.FunctionalInterface");
7.44 + } catch (ClassNotFoundException classNotFoundException) {
7.45 + throw new IllegalStateException("This application does not run on JDK7, use at least JDK8");
7.46 + }
7.47 + BrowserBuilder.newBrowser().
7.48 + loadPage("pages/index.html").
7.49 + loadClass(Main.class).
7.50 + invoke("initialize", args).
7.51 + showAndWait();
7.52 + System.exit(0);
7.53 + }
7.54 +
7.55 + /** Called when page is ready */
7.56 + public static void initialize(String... args) throws Exception {
7.57 + Data d = new Data();
7.58 + d.setMessage("Hello World from HTML and Java!");
7.59 + d.applyBindings();
7.60 + }
7.61 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/spinningcube/src/main/webapp/pages/index.html Tue Sep 24 21:08:15 2013 +0200
8.3 @@ -0,0 +1,92 @@
8.4 +<!--
8.5 +
8.6 + The MIT License (MIT)
8.7 +
8.8 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
8.9 +
8.10 + Permission is hereby granted, free of charge, to any person obtaining a copy
8.11 + of this software and associated documentation files (the "Software"), to deal
8.12 + in the Software without restriction, including without limitation the rights
8.13 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8.14 + copies of the Software, and to permit persons to whom the Software is
8.15 + furnished to do so, subject to the following conditions:
8.16 +
8.17 + The above copyright notice and this permission notice shall be included in
8.18 + all copies or substantial portions of the Software.
8.19 +
8.20 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8.21 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8.22 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8.23 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8.24 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
8.25 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
8.26 + THE SOFTWARE.
8.27 +
8.28 +-->
8.29 +<!DOCTYPE html>
8.30 +<html>
8.31 + <head>
8.32 + <title></title>
8.33 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
8.34 +
8.35 + <style type="text/css">
8.36 +
8.37 + #stage {
8.38 + margin: 1em auto;
8.39 + -webkit-perspective: 1200px;
8.40 + -moz-perspective: 1200px;
8.41 +
8.42 + }
8.43 +
8.44 + #spinner div {
8.45 + position: absolute;
8.46 + width: 300px;
8.47 + height: 300px;
8.48 + border: 1px solid #ccc;
8.49 + background: rgba(255,255,155,0.8);
8.50 + text-align: center;
8.51 + line-height: 300px;
8.52 + font-size: 80px;
8.53 + -webkit-box-shadow: inset 0 0 40px rgba(0,0,0,0.4);
8.54 + }
8.55 +
8.56 + #spinner div:nth-child(1) { -webkit-transform: translateZ(150px); }
8.57 + #spinner div:nth-child(2) { -webkit-transform: rotateY(90deg) translateZ(150px); }
8.58 + #spinner div:nth-child(3) { -webkit-transform: rotateY(90deg) rotateX(90deg) translateZ(150px); }
8.59 + #spinner div:nth-child(4) { -webkit-transform: rotateY(180deg) rotateZ(90deg) translateZ(150px); }
8.60 + #spinner div:nth-child(5) { -webkit-transform: rotateY(-90deg) rotateZ(90deg) translateZ(150px); }
8.61 + #spinner div:nth-child(6) { -webkit-transform: rotateX(-90deg) translateZ(150px); }
8.62 +
8.63 + @-webkit-keyframes spincube {
8.64 + from,to { }
8.65 + 16% { -webkit-transform: rotateY(-90deg); }
8.66 + 33% { -webkit-transform: rotateY(-90deg) rotateZ(90deg); }
8.67 + 50% { -webkit-transform: rotateY(180deg) rotateZ(90deg); }
8.68 + 66% { -webkit-transform: rotateY(90deg) rotateX(90deg); }
8.69 + 83% { -webkit-transform: rotateX(90deg); }
8.70 + }
8.71 +
8.72 + #spinner {
8.73 + -webkit-animation-name: spincube;
8.74 + -webkit-animation-timing-function: ease-in-out;
8.75 + -webkit-animation-iteration-count: infinite;
8.76 + -webkit-animation-duration: 12s;
8.77 + -webkit-transform-style: preserve-3d;
8.78 + -webkit-transform-origin: 150px 150px 0;
8.79 + }
8.80 +
8.81 + </style>
8.82 +
8.83 + </head>
8.84 + <body>
8.85 + <h1>Spinning Cube Demo</h1>
8.86 + <input data-bind="value: message, valueUpdate: 'afterkeydown'" size="100">
8.87 + <div style="position: relative; top:62px;">
8.88 + <div id="stage" style="width: 300px; height: 300px;">
8.89 + <div id="spinner" data-bind="foreach: sides ">
8.90 + <div data-bind="text: $data"></div>
8.91 + </div>
8.92 + </div>
8.93 + </div>
8.94 + </body>
8.95 +</html>
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/spinningcube/src/test/java/org/apidesign/demo/spinningcube/DataModelTest.java Tue Sep 24 21:08:15 2013 +0200
9.3 @@ -0,0 +1,39 @@
9.4 +/**
9.5 + * The MIT License (MIT)
9.6 + *
9.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
9.8 + *
9.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
9.10 + * of this software and associated documentation files (the "Software"), to deal
9.11 + * in the Software without restriction, including without limitation the rights
9.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9.13 + * copies of the Software, and to permit persons to whom the Software is
9.14 + * furnished to do so, subject to the following conditions:
9.15 + *
9.16 + * The above copyright notice and this permission notice shall be included in
9.17 + * all copies or substantial portions of the Software.
9.18 + *
9.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
9.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
9.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
9.25 + * THE SOFTWARE.
9.26 + */
9.27 +package org.apidesign.demo.spinningcube;
9.28 +
9.29 +import static org.testng.Assert.*;
9.30 +import org.testng.annotations.Test;
9.31 +
9.32 +public class DataModelTest {
9.33 + @Test public void areHelloWorldTwoWords() {
9.34 + Data model = new Data();
9.35 + model.setMessage("Hello World!");
9.36 +
9.37 + String[] arr = model.getSides();
9.38 + assertEquals(arr.length, 6, "Cube has six sides");
9.39 + assertEquals("Hello", arr[0], "Hello is the first word");
9.40 + assertEquals("World!", arr[1], "World is the second word");
9.41 + }
9.42 +}
10.1 --- a/twitter/nbactions-bck2brwsr.xml Wed Jul 31 17:04:32 2013 +0200
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,35 +0,0 @@
10.4 -<?xml version="1.0" encoding="UTF-8"?>
10.5 -<!--
10.6 -
10.7 - The MIT License (MIT)
10.8 -
10.9 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
10.10 -
10.11 - Permission is hereby granted, free of charge, to any person obtaining a copy
10.12 - of this software and associated documentation files (the "Software"), to deal
10.13 - in the Software without restriction, including without limitation the rights
10.14 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10.15 - copies of the Software, and to permit persons to whom the Software is
10.16 - furnished to do so, subject to the following conditions:
10.17 -
10.18 - The above copyright notice and this permission notice shall be included in
10.19 - all copies or substantial portions of the Software.
10.20 -
10.21 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10.22 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10.23 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
10.24 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10.25 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
10.26 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
10.27 - THE SOFTWARE.
10.28 -
10.29 --->
10.30 -<actions>
10.31 - <action>
10.32 - <actionName>run</actionName>
10.33 - <goals>
10.34 - <goal>process-classes</goal>
10.35 - <goal>bck2brwsr:brwsr</goal>
10.36 - </goals>
10.37 - </action>
10.38 -</actions>
11.1 --- a/twitter/nbactions-fxbrwsr.xml Wed Jul 31 17:04:32 2013 +0200
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,45 +0,0 @@
11.4 -<?xml version="1.0" encoding="UTF-8"?>
11.5 -<!--
11.6 -
11.7 - The MIT License (MIT)
11.8 -
11.9 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
11.10 -
11.11 - Permission is hereby granted, free of charge, to any person obtaining a copy
11.12 - of this software and associated documentation files (the "Software"), to deal
11.13 - in the Software without restriction, including without limitation the rights
11.14 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11.15 - copies of the Software, and to permit persons to whom the Software is
11.16 - furnished to do so, subject to the following conditions:
11.17 -
11.18 - The above copyright notice and this permission notice shall be included in
11.19 - all copies or substantial portions of the Software.
11.20 -
11.21 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11.22 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11.23 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11.24 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
11.25 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
11.26 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11.27 - THE SOFTWARE.
11.28 -
11.29 --->
11.30 -<actions>
11.31 - <action>
11.32 - <actionName>run</actionName>
11.33 - <goals>
11.34 - <goal>process-classes</goal>
11.35 - <goal>bck2brwsr:brwsr</goal>
11.36 - </goals>
11.37 - </action>
11.38 - <action>
11.39 - <actionName>debug</actionName>
11.40 - <goals>
11.41 - <goal>process-classes</goal>
11.42 - <goal>bck2brwsr:brwsr</goal>
11.43 - </goals>
11.44 - <properties>
11.45 - <jpda.listen>maven</jpda.listen>
11.46 - </properties>
11.47 - </action>
11.48 -</actions>
12.1 --- a/twitter/nbactions.xml Wed Jul 31 17:04:32 2013 +0200
12.2 +++ b/twitter/nbactions.xml Tue Sep 24 21:08:15 2013 +0200
12.3 @@ -28,15 +28,15 @@
12.4 <action>
12.5 <actionName>run</actionName>
12.6 <goals>
12.7 - <goal>process-classes</goal>
12.8 - <goal>bck2brwsr:brwsr</goal>
12.9 + <goal>package</goal>
12.10 + <goal>exec:java</goal>
12.11 </goals>
12.12 </action>
12.13 <action>
12.14 <actionName>debug</actionName>
12.15 <goals>
12.16 - <goal>process-classes</goal>
12.17 - <goal>bck2brwsr:brwsr</goal>
12.18 + <goal>package</goal>
12.19 + <goal>exec:java</goal>
12.20 </goals>
12.21 <properties>
12.22 <jpda.listen>maven</jpda.listen>
13.1 --- a/twitter/pom.xml Wed Jul 31 17:04:32 2013 +0200
13.2 +++ b/twitter/pom.xml Tue Sep 24 21:08:15 2013 +0200
13.3 @@ -2,8 +2,8 @@
13.4 <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">
13.5 <modelVersion>4.0.0</modelVersion>
13.6
13.7 - <groupId>org.apidesign.bck2brwsr</groupId>
13.8 - <artifactId>demo-twitter</artifactId>
13.9 + <groupId>org.apidesign.html.demo</groupId>
13.10 + <artifactId>twitter</artifactId>
13.11 <version>1.0-SNAPSHOT</version>
13.12 <packaging>jar</packaging>
13.13 <parent>
13.14 @@ -12,27 +12,18 @@
13.15 <version>1.0-SNAPSHOT</version>
13.16 </parent>
13.17
13.18 - <name>Fx/Bck2Brwsr's Twttr</name>
13.19 + <name>KO4Java's Twttr</name>
13.20 <description>
13.21 - Rewrite of knockout.js example to use model written in Java and
13.22 - execute using FxBrwsr or Bck2Brwsr.
13.23 + Rewrite of knockout.js example to use model written in Java displayed
13.24 + by HTML.
13.25 </description>
13.26
13.27 <properties>
13.28 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13.29 - <net.java.html.version>0.1</net.java.html.version>
13.30 - <bck2brwsr.version>0.7</bck2brwsr.version>
13.31 - <bck2brwsr.obfuscationlevel>MINIMAL</bck2brwsr.obfuscationlevel>
13.32 - <brwsr.startpage>org/apidesign/html/demo/twitter/index.html</brwsr.startpage>
13.33 + <net.java.html.version>0.6</net.java.html.version>
13.34 + <project.mainclass>org.apidesign.html.demo.twitter.TwitterMain</project.mainclass>
13.35 </properties>
13.36
13.37 - <repositories>
13.38 - <repository>
13.39 - <id>java.net</id>
13.40 - <name>Java.net</name>
13.41 - <url>https://maven.java.net/content/repositories/releases/</url>
13.42 - </repository>
13.43 - </repositories>
13.44 <pluginRepositories>
13.45 <pluginRepository>
13.46 <id>java.net</id>
13.47 @@ -44,22 +35,6 @@
13.48 <build>
13.49 <plugins>
13.50 <plugin>
13.51 - <groupId>org.apidesign.bck2brwsr</groupId>
13.52 - <artifactId>bck2brwsr-maven-plugin</artifactId>
13.53 - <version>${bck2brwsr.version}</version>
13.54 - <executions>
13.55 - <execution>
13.56 - <goals>
13.57 - <goal>brwsr</goal>
13.58 - </goals>
13.59 - </execution>
13.60 - </executions>
13.61 - <configuration>
13.62 - <startpage>${brwsr.startpage}</startpage>
13.63 - <launcher>${brwsr}</launcher>
13.64 - </configuration>
13.65 - </plugin>
13.66 - <plugin>
13.67 <groupId>org.apache.maven.plugins</groupId>
13.68 <artifactId>maven-compiler-plugin</artifactId>
13.69 <version>2.3.2</version>
13.70 @@ -79,6 +54,20 @@
13.71 </configuration>
13.72 </plugin>
13.73 <plugin>
13.74 + <groupId>org.codehaus.mojo</groupId>
13.75 + <artifactId>exec-maven-plugin</artifactId>
13.76 + <version>1.2.1</version>
13.77 + <configuration>
13.78 + <systemProperties>
13.79 + <systemProperty>
13.80 + <key>browser.rootdir</key>
13.81 + <value>${basedir}/src/main/webapp/</value>
13.82 + </systemProperty>
13.83 + </systemProperties>
13.84 + <mainClass>${project.mainclass}</mainClass>
13.85 + </configuration>
13.86 + </plugin>
13.87 + <plugin>
13.88 <groupId>org.apache.maven.plugins</groupId>
13.89 <artifactId>maven-jar-plugin</artifactId>
13.90 <version>2.4</version>
13.91 @@ -110,154 +99,28 @@
13.92 <scope>test</scope>
13.93 </dependency>
13.94 <dependency>
13.95 - <groupId>org.apidesign.bck2brwsr</groupId>
13.96 - <artifactId>vmtest</artifactId>
13.97 - <version>${bck2brwsr.version}</version>
13.98 - <scope>test</scope>
13.99 - </dependency>
13.100 - <dependency>
13.101 <groupId>org.apidesign.html</groupId>
13.102 <artifactId>net.java.html.json</artifactId>
13.103 <version>${net.java.html.version}</version>
13.104 <type>jar</type>
13.105 </dependency>
13.106 + <dependency>
13.107 + <groupId>org.apidesign.html</groupId>
13.108 + <artifactId>net.java.html.boot</artifactId>
13.109 + <version>${net.java.html.version}</version>
13.110 + <type>jar</type>
13.111 + </dependency>
13.112 + <dependency>
13.113 + <groupId>org.apidesign.html</groupId>
13.114 + <artifactId>boot-fx</artifactId>
13.115 + <version>${net.java.html.version}</version>
13.116 + <scope>runtime</scope>
13.117 + </dependency>
13.118 + <dependency>
13.119 + <groupId>org.apidesign.html</groupId>
13.120 + <artifactId>ko-fx</artifactId>
13.121 + <version>${net.java.html.version}</version>
13.122 + <scope>runtime</scope>
13.123 + </dependency>
13.124 </dependencies>
13.125 - <profiles>
13.126 - <profile>
13.127 - <id>fxbrwsr</id>
13.128 - <activation>
13.129 - <activeByDefault>true</activeByDefault>
13.130 - </activation>
13.131 - <properties>
13.132 - <brwsr>fxbrwsr</brwsr>
13.133 - </properties>
13.134 - <build>
13.135 - <plugins>
13.136 - <plugin>
13.137 - <groupId>org.apache.maven.plugins</groupId>
13.138 - <artifactId>maven-jar-plugin</artifactId>
13.139 - <version>2.4</version>
13.140 - <configuration>
13.141 - <archive>
13.142 - <manifest>
13.143 - <mainClass>org.apidesign.bck2brwsr.launcher.FXBrwsrLauncher</mainClass>
13.144 - <addClasspath>true</addClasspath>
13.145 - <classpathPrefix>lib/</classpathPrefix>
13.146 - </manifest>
13.147 - <manifestEntries>
13.148 - <StartPage>${brwsr.startpage}</StartPage>
13.149 - </manifestEntries>
13.150 - </archive>
13.151 - </configuration>
13.152 - </plugin>
13.153 - <plugin>
13.154 - <artifactId>maven-assembly-plugin</artifactId>
13.155 - <version>2.4</version>
13.156 - <executions>
13.157 - <execution>
13.158 - <id>distro-assembly</id>
13.159 - <phase>package</phase>
13.160 - <goals>
13.161 - <goal>single</goal>
13.162 - </goals>
13.163 - <configuration>
13.164 - <descriptors>
13.165 - <descriptor>src/main/assembly/fxbrwsr.xml</descriptor>
13.166 - </descriptors>
13.167 - </configuration>
13.168 - </execution>
13.169 - </executions>
13.170 - </plugin>
13.171 - </plugins>
13.172 - </build>
13.173 - <dependencies>
13.174 - <dependency>
13.175 - <groupId>org.apidesign.html</groupId>
13.176 - <artifactId>ko-fx</artifactId>
13.177 - <version>${net.java.html.version}</version>
13.178 - </dependency>
13.179 - <dependency>
13.180 - <groupId>org.apidesign.bck2brwsr</groupId>
13.181 - <artifactId>launcher.fx</artifactId>
13.182 - <version>${bck2brwsr.version}</version>
13.183 - <scope>runtime</scope>
13.184 - </dependency>
13.185 - </dependencies>
13.186 - </profile>
13.187 - <profile>
13.188 - <id>bck2brwsr</id>
13.189 - <activation>
13.190 - <property>
13.191 - <name>brwsr</name>
13.192 - <value>bck2brwsr</value>
13.193 - </property>
13.194 - </activation>
13.195 - <build>
13.196 - <plugins>
13.197 - <plugin>
13.198 - <groupId>org.apidesign.bck2brwsr</groupId>
13.199 - <artifactId>bck2brwsr-maven-plugin</artifactId>
13.200 - <executions>
13.201 - <execution>
13.202 - <goals>
13.203 - <goal>j2js</goal>
13.204 - </goals>
13.205 - </execution>
13.206 - </executions>
13.207 - <configuration>
13.208 - <javascript>${project.build.directory}/bck2brwsr.js</javascript>
13.209 - <obfuscation>${bck2brwsr.obfuscationlevel}</obfuscation>
13.210 - </configuration>
13.211 - </plugin>
13.212 - <plugin>
13.213 - <groupId>org.apache.maven.plugins</groupId>
13.214 - <artifactId>maven-compiler-plugin</artifactId>
13.215 - <configuration>
13.216 - <compilerArguments>
13.217 - <bootclasspath>netbeans.ignore.jdk.bootclasspath</bootclasspath>
13.218 - </compilerArguments>
13.219 - </configuration>
13.220 - </plugin>
13.221 - <plugin>
13.222 - <artifactId>maven-assembly-plugin</artifactId>
13.223 - <version>2.4</version>
13.224 - <executions>
13.225 - <execution>
13.226 - <id>distro-assembly</id>
13.227 - <phase>package</phase>
13.228 - <goals>
13.229 - <goal>single</goal>
13.230 - </goals>
13.231 - <configuration>
13.232 - <descriptors>
13.233 - <descriptor>src/main/assembly/bck2brwsr.xml</descriptor>
13.234 - </descriptors>
13.235 - </configuration>
13.236 - </execution>
13.237 - </executions>
13.238 - </plugin>
13.239 - </plugins>
13.240 - </build>
13.241 - <dependencies>
13.242 - <dependency>
13.243 - <groupId>org.apidesign.bck2brwsr</groupId>
13.244 - <artifactId>emul</artifactId>
13.245 - <version>${bck2brwsr.version}</version>
13.246 - <classifier>rt</classifier>
13.247 - </dependency>
13.248 - <dependency>
13.249 - <groupId>org.apidesign.html</groupId>
13.250 - <artifactId>ko-bck2brwsr</artifactId>
13.251 - <version>${net.java.html.version}</version>
13.252 - <scope>runtime</scope>
13.253 - </dependency>
13.254 - <dependency>
13.255 - <groupId>org.apidesign.bck2brwsr</groupId>
13.256 - <artifactId>launcher.http</artifactId>
13.257 - <version>${bck2brwsr.version}</version>
13.258 - <scope>test</scope>
13.259 - </dependency>
13.260 - </dependencies>
13.261 - </profile>
13.262 - </profiles>
13.263 </project>
14.1 --- a/twitter/src/main/assembly/bck2brwsr.xml Wed Jul 31 17:04:32 2013 +0200
14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
14.3 @@ -1,68 +0,0 @@
14.4 -<?xml version="1.0"?>
14.5 -<!--
14.6 -
14.7 - The MIT License (MIT)
14.8 -
14.9 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
14.10 -
14.11 - Permission is hereby granted, free of charge, to any person obtaining a copy
14.12 - of this software and associated documentation files (the "Software"), to deal
14.13 - in the Software without restriction, including without limitation the rights
14.14 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14.15 - copies of the Software, and to permit persons to whom the Software is
14.16 - furnished to do so, subject to the following conditions:
14.17 -
14.18 - The above copyright notice and this permission notice shall be included in
14.19 - all copies or substantial portions of the Software.
14.20 -
14.21 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14.22 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14.23 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14.24 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14.25 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
14.26 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14.27 - THE SOFTWARE.
14.28 -
14.29 --->
14.30 -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
14.31 - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
14.32 -
14.33 - <id>bck2brwsr</id>
14.34 - <formats>
14.35 - <format>zip</format>
14.36 - </formats>
14.37 - <baseDirectory>public_html</baseDirectory>
14.38 - <dependencySets>
14.39 - <dependencySet>
14.40 - <useProjectArtifact>false</useProjectArtifact>
14.41 - <scope>runtime</scope>
14.42 - <outputDirectory>lib</outputDirectory>
14.43 - <includes>
14.44 - <include>*:jar</include>
14.45 - <include>*:rt</include>
14.46 - </includes>
14.47 - </dependencySet>
14.48 - </dependencySets>
14.49 - <fileSets>
14.50 - <fileSet>
14.51 - <directory>${project.build.directory}/classes/org/apidesign/html/demo/twitter/</directory>
14.52 - <includes>
14.53 - <include>**/*</include>
14.54 - </includes>
14.55 - <excludes>
14.56 - <exclude>**/*.class</exclude>
14.57 - </excludes>
14.58 - <outputDirectory>/</outputDirectory>
14.59 - </fileSet>
14.60 - </fileSets>
14.61 - <files>
14.62 - <file>
14.63 - <source>${project.build.directory}/${project.build.finalName}.jar</source>
14.64 - <outputDirectory>/</outputDirectory>
14.65 - </file>
14.66 - <file>
14.67 - <source>${project.build.directory}/bck2brwsr.js</source>
14.68 - <outputDirectory>/</outputDirectory>
14.69 - </file>
14.70 - </files>
14.71 -</assembly>
14.72 \ No newline at end of file
15.1 --- a/twitter/src/main/java/org/apidesign/html/demo/twitter/TwitterClient.java Wed Jul 31 17:04:32 2013 +0200
15.2 +++ b/twitter/src/main/java/org/apidesign/html/demo/twitter/TwitterClient.java Tue Sep 24 21:08:15 2013 +0200
15.3 @@ -26,7 +26,6 @@
15.4 import java.util.Arrays;
15.5 import java.util.List;
15.6 import net.java.html.json.ComputedProperty;
15.7 -import net.java.html.json.Context;
15.8 import net.java.html.json.Function;
15.9 import net.java.html.json.Model;
15.10 import net.java.html.json.OnPropertyChange;
15.11 @@ -45,7 +44,7 @@
15.12 @Property(name="currentTweets", type=Tweet.class, array = true),
15.13 @Property(name="loading", type=boolean.class)
15.14 })
15.15 -public class TwitterClient {
15.16 +final class TwitterClient {
15.17 @Model(className = "Tweeters", properties = {
15.18 @Property(name="name", type = String.class),
15.19 @Property(name="userNames", type = String.class, array = true)
15.20 @@ -118,9 +117,8 @@
15.21 model.queryTweets("http://search.twitter.com", sb.toString());
15.22 }
15.23
15.24 - private static final Context DEFAULT = Context.findDefault(TwitterClient.class);
15.25 - static {
15.26 - final TwitterModel model = new TwitterModel(DEFAULT);
15.27 + static void init() {
15.28 + final TwitterModel model = new TwitterModel();
15.29 final List<Tweeters> svdLst = model.getSavedLists();
15.30 svdLst.add(newTweeters("API Design", "JaroslavTulach"));
15.31 svdLst.add(newTweeters("Celebrities", "JohnCleese", "MCHammer", "StephenFry", "algore", "StevenSanderson"));
15.32 @@ -161,7 +159,7 @@
15.33 final List<Tweeters> sl = model.getSavedLists();
15.34 sl.remove(findByName(sl, model.getActiveTweetersName()));
15.35 if (sl.isEmpty()) {
15.36 - final Tweeters t = new Tweeters(DEFAULT);
15.37 + final Tweeters t = new Tweeters();
15.38 t.setName("New");
15.39 sl.add(t);
15.40 }
15.41 @@ -195,11 +193,11 @@
15.42 return l;
15.43 }
15.44 }
15.45 - return list.isEmpty() ? new Tweeters(DEFAULT) : list.get(0);
15.46 + return list.isEmpty() ? new Tweeters() : list.get(0);
15.47 }
15.48
15.49 private static Tweeters newTweeters(String listName, String... userNames) {
15.50 - Tweeters t = new Tweeters(DEFAULT);
15.51 + Tweeters t = new Tweeters();
15.52 t.setName(listName);
15.53 t.getUserNames().addAll(Arrays.asList(userNames));
15.54 return t;
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/twitter/src/main/java/org/apidesign/html/demo/twitter/TwitterMain.java Tue Sep 24 21:08:15 2013 +0200
16.3 @@ -0,0 +1,47 @@
16.4 +/**
16.5 + * The MIT License (MIT)
16.6 + *
16.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
16.8 + *
16.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
16.10 + * of this software and associated documentation files (the "Software"), to deal
16.11 + * in the Software without restriction, including without limitation the rights
16.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16.13 + * copies of the Software, and to permit persons to whom the Software is
16.14 + * furnished to do so, subject to the following conditions:
16.15 + *
16.16 + * The above copyright notice and this permission notice shall be included in
16.17 + * all copies or substantial portions of the Software.
16.18 + *
16.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16.25 + * THE SOFTWARE.
16.26 + */
16.27 +package org.apidesign.html.demo.twitter;
16.28 +
16.29 +import net.java.html.boot.BrowserBuilder;
16.30 +
16.31 +/** Boots browser and then performs initialization when the HTML page
16.32 + * is ready.
16.33 + *
16.34 + * @author Jaroslav Tulach <jtulach@netbeans.org>
16.35 + */
16.36 +public class TwitterMain {
16.37 + private TwitterMain() {
16.38 + }
16.39 +
16.40 + public static void main(String... args) {
16.41 + BrowserBuilder.newBrowser().loadPage("pages/index.html")
16.42 + .invoke("onPageLoad", args).loadClass(TwitterMain.class)
16.43 + .showAndWait();
16.44 + System.exit(0);
16.45 + }
16.46 +
16.47 + public static void onPageLoad(String... args) {
16.48 + TwitterClient.init();
16.49 + }
16.50 +}
17.1 --- a/twitter/src/main/resources/org/apidesign/html/demo/twitter/index.html Wed Jul 31 17:04:32 2013 +0200
17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
17.3 @@ -1,105 +0,0 @@
17.4 -<?xml version="1.0" encoding="UTF-8"?>
17.5 -<!--
17.6 -
17.7 - The MIT License (MIT)
17.8 -
17.9 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
17.10 -
17.11 - Permission is hereby granted, free of charge, to any person obtaining a copy
17.12 - of this software and associated documentation files (the "Software"), to deal
17.13 - in the Software without restriction, including without limitation the rights
17.14 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17.15 - copies of the Software, and to permit persons to whom the Software is
17.16 - furnished to do so, subject to the following conditions:
17.17 -
17.18 - The above copyright notice and this permission notice shall be included in
17.19 - all copies or substantial portions of the Software.
17.20 -
17.21 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17.22 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17.23 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17.24 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17.25 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17.26 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17.27 - THE SOFTWARE.
17.28 -
17.29 --->
17.30 -
17.31 -<!--
17.32 - Copied from knockout.js Twitter example:
17.33 - http://knockoutjs.com/examples/twitter.html
17.34 --->
17.35 -
17.36 -<!DOCTYPE html>
17.37 -<html xmlns="http://www.w3.org/1999/xhtml">
17.38 - <head>
17.39 - <title>Bck2Brwsr's Twitter</title>
17.40 - </head>
17.41 - <body>
17.42 - <link href='twitterExample.css' rel='Stylesheet' ></link>
17.43 -
17.44 - <style type='text/css'>
17.45 - .liveExample select { height: 1.7em; }
17.46 - .liveExample button { height: 2em; }
17.47 - </style>
17.48 -
17.49 -
17.50 - <h2>Bck2Brwsr's Twitter</h2>
17.51 -
17.52 - <p>
17.53 - This code is based on original <a href="http://knockoutjs.com/examples/twitter.html">knockout.js Twitter example</a> and
17.54 - uses almost unmodified HTML page. It just changes the model. It
17.55 - is written in Java language and it is executed using <a href="http://bck2brwsr.apidesign.org">Bck2Brwsr</a>
17.56 - virtual machine. The Java source code has about 190 lines and is available
17.57 - <a href="http://source.apidesign.org/hg/bck2brwsr/file/7fc6b7e9c982/javaquery/demo-twitter/src/main/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClient.java">here</a>
17.58 - - in fact it may even be more dense than the original JavaScript model.
17.59 - </p>
17.60 -
17.61 - <div class='liveExample'>
17.62 - <div class='configuration'>
17.63 - <div class='listChooser'>
17.64 - <button data-bind='click: deleteList, enable: activeTweetersName'>Delete</button>
17.65 - <button data-bind='click: saveChanges, enable: hasUnsavedChanges'>Save</button>
17.66 - <select data-bind='options: savedLists, optionsValue: "name", value: activeTweetersName'> </select>
17.67 - </div>
17.68 -
17.69 - <p>Currently viewing <span data-bind='text: activeTweetersCount'> </span> user(s):</p>
17.70 - <div class='currentUsers' >
17.71 - <ul data-bind='foreach: activeTweeters'>
17.72 - <li>
17.73 - <button data-bind='click: $root.removeUser'>Remove</button>
17.74 - <div data-bind='text: $data'> </div>
17.75 - </li>
17.76 - </ul>
17.77 - </div>
17.78 -
17.79 - <form data-bind='submit: addUser'>
17.80 - <label>Add user:</label>
17.81 - <input data-bind='value: userNameToAdd, valueUpdate: "keyup", css: { invalid: !userNameToAddIsValid() }' />
17.82 - <button data-bind='enable: userNameToAddIsValid' type='submit'>Add</button>
17.83 - </form>
17.84 - </div>
17.85 - <div class='tweets'>
17.86 - <div class='loadingIndicator' data-bind="visible: loading">Loading...</div>
17.87 - <table data-bind='foreach: currentTweets' width='100%'>
17.88 - <tr>
17.89 - <td><img data-bind='attr: { src: profile_image_url }' /></td>
17.90 - <td>
17.91 - <a class='twitterUser' data-bind='attr: { href: userUrl }, text: from_user'> </a>
17.92 - <span data-bind='html: html'> </span>
17.93 - <div class='tweetInfo' data-bind='text: created_at'> </div>
17.94 - </td>
17.95 - </tr>
17.96 - </table>
17.97 - </div>
17.98 - </div>
17.99 -
17.100 - <script src="bck2brwsr.js"></script>
17.101 - <script type="text/javascript">
17.102 - var vm = bck2brwsr('demo-twitter-1.0-SNAPSHOT.jar');
17.103 - vm.loadClass('org.apidesign.html.demo.twitter.TwitterClient');
17.104 - </script>
17.105 -
17.106 -
17.107 - </body>
17.108 -</html>
18.1 --- a/twitter/src/main/resources/org/apidesign/html/demo/twitter/twitterExample.css Wed Jul 31 17:04:32 2013 +0200
18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
18.3 @@ -1,58 +0,0 @@
18.4 -/**
18.5 - * The MIT License (MIT)
18.6 - *
18.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
18.8 - *
18.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
18.10 - * of this software and associated documentation files (the "Software"), to deal
18.11 - * in the Software without restriction, including without limitation the rights
18.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18.13 - * copies of the Software, and to permit persons to whom the Software is
18.14 - * furnished to do so, subject to the following conditions:
18.15 - *
18.16 - * The above copyright notice and this permission notice shall be included in
18.17 - * all copies or substantial portions of the Software.
18.18 - *
18.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
18.25 - * THE SOFTWARE.
18.26 - */
18.27 -
18.28 -
18.29 -
18.30 -/*
18.31 - Copied from knockout.js Twitter example:
18.32 - http://knockoutjs.com/examples/twitter.html
18.33 -*/
18.34 -
18.35 -.configuration, .tweets, .tweets td { font-family: Verdana; font-size: 13px; }
18.36 -.configuration { background-color: #DEDEDE; border: 2px solid gray; float:left; height: 40em; width: 40%; padding: 0.5em; border-right-width:0; }
18.37 -.tweets { width: 55%; border: 2px solid gray; height: 40em; overflow: scroll; overflow-x: hidden; background-color: Black; color: White; padding: 0.5em; position: relative; }
18.38 -.tweets table { border-width: 0;}
18.39 -.tweets tr { vertical-align: top; }
18.40 -.tweets td { padding: 0.4em 0.3em 1em 0.4em; border-width: 0; }
18.41 -.tweets img { width: 4em; }
18.42 -.tweetInfo { color: Gray; font-size: 0.9em; }
18.43 -.twitterUser { color: #77AAFF; text-decoration: none; font-size: 1.1em; font-weight: bold; }
18.44 -input.invalid { border: 1px solid red !important; background-color: #FFAAAA !important; }
18.45 -
18.46 -.listChooser select, .listChooser button { vertical-align:top; }
18.47 -.listChooser select { width: 60%; font-size:1.2em; height:1.4em; }
18.48 -.listChooser button { width: 19%; height:1.68em; float:right; }
18.49 -
18.50 -.currentUsers { height: 28em; overflow-y: auto; overflow-x: hidden; }
18.51 -.currentUsers button { float: right; height: 2.5em; margin: 0.1em; padding-left: 1em; padding-right: 1em; }
18.52 -.currentUsers ul, .configuration li { list-style: none; margin: 0; padding: 0 }
18.53 -.currentUsers li { height: 2.4em; font-size: 1.2em; background-color: #A7D0E3; border: 1px solid gray; margin-bottom: 0.3em; -webkit-border-radius: 5px; -moz-border-radius: 5px; -webkit-box-shadow: 0 0.2em 0.5em gray; -moz-box-shadow: 0 0.2em 0.5em gray; }
18.54 -.currentUsers li div { padding: 0.6em; }
18.55 -.currentUsers li:hover { background-color: #EEC; }
18.56 -
18.57 -.configuration form label { width: 25%; display: inline-block; text-align:right; overflow: hidden; }
18.58 -.configuration form input { width:40%; font-size: 1.3em; border:1px solid silver; background-color: White; padding: 0.1em; }
18.59 -.configuration form button { width: 20%; margin-left: 0.3em; height: 2em; }
18.60 -
18.61 -.loadingIndicator { position: absolute; top: 0.1em; left: 0.1em; font: 0.8em Arial; background-color: #229; color: White; padding: 0.2em 0.5em 0.2em 0.5em; }
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/twitter/src/main/webapp/pages/index.html Tue Sep 24 21:08:15 2013 +0200
19.3 @@ -0,0 +1,97 @@
19.4 +<?xml version="1.0" encoding="UTF-8"?>
19.5 +<!--
19.6 +
19.7 + The MIT License (MIT)
19.8 +
19.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
19.10 +
19.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
19.12 + of this software and associated documentation files (the "Software"), to deal
19.13 + in the Software without restriction, including without limitation the rights
19.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19.15 + copies of the Software, and to permit persons to whom the Software is
19.16 + furnished to do so, subject to the following conditions:
19.17 +
19.18 + The above copyright notice and this permission notice shall be included in
19.19 + all copies or substantial portions of the Software.
19.20 +
19.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19.27 + THE SOFTWARE.
19.28 +
19.29 +-->
19.30 +
19.31 +<!--
19.32 + Copied from knockout.js Twitter example:
19.33 + http://knockoutjs.com/examples/twitter.html
19.34 +-->
19.35 +
19.36 +<!DOCTYPE html>
19.37 +<html xmlns="http://www.w3.org/1999/xhtml">
19.38 + <head>
19.39 + <title>Html and Java Twitter</title>
19.40 + </head>
19.41 + <body>
19.42 + <link href='twitterExample.css' rel='Stylesheet' ></link>
19.43 +
19.44 + <style type='text/css'>
19.45 + .liveExample select { height: 1.7em; }
19.46 + .liveExample button { height: 2em; }
19.47 + </style>
19.48 +
19.49 +
19.50 + <h2>Bck2Brwsr's Twitter</h2>
19.51 +
19.52 + <p>
19.53 + This code is based on original <a href="http://knockoutjs.com/examples/twitter.html">knockout.js Twitter example</a> and
19.54 + uses almost unmodified HTML page. It just changes the model. It
19.55 + is written in Java language and it is executed using the HotSpot
19.56 + virtual machine. The Java source code has about 190 lines and is available
19.57 + <a href="http://source.apidesign.org/hg/bck2brwsr/file/7fc6b7e9c982/javaquery/demo-twitter/src/main/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClient.java">here</a>
19.58 + - in fact it may even be more dense than the original JavaScript model.
19.59 + </p>
19.60 +
19.61 + <div class='liveExample'>
19.62 + <div class='configuration'>
19.63 + <div class='listChooser'>
19.64 + <button data-bind='click: deleteList, enable: activeTweetersName'>Delete</button>
19.65 + <button data-bind='click: saveChanges, enable: hasUnsavedChanges'>Save</button>
19.66 + <select data-bind='options: savedLists, optionsValue: "name", value: activeTweetersName'> </select>
19.67 + </div>
19.68 +
19.69 + <p>Currently viewing <span data-bind='text: activeTweetersCount'> </span> user(s):</p>
19.70 + <div class='currentUsers' >
19.71 + <ul data-bind='foreach: activeTweeters'>
19.72 + <li>
19.73 + <button data-bind='click: $root.removeUser'>Remove</button>
19.74 + <div data-bind='text: $data'> </div>
19.75 + </li>
19.76 + </ul>
19.77 + </div>
19.78 +
19.79 + <form data-bind='submit: addUser'>
19.80 + <label>Add user:</label>
19.81 + <input data-bind='value: userNameToAdd, valueUpdate: "keyup", css: { invalid: !userNameToAddIsValid() }' />
19.82 + <button data-bind='enable: userNameToAddIsValid' type='submit'>Add</button>
19.83 + </form>
19.84 + </div>
19.85 + <div class='tweets'>
19.86 + <div class='loadingIndicator' data-bind="visible: loading">Loading...</div>
19.87 + <table data-bind='foreach: currentTweets' width='100%'>
19.88 + <tr>
19.89 + <td><img data-bind='attr: { src: profile_image_url }' /></td>
19.90 + <td>
19.91 + <a class='twitterUser' data-bind='attr: { href: userUrl }, text: from_user'> </a>
19.92 + <span data-bind='html: html'> </span>
19.93 + <div class='tweetInfo' data-bind='text: created_at'> </div>
19.94 + </td>
19.95 + </tr>
19.96 + </table>
19.97 + </div>
19.98 + </div>
19.99 + </body>
19.100 +</html>
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/twitter/src/main/webapp/pages/twitterExample.css Tue Sep 24 21:08:15 2013 +0200
20.3 @@ -0,0 +1,58 @@
20.4 +/**
20.5 + * The MIT License (MIT)
20.6 + *
20.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
20.8 + *
20.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
20.10 + * of this software and associated documentation files (the "Software"), to deal
20.11 + * in the Software without restriction, including without limitation the rights
20.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20.13 + * copies of the Software, and to permit persons to whom the Software is
20.14 + * furnished to do so, subject to the following conditions:
20.15 + *
20.16 + * The above copyright notice and this permission notice shall be included in
20.17 + * all copies or substantial portions of the Software.
20.18 + *
20.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20.25 + * THE SOFTWARE.
20.26 + */
20.27 +
20.28 +
20.29 +
20.30 +/*
20.31 + Copied from knockout.js Twitter example:
20.32 + http://knockoutjs.com/examples/twitter.html
20.33 +*/
20.34 +
20.35 +.configuration, .tweets, .tweets td { font-family: Verdana; font-size: 13px; }
20.36 +.configuration { background-color: #DEDEDE; border: 2px solid gray; float:left; height: 40em; width: 40%; padding: 0.5em; border-right-width:0; }
20.37 +.tweets { width: 55%; border: 2px solid gray; height: 40em; overflow: scroll; overflow-x: hidden; background-color: Black; color: White; padding: 0.5em; position: relative; }
20.38 +.tweets table { border-width: 0;}
20.39 +.tweets tr { vertical-align: top; }
20.40 +.tweets td { padding: 0.4em 0.3em 1em 0.4em; border-width: 0; }
20.41 +.tweets img { width: 4em; }
20.42 +.tweetInfo { color: Gray; font-size: 0.9em; }
20.43 +.twitterUser { color: #77AAFF; text-decoration: none; font-size: 1.1em; font-weight: bold; }
20.44 +input.invalid { border: 1px solid red !important; background-color: #FFAAAA !important; }
20.45 +
20.46 +.listChooser select, .listChooser button { vertical-align:top; }
20.47 +.listChooser select { width: 60%; font-size:1.2em; height:1.4em; }
20.48 +.listChooser button { width: 19%; height:1.68em; float:right; }
20.49 +
20.50 +.currentUsers { height: 28em; overflow-y: auto; overflow-x: hidden; }
20.51 +.currentUsers button { float: right; height: 2.5em; margin: 0.1em; padding-left: 1em; padding-right: 1em; }
20.52 +.currentUsers ul, .configuration li { list-style: none; margin: 0; padding: 0 }
20.53 +.currentUsers li { height: 2.4em; font-size: 1.2em; background-color: #A7D0E3; border: 1px solid gray; margin-bottom: 0.3em; -webkit-border-radius: 5px; -moz-border-radius: 5px; -webkit-box-shadow: 0 0.2em 0.5em gray; -moz-box-shadow: 0 0.2em 0.5em gray; }
20.54 +.currentUsers li div { padding: 0.6em; }
20.55 +.currentUsers li:hover { background-color: #EEC; }
20.56 +
20.57 +.configuration form label { width: 25%; display: inline-block; text-align:right; overflow: hidden; }
20.58 +.configuration form input { width:40%; font-size: 1.3em; border:1px solid silver; background-color: White; padding: 0.1em; }
20.59 +.configuration form button { width: 20%; margin-left: 0.3em; height: 2em; }
20.60 +
20.61 +.loadingIndicator { position: absolute; top: 0.1em; left: 0.1em; font: 0.8em Arial; background-color: #229; color: White; padding: 0.2em 0.5em 0.2em 0.5em; }
21.1 --- a/twitter/src/test/java/org/apidesign/html/demo/twitter/TwitterClientTest.java Wed Jul 31 17:04:32 2013 +0200
21.2 +++ b/twitter/src/test/java/org/apidesign/html/demo/twitter/TwitterClientTest.java Tue Sep 24 21:08:15 2013 +0200
21.3 @@ -23,9 +23,7 @@
21.4 */
21.5 package org.apidesign.html.demo.twitter;
21.6
21.7 -import org.apidesign.html.demo.twitter.TwitterClient;
21.8 import java.util.List;
21.9 -import net.java.html.json.Context;
21.10 import static org.testng.Assert.*;
21.11 import org.testng.annotations.BeforeMethod;
21.12 import org.testng.annotations.Test;
21.13 @@ -40,12 +38,12 @@
21.14
21.15 @BeforeMethod
21.16 public void initModel() {
21.17 - model = new TwitterModel(Context.EMPTY);
21.18 + model = new TwitterModel();
21.19 }
21.20
21.21 @Test public void testIsValidToAdd() {
21.22 model.setUserNameToAdd("Joe");
21.23 - Tweeters t = new Tweeters(Context.EMPTY);
21.24 + Tweeters t = new Tweeters();
21.25 t.setName("test");
21.26 model.getSavedLists().add(t);
21.27 model.setActiveTweetersName("test");
22.1 --- a/twitter/src/test/java/org/apidesign/html/demo/twitter/TwitterProtocolTest.java Wed Jul 31 17:04:32 2013 +0200
22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
22.3 @@ -1,101 +0,0 @@
22.4 -/**
22.5 - * The MIT License (MIT)
22.6 - *
22.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
22.8 - *
22.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
22.10 - * of this software and associated documentation files (the "Software"), to deal
22.11 - * in the Software without restriction, including without limitation the rights
22.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22.13 - * copies of the Software, and to permit persons to whom the Software is
22.14 - * furnished to do so, subject to the following conditions:
22.15 - *
22.16 - * The above copyright notice and this permission notice shall be included in
22.17 - * all copies or substantial portions of the Software.
22.18 - *
22.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22.25 - * THE SOFTWARE.
22.26 - */
22.27 -package org.apidesign.html.demo.twitter;
22.28 -
22.29 -import net.java.html.json.Context;
22.30 -import org.apidesign.bck2brwsr.vmtest.BrwsrTest;
22.31 -import org.apidesign.bck2brwsr.vmtest.Http;
22.32 -import org.apidesign.bck2brwsr.vmtest.VMTest;
22.33 -import org.testng.annotations.Factory;
22.34 -
22.35 -/**
22.36 - *
22.37 - * @author Jaroslav Tulach <jtulach@netbeans.org>
22.38 - */
22.39 -public class TwitterProtocolTest {
22.40 - private TwitterModel page;
22.41 - @Http(@Http.Resource(
22.42 - path = "/search.json",
22.43 - mimeType = "application/json",
22.44 - parameters = {"callback"},
22.45 - content = "$0({\"completed_in\":0.04,\"max_id\":320055706885689344,\"max_id_str\""
22.46 - + ":\"320055706885689344\",\"page\":1,\"query\":\"from%3AJaroslavTulach\",\"refresh_url\":"
22.47 - + "\"?since_id=320055706885689344&q=from%3AJaroslavTulach\","
22.48 - + "\"results\":[{\"created_at\":\"Fri, 05 Apr 2013 06:10:01 +0000\","
22.49 - + "\"from_user\":\"JaroslavTulach\",\"from_user_id\":420944648,\"from_user_id_str\":"
22.50 - + "\"420944648\",\"from_user_name\":\"Jaroslav Tulach\",\"geo\":null,\"id\":320055706885689344,"
22.51 - + "\"id_str\":\"320055706885689344\",\"iso_language_code\":\"en\",\"metadata\":{\"result_type\":"
22.52 - + "\"recent\"},\"profile_image_url\":\"http:\\/\\/a0.twimg.com\\/profile_images\\/1656828312\\/jst_normal.gif\","
22.53 - + "\"profile_image_url_https\":\"https:\\/\\/si0.twimg.com\\/profile_images\\/1656828312\\/jst_normal.gif\","
22.54 - + "\"source\":\"<a href="http:\\/\\/twitter.com\\/">web<\\/a>\",\"text\":"
22.55 - + "\"@tom_enebo Amzng! Not that I would like #ruby, but I am really glad you guys stabilized the plugin + "
22.56 - + "made it work in #netbeans 7.3! Gd wrk.\",\"to_user\":\"tom_enebo\",\"to_user_id\":14498747,"
22.57 - + "\"to_user_id_str\":\"14498747\",\"to_user_name\":\"tom_enebo\",\"in_reply_to_status_id\":319832359509839872,"
22.58 - + "\"in_reply_to_status_id_str\":\"319832359509839872\"},{\"created_at\":\"Thu, 04 Apr 2013 07:33:06 +0000\","
22.59 - + "\"from_user\":\"JaroslavTulach\",\"from_user_id\":420944648,\"from_user_id_str\":"
22.60 - + "\"420944648\",\"from_user_name\":\"Jaroslav Tulach\",\"geo\":null,\"id\":319714227088678913,"
22.61 - + "\"id_str\":\"319714227088678913\",\"iso_language_code\":\"en\",\"metadata\":{\"result_type\":"
22.62 - + "\"recent\"},\"profile_image_url\":\"http:\\/\\/a0.twimg.com\\/profile_images\\/1656828312\\/jst_normal.gif\","
22.63 - + "\"profile_image_url_https\":\"https:\\/\\/si0.twimg.com\\/profile_images\\/1656828312\\/jst_normal.gif\","
22.64 - + "\"source\":\"<a href="http:\\/\\/twitter.com\\/">web<\\/a>\",\"text\":"
22.65 - + "\"RT @drkrab: At #erlangfactory @joerl: Frameworks grow in complexity until nobody can use them.\"},"
22.66 - + "{\"created_at\":\"Tue, 02 Apr 2013 07:44:34 +0000\",\"from_user\":\"JaroslavTulach\","
22.67 - + "\"from_user_id\":420944648,\"from_user_id_str\":\"420944648\",\"from_user_name\":\"Jaroslav Tulach\","
22.68 - + "\"geo\":null,\"id\":318992336145248256,\"id_str\":\"318992336145248256\",\"iso_language_code\":\"en\","
22.69 - + "\"metadata\":{\"result_type\":\"recent\"},\"profile_image_url\":"
22.70 - + "\"http:\\/\\/a0.twimg.com\\/profile_images\\/1656828312\\/jst_normal.gif\","
22.71 - + "\"profile_image_url_https\":\"https:\\/\\/si0.twimg.com\\/profile_images\\/1656828312\\/jst_normal.gif\","
22.72 - + "\"source\":\"<a href="http:\\/\\/twitter.com\\/">web<\\/a>\",\"text\":"
22.73 - + "\"Twitter renamed to twttr http:\\/\\/t.co\\/tqaN4T1xlZ - good, I don't have to rename #bck2brwsr!\"},"
22.74 - + "{\"created_at\":\"Sun, 31 Mar 2013 03:52:04 +0000\",\"from_user\":\"JaroslavTulach\",\"from_user_id\":420944648,"
22.75 - + "\"from_user_id_str\":\"420944648\",\"from_user_name\":\"Jaroslav Tulach\",\"geo\":null,"
22.76 - + "\"id\":318209051223789568,\"id_str\":\"318209051223789568\",\"iso_language_code\":\"en\",\"metadata\":"
22.77 - + "{\"result_type\":\"recent\"},\"profile_image_url\":"
22.78 - + "\"http:\\/\\/a0.twimg.com\\/profile_images\\/1656828312\\/jst_normal.gif\","
22.79 - + "\"profile_image_url_https\":\"https:\\/\\/si0.twimg.com\\/profile_images\\/1656828312\\/jst_normal.gif\","
22.80 - + "\"source\":\"<a href="http:\\/\\/twitter.com\\/">web<\\/a>\",\"text\":"
22.81 - + "\"Math proofs without words. Ingenious: http:\\/\\/t.co\\/sz7yVbfpGw\"}],\"results_per_page\":100,"
22.82 - + "\"since_id\":0,\"since_id_str\":\"0\"})"
22.83 - ))
22.84 - @BrwsrTest public void readFromTwttr() throws InterruptedException {
22.85 - if (page == null) {
22.86 - page = new TwitterModel(Context.findDefault(TwitterProtocolTest.class));
22.87 - page.applyBindings();
22.88 - page.queryTweets("", "q=xyz");
22.89 - }
22.90 -
22.91 - if (page.getCurrentTweets().isEmpty()) {
22.92 - throw new InterruptedException();
22.93 - }
22.94 -
22.95 - assert 4 == page.getCurrentTweets().size() : "Four tweets: " + page.getCurrentTweets();
22.96 -
22.97 - String firstDate = page.getCurrentTweets().get(0).getCreated_at();
22.98 - assert "Fri, 05 Apr 2013 06:10:01 +0000".equals(firstDate) : "Date is OK: " + firstDate;
22.99 - }
22.100 -
22.101 - @Factory public static Object[] create() {
22.102 - return VMTest.create(TwitterProtocolTest.class);
22.103 - }
22.104 -}
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
23.2 +++ b/words/nbactions-iOS.xml Tue Sep 24 21:08:15 2013 +0200
23.3 @@ -0,0 +1,51 @@
23.4 +<?xml version="1.0" encoding="UTF-8"?>
23.5 +<!--
23.6 +
23.7 + The MIT License (MIT)
23.8 +
23.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
23.10 +
23.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
23.12 + of this software and associated documentation files (the "Software"), to deal
23.13 + in the Software without restriction, including without limitation the rights
23.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23.15 + copies of the Software, and to permit persons to whom the Software is
23.16 + furnished to do so, subject to the following conditions:
23.17 +
23.18 + The above copyright notice and this permission notice shall be included in
23.19 + all copies or substantial portions of the Software.
23.20 +
23.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23.27 + THE SOFTWARE.
23.28 +
23.29 +-->
23.30 +<actions>
23.31 + <action>
23.32 + <actionName>run</actionName>
23.33 + <goals>
23.34 + <goal>package</goal>
23.35 + <goal>org.netbeans.ios:ios-maven-plugin:0.2:deploy</goal>
23.36 + </goals>
23.37 + <properties>
23.38 + <skipTests>true</skipTests>
23.39 + </properties>
23.40 + </action>
23.41 + <action>
23.42 + <actionName>debug</actionName>
23.43 + <goals>
23.44 + <goal>package</goal>
23.45 + <goal>org.netbeans.ios:ios-maven-plugin:0.2:deploy</goal>
23.46 + </goals>
23.47 + <properties>
23.48 + <skipTests>true</skipTests>
23.49 + <jpda.listen>true</jpda.listen>
23.50 + <jpdaAddress>${jpda.address}</jpdaAddress>
23.51 + <runMode>Debug</runMode>
23.52 + </properties>
23.53 + </action>
23.54 +</actions>
23.55 \ No newline at end of file
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
24.2 +++ b/words/nbactions.xml Tue Sep 24 21:08:15 2013 +0200
24.3 @@ -0,0 +1,45 @@
24.4 +<?xml version="1.0" encoding="UTF-8"?>
24.5 +<!--
24.6 +
24.7 + The MIT License (MIT)
24.8 +
24.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
24.10 +
24.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
24.12 + of this software and associated documentation files (the "Software"), to deal
24.13 + in the Software without restriction, including without limitation the rights
24.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24.15 + copies of the Software, and to permit persons to whom the Software is
24.16 + furnished to do so, subject to the following conditions:
24.17 +
24.18 + The above copyright notice and this permission notice shall be included in
24.19 + all copies or substantial portions of the Software.
24.20 +
24.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24.27 + THE SOFTWARE.
24.28 +
24.29 +-->
24.30 +<actions>
24.31 + <action>
24.32 + <actionName>run</actionName>
24.33 + <goals>
24.34 + <goal>process-classes</goal>
24.35 + <goal>exec:java</goal>
24.36 + </goals>
24.37 + </action>
24.38 + <action>
24.39 + <actionName>debug</actionName>
24.40 + <goals>
24.41 + <goal>process-classes</goal>
24.42 + <goal>exec:java</goal>
24.43 + </goals>
24.44 + <properties>
24.45 + <jpda.listen>maven</jpda.listen>
24.46 + </properties>
24.47 + </action>
24.48 +</actions>
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
25.2 +++ b/words/pom.xml Tue Sep 24 21:08:15 2013 +0200
25.3 @@ -0,0 +1,148 @@
25.4 +<?xml version="1.0" encoding="UTF-8"?>
25.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">
25.6 + <modelVersion>4.0.0</modelVersion>
25.7 + <parent>
25.8 + <artifactId>demo</artifactId>
25.9 + <groupId>org.apidesign.html</groupId>
25.10 + <version>1.0-SNAPSHOT</version>
25.11 + </parent>
25.12 +
25.13 + <groupId>org.apidesign.demo</groupId>
25.14 + <artifactId>words</artifactId>
25.15 + <version>1.0-SNAPSHOT</version>
25.16 + <packaging>jar</packaging>
25.17 +
25.18 + <name>Words</name>
25.19 +
25.20 + <pluginRepositories>
25.21 + <pluginRepository>
25.22 + <id>ios</id>
25.23 + <name>NetBeans iOS Maven Plugin</name>
25.24 + <url>http://beetle.cz.oracle.com/~jtulach/maven/</url>
25.25 + <snapshots>
25.26 + </snapshots>
25.27 + </pluginRepository>
25.28 + </pluginRepositories>
25.29 +
25.30 + <properties>
25.31 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
25.32 + <net.java.html.version>0.4</net.java.html.version>
25.33 + <project.mainclass>org.apidesign.demo.words.Main</project.mainclass>
25.34 + <netbeans.compile.on.save>none</netbeans.compile.on.save>
25.35 + </properties>
25.36 + <build>
25.37 + <plugins>
25.38 + <plugin>
25.39 + <groupId>org.apache.maven.plugins</groupId>
25.40 + <artifactId>maven-compiler-plugin</artifactId>
25.41 + <version>2.3.2</version>
25.42 + <configuration>
25.43 + <source>1.7</source>
25.44 + <target>1.7</target>
25.45 + </configuration>
25.46 + </plugin>
25.47 + <plugin>
25.48 + <groupId>org.apache.maven.plugins</groupId>
25.49 + <artifactId>maven-jar-plugin</artifactId>
25.50 + <version>2.4</version>
25.51 + <configuration>
25.52 + <archive>
25.53 + <manifest>
25.54 + <mainClass>${project.mainclass}</mainClass>
25.55 + <addClasspath>true</addClasspath>
25.56 + <classpathPrefix>lib/</classpathPrefix>
25.57 + </manifest>
25.58 + </archive>
25.59 + </configuration>
25.60 + </plugin>
25.61 + <plugin>
25.62 + <groupId>org.codehaus.mojo</groupId>
25.63 + <artifactId>exec-maven-plugin</artifactId>
25.64 + <version>1.2.1</version>
25.65 + <configuration>
25.66 + <systemProperties>
25.67 + <systemProperty>
25.68 + <key>browser.rootdir</key>
25.69 + <value>${basedir}/src/main/webapp/</value>
25.70 + </systemProperty>
25.71 + </systemProperties>
25.72 + <mainClass>${project.mainclass}</mainClass>
25.73 + </configuration>
25.74 + </plugin>
25.75 + <plugin>
25.76 + <artifactId>maven-assembly-plugin</artifactId>
25.77 + <version>2.4</version>
25.78 + <executions>
25.79 + <execution>
25.80 + <id>distro-assembly</id>
25.81 + <phase>package</phase>
25.82 + <goals>
25.83 + <goal>single</goal>
25.84 + </goals>
25.85 + <configuration>
25.86 + <descriptors>
25.87 + <descriptor>src/main/assembly/html.java.net.xml</descriptor>
25.88 + </descriptors>
25.89 + </configuration>
25.90 + </execution>
25.91 + </executions>
25.92 + </plugin>
25.93 + </plugins>
25.94 + </build>
25.95 + <dependencies>
25.96 + <dependency>
25.97 + <groupId>org.apidesign.html</groupId>
25.98 + <artifactId>net.java.html.json</artifactId>
25.99 + <version>${net.java.html.version}</version>
25.100 + </dependency>
25.101 + <dependency>
25.102 + <groupId>org.apidesign.html</groupId>
25.103 + <artifactId>net.java.html.boot</artifactId>
25.104 + <version>${net.java.html.version}</version>
25.105 + </dependency>
25.106 + <dependency>
25.107 + <groupId>org.apidesign.html</groupId>
25.108 + <artifactId>ko-fx</artifactId>
25.109 + <version>${net.java.html.version}</version>
25.110 + <scope>runtime</scope>
25.111 + </dependency>
25.112 + <dependency>
25.113 + <groupId>org.apidesign.html</groupId>
25.114 + <artifactId>boot-fx</artifactId>
25.115 + <version>${net.java.html.version}</version>
25.116 + <scope>runtime</scope>
25.117 + </dependency>
25.118 + <dependency>
25.119 + <groupId>org.testng</groupId>
25.120 + <artifactId>testng</artifactId>
25.121 + <version>6.7</version>
25.122 + <scope>test</scope>
25.123 + </dependency>
25.124 + </dependencies>
25.125 + <profiles>
25.126 + <profile>
25.127 + <id>iOS</id>
25.128 + <activation>
25.129 + <os>
25.130 + <family>mac</family>
25.131 + <name>Mac OS X</name>
25.132 + </os>
25.133 + </activation>
25.134 + <build>
25.135 + <plugins>
25.136 + <plugin>
25.137 + <groupId>org.netbeans.ios</groupId>
25.138 + <artifactId>ios-maven-plugin</artifactId>
25.139 + <version>0.2</version>
25.140 + <configuration>
25.141 + <jarfile>${project.build.directory}/${project.build.finalName}.jar</jarfile>
25.142 + <title>${project.name}</title>
25.143 + <mainclass>${project.mainclass}</mainclass>
25.144 + <resourcesDir>src/main/webapp/</resourcesDir>
25.145 + </configuration>
25.146 + </plugin>
25.147 + </plugins>
25.148 + </build>
25.149 + </profile>
25.150 + </profiles>
25.151 +</project>
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
26.2 +++ b/words/src/main/assembly/html.java.net.xml Tue Sep 24 21:08:15 2013 +0200
26.3 @@ -0,0 +1,57 @@
26.4 +<?xml version="1.0"?>
26.5 +<!--
26.6 +
26.7 + The MIT License (MIT)
26.8 +
26.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
26.10 +
26.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
26.12 + of this software and associated documentation files (the "Software"), to deal
26.13 + in the Software without restriction, including without limitation the rights
26.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26.15 + copies of the Software, and to permit persons to whom the Software is
26.16 + furnished to do so, subject to the following conditions:
26.17 +
26.18 + The above copyright notice and this permission notice shall be included in
26.19 + all copies or substantial portions of the Software.
26.20 +
26.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26.27 + THE SOFTWARE.
26.28 +
26.29 +-->
26.30 +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
26.31 + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
26.32 +
26.33 + <id>html.java.net</id>
26.34 + <formats>
26.35 + <format>zip</format>
26.36 + </formats>
26.37 + <baseDirectory>${project.build.finalName}-app</baseDirectory>
26.38 + <dependencySets>
26.39 + <dependencySet>
26.40 + <useProjectArtifact>false</useProjectArtifact>
26.41 + <scope>runtime</scope>
26.42 + <outputDirectory>lib</outputDirectory>
26.43 + </dependencySet>
26.44 + </dependencySets>
26.45 + <files>
26.46 + <file>
26.47 + <source>${project.build.directory}/${project.build.finalName}.jar</source>
26.48 + <outputDirectory>/</outputDirectory>
26.49 + </file>
26.50 + </files>
26.51 + <fileSets>
26.52 + <fileSet>
26.53 + <directory>src/main/webapp/</directory>
26.54 + <outputDirectory>/</outputDirectory>
26.55 + <includes>
26.56 + <include>pages/**</include>
26.57 + </includes>
26.58 + </fileSet>
26.59 + </fileSets>
26.60 +</assembly>
26.61 \ No newline at end of file
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
27.2 +++ b/words/src/main/java/org/apidesign/demo/words/DataModel.java Tue Sep 24 21:08:15 2013 +0200
27.3 @@ -0,0 +1,55 @@
27.4 +/**
27.5 + * The MIT License (MIT)
27.6 + *
27.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
27.8 + *
27.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
27.10 + * of this software and associated documentation files (the "Software"), to deal
27.11 + * in the Software without restriction, including without limitation the rights
27.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
27.13 + * copies of the Software, and to permit persons to whom the Software is
27.14 + * furnished to do so, subject to the following conditions:
27.15 + *
27.16 + * The above copyright notice and this permission notice shall be included in
27.17 + * all copies or substantial portions of the Software.
27.18 + *
27.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27.25 + * THE SOFTWARE.
27.26 + */
27.27 +package org.apidesign.demo.words;
27.28 +
27.29 +import net.java.html.json.ComputedProperty;
27.30 +import net.java.html.json.Function;
27.31 +import net.java.html.json.Model;
27.32 +import net.java.html.json.Property;
27.33 +
27.34 +/** Model with one message and cube with six sides.
27.35 + *
27.36 + * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
27.37 + */
27.38 +@Model(className = "Data", properties = {
27.39 + @Property(name = "message", type = String.class),
27.40 + @Property(name = "on", type = boolean.class)
27.41 +})
27.42 +final class DataModel {
27.43 + @ComputedProperty static String[] sides(String message) {
27.44 + String[] arr = new String[6];
27.45 + String[] words = message == null ? new String[0] : message.split(" ", 6);
27.46 + for (int i = 0; i < 6; i++) {
27.47 + arr[i] = words.length > i ? words[i] : "!";
27.48 + }
27.49 + return arr;
27.50 + }
27.51 +
27.52 + @Function static void turnOn(Data model) {
27.53 + model.setOn(true);
27.54 + }
27.55 + @Function static void turnOff(Data model) {
27.56 + model.setOn(false);
27.57 + }
27.58 +}
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
28.2 +++ b/words/src/main/java/org/apidesign/demo/words/Main.java Tue Sep 24 21:08:15 2013 +0200
28.3 @@ -0,0 +1,53 @@
28.4 +/**
28.5 + * The MIT License (MIT)
28.6 + *
28.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
28.8 + *
28.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
28.10 + * of this software and associated documentation files (the "Software"), to deal
28.11 + * in the Software without restriction, including without limitation the rights
28.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28.13 + * copies of the Software, and to permit persons to whom the Software is
28.14 + * furnished to do so, subject to the following conditions:
28.15 + *
28.16 + * The above copyright notice and this permission notice shall be included in
28.17 + * all copies or substantial portions of the Software.
28.18 + *
28.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28.25 + * THE SOFTWARE.
28.26 + */
28.27 +package org.apidesign.demo.words;
28.28 +
28.29 +import net.java.html.boot.BrowserBuilder;
28.30 +
28.31 +
28.32 +/** Bootstrap and initialization.
28.33 + *
28.34 + * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
28.35 + */
28.36 +public final class Main {
28.37 + private Main() {
28.38 + }
28.39 +
28.40 + /** Launches the browser */
28.41 + public static void main(String... args) throws Exception {
28.42 + BrowserBuilder.newBrowser().
28.43 + loadPage("pages/index.html").
28.44 + loadClass(Main.class).
28.45 + invoke("onPageLoad", args).
28.46 + showAndWait();
28.47 + System.exit(0);
28.48 + }
28.49 +
28.50 + /** Called when page is ready */
28.51 + public static void onPageLoad(String... args) throws Exception {
28.52 + Data d = new Data();
28.53 + d.setMessage("Hello World from HTML and Java!");
28.54 + d.applyBindings();
28.55 + }
28.56 +}
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/words/src/main/webapp/pages/index.html Tue Sep 24 21:08:15 2013 +0200
29.3 @@ -0,0 +1,83 @@
29.4 +<!--
29.5 +
29.6 + The MIT License (MIT)
29.7 +
29.8 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
29.9 +
29.10 + Permission is hereby granted, free of charge, to any person obtaining a copy
29.11 + of this software and associated documentation files (the "Software"), to deal
29.12 + in the Software without restriction, including without limitation the rights
29.13 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29.14 + copies of the Software, and to permit persons to whom the Software is
29.15 + furnished to do so, subject to the following conditions:
29.16 +
29.17 + The above copyright notice and this permission notice shall be included in
29.18 + all copies or substantial portions of the Software.
29.19 +
29.20 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29.21 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29.22 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29.23 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29.24 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29.25 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29.26 + THE SOFTWARE.
29.27 +
29.28 +-->
29.29 +<!DOCTYPE html>
29.30 +<html>
29.31 + <head>
29.32 + <title></title>
29.33 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
29.34 +
29.35 + <style type="text/css">
29.36 + @-webkit-keyframes spin {
29.37 + 0% { -webkit-transform: rotate(0deg); }
29.38 + 100% { -webkit-transform: rotate(360deg); }
29.39 + }
29.40 +
29.41 + .rotate {
29.42 + -webkit-animation-name: spin;
29.43 + -webkit-animation-duration: 3s;
29.44 + -webkit-animation-iteration-count: infinite;
29.45 + -webkit-animation-direction: alternate;
29.46 + }
29.47 +
29.48 + #scene {
29.49 + position: relative;
29.50 + top: 60px;
29.51 + text-align: center;
29.52 + }
29.53 +
29.54 + #words span {
29.55 + border: 1px solid #ccc;
29.56 + background: rgba(255,255,155,0.8);
29.57 + text-align: center;
29.58 + font-size: 30px;
29.59 + -webkit-box-shadow: inset 0 0 40px rgba(0,0,0,0.4);
29.60 + position: absolute;
29.61 + }
29.62 +
29.63 + #words span:nth-child(1) { left: 45%; top: 0px; }
29.64 + #words span:nth-child(2) { left: 25%; top: 100px; }
29.65 + #words span:nth-child(3) { left: 65%; top: 100px; }
29.66 + #words span:nth-child(4) { left: 10%; top: 200px; }
29.67 + #words span:nth-child(5) { left: 45%; top: 200px; }
29.68 + #words span:nth-child(6) { left: 80%; top: 200px; }
29.69 +
29.70 + </style>
29.71 +
29.72 + </head>
29.73 + <body>
29.74 + <h1>Words Demo</h1>
29.75 + <input data-bind="value: message, valueUpdate: 'afterkeydown'" size="80">
29.76 + <br>
29.77 + <button data-bind="enable: !on(), click: $root.turnOn">Start</button>
29.78 + <button data-bind="enable: on, click: $root.turnOff">Stop</button>
29.79 +
29.80 + <div id="scene">
29.81 + <span id="words" data-bind="foreach: sides">
29.82 + <span data-bind="text: $data, css: { 'rotate' : $root.on } "></span>
29.83 + </span>
29.84 + </div>
29.85 + </body>
29.86 +</html>
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
30.2 +++ b/words/src/test/java/org/apidesign/demo/words/DataModelTest.java Tue Sep 24 21:08:15 2013 +0200
30.3 @@ -0,0 +1,39 @@
30.4 +/**
30.5 + * The MIT License (MIT)
30.6 + *
30.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
30.8 + *
30.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
30.10 + * of this software and associated documentation files (the "Software"), to deal
30.11 + * in the Software without restriction, including without limitation the rights
30.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
30.13 + * copies of the Software, and to permit persons to whom the Software is
30.14 + * furnished to do so, subject to the following conditions:
30.15 + *
30.16 + * The above copyright notice and this permission notice shall be included in
30.17 + * all copies or substantial portions of the Software.
30.18 + *
30.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30.25 + * THE SOFTWARE.
30.26 + */
30.27 +package org.apidesign.demo.words;
30.28 +
30.29 +import static org.testng.Assert.*;
30.30 +import org.testng.annotations.Test;
30.31 +
30.32 +public class DataModelTest {
30.33 + @Test public void areHelloWorldTwoWords() {
30.34 + Data model = new Data();
30.35 + model.setMessage("Hello World!");
30.36 +
30.37 + String[] arr = model.getSides();
30.38 + assertEquals(arr.length, 6, "Cube has six sides");
30.39 + assertEquals("Hello", arr[0], "Hello is the first word");
30.40 + assertEquals("World!", arr[1], "World is the second word");
30.41 + }
30.42 +}