1.1 --- a/.hgignore Fri Mar 21 15:02:25 2014 +0100
1.2 +++ b/.hgignore Mon Sep 08 10:11:50 2014 +0200
1.3 @@ -1,3 +1,8 @@
1.4 .*~
1.5 .*\.orig$
1.6 .*target/.*
1.7 +\.orig\..*$
1.8 +\.orig$
1.9 +\.chg\..*$
1.10 +\.rej$
1.11 +\.conflict\~$
2.1 --- a/chat/client/pom.xml Fri Mar 21 15:02:25 2014 +0100
2.2 +++ b/chat/client/pom.xml Mon Sep 08 10:11:50 2014 +0200
2.3 @@ -117,5 +117,19 @@
2.4 <version>${bck2brwsr.version}</version>
2.5 <scope>runtime</scope>
2.6 </dependency>
2.7 + <dependency>
2.8 + <artifactId>ko4j</artifactId>
2.9 + <groupId>org.netbeans.html</groupId>
2.10 + <type>jar</type>
2.11 + <version>${net.java.html.version}</version>
2.12 + <scope>runtime</scope>
2.13 + </dependency>
2.14 + <dependency>
2.15 + <artifactId>net.java.html.boot</artifactId>
2.16 + <groupId>org.netbeans.html</groupId>
2.17 + <type>jar</type>
2.18 + <version>${net.java.html.version}</version>
2.19 + <scope>runtime</scope>
2.20 + </dependency>
2.21 </dependencies>
2.22 </project>
3.1 --- a/chat/server/pom.xml Fri Mar 21 15:02:25 2014 +0100
3.2 +++ b/chat/server/pom.xml Mon Sep 08 10:11:50 2014 +0200
3.3 @@ -119,5 +119,12 @@
3.4 <version>2.3.8</version>
3.5 <scope>runtime</scope>
3.6 </dependency>
3.7 + <dependency>
3.8 + <artifactId>ko-ws-tyrus</artifactId>
3.9 + <groupId>org.netbeans.html</groupId>
3.10 + <type>jar</type>
3.11 + <version>${net.java.html.version}</version>
3.12 + <scope>runtime</scope>
3.13 + </dependency>
3.14 </dependencies>
3.15 </project>
4.1 --- a/chess/pom.xml Fri Mar 21 15:02:25 2014 +0100
4.2 +++ b/chess/pom.xml Mon Sep 08 10:11:50 2014 +0200
4.3 @@ -141,6 +141,11 @@
4.4 <scope>provided</scope>
4.5 <type>jar</type>
4.6 </dependency>
4.7 + <dependency>
4.8 + <groupId>org.netbeans.html</groupId>
4.9 + <artifactId>ko4j</artifactId>
4.10 + <version>${net.java.html.version}</version>
4.11 + </dependency>
4.12 </dependencies>
4.13 <profiles>
4.14 <profile>
4.15 @@ -252,5 +257,78 @@
4.16 </dependency>
4.17 </dependencies>
4.18 </profile>
4.19 + <profile>
4.20 + <id>teabrwsr</id>
4.21 + <build>
4.22 + <plugins>
4.23 + <plugin>
4.24 + <groupId>org.teavm</groupId>
4.25 + <artifactId>teavm-maven-plugin</artifactId>
4.26 + <version>${teavm.version}</version>
4.27 + <dependencies>
4.28 + <dependency>
4.29 + <groupId>org.teavm</groupId>
4.30 + <artifactId>teavm-classlib</artifactId>
4.31 + <version>${teavm.version}</version>
4.32 + </dependency>
4.33 + <!-- This module adds html4j support. It mainly includes JavaScriptBuilder support.
4.34 + Also there are some little patches to JCL emulation, that are required to pass TCK -->
4.35 + <dependency>
4.36 + <groupId>org.teavm</groupId>
4.37 + <artifactId>teavm-html4j</artifactId>
4.38 + <version>${teavm.version}</version>
4.39 + </dependency>
4.40 + </dependencies>
4.41 + <executions>
4.42 + <execution>
4.43 + <id>generate-minesweeper</id>
4.44 + <goals>
4.45 + <goal>build-javascript</goal>
4.46 + </goals>
4.47 + <phase>process-classes</phase>
4.48 + <configuration>
4.49 + <!-- Whether we want TeaVM to minify (obfuscate) the generated JavaScript -->
4.50 + <minifying>false</minifying>
4.51 + <properties>
4.52 + <!-- This classes (separated with , ; space) will be available through vm.loadClass() -->
4.53 + <html4j.entryPoints>org.apidesign.html.demo.chess.LoadMain</html4j.entryPoints>
4.54 + </properties>
4.55 + <!-- Don't include main page - we created it by ourselves -->
4.56 + <mainPageIncluded>false</mainPageIncluded>
4.57 + <!-- Merge runtime.js instead of putting as a separate file -->
4.58 + <runtime>MERGED</runtime>
4.59 + <!-- Name of the generated file -->
4.60 + <targetFileName>bck2brwsr.js</targetFileName>
4.61 + <targetDirectory>${project.build.directory}/teavm</targetDirectory>
4.62 + <!-- This transformer adds null checks before virtual calls. It is not included
4.63 + by default as we don't always need these null checks -->
4.64 + <transformers>
4.65 + <param>org.teavm.javascript.NullPointerExceptionTransformer</param>
4.66 + </transformers>
4.67 + </configuration>
4.68 + </execution>
4.69 + </executions>
4.70 + </plugin>
4.71 + <plugin>
4.72 + <artifactId>maven-assembly-plugin</artifactId>
4.73 + <version>2.4</version>
4.74 + <executions>
4.75 + <execution>
4.76 + <id>distro-assembly</id>
4.77 + <phase>package</phase>
4.78 + <goals>
4.79 + <goal>single</goal>
4.80 + </goals>
4.81 + <configuration>
4.82 + <descriptors>
4.83 + <descriptor>src/main/assembly/teabrwsr.xml</descriptor>
4.84 + </descriptors>
4.85 + </configuration>
4.86 + </execution>
4.87 + </executions>
4.88 + </plugin>
4.89 + </plugins>
4.90 + </build>
4.91 + </profile>
4.92 </profiles>
4.93 </project>
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/chess/src/main/assembly/teabrwsr.xml Mon Sep 08 10:11:50 2014 +0200
5.3 @@ -0,0 +1,47 @@
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>teabrwsr</id>
5.34 + <formats>
5.35 + <format>zip</format>
5.36 + </formats>
5.37 + <baseDirectory>public_html</baseDirectory>
5.38 + <fileSets>
5.39 + <fileSet>
5.40 + <directory>src/main/webapp/pages</directory>
5.41 + <outputDirectory>/</outputDirectory>
5.42 + <filtered>true</filtered>
5.43 + </fileSet>
5.44 + <fileSet>
5.45 + <directory>${project.build.directory}/teavm/</directory>
5.46 + <outputDirectory>/</outputDirectory>
5.47 + <filtered>false</filtered>
5.48 + </fileSet>
5.49 + </fileSets>
5.50 +</assembly>
6.1 --- a/minesweeper/AndroidManifest.xml Fri Mar 21 15:02:25 2014 +0100
6.2 +++ b/minesweeper/AndroidManifest.xml Mon Sep 08 10:11:50 2014 +0200
6.3 @@ -33,23 +33,31 @@
6.4 android:minSdkVersion="8"
6.5 android:targetSdkVersion="16" />
6.6
6.7 - <uses-permission android:name="android.permission.INTERNET" />
6.8 <application
6.9 android:allowBackup="true"
6.10 android:icon="@drawable/ic_launcher"
6.11 - android:label="@string/app_name"
6.12 + android:label="Minesweeper"
6.13 android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
6.14 <activity android:name="org.apidesign.brwsr.DlvkBrwsr"
6.15 android:configChanges="orientation|screenSize">
6.16 <intent-filter>
6.17 <action android:name="android.intent.action.MAIN" />
6.18 -
6.19 <category android:name="android.intent.category.LAUNCHER" />
6.20 </intent-filter>
6.21 </activity>
6.22 +
6.23 + <!-- Configuration section. Defines:
6.24 + - the HTML page to load on start
6.25 + - the class that contains the main initialization method
6.26 + - name of the initialization method in the given class
6.27 + -->
6.28 <meta-data android:name="loadPage" android:value="file:///android_asset/pages/index.html" />
6.29 - <meta-data android:name="loadClass" android:value="org.apidesign.demo.minesweeper.Main" />
6.30 - <meta-data android:name="invoke" android:value="onPageLoad" />
6.31 + <meta-data android:name="loadClass" android:value="org.apidesign.demo.minesweeper.MinesModel" />
6.32 + <meta-data android:name="invoke" android:value="main" />
6.33 </application>
6.34 -
6.35 +
6.36 + <!-- allows use of internet and also 'call-home' feature. See
6.37 + licensing section in Javadoc
6.38 + -->
6.39 + <uses-permission android:name="android.permission.INTERNET" />
6.40 </manifest>
6.41 \ No newline at end of file
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/minesweeper/Info.plist.xml Mon Sep 08 10:11:50 2014 +0200
7.3 @@ -0,0 +1,71 @@
7.4 +<?xml version="1.0" encoding="UTF-8"?>
7.5 +<!--
7.6 +
7.7 + The MIT License (MIT)
7.8 +
7.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
7.10 +
7.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
7.12 + of this software and associated documentation files (the "Software"), to deal
7.13 + in the Software without restriction, including without limitation the rights
7.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7.15 + copies of the Software, and to permit persons to whom the Software is
7.16 + furnished to do so, subject to the following conditions:
7.17 +
7.18 + The above copyright notice and this permission notice shall be included in
7.19 + all copies or substantial portions of the Software.
7.20 +
7.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
7.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
7.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
7.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
7.27 + THE SOFTWARE.
7.28 +
7.29 +-->
7.30 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
7.31 +<plist version="1.0">
7.32 + <dict>
7.33 + <key>CFBundleDevelopmentRegion</key>
7.34 + <string>en</string>
7.35 + <key>CFBundleDisplayName</key>
7.36 + <string>Fair Mines</string>
7.37 + <key>CFBundleExecutable</key>
7.38 + <string>MineSweeper</string>
7.39 + <key>CFBundleIdentifier</key>
7.40 + <string>jst</string>
7.41 + <key>CFBundleInfoDictionaryVersion</key>
7.42 + <string>6.0</string>
7.43 + <key>CFBundleName</key>
7.44 + <string>Fair Mines</string>
7.45 + <key>CFBundlePackageType</key>
7.46 + <string>APPL</string>
7.47 + <key>CFBundleShortVersionString</key>
7.48 + <string>2.3</string>
7.49 + <key>CFBundleSignature</key>
7.50 + <string>????</string>
7.51 + <key>CFBundleVersion</key>
7.52 + <string>1</string>
7.53 + <key>NSHumanReadableCopyright</key>
7.54 + <string>Copyright © 2014 Jaroslav Tulach. All rights reserved.</string>
7.55 + <key>LSRequiresIPhoneOS</key>
7.56 + <true/>
7.57 + <key>UIDeviceFamily</key>
7.58 + <array>
7.59 + <integer>1</integer>
7.60 + <integer>2</integer>
7.61 + </array>
7.62 + <key>UIRequiredDeviceCapabilities</key>
7.63 + <array>
7.64 + <string>armv7</string>
7.65 + </array>
7.66 + <key>UISupportedInterfaceOrientations</key>
7.67 + <array>
7.68 + <string>UIInterfaceOrientationPortrait</string>
7.69 + <string>UIInterfaceOrientationLandscapeLeft</string>
7.70 + <string>UIInterfaceOrientationLandscapeRight</string>
7.71 + <string>UIInterfaceOrientationPortraitUpsideDown</string>
7.72 + </array>
7.73 + </dict>
7.74 +</plist>
8.1 --- a/minesweeper/nbactions-bck2brwsr.xml Fri Mar 21 15:02:25 2014 +0100
8.2 +++ b/minesweeper/nbactions-bck2brwsr.xml Mon Sep 08 10:11:50 2014 +0200
8.3 @@ -29,7 +29,7 @@
8.4 <actionName>run</actionName>
8.5 <goals>
8.6 <goal>package</goal>
8.7 - <goal>bck2brwsr:brwsr</goal>
8.8 + <goal>bck2brwsr:show</goal>
8.9 </goals>
8.10 <properties>
8.11 <skipTests>true</skipTests>
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/minesweeper/nbactions-ibrwsr.xml Mon Sep 08 10:11:50 2014 +0200
9.3 @@ -0,0 +1,35 @@
9.4 +<?xml version="1.0" encoding="UTF-8"?>
9.5 +<!--
9.6 +
9.7 + The MIT License (MIT)
9.8 +
9.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
9.10 +
9.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
9.12 + of this software and associated documentation files (the "Software"), to deal
9.13 + in the Software without restriction, including without limitation the rights
9.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9.15 + copies of the Software, and to permit persons to whom the Software is
9.16 + furnished to do so, subject to the following conditions:
9.17 +
9.18 + The above copyright notice and this permission notice shall be included in
9.19 + all copies or substantial portions of the Software.
9.20 +
9.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
9.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
9.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
9.27 + THE SOFTWARE.
9.28 +
9.29 +-->
9.30 +<actions>
9.31 + <action>
9.32 + <actionName>run</actionName>
9.33 + <goals>
9.34 + <goal>package</goal>
9.35 + <goal>robovm:ipad-sim</goal>
9.36 + </goals>
9.37 + </action>
9.38 +</actions>
10.1 --- a/minesweeper/nbactions.xml Fri Mar 21 15:02:25 2014 +0100
10.2 +++ b/minesweeper/nbactions.xml Mon Sep 08 10:11:50 2014 +0200
10.3 @@ -24,22 +24,4 @@
10.4 THE SOFTWARE.
10.5
10.6 -->
10.7 -<actions>
10.8 - <action>
10.9 - <actionName>run</actionName>
10.10 - <goals>
10.11 - <goal>process-classes</goal>
10.12 - <goal>exec:java</goal>
10.13 - </goals>
10.14 - </action>
10.15 - <action>
10.16 - <actionName>debug</actionName>
10.17 - <goals>
10.18 - <goal>process-classes</goal>
10.19 - <goal>exec:java</goal>
10.20 - </goals>
10.21 - <properties>
10.22 - <jpda.listen>maven</jpda.listen>
10.23 - </properties>
10.24 - </action>
10.25 </actions>
11.1 --- a/minesweeper/pom.xml Fri Mar 21 15:02:25 2014 +0100
11.2 +++ b/minesweeper/pom.xml Mon Sep 08 10:11:50 2014 +0200
11.3 @@ -4,7 +4,7 @@
11.4
11.5 <groupId>org.apidesign.demo</groupId>
11.6 <artifactId>minesweeper</artifactId>
11.7 - <version>1.0-SNAPSHOT</version>
11.8 + <version>2.0-SNAPSHOT</version>
11.9 <packaging>jar</packaging>
11.10 <parent>
11.11 <artifactId>demo</artifactId>
11.12 @@ -13,12 +13,20 @@
11.13 </parent>
11.14
11.15 <name>Mine Sweeper</name>
11.16 -
11.17 + <description>
11.18 + Demonstration of DukeScript rendering technology.
11.19 + Plus old, good, simple and entertaining game.
11.20 + Improve your coding skills by playing a game and
11.21 + meanwhile learn what a rendering technology of the
11.22 + future is going to look like. Learn to use DukeScript:
11.23 + Write once, display (and deploy) anywhere!
11.24 + </description>
11.25 + <url>http://html.java.net/</url>
11.26 <properties>
11.27 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11.28 - <brwsr.startpage>pages/index.html</brwsr.startpage>
11.29 <project.mainclass>org.apidesign.demo.minesweeper.Main</project.mainclass>
11.30 <netbeans.compile.on.save>none</netbeans.compile.on.save>
11.31 + <bck2brwsr.obfuscationlevel>FULL</bck2brwsr.obfuscationlevel>
11.32 </properties>
11.33 <build>
11.34 <plugins>
11.35 @@ -90,7 +98,7 @@
11.36 <dependency>
11.37 <groupId>org.netbeans.html</groupId>
11.38 <artifactId>nbrwsr</artifactId>
11.39 - <version>${net.java.html.version}</version>
11.40 + <version>${nb.html.version}</version>
11.41 <scope>provided</scope>
11.42 </dependency>
11.43 <dependency>
11.44 @@ -109,6 +117,20 @@
11.45 <build>
11.46 <plugins>
11.47 <plugin>
11.48 + <groupId>org.apache.maven.plugins</groupId>
11.49 + <artifactId>maven-jar-plugin</artifactId>
11.50 + <version>2.4</version>
11.51 + <configuration>
11.52 + <archive>
11.53 + <manifest>
11.54 + <mainClass>${project.mainclass}</mainClass>
11.55 + <addClasspath>true</addClasspath>
11.56 + <classpathPrefix>lib/</classpathPrefix>
11.57 + </manifest>
11.58 + </archive>
11.59 + </configuration>
11.60 + </plugin>
11.61 + <plugin>
11.62 <artifactId>maven-assembly-plugin</artifactId>
11.63 <version>2.4</version>
11.64 <executions>
11.65 @@ -141,13 +163,27 @@
11.66 <id>bck2brwsr</id>
11.67 <activation>
11.68 <property>
11.69 - <name>brwsr</name>
11.70 <value>bck2brwsr</value>
11.71 + <name>show</name>
11.72 </property>
11.73 </activation>
11.74 <build>
11.75 <plugins>
11.76 <plugin>
11.77 + <groupId>org.apache.maven.plugins</groupId>
11.78 + <artifactId>maven-jar-plugin</artifactId>
11.79 + <version>2.4</version>
11.80 + <configuration>
11.81 + <archive>
11.82 + <manifest>
11.83 + <mainClass>${project.mainclass}</mainClass>
11.84 + <addClasspath>true</addClasspath>
11.85 + <classpathPrefix>lib/</classpathPrefix>
11.86 + </manifest>
11.87 + </archive>
11.88 + </configuration>
11.89 + </plugin>
11.90 + <plugin>
11.91 <groupId>org.apidesign.bck2brwsr</groupId>
11.92 <artifactId>bck2brwsr-maven-plugin</artifactId>
11.93 <version>${bck2brwsr.version}</version>
11.94 @@ -155,12 +191,19 @@
11.95 <execution>
11.96 <goals>
11.97 <goal>brwsr</goal>
11.98 + <goal>aot</goal>
11.99 </goals>
11.100 </execution>
11.101 </executions>
11.102 <configuration>
11.103 - <directory>${basedir}/src/main/webapp/</directory>
11.104 - <startpage>${brwsr.startpage}</startpage>
11.105 + <obfuscation>${bck2brwsr.obfuscationlevel}</obfuscation>
11.106 + <directory>${project.build.directory}/${project.build.finalName}-bck2brwsr/public_html/</directory>
11.107 + <startpage>index.html</startpage>
11.108 + <classPathPrefix>lib</classPathPrefix>
11.109 + <mainJavaScript>${project.build.directory}/minesweeper.js</mainJavaScript>
11.110 + <exports>
11.111 + <export>org.apidesign.demo.minesweeper.MinesModel</export>
11.112 + </exports>
11.113 </configuration>
11.114 </plugin>
11.115 <plugin>
11.116 @@ -200,6 +243,17 @@
11.117 <classifier>rt</classifier>
11.118 </dependency>
11.119 <dependency>
11.120 + <groupId>org.netbeans.html</groupId>
11.121 + <artifactId>net.java.html.boot</artifactId>
11.122 + <version>${net.java.html.version}</version>
11.123 + <exclusions>
11.124 + <exclusion>
11.125 + <artifactId>asm</artifactId>
11.126 + <groupId>org.ow2.asm</groupId>
11.127 + </exclusion>
11.128 + </exclusions>
11.129 + </dependency>
11.130 + <dependency>
11.131 <groupId>org.apidesign.bck2brwsr</groupId>
11.132 <artifactId>ko-bck2brwsr</artifactId>
11.133 <version>${bck2brwsr.version}</version>
11.134 @@ -232,7 +286,7 @@
11.135 <dependency>
11.136 <groupId>org.apidesign.brwsr</groupId>
11.137 <artifactId>dlvkbrwsr</artifactId>
11.138 - <version>0.5</version>
11.139 + <version>1.0-SNAPSHOT</version>
11.140 <type>jar</type>
11.141 </dependency>
11.142 <dependency>
11.143 @@ -250,17 +304,55 @@
11.144 <build>
11.145 <plugins>
11.146 <plugin>
11.147 + <groupId>com.filmon.maven</groupId>
11.148 + <artifactId>image-maven-plugin</artifactId>
11.149 + <version>1.1</version>
11.150 + <executions>
11.151 + <execution>
11.152 + <goals>
11.153 + <goal>scale</goal>
11.154 + </goals>
11.155 + <configuration>
11.156 + <outputDirectory>target/res</outputDirectory>
11.157 + <images>
11.158 + <image>
11.159 + <source>src/main/icons/DukeSweeper.png</source>
11.160 + <destination>drawable-hdpi/ic_launcher.png</destination>
11.161 + <width>72</width>
11.162 + </image>
11.163 + <image>
11.164 + <source>src/main/icons/DukeSweeper.png</source>
11.165 + <destination>drawable-mdpi/ic_launcher.png</destination>
11.166 + <width>48</width>
11.167 + </image>
11.168 + <image>
11.169 + <source>src/main/icons/DukeSweeper.png</source>
11.170 + <destination>drawable-xhdpi/ic_launcher.png</destination>
11.171 + <width>96</width>
11.172 + </image>
11.173 + <image>
11.174 + <source>src/main/icons/DukeSweeper.png</source>
11.175 + <destination>drawable-xxhdpi/ic_launcher.png</destination>
11.176 + <width>144</width>
11.177 + </image>
11.178 + </images>
11.179 + </configuration>
11.180 + </execution>
11.181 + </executions>
11.182 + </plugin>
11.183 + <plugin>
11.184 <groupId>com.jayway.maven.plugins.android.generation2</groupId>
11.185 <artifactId>android-maven-plugin</artifactId>
11.186 <version>${android.plugin.version}</version>
11.187 <extensions>true</extensions>
11.188 <configuration>
11.189 + <resourceDirectory>target/res</resourceDirectory>
11.190 <classifier>apk</classifier>
11.191 <attachJar>false</attachJar>
11.192 <apkDebug>debug</apkDebug>
11.193 <assetsDirectory>src/main/webapp</assetsDirectory>
11.194 <sdk>
11.195 - <platform>16</platform>
11.196 + <platform>19</platform>
11.197 </sdk>
11.198 <apk>
11.199 <metaIncludes>
11.200 @@ -304,15 +396,190 @@
11.201 </plugin>
11.202 </plugins>
11.203 </build>
11.204 -
11.205 </profile>
11.206 <profile>
11.207 + <id>teabrwsr</id>
11.208 + <build>
11.209 + <plugins>
11.210 + <plugin>
11.211 + <groupId>org.teavm</groupId>
11.212 + <artifactId>teavm-maven-plugin</artifactId>
11.213 + <version>${teavm.version}</version>
11.214 + <dependencies>
11.215 + <dependency>
11.216 + <groupId>org.teavm</groupId>
11.217 + <artifactId>teavm-classlib</artifactId>
11.218 + <version>${teavm.version}</version>
11.219 + </dependency>
11.220 + <!-- This module adds html4j support. It mainly includes JavaScriptBuilder support.
11.221 + Also there are some little patches to JCL emulation, that are required to pass TCK -->
11.222 + <dependency>
11.223 + <groupId>org.teavm</groupId>
11.224 + <artifactId>teavm-html4j</artifactId>
11.225 + <version>${teavm.version}</version>
11.226 + </dependency>
11.227 + </dependencies>
11.228 + <executions>
11.229 + <execution>
11.230 + <id>generate-minesweeper</id>
11.231 + <goals>
11.232 + <goal>build-javascript</goal>
11.233 + </goals>
11.234 + <phase>process-classes</phase>
11.235 + <configuration>
11.236 + <!-- Whether we want TeaVM to minify (obfuscate) the generated JavaScript -->
11.237 + <minifying>false</minifying>
11.238 + <properties>
11.239 + <!-- This classes (separated with , ; space) will be available through vm.loadClass() -->
11.240 + <html4j.entryPoints>org.apidesign.demo.minesweeper.MainBrwsr</html4j.entryPoints>
11.241 + </properties>
11.242 + <!-- Don't include main page - we created it by ourselves -->
11.243 + <mainPageIncluded>false</mainPageIncluded>
11.244 + <!-- Merge runtime.js instead of putting as a separate file -->
11.245 + <runtime>MERGED</runtime>
11.246 + <!-- Name of the generated file -->
11.247 + <targetFileName>bck2brwsr.js</targetFileName>
11.248 + <targetDirectory>${project.build.directory}/teavm</targetDirectory>
11.249 + <!-- This transformer adds null checks before virtual calls. It is not included
11.250 + by default as we don't always need these null checks -->
11.251 + <transformers>
11.252 + <param>org.teavm.javascript.NullPointerExceptionTransformer</param>
11.253 + </transformers>
11.254 + </configuration>
11.255 + </execution>
11.256 + </executions>
11.257 + </plugin>
11.258 + <plugin>
11.259 + <artifactId>maven-assembly-plugin</artifactId>
11.260 + <version>2.4</version>
11.261 + <executions>
11.262 + <execution>
11.263 + <id>distro-assembly</id>
11.264 + <phase>package</phase>
11.265 + <goals>
11.266 + <goal>single</goal>
11.267 + </goals>
11.268 + <configuration>
11.269 + <descriptors>
11.270 + <descriptor>src/main/assembly/teabrwsr.xml</descriptor>
11.271 + </descriptors>
11.272 + </configuration>
11.273 + </execution>
11.274 + </executions>
11.275 + </plugin>
11.276 + </plugins>
11.277 + </build>
11.278 + </profile>
11.279 + <profile>
11.280 + <id>ibrwsr</id>
11.281 + <dependencies>
11.282 + <dependency>
11.283 + <groupId>org.apidesign.brwsr</groupId>
11.284 + <artifactId>ibrwsr</artifactId>
11.285 + <version>0.8.3</version>
11.286 + <scope>runtime</scope>
11.287 + </dependency>
11.288 + </dependencies>
11.289 + <build>
11.290 + <plugins>
11.291 + <plugin>
11.292 + <groupId>com.filmon.maven</groupId>
11.293 + <artifactId>image-maven-plugin</artifactId>
11.294 + <version>1.1</version>
11.295 + <executions>
11.296 + <execution>
11.297 + <goals>
11.298 + <goal>scale</goal>
11.299 + </goals>
11.300 + <configuration>
11.301 + <outputDirectory>target/images</outputDirectory>
11.302 + <images>
11.303 + <image>
11.304 + <source>src/main/icons/DukeSweeper.png</source>
11.305 + <destination>Icon.png</destination>
11.306 + <width>57</width>
11.307 + </image>
11.308 + <image>
11.309 + <source>src/main/icons/DukeSweeper.png</source>
11.310 + <destination>Icon@2.png</destination>
11.311 + <width>114</width>
11.312 + </image>
11.313 + <image>
11.314 + <source>src/main/icons/DukeSweeper.png</source>
11.315 + <destination>Icon-60.png</destination>
11.316 + <width>60</width>
11.317 + </image>
11.318 + <image>
11.319 + <source>src/main/icons/DukeSweeper.png</source>
11.320 + <destination>Icon-60@2.png</destination>
11.321 + <width>120</width>
11.322 + </image>
11.323 + <image>
11.324 + <source>src/main/icons/DukeSweeper.png</source>
11.325 + <destination>Icon-72.png</destination>
11.326 + <width>72</width>
11.327 + </image>
11.328 + <image>
11.329 + <source>src/main/icons/DukeSweeper.png</source>
11.330 + <destination>Icon-76.png</destination>
11.331 + <width>76</width>
11.332 + </image>
11.333 + </images>
11.334 + </configuration>
11.335 + </execution>
11.336 + </executions>
11.337 + </plugin>
11.338 + <plugin>
11.339 + <groupId>org.robovm</groupId>
11.340 + <artifactId>robovm-maven-plugin</artifactId>
11.341 + <version>0.0.14.1</version>
11.342 + <configuration>
11.343 + <config>
11.344 + <mainClass>org.apidesign.demo.minesweeper.Main</mainClass>
11.345 + <forceLinkClasses>
11.346 + <pattern>java.util.logging.ConsoleHandler</pattern>
11.347 + <pattern>java.util.logging.SimpleFormatter</pattern>
11.348 + <pattern>org.netbeans.html.ko4j.KO4J</pattern>
11.349 + <pattern>org.netbeans.html.sound.impl.BrowserAudioEnv</pattern>
11.350 + <pattern>org.apidesign.brwsr.IBrwsrPrsntr</pattern>
11.351 + </forceLinkClasses>
11.352 + <executableName>MineSweeper</executableName>
11.353 + <resources>
11.354 + <resource>src/main/webapp/pages</resource>
11.355 + <resource>
11.356 + <targetPath>/</targetPath>
11.357 + <directory>src/main/icons/</directory>
11.358 + <includes>
11.359 + <include>Default*.png</include>
11.360 + </includes>
11.361 + </resource>
11.362 + <resource>
11.363 + <targetPath>/</targetPath>
11.364 + <directory>target/images/</directory>
11.365 + <includes>
11.366 + <include>*.png</include>
11.367 + </includes>
11.368 + </resource>
11.369 + </resources>
11.370 + <iosInfoPList>Info.plist.xml</iosInfoPList>
11.371 + </config>
11.372 + <includeJFX>false</includeJFX>
11.373 + <!--
11.374 + <iosSignIdentity>iPhone Distribution</iosSignIdentity>
11.375 + <iosProvisioningProfile>9728E91B-1BB7-40D6-8922-3DD3BA5E6ECD</iosProvisioningProfile>
11.376 + -->
11.377 + </configuration>
11.378 + </plugin>
11.379 + </plugins>
11.380 + </build>
11.381 + </profile>
11.382 + <profile>
11.383 <id>nbrwsr</id>
11.384 <dependencies>
11.385 <dependency>
11.386 <groupId>org.netbeans.html</groupId>
11.387 <artifactId>nbrwsr</artifactId>
11.388 - <version>${net.java.html.version}</version>
11.389 + <version>${nb.html.version}</version>
11.390 <scope>compile</scope>
11.391 </dependency>
11.392 </dependencies>
11.393 @@ -356,7 +623,7 @@
11.394 <configuration>
11.395 <useOSGiDependencies>true</useOSGiDependencies>
11.396 <brandingToken>html4j4nb</brandingToken>
11.397 - <cluster>html4j4nb</cluster>
11.398 + <cluster>extra</cluster>
11.399 <verifyIntegrity>false</verifyIntegrity>
11.400 </configuration>
11.401 </execution>
11.402 @@ -368,7 +635,7 @@
11.403 </goals>
11.404 <configuration>
11.405 <useOSGiDependencies>true</useOSGiDependencies>
11.406 - <cluster>html4j4nb</cluster>
11.407 + <cluster>extra</cluster>
11.408 <verifyIntegrity>false</verifyIntegrity>
11.409 </configuration>
11.410 </execution>
12.1 Binary file minesweeper/res/drawable-hdpi/ic_launcher.png has changed
13.1 Binary file minesweeper/res/drawable-mdpi/ic_launcher.png has changed
14.1 Binary file minesweeper/res/drawable-xhdpi/ic_launcher.png has changed
15.1 Binary file minesweeper/res/drawable-xxhdpi/ic_launcher.png has changed
16.1 --- a/minesweeper/res/layout/activity_main.xml Fri Mar 21 15:02:25 2014 +0100
16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
16.3 @@ -1,40 +0,0 @@
16.4 -<!--
16.5 -
16.6 - The MIT License (MIT)
16.7 -
16.8 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
16.9 -
16.10 - Permission is hereby granted, free of charge, to any person obtaining a copy
16.11 - of this software and associated documentation files (the "Software"), to deal
16.12 - in the Software without restriction, including without limitation the rights
16.13 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16.14 - copies of the Software, and to permit persons to whom the Software is
16.15 - furnished to do so, subject to the following conditions:
16.16 -
16.17 - The above copyright notice and this permission notice shall be included in
16.18 - all copies or substantial portions of the Software.
16.19 -
16.20 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16.21 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16.22 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16.23 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16.24 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16.25 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16.26 - THE SOFTWARE.
16.27 -
16.28 --->
16.29 -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
16.30 - android:layout_width="match_parent"
16.31 - android:layout_height="match_parent"
16.32 - android:paddingBottom="@dimen/activity_vertical_margin"
16.33 - android:paddingLeft="@dimen/activity_horizontal_margin"
16.34 - android:paddingRight="@dimen/activity_horizontal_margin"
16.35 - android:paddingTop="@dimen/activity_vertical_margin" >
16.36 -
16.37 - <Button android:layout_width="wrap_content"
16.38 - android:layout_height="wrap_content"
16.39 - android:text="@string/hello_world"
16.40 - android:onClick="click"
16.41 - />
16.42 -
16.43 -</RelativeLayout>
16.44 \ No newline at end of file
17.1 --- a/minesweeper/res/menu/main.xml Fri Mar 21 15:02:25 2014 +0100
17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
17.3 @@ -1,34 +0,0 @@
17.4 -<!--
17.5 -
17.6 - The MIT License (MIT)
17.7 -
17.8 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
17.9 -
17.10 - Permission is hereby granted, free of charge, to any person obtaining a copy
17.11 - of this software and associated documentation files (the "Software"), to deal
17.12 - in the Software without restriction, including without limitation the rights
17.13 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17.14 - copies of the Software, and to permit persons to whom the Software is
17.15 - furnished to do so, subject to the following conditions:
17.16 -
17.17 - The above copyright notice and this permission notice shall be included in
17.18 - all copies or substantial portions of the Software.
17.19 -
17.20 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17.21 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17.22 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17.23 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17.24 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17.25 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17.26 - THE SOFTWARE.
17.27 -
17.28 --->
17.29 -<menu xmlns:android="http://schemas.android.com/apk/res/android" >
17.30 -
17.31 - <item
17.32 - android:id="@+id/action_settings"
17.33 - android:orderInCategory="100"
17.34 - android:showAsAction="never"
17.35 - android:title="@string/action_settings"/>
17.36 -
17.37 -</menu>
17.38 \ No newline at end of file
18.1 --- a/minesweeper/res/values-sw600dp/dimens.xml Fri Mar 21 15:02:25 2014 +0100
18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
18.3 @@ -1,33 +0,0 @@
18.4 -<!--
18.5 -
18.6 - The MIT License (MIT)
18.7 -
18.8 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
18.9 -
18.10 - Permission is hereby granted, free of charge, to any person obtaining a copy
18.11 - of this software and associated documentation files (the "Software"), to deal
18.12 - in the Software without restriction, including without limitation the rights
18.13 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18.14 - copies of the Software, and to permit persons to whom the Software is
18.15 - furnished to do so, subject to the following conditions:
18.16 -
18.17 - The above copyright notice and this permission notice shall be included in
18.18 - all copies or substantial portions of the Software.
18.19 -
18.20 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18.21 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18.22 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18.23 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18.24 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18.25 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
18.26 - THE SOFTWARE.
18.27 -
18.28 --->
18.29 -<resources>
18.30 -
18.31 - <!--
18.32 - Customize dimensions originally defined in res/values/dimens.xml (such as
18.33 - screen margins) for sw600dp devices (e.g. 7" tablets) here.
18.34 - -->
18.35 -
18.36 -</resources>
18.37 \ No newline at end of file
19.1 --- a/minesweeper/res/values-sw720dp-land/dimens.xml Fri Mar 21 15:02:25 2014 +0100
19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
19.3 @@ -1,34 +0,0 @@
19.4 -<!--
19.5 -
19.6 - The MIT License (MIT)
19.7 -
19.8 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
19.9 -
19.10 - Permission is hereby granted, free of charge, to any person obtaining a copy
19.11 - of this software and associated documentation files (the "Software"), to deal
19.12 - in the Software without restriction, including without limitation the rights
19.13 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19.14 - copies of the Software, and to permit persons to whom the Software is
19.15 - furnished to do so, subject to the following conditions:
19.16 -
19.17 - The above copyright notice and this permission notice shall be included in
19.18 - all copies or substantial portions of the Software.
19.19 -
19.20 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19.21 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19.22 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19.23 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19.24 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19.25 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19.26 - THE SOFTWARE.
19.27 -
19.28 --->
19.29 -<resources>
19.30 -
19.31 - <!--
19.32 - Customize dimensions originally defined in res/values/dimens.xml (such as
19.33 - screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
19.34 - -->
19.35 - <dimen name="activity_horizontal_margin">128dp</dimen>
19.36 -
19.37 -</resources>
19.38 \ No newline at end of file
20.1 --- a/minesweeper/res/values-v11/styles.xml Fri Mar 21 15:02:25 2014 +0100
20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
20.3 @@ -1,36 +0,0 @@
20.4 -<!--
20.5 -
20.6 - The MIT License (MIT)
20.7 -
20.8 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
20.9 -
20.10 - Permission is hereby granted, free of charge, to any person obtaining a copy
20.11 - of this software and associated documentation files (the "Software"), to deal
20.12 - in the Software without restriction, including without limitation the rights
20.13 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20.14 - copies of the Software, and to permit persons to whom the Software is
20.15 - furnished to do so, subject to the following conditions:
20.16 -
20.17 - The above copyright notice and this permission notice shall be included in
20.18 - all copies or substantial portions of the Software.
20.19 -
20.20 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20.21 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20.22 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20.23 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20.24 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20.25 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20.26 - THE SOFTWARE.
20.27 -
20.28 --->
20.29 -<resources>
20.30 -
20.31 - <!--
20.32 - Base application theme for API 11+. This theme completely replaces
20.33 - AppBaseTheme from res/values/styles.xml on API 11+ devices.
20.34 - -->
20.35 - <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
20.36 - <!-- API 11 theme customizations can go here. -->
20.37 - </style>
20.38 -
20.39 -</resources>
20.40 \ No newline at end of file
21.1 --- a/minesweeper/res/values-v14/styles.xml Fri Mar 21 15:02:25 2014 +0100
21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
21.3 @@ -1,37 +0,0 @@
21.4 -<!--
21.5 -
21.6 - The MIT License (MIT)
21.7 -
21.8 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
21.9 -
21.10 - Permission is hereby granted, free of charge, to any person obtaining a copy
21.11 - of this software and associated documentation files (the "Software"), to deal
21.12 - in the Software without restriction, including without limitation the rights
21.13 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21.14 - copies of the Software, and to permit persons to whom the Software is
21.15 - furnished to do so, subject to the following conditions:
21.16 -
21.17 - The above copyright notice and this permission notice shall be included in
21.18 - all copies or substantial portions of the Software.
21.19 -
21.20 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21.21 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21.22 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21.23 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21.24 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21.25 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21.26 - THE SOFTWARE.
21.27 -
21.28 --->
21.29 -<resources>
21.30 -
21.31 - <!--
21.32 - Base application theme for API 14+. This theme completely replaces
21.33 - AppBaseTheme from BOTH res/values/styles.xml and
21.34 - res/values-v11/styles.xml on API 14+ devices.
21.35 - -->
21.36 - <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
21.37 - <!-- API 14 theme customizations can go here. -->
21.38 - </style>
21.39 -
21.40 -</resources>
21.41 \ No newline at end of file
22.1 --- a/minesweeper/res/values/dimens.xml Fri Mar 21 15:02:25 2014 +0100
22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
22.3 @@ -1,32 +0,0 @@
22.4 -<!--
22.5 -
22.6 - The MIT License (MIT)
22.7 -
22.8 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
22.9 -
22.10 - Permission is hereby granted, free of charge, to any person obtaining a copy
22.11 - of this software and associated documentation files (the "Software"), to deal
22.12 - in the Software without restriction, including without limitation the rights
22.13 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22.14 - copies of the Software, and to permit persons to whom the Software is
22.15 - furnished to do so, subject to the following conditions:
22.16 -
22.17 - The above copyright notice and this permission notice shall be included in
22.18 - all copies or substantial portions of the Software.
22.19 -
22.20 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22.21 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22.22 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22.23 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22.24 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22.25 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22.26 - THE SOFTWARE.
22.27 -
22.28 --->
22.29 -<resources>
22.30 -
22.31 - <!-- Default screen margins, per the Android Design guidelines. -->
22.32 - <dimen name="activity_horizontal_margin">16dp</dimen>
22.33 - <dimen name="activity_vertical_margin">16dp</dimen>
22.34 -
22.35 -</resources>
22.36 \ No newline at end of file
23.1 --- a/minesweeper/res/values/strings.xml Fri Mar 21 15:02:25 2014 +0100
23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
23.3 @@ -1,34 +0,0 @@
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 -<resources>
23.31 -
23.32 - <string name="app_name">Minesweeper</string>
23.33 - <string name="hello">Hello m4dlvk!</string>
23.34 - <string name="action_settings">Settings</string>
23.35 - <string name="hello_world">Hello world!</string>
23.36 -
23.37 -</resources>
23.38 \ No newline at end of file
24.1 --- a/minesweeper/res/values/styles.xml Fri Mar 21 15:02:25 2014 +0100
24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
24.3 @@ -1,28 +0,0 @@
24.4 -<!--
24.5 -
24.6 - The MIT License (MIT)
24.7 -
24.8 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
24.9 -
24.10 - Permission is hereby granted, free of charge, to any person obtaining a copy
24.11 - of this software and associated documentation files (the "Software"), to deal
24.12 - in the Software without restriction, including without limitation the rights
24.13 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24.14 - copies of the Software, and to permit persons to whom the Software is
24.15 - furnished to do so, subject to the following conditions:
24.16 -
24.17 - The above copyright notice and this permission notice shall be included in
24.18 - all copies or substantial portions of the Software.
24.19 -
24.20 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24.21 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24.22 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24.23 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24.24 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24.25 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24.26 - THE SOFTWARE.
24.27 -
24.28 --->
24.29 -<resources>
24.30 -
24.31 -</resources>
24.32 \ No newline at end of file
25.1 --- a/minesweeper/src/main/assembly/bck2brwsr.xml Fri Mar 21 15:02:25 2014 +0100
25.2 +++ b/minesweeper/src/main/assembly/bck2brwsr.xml Mon Sep 08 10:11:50 2014 +0200
25.3 @@ -30,39 +30,36 @@
25.4 <id>bck2brwsr</id>
25.5 <formats>
25.6 <format>zip</format>
25.7 + <format>dir</format>
25.8 </formats>
25.9 <baseDirectory>public_html</baseDirectory>
25.10 - <dependencySets>
25.11 - <dependencySet>
25.12 - <useProjectArtifact>false</useProjectArtifact>
25.13 - <scope>runtime</scope>
25.14 - <outputDirectory>lib</outputDirectory>
25.15 - <includes>
25.16 - <include>*:jar</include>
25.17 - <include>*:rt</include>
25.18 - </includes>
25.19 - </dependencySet>
25.20 - <dependencySet>
25.21 - <useProjectArtifact>false</useProjectArtifact>
25.22 - <scope>provided</scope>
25.23 - <includes>
25.24 - <include>*:js</include>
25.25 - </includes>
25.26 - <unpack>true</unpack>
25.27 - <outputDirectory>/</outputDirectory>
25.28 - </dependencySet>
25.29 - </dependencySets>
25.30 <fileSets>
25.31 <fileSet>
25.32 <directory>src/main/webapp/pages</directory>
25.33 <outputDirectory>/</outputDirectory>
25.34 <filtered>true</filtered>
25.35 + <includes>
25.36 + <include>*.html</include>
25.37 + <include>*.css</include>
25.38 + </includes>
25.39 </fileSet>
25.40 + <fileSet>
25.41 + <directory>src/main/webapp/pages</directory>
25.42 + <outputDirectory>/</outputDirectory>
25.43 + <filtered>false</filtered>
25.44 + <excludes>
25.45 + <exclude>*.html</exclude>
25.46 + <exclude>*.css</exclude>
25.47 + </excludes>
25.48 + </fileSet>
25.49 + <fileSet>
25.50 + <directory>${project.build.directory}</directory>
25.51 + <outputDirectory>/</outputDirectory>
25.52 + <includes>
25.53 + <include>bck2brwsr.js</include>
25.54 + <include>minesweeper.js</include>
25.55 + <include>lib/*.js</include>
25.56 + </includes>
25.57 + </fileSet>
25.58 </fileSets>
25.59 - <files>
25.60 - <file>
25.61 - <source>${project.build.directory}/${project.build.finalName}.jar</source>
25.62 - <outputDirectory>/</outputDirectory>
25.63 - </file>
25.64 - </files>
25.65 </assembly>
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
26.2 +++ b/minesweeper/src/main/assembly/teabrwsr.xml Mon Sep 08 10:11:50 2014 +0200
26.3 @@ -0,0 +1,47 @@
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>teabrwsr</id>
26.34 + <formats>
26.35 + <format>zip</format>
26.36 + </formats>
26.37 + <baseDirectory>public_html</baseDirectory>
26.38 + <fileSets>
26.39 + <fileSet>
26.40 + <directory>src/main/webapp/pages</directory>
26.41 + <outputDirectory>/</outputDirectory>
26.42 + <filtered>true</filtered>
26.43 + </fileSet>
26.44 + <fileSet>
26.45 + <directory>${project.build.directory}/teavm/</directory>
26.46 + <outputDirectory>/</outputDirectory>
26.47 + <filtered>false</filtered>
26.48 + </fileSet>
26.49 + </fileSets>
26.50 +</assembly>
27.1 Binary file minesweeper/src/main/icons/Default-568h@2x.png has changed
28.1 Binary file minesweeper/src/main/icons/Default.png has changed
29.1 Binary file minesweeper/src/main/icons/Default@2x.png has changed
30.1 Binary file minesweeper/src/main/icons/DukeSweeper.png has changed
31.1 --- a/minesweeper/src/main/java/org/apidesign/demo/minesweeper/Main.java Fri Mar 21 15:02:25 2014 +0100
31.2 +++ b/minesweeper/src/main/java/org/apidesign/demo/minesweeper/Main.java Mon Sep 08 10:11:50 2014 +0200
31.3 @@ -23,6 +23,7 @@
31.4 */
31.5 package org.apidesign.demo.minesweeper;
31.6
31.7 +import java.util.Locale;
31.8 import net.java.html.boot.BrowserBuilder;
31.9 import org.netbeans.api.nbrwsr.OpenHTMLRegistration;
31.10 import org.openide.awt.ActionID;
31.11 @@ -34,13 +35,14 @@
31.12 public final class Main {
31.13 private Main() {
31.14 }
31.15 -
31.16 +
31.17 /** Launches the browser */
31.18 - public static void main(String... args) throws Exception {
31.19 + public static void main(String... args) throws Exception {
31.20 BrowserBuilder.newBrowser().
31.21 loadPage("pages/index.html").
31.22 - loadClass(Main.class).
31.23 - invoke("onPageLoad", args).
31.24 + locale(Locale.getDefault()).
31.25 + loadClass(MinesModel.class).
31.26 + invoke("main", args).
31.27 showAndWait();
31.28 System.exit(0);
31.29 }
31.30 @@ -61,7 +63,7 @@
31.31 )
31.32 @ActionReferences({
31.33 @ActionReference(path = "Menu/Window"),
31.34 - @ActionReference(path = "Toolbars/Run")
31.35 + @ActionReference(path = "Toolbars/Games")
31.36 })
31.37 //
31.38 // end of NetBeans actions registration
32.1 --- a/minesweeper/src/main/java/org/apidesign/demo/minesweeper/MainBrwsr.java Fri Mar 21 15:02:25 2014 +0100
32.2 +++ b/minesweeper/src/main/java/org/apidesign/demo/minesweeper/MainBrwsr.java Mon Sep 08 10:11:50 2014 +0200
32.3 @@ -26,7 +26,7 @@
32.4 public class MainBrwsr {
32.5 static {
32.6 try {
32.7 - Main.onPageLoad();
32.8 + MinesModel.main();
32.9 } catch (Exception ex) {
32.10 throw new IllegalStateException(ex);
32.11 }
33.1 --- a/minesweeper/src/main/java/org/apidesign/demo/minesweeper/MinesModel.java Fri Mar 21 15:02:25 2014 +0100
33.2 +++ b/minesweeper/src/main/java/org/apidesign/demo/minesweeper/MinesModel.java Mon Sep 08 10:11:50 2014 +0200
33.3 @@ -39,9 +39,13 @@
33.4 @Property(name = "state", type = MinesModel.GameState.class),
33.5 @Property(name = "rows", type = Row.class, array = true),
33.6 })
33.7 -final class MinesModel {
33.8 +public final class MinesModel {
33.9 enum GameState {
33.10 - IN_PROGRESS, WON, LOST;
33.11 + IN_PROGRESS, MARKING_MINE, WON, LOST;
33.12 + }
33.13 +
33.14 + @ComputedProperty static String gameStyle(GameState state) {
33.15 + return state == GameState.MARKING_MINE ? "MARKING" : "PLAYING";
33.16 }
33.17
33.18 @Model(className = "Row", properties = {
33.19 @@ -55,17 +59,6 @@
33.20 @Property(name = "mine", type = boolean.class)
33.21 })
33.22 static class SquareModel {
33.23 - @ComputedProperty static String html(SquareType state) {
33.24 - if (state == null) return " ";
33.25 - switch (state) {
33.26 - case EXPLOSION: return "✗";
33.27 - case UNKNOWN: return " ";
33.28 - case DISCOVERED: return "✔";
33.29 - case N_0: return " ";
33.30 - }
33.31 - return "ɸ" + (state.ordinal() - 1);
33.32 - }
33.33 -
33.34 @ComputedProperty static String style(SquareType state) {
33.35 return state == null ? null : state.toString();
33.36 }
33.37 @@ -73,7 +66,7 @@
33.38
33.39 enum SquareType {
33.40 N_0, N_1, N_2, N_3, N_4, N_5, N_6, N_7, N_8,
33.41 - UNKNOWN, EXPLOSION, DISCOVERED;
33.42 + UNKNOWN, EXPLOSION, DISCOVERED, MARKED;
33.43
33.44 final boolean isVisible() {
33.45 return name().startsWith("N_");
33.46 @@ -95,6 +88,10 @@
33.47 return state != null;
33.48 }
33.49
33.50 + @ComputedProperty static boolean gameInProgress(GameState state) {
33.51 + return state == GameState.IN_PROGRESS;
33.52 + }
33.53 +
33.54 @Function static void showHelp(Mines model) {
33.55 model.setState(null);
33.56 }
33.57 @@ -108,6 +105,13 @@
33.58
33.59 @Function static void giveUp(Mines model) {
33.60 showAllBombs(model, SquareType.EXPLOSION);
33.61 + model.setState(GameState.LOST);
33.62 + }
33.63 +
33.64 + @Function static void markMine(Mines model) {
33.65 + if (model.getState() == GameState.IN_PROGRESS) {
33.66 + model.setState(GameState.MARKING_MINE);
33.67 + }
33.68 }
33.69
33.70 @ModelOperation static void init(Mines model, int width, int height, int mines) {
33.71 @@ -193,6 +197,8 @@
33.72 if (!emptyHidden) {
33.73 model.setState(GameState.WON);
33.74 showAllBombs(model, SquareType.DISCOVERED);
33.75 + AudioClip applause = AudioClip.create("applause.mp3");
33.76 + applause.play();
33.77 }
33.78 }
33.79
33.80 @@ -231,28 +237,149 @@
33.81 }
33.82 }
33.83
33.84 - private static AudioClip TOUCH;
33.85 @Function static void click(Mines model, Square data) {
33.86 + if (model.getState() == GameState.MARKING_MINE) {
33.87 + if (data.getState() == SquareType.UNKNOWN) {
33.88 + data.setState(SquareType.MARKED);
33.89 + if (allMarked(model)) {
33.90 + model.setState(GameState.WON);
33.91 + return;
33.92 + }
33.93 + }
33.94 + model.setState(GameState.IN_PROGRESS);
33.95 + return;
33.96 + }
33.97 if (model.getState() != GameState.IN_PROGRESS) {
33.98 return;
33.99 }
33.100 -
33.101 - switch (data.getState()) {
33.102 - case UNKNOWN:
33.103 - if (data.isMine()) {
33.104 - showAllBombs(model, SquareType.EXPLOSION);
33.105 - model.setState(GameState.LOST);
33.106 - } else {
33.107 - if (TOUCH == null) {
33.108 - TOUCH = AudioClip.create("move.mp3");
33.109 - }
33.110 - TOUCH.play();
33.111 - expandKnown(model, data);
33.112 - model.computeMines();
33.113 + if (data.getState() == SquareType.MARKED) {
33.114 + data.setState(SquareType.UNKNOWN);
33.115 + if (allMarked(model)) {
33.116 + model.setState(GameState.WON);
33.117 + }
33.118 + return;
33.119 + }
33.120 + if (data.getState() != SquareType.UNKNOWN) {
33.121 + return;
33.122 + }
33.123 + if (data.isMine()) {
33.124 + Square fair = atLeastOnePlaceWhereBombCantBe(model);
33.125 + if (fair == null) {
33.126 + if (placeBombElseWhere(model, data)) {
33.127 + cleanedUp(model, data);
33.128 + return;
33.129 }
33.130 - break;
33.131 + }
33.132 + explosion(model);
33.133 + } else {
33.134 + Square takeFrom = tryStealBomb(model, data);
33.135 + if (takeFrom != null) {
33.136 + final Square fair = atLeastOnePlaceWhereBombCantBe(model);
33.137 + if (fair != null) {
33.138 + takeFrom.setMine(false);
33.139 + data.setMine(true);
33.140 + explosion(model);
33.141 + return;
33.142 + }
33.143 + }
33.144 + cleanedUp(model, data);
33.145 }
33.146 }
33.147 +
33.148 + private static void cleanedUp(Mines model, Square data) {
33.149 + AudioClip touch = AudioClip.create("move.mp3");
33.150 + touch.play();
33.151 + expandKnown(model, data);
33.152 + model.computeMines();
33.153 + }
33.154 +
33.155 + private static void explosion(Mines model) {
33.156 + showAllBombs(model, SquareType.EXPLOSION);
33.157 + model.setState(GameState.LOST);
33.158 + AudioClip oops = AudioClip.create("oops.mp3");
33.159 + oops.play();
33.160 + }
33.161 +
33.162 + private static Square tryStealBomb(Mines model, Square data) {
33.163 + data.setMine(true);
33.164 + final List<Row> rows = model.getRows();
33.165 + for (int y = 0; y < rows.size(); y++) {
33.166 + final List<Square> columns = rows.get(y).getColumns();
33.167 + for (int x = 0; x < columns.size(); x++) {
33.168 + Square sq = columns.get(x);
33.169 + if (sq == data) {
33.170 + continue;
33.171 + }
33.172 + if (sq.isMine()) {
33.173 + sq.setMine(false);
33.174 + final boolean ok = isConsistent(model);
33.175 + sq.setMine(true);
33.176 + if (ok) {
33.177 + data.setMine(false);
33.178 + return sq;
33.179 + }
33.180 + }
33.181 + }
33.182 + }
33.183 + data.setMine(false);
33.184 + return null;
33.185 + }
33.186 +
33.187 + private static Square atLeastOnePlaceWhereBombCantBe(Mines model) {
33.188 + final List<Row> rows = model.getRows();
33.189 + Square cantBe = null;
33.190 + int discovered = 0;
33.191 + for (int y = 0; y < rows.size(); y++) {
33.192 + final List<Square> columns = rows.get(y).getColumns();
33.193 + for (int x = 0; x < columns.size(); x++) {
33.194 + Square sq = columns.get(x);
33.195 + if (sq.getState() == SquareType.UNKNOWN) {
33.196 + if (!sq.isMine()) {
33.197 + if (tryStealBomb(model, sq) == null) {
33.198 + cantBe = sq;
33.199 + }
33.200 + }
33.201 + } else {
33.202 + discovered++;
33.203 + }
33.204 + }
33.205 + }
33.206 +
33.207 + if (discovered > 5) {
33.208 + return cantBe;
33.209 + }
33.210 +
33.211 + return null;
33.212 + }
33.213 +
33.214 + private static boolean placeBombElseWhere(Mines model, Square moveBomb) {
33.215 + List<Square> ok = new ArrayList<Square>();
33.216 + moveBomb.setMine(false);
33.217 + final List<Row> rows = model.getRows();
33.218 + for (int y = 0; y < rows.size(); y++) {
33.219 + final List<Square> columns = rows.get(y).getColumns();
33.220 + for (int x = 0; x < columns.size(); x++) {
33.221 + Square sq = columns.get(x);
33.222 + if (sq == moveBomb || sq.isMine() || sq.getState().isVisible()) {
33.223 + continue;
33.224 + }
33.225 + sq.setMine(true);
33.226 + if (isConsistent(model)) {
33.227 + ok.add(sq);
33.228 + }
33.229 + sq.setMine(false);
33.230 + }
33.231 + }
33.232 + if (ok.isEmpty()) {
33.233 + moveBomb.setMine(true);
33.234 + return false;
33.235 + } else {
33.236 + int r = new Random().nextInt(ok.size());
33.237 + ok.get(r).setMine(true);
33.238 + return true;
33.239 + }
33.240 + }
33.241 +
33.242 private static void expandKnown(Mines model, Square data) {
33.243 final List<Row> rows = model.getRows();
33.244 for (int y = 0; y < rows.size(); y++) {
33.245 @@ -276,15 +403,7 @@
33.246 }
33.247 final Square sq = columns.get(x);
33.248 if (sq.getState() == SquareType.UNKNOWN) {
33.249 - int around =
33.250 - minesAt(model, x - 1, y - 1) +
33.251 - minesAt(model, x - 1, y) +
33.252 - minesAt(model, x - 1, y + 1) +
33.253 - minesAt(model, x , y - 1) +
33.254 - minesAt(model, x, y + 1) +
33.255 - minesAt(model, x + 1, y - 1) +
33.256 - minesAt(model, x + 1, y) +
33.257 - minesAt(model, x + 1, y + 1);
33.258 + int around = around(model, x, y);
33.259 final SquareType t = SquareType.valueOf("N_" + around);
33.260 sq.setState(t);
33.261 if (t == SquareType.N_0) {
33.262 @@ -299,6 +418,18 @@
33.263 }
33.264 }
33.265 }
33.266 +
33.267 + private static int around(Mines model, int x, int y) {
33.268 + return
33.269 + minesAt(model, x - 1, y - 1) +
33.270 + minesAt(model, x - 1, y) +
33.271 + minesAt(model, x - 1, y + 1) +
33.272 + minesAt(model, x , y - 1) +
33.273 + minesAt(model, x, y + 1) +
33.274 + minesAt(model, x + 1, y - 1) +
33.275 + minesAt(model, x + 1, y) +
33.276 + minesAt(model, x + 1, y + 1);
33.277 + }
33.278
33.279 private static int minesAt(Mines model, int x, int y) {
33.280 if (y < 0 || y >= model.getRows().size()) {
33.281 @@ -312,4 +443,48 @@
33.282 return sq.isMine() ? 1 : 0;
33.283 }
33.284
33.285 + private static boolean isConsistent(Mines m) {
33.286 + for (int row = 0; row < m.getRows().size(); row++) {
33.287 + Row r = m.getRows().get(row);
33.288 + for (int col = 0; col < r.getColumns().size(); col++) {
33.289 + Square sq = r.getColumns().get(col);
33.290 + if (sq.getState().isVisible()) {
33.291 + int around = around(m, col, row);
33.292 + if (around != sq.getState().ordinal()) {
33.293 + return false;
33.294 + }
33.295 + }
33.296 + }
33.297 + }
33.298 + return true;
33.299 + }
33.300 +
33.301 + private static boolean allMarked(Mines m) {
33.302 + for (Row r : m.getRows()) {
33.303 + for (Square sq : r.getColumns()) {
33.304 + if (sq.isMine() == (sq.getState() != SquareType.MARKED)) {
33.305 + return false;
33.306 + }
33.307 + }
33.308 + }
33.309 + for (Row r : m.getRows()) {
33.310 + for (Square sq : r.getColumns()) {
33.311 + if (sq.isMine()) {
33.312 + sq.setState(SquareType.DISCOVERED);
33.313 + } else {
33.314 + sq.setState(SquareType.N_0);
33.315 + }
33.316 + }
33.317 + }
33.318 + computeMines(m);
33.319 + return true;
33.320 + }
33.321 +
33.322 + /**
33.323 + * Called when page is ready
33.324 + */
33.325 + public static void main(String... args) throws Exception {
33.326 + Mines m = new Mines();
33.327 + m.applyBindings();
33.328 + }
33.329 }
34.1 --- a/minesweeper/src/main/resources/org/apidesign/demo/minesweeper/index.html Fri Mar 21 15:02:25 2014 +0100
34.2 +++ b/minesweeper/src/main/resources/org/apidesign/demo/minesweeper/index.html Mon Sep 08 10:11:50 2014 +0200
34.3 @@ -1,3 +1,28 @@
34.4 +<!--
34.5 +
34.6 + The MIT License (MIT)
34.7 +
34.8 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
34.9 +
34.10 + Permission is hereby granted, free of charge, to any person obtaining a copy
34.11 + of this software and associated documentation files (the "Software"), to deal
34.12 + in the Software without restriction, including without limitation the rights
34.13 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
34.14 + copies of the Software, and to permit persons to whom the Software is
34.15 + furnished to do so, subject to the following conditions:
34.16 +
34.17 + The above copyright notice and this permission notice shall be included in
34.18 + all copies or substantial portions of the Software.
34.19 +
34.20 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34.21 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34.22 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34.23 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34.24 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34.25 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
34.26 + THE SOFTWARE.
34.27 +
34.28 +-->
34.29 <html>
34.30 <head>
34.31 <title>Dummy Page</title>
35.1 Binary file minesweeper/src/main/webapp/pages/DukeSweeper.png has changed
36.1 Binary file minesweeper/src/main/webapp/pages/android_logo.jpg has changed
37.1 Binary file minesweeper/src/main/webapp/pages/applause.mp3 has changed
38.1 --- a/minesweeper/src/main/webapp/pages/index.html Fri Mar 21 15:02:25 2014 +0100
38.2 +++ b/minesweeper/src/main/webapp/pages/index.html Mon Sep 08 10:11:50 2014 +0200
38.3 @@ -26,14 +26,14 @@
38.4 <!DOCTYPE html>
38.5 <html>
38.6 <head>
38.7 - <title>Minesweeper</title>
38.8 + <title>Fair Minesweeper</title>
38.9 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
38.10 <link href="bootstrap.css" rel="stylesheet">
38.11 <link href="bootstrap-responsive.css" rel="stylesheet">
38.12 <link href="mines.css" rel="stylesheet">
38.13 <!-- Target tablets -->
38.14 <link href="mines-tablet-large.css"
38.15 - media="(min-width:640px) and (max-width:780px), (min-height:660px) and (max-height:830px)"
38.16 + media="(min-width:640px), (min-height:660px)"
38.17 rel="stylesheet" />
38.18 <link href="mines-tablet-small.css"
38.19 media="(min-width:510px) and (max-width:640px), (min-height:520px) and (max-height:660px)"
38.20 @@ -43,42 +43,51 @@
38.21 media="(min-width:410px) and (max-width:510px), (min-height:400px) and (max-height:520px)"
38.22 rel="stylesheet" />
38.23 <link href="mines-phone-small.css"
38.24 - media="(min-width:250px) and (max-width:410px), (min-height:250px) and (max-height:400px)"
38.25 + media="(min-width:300px) and (max-width:410px), (min-height:300px) and (max-height:400px)"
38.26 rel="stylesheet" />
38.27 <link href="mines-phone-smaller.css"
38.28 - media="(max-width:250px), (max-height:250px)"
38.29 + media="(max-width:300px), (max-height:300px)"
38.30 rel="stylesheet" />
38.31 </head>
38.32 <body>
38.33 <div class="navbar">
38.34 <div class="navbar-inner">
38.35 - <a id="apptitle" class="brand" href="#" data-bind="click: showHelp">Minesweeper</a>
38.36 + <a id="apptitle" class="brand" href="#" data-bind="click: showHelp">
38.37 + <img height="20" width="20" src="DukeSweeper.png">
38.38 + <span class="hidden-phone">Minesweeper</span>
38.39 + </a>
38.40 <button class="btn btn-default navbar-btn" disabled="true" data-bind="disable: false, click: normalGame">
38.41 <span>↻</span>
38.42 - <span class="hidden-phone">New Game!</span>
38.43 + <span class="info-text">New!</span>
38.44 </button>
38.45 - <button class="btn btn-default navbar-btn" disabled="true" data-bind="disable: !fieldShowing(), click: giveUp ">
38.46 + <button class="hidden-phone btn btn-default navbar-btn" disabled="true" data-bind="disable: !gameInProgress(), click: giveUp ">
38.47 <span>✗</span>
38.48 - <span class="hidden-phone">Show Mines!</span>
38.49 + <span>Show Mines!</span>
38.50 + </button>
38.51 + <button class="btn btn-default navbar-btn" disabled="true" data-bind="disable: !gameInProgress(), click: markMine">
38.52 + <span>⚠</span>
38.53 + <span class="info-text">Mark Mine!</span>
38.54 </button>
38.55 </div>
38.56 </div>
38.57 -
38.58 +
38.59
38.60 <script type="text/html" id="field">
38.61 - <table class="field">
38.62 + <center>
38.63 + <table class="field" data-bind="css: gameStyle">
38.64 <tbody>
38.65 <!-- ko foreach: rows -->
38.66 <tr>
38.67 <!-- ko foreach: columns -->
38.68 <td data-bind="css: style, click: $parents[1].click" >
38.69 - <div data-bind='html: html'></div>
38.70 + <div></div>
38.71 </td>
38.72 <!-- /ko -->
38.73 </tr>
38.74 <!-- /ko -->
38.75 </tbody>
38.76 </table>
38.77 + </center>
38.78 </script>
38.79
38.80 <div data-bind="template: { name : 'field', if: fieldShowing }"></div>
38.81 @@ -102,17 +111,18 @@
38.82 </div>
38.83
38.84 <div class="container" data-bind="visible: !fieldShowing()">
38.85 - <div class="row">
38.86 + <div>
38.87 <div class="col-md-4">
38.88 <h2>Minesweeper</h2>
38.89 <p>
38.90 - At the end this is a <em>minesweeper</em>
38.91 - game and you can of course play it. Discover
38.92 - all fields that don't contain a mine.
38.93 - Touch a field to find out if there is
38.94 - a mine or not. A number on a field indicates
38.95 - how many mines is in the eight surrounding
38.96 - fields.
38.97 + Discover ten square fields that contain a mine and
38.98 + mark them with a ⚠ sign.
38.99 + Touch a square to find out if there is
38.100 + a mine or not and
38.101 + how many mines are in the eight surrounding
38.102 + ones. Avoid random play, the game
38.103 + recognizes guessing and can re-arrange
38.104 + the mines. This game is <b>fair</b>!
38.105 </p>
38.106 <p><a class="btn btn-default" href="#" data-bind="click: normalGame"role="button">Play »</a></p>
38.107 </div>
38.108 @@ -126,7 +136,7 @@
38.109 our documentation.
38.110 </p>
38.111 <p><a class="btn btn-default"
38.112 - target="_blank" href="http://bits.netbeans.org/html4j/0.7.5/"
38.113 + target="_blank" href="http://bits.netbeans.org/html+java/"
38.114 role="button">Read more »</a></p>
38.115 </div>
38.116 <div class="col-md-4">
38.117 @@ -135,20 +145,100 @@
38.118 While primarily this technology runs on a desktop
38.119 or as a table or phone application, it is possible
38.120 to execute the same unchanged code in a browser
38.121 - as well. To do so, one needs a <strong>bck2brwsr</strong>
38.122 + as well. To do so, one needs a
38.123 + <a href="http://bck2brwsr.apidesign.org">bck2brwsr</a>
38.124 virtual machine.
38.125 </p>
38.126 <p><a class="btn btn-default"
38.127 - target="_blank" href="http://bck2brwsr.apidesign.org"
38.128 - role="button">Learn more »</a></p>
38.129 + target="_blank" href="http://xelfi.cz/minesweeper/bck2brwsr/"
38.130 + role="button">Try it »</a></p>
38.131 </div>
38.132 + </div>
38.133 </div>
38.134 -
38.135 +<div class="container" data-bind="visible: !fieldShowing()">
38.136 + <div class="col-sm-6 col-md-4">
38.137 + <div class="thumbnail">
38.138 + <img src="android_logo.jpg" width="120" height="120" alt="Android">
38.139 + <div class="caption">
38.140 + <h3>DlvkBrwsr</h3>
38.141 + <p>
38.142 + This application has been packaged to run on your Android phone
38.143 + and is available on Google Play! In this mode it
38.144 + uses Dalvik virtual machine to execute Java code natively.
38.145 + It uses Android's WebView to display the UI and execute
38.146 + generated JavaScript. Both these components are
38.147 + bound together via <a href="http://wiki.apidesign.org/wiki/DlvkBrwsr">
38.148 + DlvkBrwsr</a>.
38.149 + </p>
38.150 + <p>
38.151 + <a href="https://play.google.com/store/apps/details?id=org.apidesign.demo.minesweeper"
38.152 + target="_blank"
38.153 + class="btn btn-primary" role="button"
38.154 + >Install »</a>
38.155 + </p>
38.156 + </div>
38.157 + </div>
38.158 + </div>
38.159 + <div class="col-sm-6 col-md-4">
38.160 + <div class="thumbnail">
38.161 + <img src="ios_logo.jpg" width="120" height="120" alt="Android">
38.162 + <div class="caption">
38.163 + <h3>iBrwsr</h3>
38.164 + <p>
38.165 + This application has been packaged to run on your iPhone
38.166 + or iPad and made available on AppStore.
38.167 + In this mode it
38.168 + uses <a target="_blank" href="http://www.robovm.org">RoboVM</a>
38.169 + virtual machine to execute Java code natively.
38.170 + It uses iOS WebView to display the UI and execute
38.171 + generated JavaScript. Both these components are
38.172 + bound together via <a target="_blank"
38.173 + href="http://wiki.apidesign.org/wiki/IBrwsr">
38.174 + iBrwsr</a> library.
38.175 + </p>
38.176 + <p>
38.177 + <a href="https://itunes.apple.com/us/app/fair-minesweeper/id903688146"
38.178 + target="_blank"
38.179 + class="btn btn-primary" role="button"
38.180 + >Install »</a>
38.181 + </p>
38.182 + </div>
38.183 + </div>
38.184 + </div>
38.185 + <div class="col-sm-6 col-md-4">
38.186 + <div class="thumbnail">
38.187 + <img src="netbeans_logo.jpg" width="120" height="120" alt="Android">
38.188 + <div class="caption">
38.189 + <h3>Develop Own App!</h3>
38.190 + <p>
38.191 + One can package this application as a
38.192 + <a href="http://plugins.netbeans.org/plugin/53864/"
38.193 + target="_blank"
38.194 + >plugin for NetBeans</a> or
38.195 + use <a href="http://www.netbeans.org" target="_blank">
38.196 + NetBeans</a> IDE to create
38.197 + application like this yourself. Enjoy the
38.198 + power of <em>HTML</em> and <em>Java</em>.
38.199 + Write your applications once and deploy and display
38.200 + them on any device!
38.201 + </p>
38.202 + <p>
38.203 + <a href="http://wiki.apidesign.org/wiki/DukeScriptInNetBeans"
38.204 + target="_blank"
38.205 + class="btn btn-primary" role="button"
38.206 + >Develop »</a>
38.207 + </p>
38.208 + </div>
38.209 + </div>
38.210 + </div>
38.211 +</div>
38.212 + <!-- boot bck2brwsr -->
38.213 <script type="text/javascript" src="bck2brwsr.js"></script>
38.214 <script>
38.215 - var vm = bck2brwsr('${project.build.finalName}.jar');
38.216 - vm.loadClass('org.apidesign.demo.minesweeper.MainBrwsr');
38.217 + var vm = bck2brwsr('minesweeper.js');
38.218 + var c = vm.loadClass('org.apidesign.demo.minesweeper.MinesModel');
38.219 + c.invoke('main');
38.220 </script>
38.221 -
38.222 +
38.223 </body>
38.224 </html>
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
39.2 +++ b/minesweeper/src/main/webapp/pages/index_cs.html Mon Sep 08 10:11:50 2014 +0200
39.3 @@ -0,0 +1,247 @@
39.4 +<!--
39.5 +
39.6 + The MIT License (MIT)
39.7 +
39.8 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
39.9 +
39.10 + Permission is hereby granted, free of charge, to any person obtaining a copy
39.11 + of this software and associated documentation files (the "Software"), to deal
39.12 + in the Software without restriction, including without limitation the rights
39.13 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
39.14 + copies of the Software, and to permit persons to whom the Software is
39.15 + furnished to do so, subject to the following conditions:
39.16 +
39.17 + The above copyright notice and this permission notice shall be included in
39.18 + all copies or substantial portions of the Software.
39.19 +
39.20 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39.21 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39.22 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39.23 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39.24 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39.25 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
39.26 + THE SOFTWARE.
39.27 +
39.28 +-->
39.29 +<!DOCTYPE html>
39.30 +<html>
39.31 + <head>
39.32 + <title>Férové miny</title>
39.33 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
39.34 + <link href="bootstrap.css" rel="stylesheet">
39.35 + <link href="bootstrap-responsive.css" rel="stylesheet">
39.36 + <link href="mines.css" rel="stylesheet">
39.37 + <!-- Target tablets -->
39.38 + <link href="mines-tablet-large.css"
39.39 + media="(min-width:640px), (min-height:660px)"
39.40 + rel="stylesheet" />
39.41 + <link href="mines-tablet-small.css"
39.42 + media="(min-width:510px) and (max-width:640px), (min-height:520px) and (max-height:660px)"
39.43 + rel="stylesheet" />
39.44 + <!-- Target phones -->
39.45 + <link href="mines-phone-large.css"
39.46 + media="(min-width:410px) and (max-width:510px), (min-height:400px) and (max-height:520px)"
39.47 + rel="stylesheet" />
39.48 + <link href="mines-phone-small.css"
39.49 + media="(min-width:300px) and (max-width:410px), (min-height:300px) and (max-height:400px)"
39.50 + rel="stylesheet" />
39.51 + <link href="mines-phone-smaller.css"
39.52 + media="(max-width:300px), (max-height:300px)"
39.53 + rel="stylesheet" />
39.54 + </head>
39.55 + <body>
39.56 + <div class="navbar">
39.57 + <div class="navbar-inner">
39.58 + <a id="apptitle" class="brand" href="#" data-bind="click: showHelp">
39.59 + <img height="20" width="20" src="DukeSweeper.png">
39.60 + <span class="hidden-phone">Miny</span>
39.61 + </a>
39.62 + <button class="btn btn-default navbar-btn" disabled="true" data-bind="disable: false, click: normalGame">
39.63 + <span>↻</span>
39.64 + <span class="info-text">Hra</span>
39.65 + </button>
39.66 + <button class="hidden-phone btn btn-default navbar-btn" disabled="true" data-bind="disable: !gameInProgress(), click: giveUp ">
39.67 + <span>✗</span>
39.68 + <span>Vzdát</span>
39.69 + </button>
39.70 + <button class="btn btn-default navbar-btn" disabled="true" data-bind="disable: !gameInProgress(), click: markMine">
39.71 + <span>⚠</span>
39.72 + <span class="info-text">Označkovat</span>
39.73 + </button>
39.74 + </div>
39.75 + </div>
39.76 +
39.77 +
39.78 + <script type="text/html" id="field">
39.79 + <center>
39.80 + <table class="field" data-bind="css: gameStyle">
39.81 + <tbody>
39.82 + <!-- ko foreach: rows -->
39.83 + <tr>
39.84 + <!-- ko foreach: columns -->
39.85 + <td data-bind="css: style, click: $parents[1].click" >
39.86 + <div></div>
39.87 + </td>
39.88 + <!-- /ko -->
39.89 + </tr>
39.90 + <!-- /ko -->
39.91 + </tbody>
39.92 + </table>
39.93 + </center>
39.94 + </script>
39.95 +
39.96 + <div data-bind="template: { name : 'field', if: fieldShowing }"></div>
39.97 +
39.98 + <div class="jumbotron control-label" data-bind="visible: !fieldShowing() ">
39.99 + <div class="container">
39.100 + <h1>Ukázka HTML/Java technologie</h1>
39.101 +
39.102 + <p>Na první pohled se jedná o staré dobré <em>miny</em>.
39.103 + Bližší pohled však odhalí revoluční technologii, jež
39.104 + umožňuje programovat logiku aplikace v <strong>Javě</strong>
39.105 + a uživatelské rozhraní definovat v <strong>HTML</strong>.
39.106 + To vše na jakémkoli zařízení schopném zobrazit moderní
39.107 + <strong>HTML5</strong> prohlížeč.
39.108 + </p>
39.109 + <p><a class="btn btn-primary btn-lg" role="button"
39.110 + target="_blank" href="http://html.java.net"
39.111 + >Navštívit stránky projektu</a>
39.112 + </p>
39.113 + </div>
39.114 + </div>
39.115 +
39.116 + <div class="container" data-bind="visible: !fieldShowing()">
39.117 + <div>
39.118 + <div class="col-md-4">
39.119 + <h2>Miny</h2>
39.120 + <p>
39.121 + Odhalte deset políček jež skrývají miny
39.122 + a označte je znakem ⚠.
39.123 + Dotykem políčka se zjistí,
39.124 + zda-li je na něm mina či kolik min se
39.125 + nachází v sousedních osmi políčkách.
39.126 + Nespoléhejte na náhodu,
39.127 + tato verze min dokáže detekovat
39.128 + náhodné hádání a v takovém případě přerovnat miny.
39.129 + Tato hra je <b>fér</b>!
39.130 + </p>
39.131 + <p><a class="btn btn-default" href="#" data-bind="click: normalGame"role="button">Hrát »</a></p>
39.132 + </div>
39.133 + <div class="col-md-4">
39.134 + <h2>Dokumentace</h2>
39.135 + <p>
39.136 + Chcete-li psát aplikace jako je tato
39.137 + (tedy používat <strong>Javu</strong> a <strong>HTML</strong>)
39.138 + můžete se nyní dozvědět něco o knihovnách, které
39.139 + to umožňují. Následující odkaz Vás zavede
39.140 + stránky s dokumentací.
39.141 + </p>
39.142 + <p><a class="btn btn-default"
39.143 + target="_blank" href="http://bits.netbeans.org/html+java/"
39.144 + role="button">Více »</a></p>
39.145 + </div>
39.146 + <div class="col-md-4">
39.147 + <h2>Verze pro prohlížeč</h2>
39.148 + <p>
39.149 + Tato technologie je primárně určena pro
39.150 + klasické osobní počítače či pro tablety a telefony.
39.151 + Přesto je však možné spustit tu samou aplikaci
39.152 + s nezměným kódem v prohlížeči. Je k tomu potřeba
39.153 + implementace <b>Java</b> virtuálního stroje zvaná
39.154 + <a href="http://bck2brwsr.apidesign.org">bck2brwsr</a>.
39.155 + </p>
39.156 + <p><a class="btn btn-default"
39.157 + target="_blank" href="http://xelfi.cz/minesweeper/bck2brwsr/"
39.158 + role="button">Vyzkoušet »</a></p>
39.159 + </div>
39.160 + </div>
39.161 + </div>
39.162 +<div class="container" data-bind="visible: !fieldShowing()">
39.163 + <div class="col-sm-6 col-md-4">
39.164 + <div class="thumbnail">
39.165 + <img src="android_logo.jpg" width="120" height="120" alt="Android">
39.166 + <div class="caption">
39.167 + <h3>DlvkBrwsr</h3>
39.168 + <p>
39.169 + Tato apliace byla přeložena pro Váš telefon se systémem Android
39.170 + a je dostupná na Google Play! tržišti. V této konfiguraci
39.171 + se používá virtuální stroj Dalvik pro spouštění <b>Java</b> kódu
39.172 + a Androidí WebView k zobrazení uživatelského rozhraní a
39.173 + interpretaci generovaného JavaScriptu. Tyto komponenty jsou
39.174 + spojeny dohromady pomocí <a href="http://wiki.apidesign.org/wiki/DlvkBrwsr">
39.175 + DlvkBrwsr</a> technologie.
39.176 + </p>
39.177 + <p>
39.178 + <a href="https://play.google.com/store/apps/details?id=org.apidesign.demo.minesweeper"
39.179 + target="_blank"
39.180 + class="btn btn-primary" role="button"
39.181 + >Instalovat »</a>
39.182 + </p>
39.183 + </div>
39.184 + </div>
39.185 + </div>
39.186 + <div class="col-sm-6 col-md-4">
39.187 + <div class="thumbnail">
39.188 + <img src="ios_logo.jpg" width="120" height="120" alt="Android">
39.189 + <div class="caption">
39.190 + <h3>iBrwsr</h3>
39.191 + <p>
39.192 + Tato aplikace byla přeložena a zabalena tak, aby běžela na
39.193 + Vašem iPhonu
39.194 + nebo iPadu a je dostupná na tržišti AppStore.
39.195 + V této konfiguraci se používá
39.196 + virtuální stroj <a target="_blank" href="http://www.robovm.org">RoboVM</a>
39.197 + pro přeložení <b>Java</b> kódu do nativního formátu.
39.198 + Pro zobrazení a provádění vygenerovaného JavaScriptu
39.199 + se využívá iOS WebView. Obě tyto komponenty jsou spojeny
39.200 + pomocí <a target="_blank"
39.201 + href="http://wiki.apidesign.org/wiki/IBrwsr">
39.202 + iBrwsr</a> knihovny.
39.203 + </p>
39.204 + <p>
39.205 + <a href="https://itunes.apple.com/us/app/fair-minesweeper/id903688146"
39.206 + target="_blank"
39.207 + class="btn btn-primary" role="button"
39.208 + >Instalovat »</a>
39.209 + </p>
39.210 + </div>
39.211 + </div>
39.212 + </div>
39.213 + <div class="col-sm-6 col-md-4">
39.214 + <div class="thumbnail">
39.215 + <img src="netbeans_logo.jpg" width="120" height="120" alt="Android">
39.216 + <div class="caption">
39.217 + <h3>Vyvíjejte své aplikace!</h3>
39.218 + <p>
39.219 + Tuto aplikace lze zabalit jako
39.220 + <a href="http://plugins.netbeans.org/plugin/53864/"
39.221 + target="_blank"
39.222 + >rozšíření pro NetBeans</a> a nebo
39.223 + lze použít vývojové prostředí
39.224 + <a href="http://www.netbeans.org" target="_blank">
39.225 + NetBeans</a> k vytvoření své vlastní aplikace,
39.226 + jež bude využívat synergie
39.227 + <em>HTML</em> a <em>Javy</em>.
39.228 + Pište své aplikace jednou a zobrazte je na
39.229 + každém zařízení schopném zobrazit <em>HTML</em>!
39.230 + </p>
39.231 + <p>
39.232 + <a href="http://wiki.apidesign.org/wiki/DukeScriptInNetBeans"
39.233 + target="_blank"
39.234 + class="btn btn-primary" role="button"
39.235 + >Vyvíjejte »</a>
39.236 + </p>
39.237 + </div>
39.238 + </div>
39.239 + </div>
39.240 +</div>
39.241 + <!-- boot bck2brwsr -->
39.242 + <script type="text/javascript" src="bck2brwsr.js"></script>
39.243 + <script>
39.244 + var vm = bck2brwsr('minesweeper.js');
39.245 + var c = vm.loadClass('org.apidesign.demo.minesweeper.MinesModel');
39.246 + c.invoke('main');
39.247 + </script>
39.248 +
39.249 + </body>
39.250 +</html>
40.1 Binary file minesweeper/src/main/webapp/pages/ios_logo.jpg has changed
41.1 --- a/minesweeper/src/main/webapp/pages/mines-phone-small.css Fri Mar 21 15:02:25 2014 +0100
41.2 +++ b/minesweeper/src/main/webapp/pages/mines-phone-small.css Mon Sep 08 10:11:50 2014 +0200
41.3 @@ -22,9 +22,9 @@
41.4 * THE SOFTWARE.
41.5 */
41.6 table.field td {
41.7 - padding: 4px;
41.8 - width: 18px;
41.9 - height: 18px;
41.10 + padding: 3px;
41.11 + width: 16px;
41.12 + height: 16px;
41.13 font-size: 1.5em;
41.14 }
41.15 h1 {
41.16 @@ -51,3 +51,6 @@
41.17 .col-md-1 {
41.18 width: 100%;
41.19 }
41.20 +.info-text {
41.21 + font-size: xx-small;
41.22 +}
42.1 --- a/minesweeper/src/main/webapp/pages/mines-phone-smaller.css Fri Mar 21 15:02:25 2014 +0100
42.2 +++ b/minesweeper/src/main/webapp/pages/mines-phone-smaller.css Mon Sep 08 10:11:50 2014 +0200
42.3 @@ -22,11 +22,11 @@
42.4 * THE SOFTWARE.
42.5 */
42.6 table.field td {
42.7 - padding: 2px;
42.8 - width: 10px;
42.9 - height: 10px;
42.10 + padding: 3px;
42.11 + width: 13px;
42.12 + height: 13px;
42.13 line-height: 10px;
42.14 - font-size: 0.8em;
42.15 + font-size: 1em;
42.16 }
42.17 h1 {
42.18 font-size: 8px;
42.19 @@ -52,3 +52,6 @@
42.20 .col-md-1 {
42.21 width: 100%;
42.22 }
42.23 +.info-text {
42.24 + font-size: xx-small;
42.25 +}
43.1 --- a/minesweeper/src/main/webapp/pages/mines.css Fri Mar 21 15:02:25 2014 +0100
43.2 +++ b/minesweeper/src/main/webapp/pages/mines.css Mon Sep 08 10:11:50 2014 +0200
43.3 @@ -33,6 +33,10 @@
43.4 background-color: #fafafa;
43.5 }
43.6
43.7 +table {
43.8 + table-layout: fixed;
43.9 +}
43.10 +
43.11 table.field {
43.12 }
43.13 table.field td {
43.14 @@ -51,8 +55,50 @@
43.15 top: 0;
43.16 }
43.17
43.18 +@-moz-keyframes blinker {
43.19 + 0% { opacity: 0.9; }
43.20 + 50% { opacity: 0.1; }
43.21 + 100% { opacity: 0.9; }
43.22 +}
43.23 +
43.24 +@-webkit-keyframes blinker {
43.25 + 0% { opacity: 0.9; }
43.26 + 50% { opacity: 0.1; }
43.27 + 100% { opacity: 0.9; }
43.28 +}
43.29 +
43.30 +@keyframes blinker {
43.31 + 0% { opacity: 0.9; }
43.32 + 50% { opacity: 0.1; }
43.33 + 100% { opacity: 0.9; }
43.34 +}
43.35 +table.MARKING td.UNKNOWN div:before {
43.36 + content: "\0026a0";
43.37 + color: #802420;
43.38 +
43.39 + -webkit-animation-name: blinker;
43.40 + -webkit-animation-duration: 3s;
43.41 + -webkit-animation-timing-function: linear;
43.42 + -webkit-animation-iteration-count: infinite;
43.43 +
43.44 + -moz-animation-name: blinker;
43.45 + -moz-animation-duration: 3s;
43.46 + -moz-animation-timing-function: linear;
43.47 + -moz-animation-iteration-count: infinite;
43.48 +
43.49 + animation-name: blinker;
43.50 + animation-duration: 3s;
43.51 + animation-timing-function: linear;
43.52 + animation-iteration-count: infinite;
43.53 +}
43.54 +
43.55 table.field td.UNKNOWN {
43.56 background-color: #D6E4E1;
43.57 + color: #D6E4E1;
43.58 + cursor: pointer;
43.59 +}
43.60 +table.field td.MARKED {
43.61 + background-color: #D6E4E1;
43.62 cursor: pointer;
43.63 }
43.64 table.field td.EXPLOSION {
43.65 @@ -61,6 +107,48 @@
43.66 table.field td.DISCOVERED {
43.67 background-color: #9DB2B1;
43.68 }
43.69 +
43.70 +table.PLAYING td.UNKNOWN div::after {
43.71 + content: "\0026a0";
43.72 + visibility: hidden;
43.73 +}
43.74 +table.field td.EXPLOSION div::after {
43.75 + content: "\002717";
43.76 +}
43.77 +table.field td.DISCOVERED div::after {
43.78 + content: "\002714";
43.79 +}
43.80 +table.field td.MARKED div::after {
43.81 + content: "\0026a0";
43.82 +}
43.83 +table.field td.N_0 div::after {
43.84 + content: "\0026a0";
43.85 + visibility: hidden;
43.86 +}
43.87 +table.field td.N_1 div::after {
43.88 + content: "\002780";
43.89 +}
43.90 +table.field td.N_2 div::after {
43.91 + content: "\002781";
43.92 +}
43.93 +table.field td.N_3 div::after {
43.94 + content: "\002782";
43.95 +}
43.96 +table.field td.N_4 div::after {
43.97 + content: "\002783";
43.98 +}
43.99 +table.field td.N_5 div::after {
43.100 + content: "\002784";
43.101 +}
43.102 +table.field td.N_6 div::after {
43.103 + content: "\002785";
43.104 +}
43.105 +table.field td.N_7 div::after {
43.106 + content: "\002786";
43.107 +}
43.108 +table.field td.N_8 div::after {
43.109 + content: "\002787";
43.110 +}
43.111 .but-orientation {
43.112 margin-top:20px;
43.113 }
44.1 Binary file minesweeper/src/main/webapp/pages/netbeans_logo.jpg has changed
45.1 Binary file minesweeper/src/main/webapp/pages/oops.mp3 has changed
46.1 --- a/minesweeper/src/test/java/org/apidesign/demo/minesweeper/MinesModelTest.java Fri Mar 21 15:02:25 2014 +0100
46.2 +++ b/minesweeper/src/test/java/org/apidesign/demo/minesweeper/MinesModelTest.java Mon Sep 08 10:11:50 2014 +0200
46.3 @@ -45,6 +45,64 @@
46.4 assertEquals(cnt, 10, "Ten mines");
46.5 }
46.6
46.7 + @Test public void clickRemovesMarkedSign() {
46.8 + Mines m = new Mines();
46.9 + m.init(10, 10, 10);
46.10 +
46.11 + final Square sq = m.getRows().get(5).getColumns().get(5);
46.12 + MinesModel.markMine(m);
46.13 + MinesModel.click(m, sq);
46.14 +
46.15 + assertEquals(sq.getState(), SquareType.MARKED, "Changed to marked");
46.16 +
46.17 + MinesModel.click(m, sq);
46.18 +
46.19 + assertEquals(sq.getState(), SquareType.UNKNOWN, "Changed back to unknown");
46.20 + }
46.21 +
46.22 + @Test public void gameWonWhenAllMarked() {
46.23 + Mines m = new Mines();
46.24 + m.init(10, 10, 10);
46.25 +
46.26 + for (Row row : m.getRows()) {
46.27 + for (Square sq : row.getColumns()) {
46.28 + if (sq.isMine()) {
46.29 + MinesModel.markMine(m);
46.30 + MinesModel.click(m, sq);
46.31 + }
46.32 + }
46.33 + }
46.34 +
46.35 + assertEquals(m.getState(), MinesModel.GameState.WON, "All mines found. You have won!");
46.36 + }
46.37 +
46.38 + @Test public void gameNotWonWhenTooMuchIsMarked() {
46.39 + Mines m = new Mines();
46.40 + m.init(10, 10, 10);
46.41 +
46.42 + Square additional = null;
46.43 + for (Row row : m.getRows()) {
46.44 + for (Square sq : row.getColumns()) {
46.45 + if (sq.isMine()) {
46.46 + MinesModel.markMine(m);
46.47 + MinesModel.click(m, sq);
46.48 + } else if (additional == null) {
46.49 + MinesModel.markMine(m);
46.50 + MinesModel.click(m, additional = sq);
46.51 + }
46.52 + }
46.53 + }
46.54 +
46.55 + assertEquals(m.getState(), MinesModel.GameState.IN_PROGRESS, "One additional mine is marked!");
46.56 +
46.57 + // remove the mark
46.58 + MinesModel.click(m, additional);
46.59 +
46.60 + assertEquals(m.getState(), MinesModel.GameState.WON, "All mines found. You have won!");
46.61 +
46.62 +
46.63 + }
46.64 +
46.65 @Test public void bombsSet() {
46.66 Mines m = new Mines();
46.67 m.init(10, 10, 0);
47.1 --- a/pom.xml Fri Mar 21 15:02:25 2014 +0100
47.2 +++ b/pom.xml Mon Sep 08 10:11:50 2014 +0200
47.3 @@ -13,8 +13,10 @@
47.4 </parent>
47.5 <properties>
47.6 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
47.7 - <net.java.html.version>0.7.6</net.java.html.version>
47.8 - <bck2brwsr.version>0.8.1</bck2brwsr.version>
47.9 + <net.java.html.version>1.0-SNAPSHOT</net.java.html.version>
47.10 + <nb.html.version>0.8.3</nb.html.version>
47.11 + <bck2brwsr.version>0.9</bck2brwsr.version>
47.12 + <teavm.version>0.1</teavm.version>
47.13 <license>COPYING</license>
47.14 </properties>
47.15 <modules>