Merging use of org.netbeans.html APIs into the main development line
authorJaroslav Tulach <jtulach@netbeans.org>
Mon, 13 Jan 2014 10:29:06 +0100
changeset 6110e396bf6e64
parent 56 68cecf6c3113
parent 60 f0ab62f65322
child 62 a714dd168248
Merging use of org.netbeans.html APIs into the main development line
twitter/nbactions.xml
twitter/pom.xml
twitter/src/main/assembly/fxbrwsr.xml
twitter/src/main/java/org/apidesign/html/demo/twitter/TwitterClient.java
twitter/src/main/java/org/apidesign/html/demo/twitter/TwitterMain.java
twitter/src/main/webapp/pages/index.html
twitter/src/main/webapp/pages/twitterExample.css
twitter/src/test/java/org/apidesign/html/demo/twitter/TwitterClientTest.java
     1.1 --- a/chat/client/pom.xml	Fri Dec 20 08:24:57 2013 +0100
     1.2 +++ b/chat/client/pom.xml	Mon Jan 13 10:29:06 2014 +0100
     1.3 @@ -79,7 +79,7 @@
     1.4  
     1.5    <dependencies>
     1.6      <dependency>
     1.7 -      <groupId>org.apidesign.html</groupId>
     1.8 +      <groupId>org.netbeans.html</groupId>
     1.9        <artifactId>net.java.html.json</artifactId>
    1.10        <version>${net.java.html.version}</version>
    1.11        <type>jar</type>
    1.12 @@ -112,9 +112,9 @@
    1.13          <scope>provided</scope>
    1.14      </dependency>
    1.15      <dependency>
    1.16 -        <groupId>org.apidesign.html</groupId>
    1.17 +        <groupId>org.apidesign.bck2brwsr</groupId>
    1.18          <artifactId>ko-bck2brwsr</artifactId>
    1.19 -        <version>${net.java.html.version}</version>
    1.20 +        <version>${bck2brwsr.version}</version>
    1.21          <scope>runtime</scope>
    1.22      </dependency>
    1.23    </dependencies>
     2.1 --- a/chat/client/src/main/java/org/apidesign/html/chatserver/client/ChatClient.java	Fri Dec 20 08:24:57 2013 +0100
     2.2 +++ b/chat/client/src/main/java/org/apidesign/html/chatserver/client/ChatClient.java	Mon Jan 13 10:29:06 2014 +0100
     2.3 @@ -24,7 +24,6 @@
     2.4  package org.apidesign.html.chatserver.client;
     2.5  
     2.6  import net.java.html.json.ComputedProperty;
     2.7 -import net.java.html.json.Context;
     2.8  import net.java.html.json.Function;
     2.9  import net.java.html.json.Model;
    2.10  import net.java.html.json.OnReceive;
    2.11 @@ -53,7 +52,7 @@
    2.12          if (!sendEnabled(m.getUser(), m.getComment())) {
    2.13              return;
    2.14          }
    2.15 -        Message msg = new Message(CNTX);
    2.16 +        Message msg = new Message();
    2.17          msg.setUser(m.getUser());
    2.18          msg.setComment(m.getComment());
    2.19          m.postComment(msg);
    2.20 @@ -89,10 +88,9 @@
    2.21          m.updateMsgs("" + (now + 1));
    2.22      }
    2.23      
    2.24 -    static final Context CNTX = Context.findDefault(ChatClient.class);
    2.25      static {
    2.26 -        ChatModel chm = new ChatModel(CNTX);
    2.27 -        Message m = new Message(CNTX);
    2.28 +        ChatModel chm = new ChatModel();
    2.29 +        Message m = new Message();
    2.30          m.setComment("Waiting for messages from the server...");
    2.31          m.setUser("system");
    2.32          chm.getMsgs().add(m);
     3.1 --- a/chat/client/src/test/java/org/apidesign/html/chatserver/client/ChatClientTest.java	Fri Dec 20 08:24:57 2013 +0100
     3.2 +++ b/chat/client/src/test/java/org/apidesign/html/chatserver/client/ChatClientTest.java	Mon Jan 13 10:29:06 2014 +0100
     3.3 @@ -23,7 +23,6 @@
     3.4   */
     3.5  package org.apidesign.html.chatserver.client;
     3.6  
     3.7 -import net.java.html.json.Context;
     3.8  import static org.testng.Assert.*;
     3.9  import org.testng.annotations.Test;
    3.10  
    3.11 @@ -36,7 +35,7 @@
    3.12      }
    3.13      
    3.14      @Test public void hasSendEnabled() {
    3.15 -        ChatModel m = new ChatModel(Context.EMPTY);
    3.16 +        ChatModel m = new ChatModel();
    3.17          assertFalse(m.isSendEnabled(), "By default disabled");
    3.18          m.setComment("some msg");
    3.19          m.setUser("by me");
     4.1 --- a/chat/model/pom.xml	Fri Dec 20 08:24:57 2013 +0100
     4.2 +++ b/chat/model/pom.xml	Mon Jan 13 10:29:06 2014 +0100
     4.3 @@ -17,7 +17,7 @@
     4.4    </properties>
     4.5    <dependencies>
     4.6      <dependency>
     4.7 -      <groupId>org.apidesign.html</groupId>
     4.8 +      <groupId>org.netbeans.html</groupId>
     4.9        <artifactId>net.java.html.json</artifactId>
    4.10        <version>${net.java.html.version}</version>
    4.11        <type>jar</type>
     5.1 --- a/chat/model/src/test/java/org/apidesign/html/chatserver/model/MessageImplTest.java	Fri Dec 20 08:24:57 2013 +0100
     5.2 +++ b/chat/model/src/test/java/org/apidesign/html/chatserver/model/MessageImplTest.java	Mon Jan 13 10:29:06 2014 +0100
     5.3 @@ -23,7 +23,6 @@
     5.4   */
     5.5  package org.apidesign.html.chatserver.model;
     5.6  
     5.7 -import net.java.html.json.Context;
     5.8  import static org.testng.Assert.*;
     5.9  import org.testng.annotations.Test;
    5.10  
    5.11 @@ -34,12 +33,12 @@
    5.12  public class MessageImplTest {
    5.13      
    5.14      @Test public void properlyConvertedToSeconds() {
    5.15 -        Message msg = new Message(Context.EMPTY);
    5.16 +        Message msg = new Message();
    5.17          msg.setSince(5143);
    5.18          assertEquals(msg.getAt(), "5s");
    5.19      }
    5.20      @Test public void properlyConvertedToMinutes() {
    5.21 -        Message msg = new Message(Context.EMPTY);
    5.22 +        Message msg = new Message();
    5.23          msg.setSince(63564);
    5.24          assertEquals(msg.getAt(), "1min");
    5.25      }
     6.1 --- a/chat/pom.xml	Fri Dec 20 08:24:57 2013 +0100
     6.2 +++ b/chat/pom.xml	Mon Jan 13 10:29:06 2014 +0100
     6.3 @@ -13,8 +13,6 @@
     6.4    <name>Chat Server with Jersey and Bck2Brwsr</name>
     6.5    <properties>
     6.6        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     6.7 -      <net.java.html.version>0.3</net.java.html.version>
     6.8 -      <bck2brwsr.version>0.7.2</bck2brwsr.version>
     6.9        <bck2brwsr.obfuscationlevel>MINIMAL</bck2brwsr.obfuscationlevel>
    6.10    </properties>
    6.11    <modules>
     7.1 --- a/chat/server/pom.xml	Fri Dec 20 08:24:57 2013 +0100
     7.2 +++ b/chat/server/pom.xml	Mon Jan 13 10:29:06 2014 +0100
     7.3 @@ -62,7 +62,7 @@
     7.4    </build>
     7.5    <dependencies>
     7.6      <dependency>
     7.7 -      <groupId>org.apidesign.html</groupId>
     7.8 +      <groupId>org.netbeans.html</groupId>
     7.9        <artifactId>net.java.html.json</artifactId>
    7.10        <version>${net.java.html.version}</version>
    7.11        <type>jar</type>
    7.12 @@ -70,7 +70,7 @@
    7.13      <dependency>
    7.14        <groupId>org.glassfish.jersey.media</groupId>
    7.15        <artifactId>html-json</artifactId>
    7.16 -      <version>2.1</version>
    7.17 +      <version>2.6-SNAPSHOT</version>
    7.18        <scope>runtime</scope>
    7.19      </dependency>
    7.20      <dependency>
    7.21 @@ -82,18 +82,18 @@
    7.22      <dependency>
    7.23        <groupId>org.glassfish.jersey.connectors</groupId>
    7.24        <artifactId>jersey-grizzly-connector</artifactId>
    7.25 -      <version>2.1</version>
    7.26 +      <version>2.4.1</version>
    7.27      </dependency>
    7.28      <dependency>
    7.29        <groupId>org.glassfish.jersey.containers</groupId>
    7.30        <artifactId>jersey-container-grizzly2-http</artifactId>
    7.31 -      <version>2.1</version>
    7.32 +      <version>2.6-SNAPSHOT</version>
    7.33        <type>jar</type>
    7.34      </dependency>
    7.35      <dependency>
    7.36        <groupId>org.glassfish.grizzly</groupId>
    7.37        <artifactId>grizzly-http-server</artifactId>
    7.38 -      <version>2.3.1</version>
    7.39 +      <version>2.3.8</version>
    7.40      </dependency>
    7.41      <dependency>
    7.42        <groupId>org.apidesign.html.demo</groupId>
    7.43 @@ -105,7 +105,19 @@
    7.44        <artifactId>javax.ws.rs-api</artifactId>
    7.45        <groupId>javax.ws.rs</groupId>
    7.46        <type>jar</type>
    7.47 -      <version>2.0-rc3</version>
    7.48 +      <version>2.0</version>
    7.49 +    </dependency>
    7.50 +    <dependency>
    7.51 +      <groupId>org.glassfish.jersey.core</groupId>
    7.52 +      <artifactId>jersey-common</artifactId>
    7.53 +      <version>2.6-SNAPSHOT</version>
    7.54 +      <scope>runtime</scope>
    7.55 +    </dependency>
    7.56 +    <dependency>
    7.57 +      <groupId>org.glassfish.grizzly</groupId>
    7.58 +      <artifactId>grizzly-framework</artifactId>
    7.59 +      <version>2.3.8</version>
    7.60 +      <scope>runtime</scope>
    7.61      </dependency>
    7.62    </dependencies>
    7.63  </project>
     8.1 --- a/chat/server/src/main/java/org/apidesign/bck2brwsr/demo/chatserver/impl/ChatServerResource.java	Fri Dec 20 08:24:57 2013 +0100
     8.2 +++ b/chat/server/src/main/java/org/apidesign/bck2brwsr/demo/chatserver/impl/ChatServerResource.java	Mon Jan 13 10:29:06 2014 +0100
     8.3 @@ -39,7 +39,6 @@
     8.4  import javax.ws.rs.container.AsyncResponse;
     8.5  import javax.ws.rs.container.Suspended;
     8.6  import javax.ws.rs.core.MediaType;
     8.7 -import net.java.html.json.Context;
     8.8  import org.apidesign.html.chatserver.model.Message;
     8.9  import org.apidesign.html.chatserver.model.Query;
    8.10  
    8.11 @@ -51,7 +50,7 @@
    8.12      
    8.13      private List<Message> msgs = new ArrayList<>();
    8.14      {
    8.15 -        Message welcome = new Message(Context.findDefault(Message.class));
    8.16 +        Message welcome = new Message();
    8.17          welcome.setUser("system");
    8.18          welcome.setComment("Welcome and enjoy!");
    8.19          welcome.setSince(10);
    8.20 @@ -65,7 +64,7 @@
    8.21          @QueryParam("since") @DefaultValue("0") long since,
    8.22          @Suspended AsyncResponse ar
    8.23      ) {
    8.24 -        Query q = new Query(Context.findDefault(ChatServerResource.class));
    8.25 +        Query q = new Query();
    8.26          for (Message m : msgs) {
    8.27              if (m.getSince()>= since) {
    8.28                  q.getMessages().add(m);
     9.1 --- a/chat/server/src/main/java/org/apidesign/bck2brwsr/demo/chatserver/impl/Main.java	Fri Dec 20 08:24:57 2013 +0100
     9.2 +++ b/chat/server/src/main/java/org/apidesign/bck2brwsr/demo/chatserver/impl/Main.java	Mon Jan 13 10:29:06 2014 +0100
     9.3 @@ -23,6 +23,8 @@
     9.4   */
     9.5  package org.apidesign.bck2brwsr.demo.chatserver.impl;
     9.6  
     9.7 +import java.awt.Desktop;
     9.8 +import java.io.IOException;
     9.9  import java.net.URI;
    9.10  import org.glassfish.grizzly.http.server.HttpServer;
    9.11  import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
    9.12 @@ -40,6 +42,13 @@
    9.13          URI u = new URI("http://localhost:8080/");
    9.14          HttpServer server = GrizzlyHttpServerFactory.createHttpServer(u, rc);
    9.15          System.err.println("Server running at " + u);
    9.16 +        try {
    9.17 +            System.err.println("Launching browser");
    9.18 +            Desktop.getDesktop().browse(u);
    9.19 +        } catch (IOException ex) {
    9.20 +            System.err.println("Launching failed: " + ex.getMessage());
    9.21 +        }
    9.22 +        System.err.println("Press Enter to shutdown the server");
    9.23          System.in.read();
    9.24          server.stop();
    9.25      }
    10.1 --- a/chess/pom.xml	Fri Dec 20 08:24:57 2013 +0100
    10.2 +++ b/chess/pom.xml	Mon Jan 13 10:29:06 2014 +0100
    10.3 @@ -2,8 +2,8 @@
    10.4  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    10.5    <modelVersion>4.0.0</modelVersion>
    10.6      <parent>
    10.7 -    <artifactId>demo</artifactId>
    10.8 -    <groupId>org.apidesign.html</groupId>
    10.9 +        <artifactId>demo</artifactId>
   10.10 +        <groupId>org.apidesign.html</groupId>
   10.11          <version>1.0-SNAPSHOT</version>
   10.12      </parent>
   10.13  
   10.14 @@ -34,9 +34,7 @@
   10.15    <properties>
   10.16      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   10.17      <netbeans.compile.on.save>none</netbeans.compile.on.save>
   10.18 -    <net.java.html.version>0.6</net.java.html.version>
   10.19 -    <bck2brwsr.version>0.8</bck2brwsr.version>
   10.20 -    <bck2brwsr.launcher.version>0.8</bck2brwsr.launcher.version>
   10.21 +    <bck2brwsr.launcher.version>${bck2brwsr.version}</bck2brwsr.launcher.version>
   10.22      <bck2brwsr.obfuscationlevel>MINIMAL</bck2brwsr.obfuscationlevel>
   10.23      <brwsr.startpage>pages/index.html</brwsr.startpage>
   10.24    </properties>
   10.25 @@ -58,7 +56,7 @@
   10.26                <configuration>
   10.27                    <archive>
   10.28                        <manifest>
   10.29 -                          <mainClass>org.apidesign.html.demo.chess.Main</mainClass>
   10.30 +                          <mainClass>org.netbeans.html.demo.chess.Main</mainClass>
   10.31                            <addClasspath>true</addClasspath>
   10.32                            <classpathPrefix>lib/</classpathPrefix>
   10.33                        </manifest>
   10.34 @@ -76,7 +74,7 @@
   10.35                            <value>${basedir}/src/main/webapp/</value>
   10.36                        </systemProperty>
   10.37                    </systemProperties>
   10.38 -                  <mainClass>org.apidesign.html.demo.chess.Main</mainClass>
   10.39 +                  <mainClass>org.netbeans.html.demo.chess.Main</mainClass>
   10.40                </configuration>
   10.41            </plugin>      
   10.42            <plugin>
   10.43 @@ -115,12 +113,12 @@
   10.44    </build>
   10.45    <dependencies>
   10.46      <dependency>
   10.47 -        <groupId>org.apidesign.html</groupId>
   10.48 +        <groupId>org.netbeans.html</groupId>
   10.49          <artifactId>net.java.html.json</artifactId>
   10.50          <version>${net.java.html.version}</version>
   10.51      </dependency>
   10.52      <dependency>
   10.53 -        <groupId>org.apidesign.html</groupId>
   10.54 +        <groupId>org.netbeans.html</groupId>
   10.55          <artifactId>net.java.html.boot</artifactId>
   10.56          <version>${net.java.html.version}</version>
   10.57      </dependency>
   10.58 @@ -131,7 +129,7 @@
   10.59        <scope>test</scope>
   10.60      </dependency>
   10.61      <dependency>
   10.62 -      <groupId>org.apidesign.html</groupId>
   10.63 +      <groupId>org.netbeans.html</groupId>
   10.64        <artifactId>net.java.html.sound</artifactId>
   10.65        <version>${net.java.html.version}</version>
   10.66        <type>jar</type>
   10.67 @@ -152,19 +150,19 @@
   10.68            </activation>
   10.69            <dependencies>
   10.70                <dependency>
   10.71 -                  <groupId>org.apidesign.html</groupId>
   10.72 -                  <artifactId>ko-fx</artifactId>
   10.73 +                  <groupId>org.netbeans.html</groupId>
   10.74 +                  <artifactId>ko4j</artifactId>
   10.75                    <version>${net.java.html.version}</version>
   10.76                    <scope>runtime</scope>
   10.77                </dependency>
   10.78                <dependency>
   10.79 -                  <groupId>org.apidesign.html</groupId>
   10.80 -                  <artifactId>boot-fx</artifactId>
   10.81 +                  <groupId>org.netbeans.html</groupId>
   10.82 +                  <artifactId>net.java.html.boot.fx</artifactId>
   10.83                    <version>${net.java.html.version}</version>
   10.84                    <scope>runtime</scope>
   10.85                </dependency>
   10.86                <dependency>
   10.87 -                  <groupId>org.apidesign.html</groupId>
   10.88 +                  <groupId>org.netbeans.html</groupId>
   10.89                    <artifactId>ko-ws-tyrus</artifactId>
   10.90                    <scope>runtime</scope>
   10.91                    <version>${net.java.html.version}</version>
    11.1 --- a/pom.xml	Fri Dec 20 08:24:57 2013 +0100
    11.2 +++ b/pom.xml	Mon Jan 13 10:29:06 2014 +0100
    11.3 @@ -13,11 +13,11 @@
    11.4    </parent>  
    11.5    <properties>
    11.6        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    11.7 -      <bck2brwsr.version>0.7</bck2brwsr.version>
    11.8 +      <net.java.html.version>0.7</net.java.html.version>
    11.9 +      <bck2brwsr.version>0.9-SNAPSHOT</bck2brwsr.version>
   11.10        <license>COPYING</license>
   11.11    </properties>
   11.12    <modules>
   11.13 -    <module>twitter</module>
   11.14      <module>chat</module>
   11.15      <module>chess</module>
   11.16      <module>spinningcube</module>
    12.1 --- a/spinningcube/pom.xml	Fri Dec 20 08:24:57 2013 +0100
    12.2 +++ b/spinningcube/pom.xml	Mon Jan 13 10:29:06 2014 +0100
    12.3 @@ -26,7 +26,6 @@
    12.4  
    12.5    <properties>
    12.6      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    12.7 -    <net.java.html.version>0.4</net.java.html.version>
    12.8      <project.mainclass>org.apidesign.demo.spinningcube.Main</project.mainclass>
    12.9      <netbeans.compile.on.save>none</netbeans.compile.on.save>
   12.10    </properties>
   12.11 @@ -91,24 +90,24 @@
   12.12    </build>
   12.13    <dependencies>
   12.14      <dependency>
   12.15 -        <groupId>org.apidesign.html</groupId>
   12.16 +        <groupId>org.netbeans.html</groupId>
   12.17          <artifactId>net.java.html.json</artifactId>
   12.18          <version>${net.java.html.version}</version>
   12.19      </dependency>
   12.20      <dependency>
   12.21 -        <groupId>org.apidesign.html</groupId>
   12.22 +        <groupId>org.netbeans.html</groupId>
   12.23          <artifactId>net.java.html.boot</artifactId>
   12.24          <version>${net.java.html.version}</version>
   12.25      </dependency>
   12.26      <dependency>
   12.27 -        <groupId>org.apidesign.html</groupId>
   12.28 -        <artifactId>ko-fx</artifactId>
   12.29 +        <groupId>org.netbeans.html</groupId>
   12.30 +        <artifactId>ko4j</artifactId>
   12.31          <version>${net.java.html.version}</version>
   12.32          <scope>runtime</scope>
   12.33      </dependency>
   12.34      <dependency>
   12.35 -        <groupId>org.apidesign.html</groupId>
   12.36 -        <artifactId>boot-fx</artifactId>
   12.37 +        <groupId>org.netbeans.html</groupId>
   12.38 +        <artifactId>net.java.html.boot.fx</artifactId>
   12.39          <version>${net.java.html.version}</version>
   12.40          <scope>runtime</scope>
   12.41      </dependency>
    13.1 --- a/spinningcube/src/main/java/org/apidesign/demo/spinningcube/DataModel.java	Fri Dec 20 08:24:57 2013 +0100
    13.2 +++ b/spinningcube/src/main/java/org/apidesign/demo/spinningcube/DataModel.java	Mon Jan 13 10:29:06 2014 +0100
    13.3 @@ -23,6 +23,8 @@
    13.4   */
    13.5  package org.apidesign.demo.spinningcube;
    13.6  
    13.7 +import java.util.Arrays;
    13.8 +import java.util.List;
    13.9  import net.java.html.json.ComputedProperty;
   13.10  import net.java.html.json.Model;
   13.11  import net.java.html.json.Property;
   13.12 @@ -35,12 +37,12 @@
   13.13      @Property(name = "message", type = String.class),
   13.14  })
   13.15  final class DataModel {
   13.16 -    @ComputedProperty static String[] sides(String message) {
   13.17 +    @ComputedProperty static List<String> sides(String message) {
   13.18          String[] arr = new String[6];
   13.19          String[] words = message == null ? new String[0] : message.split(" ", 6);
   13.20          for (int i = 0; i < 6; i++) {
   13.21              arr[i] = words.length > i ? words[i] : "!";
   13.22          }
   13.23 -        return arr;
   13.24 +        return Arrays.asList(arr);
   13.25      }
   13.26  }
    14.1 --- a/twitter/nbactions.xml	Fri Dec 20 08:24:57 2013 +0100
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,45 +0,0 @@
    14.4 -<?xml version="1.0" encoding="UTF-8"?>
    14.5 -<!--
    14.6 -
    14.7 -    The MIT License (MIT)
    14.8 -
    14.9 -    Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
   14.10 -
   14.11 -    Permission is hereby granted, free of charge, to any person obtaining a copy
   14.12 -    of this software and associated documentation files (the "Software"), to deal
   14.13 -    in the Software without restriction, including without limitation the rights
   14.14 -    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   14.15 -    copies of the Software, and to permit persons to whom the Software is
   14.16 -    furnished to do so, subject to the following conditions:
   14.17 -
   14.18 -    The above copyright notice and this permission notice shall be included in
   14.19 -    all copies or substantial portions of the Software.
   14.20 -
   14.21 -    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   14.22 -    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   14.23 -    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   14.24 -    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   14.25 -    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   14.26 -    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   14.27 -    THE SOFTWARE.
   14.28 -
   14.29 --->
   14.30 -<actions>
   14.31 -    <action>
   14.32 -        <actionName>run</actionName>
   14.33 -        <goals>
   14.34 -            <goal>package</goal>
   14.35 -            <goal>exec:java</goal>
   14.36 -        </goals>
   14.37 -    </action>
   14.38 -    <action>
   14.39 -        <actionName>debug</actionName>
   14.40 -        <goals>
   14.41 -            <goal>package</goal>
   14.42 -            <goal>exec:java</goal>
   14.43 -        </goals>
   14.44 -        <properties>
   14.45 -            <jpda.listen>maven</jpda.listen>
   14.46 -        </properties>
   14.47 -    </action>
   14.48 -</actions>
    15.1 --- a/twitter/pom.xml	Fri Dec 20 08:24:57 2013 +0100
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,126 +0,0 @@
    15.4 -<?xml version="1.0" encoding="UTF-8"?>
    15.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">
    15.6 -  <modelVersion>4.0.0</modelVersion>
    15.7 -
    15.8 -  <groupId>org.apidesign.html.demo</groupId>
    15.9 -  <artifactId>twitter</artifactId>
   15.10 -  <version>1.0-SNAPSHOT</version>
   15.11 -  <packaging>jar</packaging>
   15.12 -  <parent>
   15.13 -      <groupId>org.apidesign.html</groupId>
   15.14 -      <artifactId>demo</artifactId>
   15.15 -      <version>1.0-SNAPSHOT</version>
   15.16 -  </parent>
   15.17 -
   15.18 -  <name>KO4Java's Twttr</name>
   15.19 -  <description>
   15.20 -      Rewrite of knockout.js example to use model written in Java displayed
   15.21 -      by HTML.
   15.22 -  </description>
   15.23 -
   15.24 -  <properties>
   15.25 -    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   15.26 -    <net.java.html.version>0.6</net.java.html.version>
   15.27 -    <project.mainclass>org.apidesign.html.demo.twitter.TwitterMain</project.mainclass>
   15.28 -  </properties>
   15.29 -
   15.30 -  <pluginRepositories>
   15.31 -      <pluginRepository>
   15.32 -          <id>java.net</id>
   15.33 -          <name>Java.net</name>
   15.34 -          <url>https://maven.java.net/content/repositories/releases/</url>
   15.35 -      </pluginRepository>
   15.36 -  </pluginRepositories>
   15.37 -
   15.38 -  <build>
   15.39 -      <plugins>
   15.40 -          <plugin>
   15.41 -              <groupId>org.apache.maven.plugins</groupId>
   15.42 -              <artifactId>maven-compiler-plugin</artifactId>
   15.43 -              <version>2.3.2</version>
   15.44 -              <configuration>
   15.45 -                  <source>1.7</source>
   15.46 -                  <target>1.7</target>
   15.47 -              </configuration>
   15.48 -          </plugin>
   15.49 -          <plugin>
   15.50 -              <groupId>org.apache.maven.plugins</groupId>
   15.51 -              <artifactId>maven-surefire-plugin</artifactId>
   15.52 -              <version>2.14.1</version>
   15.53 -              <configuration>
   15.54 -                  <systemPropertyVariables>
   15.55 -                      <vmtest.brwsrs>${brwsr}</vmtest.brwsrs>
   15.56 -                  </systemPropertyVariables>
   15.57 -              </configuration>
   15.58 -          </plugin>
   15.59 -          <plugin>
   15.60 -              <groupId>org.codehaus.mojo</groupId>
   15.61 -              <artifactId>exec-maven-plugin</artifactId>
   15.62 -              <version>1.2.1</version>
   15.63 -              <configuration>
   15.64 -                  <systemProperties>
   15.65 -                      <systemProperty>
   15.66 -                          <key>browser.rootdir</key>
   15.67 -                          <value>${basedir}/src/main/webapp/</value>
   15.68 -                      </systemProperty>
   15.69 -                  </systemProperties>
   15.70 -                  <mainClass>${project.mainclass}</mainClass>
   15.71 -              </configuration>
   15.72 -          </plugin>      
   15.73 -          <plugin>
   15.74 -              <groupId>org.apache.maven.plugins</groupId>
   15.75 -              <artifactId>maven-jar-plugin</artifactId>
   15.76 -              <version>2.4</version>
   15.77 -              <configuration>
   15.78 -                  <archive>
   15.79 -                      <manifest>
   15.80 -                          <addClasspath>true</addClasspath>
   15.81 -                          <classpathPrefix>lib/</classpathPrefix>
   15.82 -                      </manifest>
   15.83 -                  </archive>
   15.84 -              </configuration>
   15.85 -          </plugin>
   15.86 -          <plugin>
   15.87 -              <groupId>org.apache.maven.plugins</groupId>
   15.88 -              <artifactId>maven-deploy-plugin</artifactId>
   15.89 -              <version>2.7</version>
   15.90 -              <configuration>
   15.91 -                  <skip>true</skip>
   15.92 -              </configuration>
   15.93 -          </plugin>      
   15.94 -      </plugins>
   15.95 -  </build>
   15.96 -
   15.97 -  <dependencies>
   15.98 -    <dependency>
   15.99 -      <groupId>org.testng</groupId>
  15.100 -      <artifactId>testng</artifactId>
  15.101 -      <version>6.5.2</version>
  15.102 -      <scope>test</scope>
  15.103 -    </dependency>
  15.104 -    <dependency>
  15.105 -      <groupId>org.apidesign.html</groupId>
  15.106 -      <artifactId>net.java.html.json</artifactId>
  15.107 -      <version>${net.java.html.version}</version>
  15.108 -      <type>jar</type>
  15.109 -    </dependency>
  15.110 -    <dependency>
  15.111 -      <groupId>org.apidesign.html</groupId>
  15.112 -      <artifactId>net.java.html.boot</artifactId>
  15.113 -      <version>${net.java.html.version}</version>
  15.114 -      <type>jar</type>
  15.115 -    </dependency>
  15.116 -    <dependency>
  15.117 -      <groupId>org.apidesign.html</groupId>
  15.118 -      <artifactId>boot-fx</artifactId>
  15.119 -      <version>${net.java.html.version}</version>
  15.120 -      <scope>runtime</scope>
  15.121 -    </dependency>
  15.122 -    <dependency>
  15.123 -      <groupId>org.apidesign.html</groupId>
  15.124 -      <artifactId>ko-fx</artifactId>
  15.125 -      <version>${net.java.html.version}</version>
  15.126 -      <scope>runtime</scope>
  15.127 -    </dependency>
  15.128 -  </dependencies>
  15.129 -</project>
    16.1 --- a/twitter/src/main/assembly/fxbrwsr.xml	Fri Dec 20 08:24:57 2013 +0100
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,48 +0,0 @@
    16.4 -<?xml version="1.0"?>
    16.5 -<!--
    16.6 -
    16.7 -    The MIT License (MIT)
    16.8 -
    16.9 -    Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
   16.10 -
   16.11 -    Permission is hereby granted, free of charge, to any person obtaining a copy
   16.12 -    of this software and associated documentation files (the "Software"), to deal
   16.13 -    in the Software without restriction, including without limitation the rights
   16.14 -    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   16.15 -    copies of the Software, and to permit persons to whom the Software is
   16.16 -    furnished to do so, subject to the following conditions:
   16.17 -
   16.18 -    The above copyright notice and this permission notice shall be included in
   16.19 -    all copies or substantial portions of the Software.
   16.20 -
   16.21 -    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   16.22 -    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   16.23 -    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   16.24 -    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   16.25 -    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   16.26 -    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   16.27 -    THE SOFTWARE.
   16.28 -
   16.29 --->
   16.30 -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   16.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">
   16.32 -  
   16.33 -  <id>fxbrwsr</id>
   16.34 -  <formats>
   16.35 -      <format>zip</format>
   16.36 -  </formats>
   16.37 -  <baseDirectory>${project.build.finalName}-fxbrwsr</baseDirectory>
   16.38 -  <dependencySets>
   16.39 -    <dependencySet>
   16.40 -        <useProjectArtifact>false</useProjectArtifact>
   16.41 -        <scope>runtime</scope>
   16.42 -        <outputDirectory>lib</outputDirectory>
   16.43 -    </dependencySet>
   16.44 -  </dependencySets> 
   16.45 -  <files>
   16.46 -    <file>
   16.47 -      <source>${project.build.directory}/${project.build.finalName}.jar</source>
   16.48 -      <outputDirectory>/</outputDirectory>
   16.49 -    </file>
   16.50 -  </files>
   16.51 -</assembly>
   16.52 \ No newline at end of file
    17.1 --- a/twitter/src/main/java/org/apidesign/html/demo/twitter/TwitterClient.java	Fri Dec 20 08:24:57 2013 +0100
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,205 +0,0 @@
    17.4 -/**
    17.5 - * The MIT License (MIT)
    17.6 - *
    17.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    17.8 - *
    17.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
   17.10 - * of this software and associated documentation files (the "Software"), to deal
   17.11 - * in the Software without restriction, including without limitation the rights
   17.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   17.13 - * copies of the Software, and to permit persons to whom the Software is
   17.14 - * furnished to do so, subject to the following conditions:
   17.15 - *
   17.16 - * The above copyright notice and this permission notice shall be included in
   17.17 - * all copies or substantial portions of the Software.
   17.18 - *
   17.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   17.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   17.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   17.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   17.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   17.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   17.25 - * THE SOFTWARE.
   17.26 - */
   17.27 -package org.apidesign.html.demo.twitter;
   17.28 -
   17.29 -import java.util.Arrays;
   17.30 -import java.util.List;
   17.31 -import net.java.html.json.ComputedProperty;
   17.32 -import net.java.html.json.Function;
   17.33 -import net.java.html.json.Model;
   17.34 -import net.java.html.json.OnPropertyChange;
   17.35 -import net.java.html.json.OnReceive;
   17.36 -import net.java.html.json.Property;
   17.37 -
   17.38 -/** Controller class for access to Twitter.
   17.39 - * 
   17.40 - * @author Jaroslav Tulach
   17.41 - */
   17.42 -@Model(className="TwitterModel", properties={
   17.43 -    @Property(name="savedLists", type=Tweeters.class, array = true),
   17.44 -    @Property(name="activeTweetersName", type=String.class),
   17.45 -    @Property(name="activeTweeters", type=String.class, array = true),
   17.46 -    @Property(name="userNameToAdd", type=String.class),
   17.47 -    @Property(name="currentTweets", type=Tweet.class, array = true),
   17.48 -    @Property(name="loading", type=boolean.class)
   17.49 -})
   17.50 -final class TwitterClient {
   17.51 -    @Model(className = "Tweeters", properties = {
   17.52 -        @Property(name="name", type = String.class),
   17.53 -        @Property(name="userNames", type = String.class, array = true)
   17.54 -    })
   17.55 -    static class Twttrs {
   17.56 -    }
   17.57 -    @Model(className = "Tweet", properties = {
   17.58 -        @Property(name = "from_user", type = String.class),
   17.59 -        @Property(name = "from_user_id", type = int.class),
   17.60 -        @Property(name = "profile_image_url", type = String.class),
   17.61 -        @Property(name = "text", type = String.class),
   17.62 -        @Property(name = "created_at", type = String.class),
   17.63 -    })
   17.64 -    static final class Twt {
   17.65 -        @ComputedProperty static String html(String text) {
   17.66 -            StringBuilder sb = new StringBuilder(320);
   17.67 -            for (int pos = 0;;) {
   17.68 -                int http = text.indexOf("http", pos);
   17.69 -                if (http == -1) {
   17.70 -                    sb.append(text.substring(pos));
   17.71 -                    return sb.toString();
   17.72 -                }
   17.73 -                int spc = text.indexOf(' ', http);
   17.74 -                if (spc == -1) {
   17.75 -                    spc = text.length();
   17.76 -                }
   17.77 -                sb.append(text.substring(pos, http));
   17.78 -                String url = text.substring(http, spc);
   17.79 -                sb.append("<a href='").append(url).append("'>").append(url).append("</a>");
   17.80 -                pos = spc;
   17.81 -            }
   17.82 -        }
   17.83 -        
   17.84 -        @ComputedProperty static String userUrl(String from_user) {
   17.85 -            return "http://twitter.com/" + from_user;
   17.86 -        }
   17.87 -    }
   17.88 -    @Model(className = "TwitterQuery", properties = {
   17.89 -        @Property(array = true, name = "results", type = Twt.class)
   17.90 -    })
   17.91 -    public static final class TwttrQr {
   17.92 -    }
   17.93 -    
   17.94 -    @OnReceive(url="{root}/search.json?{query}&callback={me}", jsonp="me")
   17.95 -    static void queryTweets(TwitterModel page, TwitterQuery q) {
   17.96 -        page.getCurrentTweets().clear();
   17.97 -        page.getCurrentTweets().addAll(q.getResults());
   17.98 -        page.setLoading(false);
   17.99 -    }
  17.100 -    
  17.101 -    @OnPropertyChange("activeTweetersName")
  17.102 -    static void changeTweetersList(TwitterModel model) {
  17.103 -        Tweeters people = findByName(model.getSavedLists(), model.getActiveTweetersName());        
  17.104 -        model.getActiveTweeters().clear();
  17.105 -        model.getActiveTweeters().addAll(people.getUserNames());
  17.106 -    }
  17.107 -    
  17.108 -    @OnPropertyChange({ "activeTweeters", "activeTweetersCount" })
  17.109 -    static void refreshTweets(TwitterModel model) {
  17.110 -        StringBuilder sb = new StringBuilder();
  17.111 -        sb.append("rpp=25&q=");
  17.112 -        String sep = "";
  17.113 -        for (String p : model.getActiveTweeters()) {
  17.114 -            sb.append(sep);
  17.115 -            sb.append("from:");
  17.116 -            sb.append(p);
  17.117 -            sep = " OR ";
  17.118 -        }
  17.119 -        model.setLoading(true);
  17.120 -        model.queryTweets("http://search.twitter.com", sb.toString());
  17.121 -    }
  17.122 -    
  17.123 -    static void init() {
  17.124 -        final TwitterModel model = new TwitterModel();
  17.125 -        final List<Tweeters> svdLst = model.getSavedLists();
  17.126 -        svdLst.add(newTweeters("API Design", "JaroslavTulach"));
  17.127 -        svdLst.add(newTweeters("Celebrities", "JohnCleese", "MCHammer", "StephenFry", "algore", "StevenSanderson"));
  17.128 -        svdLst.add(newTweeters("Microsoft people", "BillGates", "shanselman", "ScottGu"));
  17.129 -        svdLst.add(newTweeters("NetBeans", "GeertjanW","monacotoni", "NetBeans", "petrjiricka"));
  17.130 -        svdLst.add(newTweeters("Tech pundits", "Scobleizer", "LeoLaporte", "techcrunch", "BoingBoing", "timoreilly", "codinghorror"));
  17.131 -
  17.132 -        model.setActiveTweetersName("NetBeans");
  17.133 -
  17.134 -        model.applyBindings();
  17.135 -    }
  17.136 -    
  17.137 -    @ComputedProperty
  17.138 -    static boolean hasUnsavedChanges(List<String> activeTweeters, List<Tweeters> savedLists, String activeTweetersName) {
  17.139 -        Tweeters tw = findByName(savedLists, activeTweetersName);
  17.140 -        if (activeTweeters == null) {
  17.141 -            return false;
  17.142 -        }
  17.143 -        return !tw.getUserNames().equals(activeTweeters);
  17.144 -    }
  17.145 -    
  17.146 -    @ComputedProperty
  17.147 -    static int activeTweetersCount(List<String> activeTweeters) {
  17.148 -        return activeTweeters.size();
  17.149 -    }
  17.150 -    
  17.151 -    @ComputedProperty
  17.152 -    static boolean userNameToAddIsValid(
  17.153 -        String userNameToAdd, String activeTweetersName, List<Tweeters> savedLists, List<String> activeTweeters
  17.154 -    ) {
  17.155 -        return userNameToAdd != null && 
  17.156 -            userNameToAdd.matches("[a-zA-Z0-9_]{1,15}") &&
  17.157 -            !activeTweeters.contains(userNameToAdd);
  17.158 -    }
  17.159 -    
  17.160 -    @Function
  17.161 -    static void deleteList(TwitterModel model) {
  17.162 -        final List<Tweeters> sl = model.getSavedLists();
  17.163 -        sl.remove(findByName(sl, model.getActiveTweetersName()));
  17.164 -        if (sl.isEmpty()) {
  17.165 -            final Tweeters t = new Tweeters();
  17.166 -            t.setName("New");
  17.167 -            sl.add(t);
  17.168 -        }
  17.169 -        model.setActiveTweetersName(sl.get(0).getName());
  17.170 -    }
  17.171 -    
  17.172 -    @Function
  17.173 -    static void saveChanges(TwitterModel model) {
  17.174 -        Tweeters t = findByName(model.getSavedLists(), model.getActiveTweetersName());
  17.175 -        int indx = model.getSavedLists().indexOf(t);
  17.176 -        if (indx != -1) {
  17.177 -            t.setName(model.getActiveTweetersName());
  17.178 -            t.getUserNames().clear();
  17.179 -            t.getUserNames().addAll(model.getActiveTweeters());
  17.180 -        }
  17.181 -    }
  17.182 -    
  17.183 -    @Function
  17.184 -    static void addUser(TwitterModel model) {
  17.185 -        String n = model.getUserNameToAdd();
  17.186 -        model.getActiveTweeters().add(n);
  17.187 -    }
  17.188 -    @Function
  17.189 -    static void removeUser(String data, TwitterModel model) {
  17.190 -        model.getActiveTweeters().remove(data);
  17.191 -    }
  17.192 -    
  17.193 -    private static Tweeters findByName(List<Tweeters> list, String name) {
  17.194 -        for (Tweeters l : list) {
  17.195 -            if (l.getName() != null && l.getName().equals(name)) {
  17.196 -                return l;
  17.197 -            }
  17.198 -        }
  17.199 -        return list.isEmpty() ? new Tweeters() : list.get(0);
  17.200 -    }
  17.201 -    
  17.202 -    private static Tweeters newTweeters(String listName, String... userNames) {
  17.203 -        Tweeters t = new Tweeters();
  17.204 -        t.setName(listName);
  17.205 -        t.getUserNames().addAll(Arrays.asList(userNames));
  17.206 -        return t;
  17.207 -    }
  17.208 -}
    18.1 --- a/twitter/src/main/java/org/apidesign/html/demo/twitter/TwitterMain.java	Fri Dec 20 08:24:57 2013 +0100
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,47 +0,0 @@
    18.4 -/**
    18.5 - * The MIT License (MIT)
    18.6 - *
    18.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    18.8 - *
    18.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
   18.10 - * of this software and associated documentation files (the "Software"), to deal
   18.11 - * in the Software without restriction, including without limitation the rights
   18.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   18.13 - * copies of the Software, and to permit persons to whom the Software is
   18.14 - * furnished to do so, subject to the following conditions:
   18.15 - *
   18.16 - * The above copyright notice and this permission notice shall be included in
   18.17 - * all copies or substantial portions of the Software.
   18.18 - *
   18.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   18.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   18.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   18.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   18.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   18.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   18.25 - * THE SOFTWARE.
   18.26 - */
   18.27 -package org.apidesign.html.demo.twitter;
   18.28 -
   18.29 -import net.java.html.boot.BrowserBuilder;
   18.30 -
   18.31 -/** Boots browser and then performs initialization when the HTML page
   18.32 - * is ready.
   18.33 - *
   18.34 - * @author Jaroslav Tulach <jtulach@netbeans.org>
   18.35 - */
   18.36 -public class TwitterMain {
   18.37 -    private TwitterMain() {
   18.38 -    }
   18.39 -    
   18.40 -    public static void main(String... args) {
   18.41 -        BrowserBuilder.newBrowser().loadPage("pages/index.html")
   18.42 -            .invoke("onPageLoad", args).loadClass(TwitterMain.class)
   18.43 -            .showAndWait();
   18.44 -        System.exit(0);
   18.45 -    }
   18.46 -    
   18.47 -    public static void onPageLoad(String... args) {
   18.48 -        TwitterClient.init();
   18.49 -    }
   18.50 -}
    19.1 --- a/twitter/src/main/webapp/pages/index.html	Fri Dec 20 08:24:57 2013 +0100
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,97 +0,0 @@
    19.4 -<?xml version="1.0" encoding="UTF-8"?>
    19.5 -<!--
    19.6 -
    19.7 -    The MIT License (MIT)
    19.8 -
    19.9 -    Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
   19.10 -
   19.11 -    Permission is hereby granted, free of charge, to any person obtaining a copy
   19.12 -    of this software and associated documentation files (the "Software"), to deal
   19.13 -    in the Software without restriction, including without limitation the rights
   19.14 -    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   19.15 -    copies of the Software, and to permit persons to whom the Software is
   19.16 -    furnished to do so, subject to the following conditions:
   19.17 -
   19.18 -    The above copyright notice and this permission notice shall be included in
   19.19 -    all copies or substantial portions of the Software.
   19.20 -
   19.21 -    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   19.22 -    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   19.23 -    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   19.24 -    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   19.25 -    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   19.26 -    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   19.27 -    THE SOFTWARE.
   19.28 -
   19.29 --->
   19.30 -
   19.31 -<!--
   19.32 -    Copied from knockout.js Twitter example:
   19.33 -    http://knockoutjs.com/examples/twitter.html
   19.34 --->
   19.35 -
   19.36 -<!DOCTYPE html>
   19.37 -<html xmlns="http://www.w3.org/1999/xhtml">
   19.38 -    <head>
   19.39 -        <title>Html and Java Twitter</title>
   19.40 -    </head>
   19.41 -    <body>
   19.42 -        <link href='twitterExample.css' rel='Stylesheet' ></link>
   19.43 -        
   19.44 -        <style type='text/css'>
   19.45 -           .liveExample select { height: 1.7em; }
   19.46 -           .liveExample button { height: 2em; }
   19.47 -        </style>
   19.48 -        
   19.49 -        
   19.50 -        <h2>Bck2Brwsr's Twitter</h2>
   19.51 -        
   19.52 -        <p>
   19.53 -        This code is based on original <a href="http://knockoutjs.com/examples/twitter.html">knockout.js Twitter example</a> and
   19.54 -        uses almost unmodified HTML page. It just changes the model. It 
   19.55 -        is written in Java language and it is executed using the HotSpot
   19.56 -        virtual machine. The Java source code has about 190 lines and is available 
   19.57 -        <a href="http://source.apidesign.org/hg/bck2brwsr/file/7fc6b7e9c982/javaquery/demo-twitter/src/main/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClient.java">here</a>
   19.58 -        - in fact it may even be more dense than the original JavaScript model.
   19.59 -        </p>
   19.60 -        
   19.61 -        <div class='liveExample'>
   19.62 -            <div class='configuration'>
   19.63 -                <div class='listChooser'>
   19.64 -                    <button data-bind='click: deleteList, enable: activeTweetersName'>Delete</button>
   19.65 -                    <button data-bind='click: saveChanges, enable: hasUnsavedChanges'>Save</button> 
   19.66 -                    <select data-bind='options: savedLists, optionsValue: "name", value: activeTweetersName'> </select>
   19.67 -                </div>
   19.68 -
   19.69 -                <p>Currently viewing <span data-bind='text: activeTweetersCount'> </span> user(s):</p>
   19.70 -                <div class='currentUsers' >
   19.71 -                    <ul data-bind='foreach: activeTweeters'>
   19.72 -                        <li>
   19.73 -                            <button data-bind='click: $root.removeUser'>Remove</button>
   19.74 -                            <div data-bind='text: $data'> </div>
   19.75 -                        </li>
   19.76 -                    </ul>
   19.77 -                </div>
   19.78 -
   19.79 -                <form data-bind='submit: addUser'>
   19.80 -                    <label>Add user:</label>
   19.81 -                    <input data-bind='value: userNameToAdd, valueUpdate: "keyup", css: { invalid: !userNameToAddIsValid() }' />
   19.82 -                    <button data-bind='enable: userNameToAddIsValid' type='submit'>Add</button>
   19.83 -                </form>
   19.84 -            </div>
   19.85 -            <div class='tweets'>
   19.86 -                <div class='loadingIndicator' data-bind="visible: loading">Loading...</div>
   19.87 -                <table data-bind='foreach: currentTweets' width='100%'>
   19.88 -                    <tr>
   19.89 -                        <td><img data-bind='attr: { src: profile_image_url }' /></td>
   19.90 -                        <td>
   19.91 -                            <a class='twitterUser' data-bind='attr: { href: userUrl }, text: from_user'> </a>
   19.92 -                            <span data-bind='html: html'> </span>
   19.93 -                            <div class='tweetInfo' data-bind='text: created_at'> </div>
   19.94 -                        </td>
   19.95 -                    </tr>
   19.96 -                </table>
   19.97 -            </div>
   19.98 -        </div>
   19.99 -    </body>
  19.100 -</html>
    20.1 --- a/twitter/src/main/webapp/pages/twitterExample.css	Fri Dec 20 08:24:57 2013 +0100
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,58 +0,0 @@
    20.4 -/**
    20.5 - * The MIT License (MIT)
    20.6 - *
    20.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    20.8 - *
    20.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
   20.10 - * of this software and associated documentation files (the "Software"), to deal
   20.11 - * in the Software without restriction, including without limitation the rights
   20.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   20.13 - * copies of the Software, and to permit persons to whom the Software is
   20.14 - * furnished to do so, subject to the following conditions:
   20.15 - *
   20.16 - * The above copyright notice and this permission notice shall be included in
   20.17 - * all copies or substantial portions of the Software.
   20.18 - *
   20.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   20.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   20.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   20.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   20.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   20.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   20.25 - * THE SOFTWARE.
   20.26 - */
   20.27 -
   20.28 -
   20.29 -
   20.30 -/*
   20.31 -    Copied from knockout.js Twitter example:
   20.32 -    http://knockoutjs.com/examples/twitter.html
   20.33 -*/
   20.34 -
   20.35 -.configuration, .tweets, .tweets td { font-family: Verdana; font-size: 13px; }
   20.36 -.configuration { background-color: #DEDEDE; border: 2px solid gray; float:left; height: 40em; width: 40%; padding: 0.5em; border-right-width:0; }
   20.37 -.tweets { width: 55%; border: 2px solid gray; height: 40em; overflow: scroll; overflow-x: hidden; background-color: Black; color: White; padding: 0.5em; position: relative; }
   20.38 -.tweets table { border-width: 0;}
   20.39 -.tweets tr { vertical-align: top; }
   20.40 -.tweets td { padding: 0.4em 0.3em 1em 0.4em; border-width: 0; }
   20.41 -.tweets img { width: 4em; }
   20.42 -.tweetInfo { color: Gray; font-size: 0.9em; }
   20.43 -.twitterUser { color: #77AAFF; text-decoration: none; font-size: 1.1em; font-weight: bold; }
   20.44 -input.invalid { border: 1px solid red !important; background-color: #FFAAAA !important; }
   20.45 -
   20.46 -.listChooser select, .listChooser button { vertical-align:top; }
   20.47 -.listChooser select { width: 60%; font-size:1.2em; height:1.4em; }
   20.48 -.listChooser button { width: 19%; height:1.68em; float:right; }
   20.49 -
   20.50 -.currentUsers { height: 28em; overflow-y: auto; overflow-x: hidden; }
   20.51 -.currentUsers button { float: right; height: 2.5em; margin: 0.1em; padding-left: 1em; padding-right: 1em; }
   20.52 -.currentUsers ul, .configuration li { list-style: none; margin: 0; padding: 0 }
   20.53 -.currentUsers li { height: 2.4em; font-size: 1.2em; background-color: #A7D0E3; border: 1px solid gray; margin-bottom: 0.3em; -webkit-border-radius: 5px; -moz-border-radius: 5px; -webkit-box-shadow: 0 0.2em 0.5em gray; -moz-box-shadow: 0 0.2em 0.5em gray; }
   20.54 -.currentUsers li div { padding: 0.6em; }
   20.55 -.currentUsers li:hover { background-color: #EEC; }
   20.56 -
   20.57 -.configuration form label { width: 25%; display: inline-block; text-align:right; overflow: hidden; }
   20.58 -.configuration form input { width:40%; font-size: 1.3em; border:1px solid silver; background-color: White; padding: 0.1em; }
   20.59 -.configuration form button { width: 20%; margin-left: 0.3em; height: 2em; }
   20.60 -
   20.61 -.loadingIndicator { position: absolute; top: 0.1em; left: 0.1em; font: 0.8em Arial; background-color: #229; color: White; padding: 0.2em 0.5em 0.2em 0.5em; }
    21.1 --- a/twitter/src/test/java/org/apidesign/html/demo/twitter/TwitterClientTest.java	Fri Dec 20 08:24:57 2013 +0100
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,73 +0,0 @@
    21.4 -/**
    21.5 - * The MIT License (MIT)
    21.6 - *
    21.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    21.8 - *
    21.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
   21.10 - * of this software and associated documentation files (the "Software"), to deal
   21.11 - * in the Software without restriction, including without limitation the rights
   21.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   21.13 - * copies of the Software, and to permit persons to whom the Software is
   21.14 - * furnished to do so, subject to the following conditions:
   21.15 - *
   21.16 - * The above copyright notice and this permission notice shall be included in
   21.17 - * all copies or substantial portions of the Software.
   21.18 - *
   21.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   21.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   21.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   21.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   21.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   21.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   21.25 - * THE SOFTWARE.
   21.26 - */
   21.27 -package org.apidesign.html.demo.twitter;
   21.28 -
   21.29 -import java.util.List;
   21.30 -import static org.testng.Assert.*;
   21.31 -import org.testng.annotations.BeforeMethod;
   21.32 -import org.testng.annotations.Test;
   21.33 -
   21.34 -/** We can unit test the TwitterModel smoothly.
   21.35 - *
   21.36 - * @author Jaroslav Tulach <jtulach@netbeans.org>
   21.37 - */
   21.38 -public class TwitterClientTest {
   21.39 -    private TwitterModel model;
   21.40 -    
   21.41 -
   21.42 -    @BeforeMethod
   21.43 -    public void initModel() {
   21.44 -        model = new TwitterModel();
   21.45 -    }
   21.46 -
   21.47 -    @Test public void testIsValidToAdd() {
   21.48 -        model.setUserNameToAdd("Joe");
   21.49 -        Tweeters t = new Tweeters();
   21.50 -        t.setName("test");
   21.51 -        model.getSavedLists().add(t);
   21.52 -        model.setActiveTweetersName("test");
   21.53 -        
   21.54 -        assertTrue(model.isUserNameToAddIsValid(), "Joe is OK");
   21.55 -        TwitterClient.addUser(model);
   21.56 -        assertFalse(model.isUserNameToAddIsValid(), "Can't add Joe for the 2nd time");
   21.57 -        assertEquals(t.getUserNames().size(), 0, "Original tweeters list remains empty");
   21.58 -        
   21.59 -        List<String> mod = model.getActiveTweeters();
   21.60 -        assertTrue(model.isHasUnsavedChanges(), "We have modifications");
   21.61 -        assertEquals(mod.size(), 1, "One element in the list");
   21.62 -        assertEquals(mod.get(0), "Joe", "Its name is Joe");
   21.63 -        
   21.64 -        assertSame(model.getActiveTweeters(), mod, "Editing list is the modified one");
   21.65 -        
   21.66 -        TwitterClient.saveChanges(model);
   21.67 -        assertFalse(model.isHasUnsavedChanges(), "Does not have anything to save");
   21.68 -        
   21.69 -        assertSame(model.getActiveTweeters(), mod, "Still editing the old modified one");
   21.70 -    }
   21.71 -    
   21.72 -    @Test public void httpAtTheEnd() {
   21.73 -        String res = TwitterClient.Twt.html("Ahoj http://kuk");
   21.74 -        assertEquals(res, "Ahoj <a href='http://kuk'>http://kuk</a>");
   21.75 -    }
   21.76 -}
    22.1 --- a/words/pom.xml	Fri Dec 20 08:24:57 2013 +0100
    22.2 +++ b/words/pom.xml	Mon Jan 13 10:29:06 2014 +0100
    22.3 @@ -26,7 +26,6 @@
    22.4  
    22.5    <properties>
    22.6      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    22.7 -    <net.java.html.version>0.6</net.java.html.version>
    22.8      <project.mainclass>org.apidesign.demo.words.Main</project.mainclass>
    22.9      <netbeans.compile.on.save>none</netbeans.compile.on.save>
   22.10    </properties>
   22.11 @@ -91,24 +90,24 @@
   22.12    </build>
   22.13    <dependencies>
   22.14      <dependency>
   22.15 -        <groupId>org.apidesign.html</groupId>
   22.16 +        <groupId>org.netbeans.html</groupId>
   22.17          <artifactId>net.java.html.json</artifactId>
   22.18          <version>${net.java.html.version}</version>
   22.19      </dependency>
   22.20      <dependency>
   22.21 -        <groupId>org.apidesign.html</groupId>
   22.22 +        <groupId>org.netbeans.html</groupId>
   22.23          <artifactId>net.java.html.boot</artifactId>
   22.24          <version>${net.java.html.version}</version>
   22.25      </dependency>
   22.26      <dependency>
   22.27 -        <groupId>org.apidesign.html</groupId>
   22.28 -        <artifactId>ko-fx</artifactId>
   22.29 +        <groupId>org.netbeans.html</groupId>
   22.30 +        <artifactId>ko4j</artifactId>
   22.31          <version>${net.java.html.version}</version>
   22.32          <scope>runtime</scope>
   22.33      </dependency>
   22.34      <dependency>
   22.35 -        <groupId>org.apidesign.html</groupId>
   22.36 -        <artifactId>boot-fx</artifactId>
   22.37 +        <groupId>org.netbeans.html</groupId>
   22.38 +        <artifactId>net.java.html.boot.fx</artifactId>
   22.39          <version>${net.java.html.version}</version>
   22.40          <scope>runtime</scope>
   22.41      </dependency>