Simpler animation demo that works on JDK7
authorJaroslav Tulach <jtulach@netbeans.org>
Thu, 15 Aug 2013 13:17:54 +0200
changeset 46009537e6ce80
parent 45 3f85884ca049
child 47 4109cd3a4aa4
Simpler animation demo that works on JDK7
pom.xml
words/nbactions-iOS.xml
words/nbactions.xml
words/pom.xml
words/src/main/assembly/html.java.net.xml
words/src/main/java/org/apidesign/demo/words/DataModel.java
words/src/main/java/org/apidesign/demo/words/Main.java
words/src/main/webapp/pages/index.html
words/src/test/java/org/apidesign/demo/words/DataModelTest.java
     1.1 --- a/pom.xml	Tue Aug 13 21:19:31 2013 +0200
     1.2 +++ b/pom.xml	Thu Aug 15 13:17:54 2013 +0200
     1.3 @@ -20,6 +20,7 @@
     1.4      <module>twitter</module>
     1.5      <module>chat</module>
     1.6      <module>spinningcube</module>
     1.7 +    <module>words</module>
     1.8    </modules>
     1.9    <licenses>
    1.10        <license>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/words/nbactions-iOS.xml	Thu Aug 15 13:17:54 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/words/nbactions.xml	Thu Aug 15 13:17:54 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/words/pom.xml	Thu Aug 15 13:17:54 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>words</artifactId>
    4.15 +  <version>1.0-SNAPSHOT</version>
    4.16 +  <packaging>jar</packaging>
    4.17 +
    4.18 +  <name>Words</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.words.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/words/src/main/assembly/html.java.net.xml	Thu Aug 15 13:17:54 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/words/src/main/java/org/apidesign/demo/words/DataModel.java	Thu Aug 15 13:17:54 2013 +0200
     6.3 @@ -0,0 +1,55 @@
     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.words;
    6.28 +
    6.29 +import net.java.html.json.ComputedProperty;
    6.30 +import net.java.html.json.Function;
    6.31 +import net.java.html.json.Model;
    6.32 +import net.java.html.json.Property;
    6.33 +
    6.34 +/** Model with one message and cube with six sides.
    6.35 + *
    6.36 + * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    6.37 + */
    6.38 +@Model(className = "Data", properties = {
    6.39 +    @Property(name = "message", type = String.class),
    6.40 +    @Property(name = "on", type = boolean.class)
    6.41 +})
    6.42 +final class DataModel {
    6.43 +    @ComputedProperty static String[] sides(String message) {
    6.44 +        String[] arr = new String[6];
    6.45 +        String[] words = message == null ? new String[0] : message.split(" ", 6);
    6.46 +        for (int i = 0; i < 6; i++) {
    6.47 +            arr[i] = words.length > i ? words[i] : "!";
    6.48 +        }
    6.49 +        return arr;
    6.50 +    }
    6.51 +    
    6.52 +    @Function static void turnOn(Data model) {
    6.53 +        model.setOn(true);
    6.54 +    }
    6.55 +    @Function static void turnOff(Data model) {
    6.56 +        model.setOn(false);
    6.57 +    }
    6.58 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/words/src/main/java/org/apidesign/demo/words/Main.java	Thu Aug 15 13:17:54 2013 +0200
     7.3 @@ -0,0 +1,53 @@
     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.words;
    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 +        BrowserBuilder.newBrowser().
    7.43 +            loadPage("pages/index.html").
    7.44 +            loadClass(Main.class).
    7.45 +            invoke("onPageLoad", args).
    7.46 +            showAndWait();
    7.47 +        System.exit(0);
    7.48 +    }
    7.49 +    
    7.50 +    /** Called when page is ready */
    7.51 +    public static void onPageLoad(String... args) throws Exception {
    7.52 +        Data d = new Data();
    7.53 +        d.setMessage("Hello World from HTML and Java!");
    7.54 +        d.applyBindings();
    7.55 +    }
    7.56 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/words/src/main/webapp/pages/index.html	Thu Aug 15 13:17:54 2013 +0200
     8.3 @@ -0,0 +1,83 @@
     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 +            @-webkit-keyframes spin {
    8.37 +                0% { -webkit-transform: rotate(0deg); }
    8.38 +                100% { -webkit-transform: rotate(360deg); }
    8.39 +            }
    8.40 +
    8.41 +            .rotate {
    8.42 +                -webkit-animation-name: spin;
    8.43 +                -webkit-animation-duration: 3s;
    8.44 +                -webkit-animation-iteration-count: infinite;
    8.45 +                -webkit-animation-direction: alternate;
    8.46 +            }
    8.47 +
    8.48 +            #scene {
    8.49 +                position: relative;
    8.50 +                top: 60px;
    8.51 +                text-align: center;
    8.52 +            }
    8.53 +            
    8.54 +            #words span {
    8.55 +                border: 1px solid #ccc;
    8.56 +                background: rgba(255,255,155,0.8);
    8.57 +                text-align: center;
    8.58 +                font-size: 30px;                
    8.59 +                -webkit-box-shadow: inset 0 0 40px rgba(0,0,0,0.4);
    8.60 +                position: absolute;
    8.61 +            }
    8.62 +
    8.63 +            #words span:nth-child(1) { left: 45%; top: 0px; }
    8.64 +            #words span:nth-child(2) { left: 25%; top: 100px; }
    8.65 +            #words span:nth-child(3) { left: 65%; top: 100px; }
    8.66 +            #words span:nth-child(4) { left: 10%; top: 200px; }
    8.67 +            #words span:nth-child(5) { left: 45%; top: 200px; }
    8.68 +            #words span:nth-child(6) { left: 80%; top: 200px; }
    8.69 +            
    8.70 +        </style>
    8.71 +
    8.72 +    </head>
    8.73 +    <body>
    8.74 +        <h1>Words Demo</h1>
    8.75 +        <input data-bind="value: message, valueUpdate: 'afterkeydown'" size="80">
    8.76 +        <br>
    8.77 +        <button data-bind="enable: !on(), click: $root.turnOn">Start</button>
    8.78 +        <button data-bind="enable: on, click: $root.turnOff">Stop</button>
    8.79 +
    8.80 +        <div id="scene">
    8.81 +            <span id="words" data-bind="foreach: sides">
    8.82 +                <span data-bind="text: $data, css: { 'rotate' : $root.on } "></span>
    8.83 +            </span>
    8.84 +        </div>
    8.85 +    </body>
    8.86 +</html>
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/words/src/test/java/org/apidesign/demo/words/DataModelTest.java	Thu Aug 15 13:17:54 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.words;
    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 +}