1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/histogram/nbactions-bck2brwsr.xml Sun Nov 17 09:46:45 2013 +0100
1.3 @@ -0,0 +1,39 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<!--
1.6 +
1.7 + The MIT License (MIT)
1.8 +
1.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
1.10 +
1.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
1.12 + of this software and associated documentation files (the "Software"), to deal
1.13 + in the Software without restriction, including without limitation the rights
1.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1.15 + copies of the Software, and to permit persons to whom the Software is
1.16 + furnished to do so, subject to the following conditions:
1.17 +
1.18 + The above copyright notice and this permission notice shall be included in
1.19 + all copies or substantial portions of the Software.
1.20 +
1.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1.27 + THE SOFTWARE.
1.28 +
1.29 +-->
1.30 +<actions>
1.31 + <action>
1.32 + <actionName>run</actionName>
1.33 + <goals>
1.34 + <goal>package</goal>
1.35 + <goal>bck2brwsr:brwsr</goal>
1.36 + </goals>
1.37 + <properties>
1.38 + <skipTests>true</skipTests>
1.39 + <bck2brwsr.obfuscationlevel>NONE</bck2brwsr.obfuscationlevel>
1.40 + </properties>
1.41 + </action>
1.42 +</actions>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/histogram/nbactions-fxbrwsr.xml Sun Nov 17 09:46:45 2013 +0100
2.3 @@ -0,0 +1,45 @@
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>process-classes</goal>
2.35 + <goal>exec:java</goal>
2.36 + </goals>
2.37 + </action>
2.38 + <action>
2.39 + <actionName>debug</actionName>
2.40 + <goals>
2.41 + <goal>process-classes</goal>
2.42 + <goal>exec:java</goal>
2.43 + </goals>
2.44 + <properties>
2.45 + <jpda.listen>maven</jpda.listen>
2.46 + </properties>
2.47 + </action>
2.48 +</actions>
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/histogram/nbactions.xml Sun Nov 17 09:46:45 2013 +0100
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/histogram/pom.xml Sun Nov 17 09:46:45 2013 +0100
4.3 @@ -0,0 +1,201 @@
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 +
4.8 + <groupId>dew.demo</groupId>
4.9 + <artifactId>histogram</artifactId>
4.10 + <version>1.0-SNAPSHOT</version>
4.11 + <packaging>jar</packaging>
4.12 +
4.13 + <name>histogram</name>
4.14 +
4.15 + <properties>
4.16 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4.17 + <net.java.html.version>0.6</net.java.html.version>
4.18 + <bck2brwsr.version>0.8</bck2brwsr.version>
4.19 + <brwsr.startpage>pages/index.html</brwsr.startpage>
4.20 + <project.mainclass>dew.demo.histogram.Main</project.mainclass>
4.21 + <netbeans.compile.on.save>none</netbeans.compile.on.save>
4.22 + </properties>
4.23 + <build>
4.24 + <plugins>
4.25 + <plugin>
4.26 + <groupId>org.apache.maven.plugins</groupId>
4.27 + <artifactId>maven-compiler-plugin</artifactId>
4.28 + <version>2.3.2</version>
4.29 + <configuration>
4.30 + <source>1.7</source>
4.31 + <target>1.7</target>
4.32 + </configuration>
4.33 + </plugin>
4.34 + <plugin>
4.35 + <groupId>org.apache.maven.plugins</groupId>
4.36 + <artifactId>maven-jar-plugin</artifactId>
4.37 + <version>2.4</version>
4.38 + <configuration>
4.39 + <archive>
4.40 + <manifest>
4.41 + <mainClass>${project.mainclass}</mainClass>
4.42 + <addClasspath>true</addClasspath>
4.43 + <classpathPrefix>lib/</classpathPrefix>
4.44 + </manifest>
4.45 + </archive>
4.46 + </configuration>
4.47 + </plugin>
4.48 + <plugin>
4.49 + <groupId>org.codehaus.mojo</groupId>
4.50 + <artifactId>exec-maven-plugin</artifactId>
4.51 + <version>1.2.1</version>
4.52 + <configuration>
4.53 + <systemProperties>
4.54 + <systemProperty>
4.55 + <key>browser.rootdir</key>
4.56 + <value>${basedir}/src/main/webapp/</value>
4.57 + </systemProperty>
4.58 + </systemProperties>
4.59 + <mainClass>${project.mainclass}</mainClass>
4.60 + </configuration>
4.61 + </plugin>
4.62 + </plugins>
4.63 + </build>
4.64 + <dependencies>
4.65 + <dependency>
4.66 + <groupId>org.apidesign.html</groupId>
4.67 + <artifactId>net.java.html.json</artifactId>
4.68 + <version>${net.java.html.version}</version>
4.69 + </dependency>
4.70 + <dependency>
4.71 + <groupId>org.apidesign.html</groupId>
4.72 + <artifactId>net.java.html.boot</artifactId>
4.73 + <version>${net.java.html.version}</version>
4.74 + </dependency>
4.75 + <dependency>
4.76 + <groupId>org.testng</groupId>
4.77 + <artifactId>testng</artifactId>
4.78 + <version>6.7</version>
4.79 + <scope>test</scope>
4.80 + </dependency>
4.81 + </dependencies>
4.82 + <profiles>
4.83 + <profile>
4.84 + <id>fxbrwsr</id>
4.85 + <activation>
4.86 + <activeByDefault>true</activeByDefault>
4.87 + </activation>
4.88 + <build>
4.89 + <plugins>
4.90 + <plugin>
4.91 + <artifactId>maven-assembly-plugin</artifactId>
4.92 + <version>2.4</version>
4.93 + <executions>
4.94 + <execution>
4.95 + <id>distro-assembly</id>
4.96 + <phase>package</phase>
4.97 + <goals>
4.98 + <goal>single</goal>
4.99 + </goals>
4.100 + <configuration>
4.101 + <descriptors>
4.102 + <descriptor>src/main/assembly/html.java.net.xml</descriptor>
4.103 + </descriptors>
4.104 + </configuration>
4.105 + </execution>
4.106 + </executions>
4.107 + </plugin>
4.108 + </plugins>
4.109 + </build>
4.110 + <dependencies>
4.111 + <dependency>
4.112 + <groupId>org.apidesign.html</groupId>
4.113 + <artifactId>ko-fx</artifactId>
4.114 + <version>${net.java.html.version}</version>
4.115 + <scope>runtime</scope>
4.116 + </dependency>
4.117 + <dependency>
4.118 + <groupId>org.apidesign.html</groupId>
4.119 + <artifactId>boot-fx</artifactId>
4.120 + <version>${net.java.html.version}</version>
4.121 + <scope>runtime</scope>
4.122 + </dependency>
4.123 + </dependencies>
4.124 + </profile>
4.125 + <profile>
4.126 + <id>bck2brwsr</id>
4.127 + <activation>
4.128 + <property>
4.129 + <name>brwsr</name>
4.130 + <value>bck2brwsr</value>
4.131 + </property>
4.132 + </activation>
4.133 + <build>
4.134 + <plugins>
4.135 + <plugin>
4.136 + <groupId>org.apidesign.bck2brwsr</groupId>
4.137 + <artifactId>bck2brwsr-maven-plugin</artifactId>
4.138 + <version>${bck2brwsr.version}</version>
4.139 + <executions>
4.140 + <execution>
4.141 + <goals>
4.142 + <goal>brwsr</goal>
4.143 + </goals>
4.144 + </execution>
4.145 + </executions>
4.146 + <configuration>
4.147 + <directory>${basedir}/src/main/webapp/</directory>
4.148 + <startpage>${brwsr.startpage}</startpage>
4.149 + </configuration>
4.150 + </plugin>
4.151 + <plugin>
4.152 + <groupId>org.apache.maven.plugins</groupId>
4.153 + <artifactId>maven-compiler-plugin</artifactId>
4.154 + <configuration>
4.155 + <compilerArguments>
4.156 + <bootclasspath>netbeans.ignore.jdk.bootclasspath</bootclasspath>
4.157 + </compilerArguments>
4.158 + </configuration>
4.159 + </plugin>
4.160 + <plugin>
4.161 + <artifactId>maven-assembly-plugin</artifactId>
4.162 + <version>2.4</version>
4.163 + <executions>
4.164 + <execution>
4.165 + <id>distro-assembly</id>
4.166 + <phase>package</phase>
4.167 + <goals>
4.168 + <goal>single</goal>
4.169 + </goals>
4.170 + <configuration>
4.171 + <descriptors>
4.172 + <descriptor>src/main/assembly/bck2brwsr.xml</descriptor>
4.173 + </descriptors>
4.174 + </configuration>
4.175 + </execution>
4.176 + </executions>
4.177 + </plugin>
4.178 + </plugins>
4.179 + </build>
4.180 + <dependencies>
4.181 + <dependency>
4.182 + <groupId>org.apidesign.bck2brwsr</groupId>
4.183 + <artifactId>emul</artifactId>
4.184 + <version>${bck2brwsr.version}</version>
4.185 + <classifier>rt</classifier>
4.186 + </dependency>
4.187 + <dependency>
4.188 + <groupId>org.apidesign.bck2brwsr</groupId>
4.189 + <artifactId>ko-bck2brwsr</artifactId>
4.190 + <version>${bck2brwsr.version}</version>
4.191 + <scope>runtime</scope>
4.192 + </dependency>
4.193 + <dependency>
4.194 + <groupId>org.apidesign.bck2brwsr</groupId>
4.195 + <artifactId>vm4brwsr</artifactId>
4.196 + <classifier>js</classifier>
4.197 + <type>zip</type>
4.198 + <version>${bck2brwsr.version}</version>
4.199 + <scope>provided</scope>
4.200 + </dependency>
4.201 + </dependencies>
4.202 + </profile>
4.203 + </profiles>
4.204 +</project>
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/histogram/src/main/assembly/bck2brwsr.xml Sun Nov 17 09:46:45 2013 +0100
5.3 @@ -0,0 +1,68 @@
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>bck2brwsr</id>
5.34 + <formats>
5.35 + <format>zip</format>
5.36 + </formats>
5.37 + <baseDirectory>public_html</baseDirectory>
5.38 + <dependencySets>
5.39 + <dependencySet>
5.40 + <useProjectArtifact>false</useProjectArtifact>
5.41 + <scope>runtime</scope>
5.42 + <outputDirectory>lib</outputDirectory>
5.43 + <includes>
5.44 + <include>*:jar</include>
5.45 + <include>*:rt</include>
5.46 + </includes>
5.47 + </dependencySet>
5.48 + <dependencySet>
5.49 + <useProjectArtifact>false</useProjectArtifact>
5.50 + <scope>provided</scope>
5.51 + <includes>
5.52 + <include>*:js</include>
5.53 + </includes>
5.54 + <unpack>true</unpack>
5.55 + <outputDirectory>/</outputDirectory>
5.56 + </dependencySet>
5.57 + </dependencySets>
5.58 + <fileSets>
5.59 + <fileSet>
5.60 + <directory>src/main/webapp/pages</directory>
5.61 + <outputDirectory>/</outputDirectory>
5.62 + <filtered>true</filtered>
5.63 + </fileSet>
5.64 + </fileSets>
5.65 + <files>
5.66 + <file>
5.67 + <source>${project.build.directory}/${project.build.finalName}.jar</source>
5.68 + <outputDirectory>/</outputDirectory>
5.69 + </file>
5.70 + </files>
5.71 +</assembly>
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/histogram/src/main/assembly/html.java.net.xml Sun Nov 17 09:46:45 2013 +0100
6.3 @@ -0,0 +1,57 @@
6.4 +<?xml version="1.0"?>
6.5 +<!--
6.6 +
6.7 + The MIT License (MIT)
6.8 +
6.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
6.10 +
6.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
6.12 + of this software and associated documentation files (the "Software"), to deal
6.13 + in the Software without restriction, including without limitation the rights
6.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6.15 + copies of the Software, and to permit persons to whom the Software is
6.16 + furnished to do so, subject to the following conditions:
6.17 +
6.18 + The above copyright notice and this permission notice shall be included in
6.19 + all copies or substantial portions of the Software.
6.20 +
6.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
6.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
6.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
6.27 + THE SOFTWARE.
6.28 +
6.29 +-->
6.30 +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6.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">
6.32 +
6.33 + <id>html.java.net</id>
6.34 + <formats>
6.35 + <format>zip</format>
6.36 + </formats>
6.37 + <baseDirectory>${project.build.finalName}-app</baseDirectory>
6.38 + <dependencySets>
6.39 + <dependencySet>
6.40 + <useProjectArtifact>false</useProjectArtifact>
6.41 + <scope>runtime</scope>
6.42 + <outputDirectory>lib</outputDirectory>
6.43 + </dependencySet>
6.44 + </dependencySets>
6.45 + <files>
6.46 + <file>
6.47 + <source>${project.build.directory}/${project.build.finalName}.jar</source>
6.48 + <outputDirectory>/</outputDirectory>
6.49 + </file>
6.50 + </files>
6.51 + <fileSets>
6.52 + <fileSet>
6.53 + <directory>src/main/webapp/</directory>
6.54 + <outputDirectory>/</outputDirectory>
6.55 + <includes>
6.56 + <include>pages/**</include>
6.57 + </includes>
6.58 + </fileSet>
6.59 + </fileSets>
6.60 +</assembly>
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/histogram/src/main/java/dew/demo/histogram/DataModel.java Sun Nov 17 09:46:45 2013 +0100
7.3 @@ -0,0 +1,80 @@
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 dew.demo.histogram;
7.28 +
7.29 +import java.util.ArrayList;
7.30 +import java.util.List;
7.31 +import net.java.html.json.ComputedProperty;
7.32 +import net.java.html.json.Model;
7.33 +import net.java.html.json.Property;
7.34 +
7.35 +/** Model annotation generates class Data with
7.36 + * one property for list of of numbers and read-only property
7.37 + * for ten of bars.
7.38 + */
7.39 +@Model(className = "Data", properties = {
7.40 + @Property(name = "numbers", type = String.class)
7.41 +})
7.42 +final class DataModel {
7.43 + @ComputedProperty static java.util.List<Bar> bars(String numbers) {
7.44 + List<Bar> arr = new ArrayList<Bar>(10);
7.45 + for (int i = 0; i < 10; i++) {
7.46 + arr.add(new Bar(i, 0));
7.47 + }
7.48 + String[] words = numbers == null ? new String[0] : numbers.split(" ");
7.49 + for (String word : words) {
7.50 + try {
7.51 + double n = Double.parseDouble(word);
7.52 + if (n > 99) {
7.53 + n = 99;
7.54 + } else if (n <= 0) {
7.55 + n = 0;
7.56 + }
7.57 + Bar b = arr.get((int) (n / 10));
7.58 + b.setValue(b.getValue() + 1);
7.59 + }catch (NumberFormatException ex) {
7.60 + // ignore
7.61 + }
7.62 + }
7.63 + return arr;
7.64 + }
7.65 +
7.66 + @Model(className = "Bar", properties = {
7.67 + @Property(name = "index", type = int.class),
7.68 + @Property(name = "value", type = int.class)
7.69 + })
7.70 + static class BarModel {
7.71 + @ComputedProperty static String left(int index) {
7.72 + return (index * 50 + 20) + "px";
7.73 + }
7.74 +
7.75 + @ComputedProperty static String top(int value) {
7.76 + return (199 - value * 20) + "px";
7.77 + }
7.78 +
7.79 + @ComputedProperty static String height(int value) {
7.80 + return 20 * value + "px";
7.81 + }
7.82 + }
7.83 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/histogram/src/main/java/dew/demo/histogram/Main.java Sun Nov 17 09:46:45 2013 +0100
8.3 @@ -0,0 +1,50 @@
8.4 +/**
8.5 + * The MIT License (MIT)
8.6 + *
8.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
8.8 + *
8.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
8.10 + * of this software and associated documentation files (the "Software"), to deal
8.11 + * in the Software without restriction, including without limitation the rights
8.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8.13 + * copies of the Software, and to permit persons to whom the Software is
8.14 + * furnished to do so, subject to the following conditions:
8.15 + *
8.16 + * The above copyright notice and this permission notice shall be included in
8.17 + * all copies or substantial portions of the Software.
8.18 + *
8.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
8.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
8.25 + * THE SOFTWARE.
8.26 + */
8.27 +package dew.demo.histogram;
8.28 +
8.29 +import net.java.html.boot.BrowserBuilder;
8.30 +
8.31 +
8.32 +/** Bootstrap and initialization. */
8.33 +public final class Main {
8.34 + private Main() {
8.35 + }
8.36 +
8.37 + /** Launches the browser */
8.38 + public static void main(String... args) throws Exception {
8.39 + BrowserBuilder.newBrowser().
8.40 + loadPage("pages/index.html").
8.41 + loadClass(Main.class).
8.42 + invoke("onPageLoad", args).
8.43 + showAndWait();
8.44 + System.exit(0);
8.45 + }
8.46 +
8.47 + /** Called when page is ready */
8.48 + public static void onPageLoad(String... args) throws Exception {
8.49 + Data d = new Data();
8.50 + d.setNumbers("15 35 55 75 95");
8.51 + d.applyBindings();
8.52 + }
8.53 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/histogram/src/main/java/dew/demo/histogram/MainBrwsr.java Sun Nov 17 09:46:45 2013 +0100
9.3 @@ -0,0 +1,34 @@
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 dew.demo.histogram;
9.28 +
9.29 +public class MainBrwsr {
9.30 + static {
9.31 + try {
9.32 + Main.onPageLoad();
9.33 + } catch (Exception ex) {
9.34 + throw new IllegalStateException(ex);
9.35 + }
9.36 + }
9.37 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/histogram/src/main/webapp/pages/index.html Sun Nov 17 09:46:45 2013 +0100
10.3 @@ -0,0 +1,83 @@
10.4 +<!--
10.5 +
10.6 + The MIT License (MIT)
10.7 +
10.8 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
10.9 +
10.10 + Permission is hereby granted, free of charge, to any person obtaining a copy
10.11 + of this software and associated documentation files (the "Software"), to deal
10.12 + in the Software without restriction, including without limitation the rights
10.13 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10.14 + copies of the Software, and to permit persons to whom the Software is
10.15 + furnished to do so, subject to the following conditions:
10.16 +
10.17 + The above copyright notice and this permission notice shall be included in
10.18 + all copies or substantial portions of the Software.
10.19 +
10.20 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10.21 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10.22 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
10.23 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10.24 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
10.25 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
10.26 + THE SOFTWARE.
10.27 +
10.28 +-->
10.29 +<!DOCTYPE html>
10.30 +<html>
10.31 + <head>
10.32 + <title></title>
10.33 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
10.34 +
10.35 + <style type="text/css">
10.36 + #graph {
10.37 + position: relative;
10.38 + width: 660px;
10.39 + height: 216px;
10.40 + margin: 8px;
10.41 + padding: 0;
10.42 + }
10.43 +
10.44 + #graph ul {
10.45 + position: absolute;
10.46 + top: 0;
10.47 + left: 32px;
10.48 + width: 600px;
10.49 + height: 200px;
10.50 + border-left: 1px solid black;
10.51 + border-bottom: 1px solid black;
10.52 + }
10.53 +
10.54 + #graph li {
10.55 + position: absolute;
10.56 + list-style: none;
10.57 + background: lightblue;
10.58 + width: 40px;
10.59 + text-align: center;
10.60 + border: 1px solid black;
10.61 + top: 60px;
10.62 + visibility: hidden;
10.63 + }
10.64 + </style>
10.65 +
10.66 + </head>
10.67 + <body>
10.68 + <h1>Histogram Demo</h1>
10.69 + <input data-bind="value: numbers, valueUpdate: 'afterkeydown'" size="80">
10.70 +
10.71 + <div id="graph">
10.72 + <ul data-bind="foreach: bars">
10.73 + <li data-bind="style: { left : left, top: top, height : height, visibility : 'visible' }">
10.74 + <span style="margin:8px; background: lightblue"></span>
10.75 + </li>
10.76 + </ul>
10.77 + </div>
10.78 +
10.79 + <script type="text/javascript" src="bck2brwsr.js"></script>
10.80 + <script>
10.81 + var vm = bck2brwsr('${project.build.finalName}.jar');
10.82 + vm.loadClass('dew.demo.histogram.MainBrwsr');
10.83 + </script>
10.84 +
10.85 + </body>
10.86 +</html>
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/histogram/src/test/java/dew/demo/histogram/DataModelTest.java Sun Nov 17 09:46:45 2013 +0100
11.3 @@ -0,0 +1,39 @@
11.4 +/**
11.5 + * The MIT License (MIT)
11.6 + *
11.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
11.8 + *
11.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
11.10 + * of this software and associated documentation files (the "Software"), to deal
11.11 + * in the Software without restriction, including without limitation the rights
11.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11.13 + * copies of the Software, and to permit persons to whom the Software is
11.14 + * furnished to do so, subject to the following conditions:
11.15 + *
11.16 + * The above copyright notice and this permission notice shall be included in
11.17 + * all copies or substantial portions of the Software.
11.18 + *
11.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
11.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
11.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11.25 + * THE SOFTWARE.
11.26 + */
11.27 +package dew.demo.histogram;
11.28 +
11.29 +import static org.testng.Assert.*;
11.30 +import org.testng.annotations.Test;
11.31 +
11.32 +public class DataModelTest {
11.33 + @Test public void areHelloWorldTwoWords() {
11.34 + Data model = new Data();
11.35 + model.setNumbers("-1 103");
11.36 +
11.37 + java.util.List<Bar> arr = model.getBars();
11.38 + assertEquals(arr.size(), 10, "Ten bars");
11.39 + assertEquals(arr.get(0).getValue(), 1, "One at lower segment");
11.40 + assertEquals(arr.get(9).getValue(), 1, "One at highest segment");
11.41 + }
11.42 +}
12.1 --- a/pom.xml Wed Sep 25 04:27:55 2013 +0200
12.2 +++ b/pom.xml Sun Nov 17 09:46:45 2013 +0100
12.3 @@ -20,6 +20,7 @@
12.4 <module>twitter</module>
12.5 <module>chat</module>
12.6 <module>chess</module>
12.7 + <module>histogram</module>
12.8 <module>spinningcube</module>
12.9 <module>words</module>
12.10 </modules>