# HG changeset patch # User Jaroslav Tulach # Date 1389565542 -3600 # Node ID 9984b9f7d8c634924d6e68776792300361b5a971 # Parent 68cecf6c31137697bec4b2b84a9eca18d62f9c48 Adjusting to new naming scheme (which includes netbeans name) diff -r 68cecf6c3113 -r 9984b9f7d8c6 chat/client/pom.xml --- a/chat/client/pom.xml Fri Dec 20 08:24:57 2013 +0100 +++ b/chat/client/pom.xml Sun Jan 12 23:25:42 2014 +0100 @@ -79,7 +79,7 @@ - org.apidesign.html + org.netbeans.html net.java.html.json ${net.java.html.version} jar @@ -112,9 +112,9 @@ provided - org.apidesign.html + org.apidesign.bck2brwsr ko-bck2brwsr - ${net.java.html.version} + ${bck2brwsr.version} runtime diff -r 68cecf6c3113 -r 9984b9f7d8c6 chat/client/src/main/java/org/apidesign/html/chatserver/client/ChatClient.java --- a/chat/client/src/main/java/org/apidesign/html/chatserver/client/ChatClient.java Fri Dec 20 08:24:57 2013 +0100 +++ b/chat/client/src/main/java/org/apidesign/html/chatserver/client/ChatClient.java Sun Jan 12 23:25:42 2014 +0100 @@ -24,7 +24,6 @@ package org.apidesign.html.chatserver.client; import net.java.html.json.ComputedProperty; -import net.java.html.json.Context; import net.java.html.json.Function; import net.java.html.json.Model; import net.java.html.json.OnReceive; @@ -53,7 +52,7 @@ if (!sendEnabled(m.getUser(), m.getComment())) { return; } - Message msg = new Message(CNTX); + Message msg = new Message(); msg.setUser(m.getUser()); msg.setComment(m.getComment()); m.postComment(msg); @@ -89,10 +88,9 @@ m.updateMsgs("" + (now + 1)); } - static final Context CNTX = Context.findDefault(ChatClient.class); static { - ChatModel chm = new ChatModel(CNTX); - Message m = new Message(CNTX); + ChatModel chm = new ChatModel(); + Message m = new Message(); m.setComment("Waiting for messages from the server..."); m.setUser("system"); chm.getMsgs().add(m); diff -r 68cecf6c3113 -r 9984b9f7d8c6 chat/client/src/test/java/org/apidesign/html/chatserver/client/ChatClientTest.java --- a/chat/client/src/test/java/org/apidesign/html/chatserver/client/ChatClientTest.java Fri Dec 20 08:24:57 2013 +0100 +++ b/chat/client/src/test/java/org/apidesign/html/chatserver/client/ChatClientTest.java Sun Jan 12 23:25:42 2014 +0100 @@ -23,7 +23,6 @@ */ package org.apidesign.html.chatserver.client; -import net.java.html.json.Context; import static org.testng.Assert.*; import org.testng.annotations.Test; @@ -36,7 +35,7 @@ } @Test public void hasSendEnabled() { - ChatModel m = new ChatModel(Context.EMPTY); + ChatModel m = new ChatModel(); assertFalse(m.isSendEnabled(), "By default disabled"); m.setComment("some msg"); m.setUser("by me"); diff -r 68cecf6c3113 -r 9984b9f7d8c6 chat/model/pom.xml --- a/chat/model/pom.xml Fri Dec 20 08:24:57 2013 +0100 +++ b/chat/model/pom.xml Sun Jan 12 23:25:42 2014 +0100 @@ -17,7 +17,7 @@ - org.apidesign.html + org.netbeans.html net.java.html.json ${net.java.html.version} jar diff -r 68cecf6c3113 -r 9984b9f7d8c6 chat/model/src/test/java/org/apidesign/html/chatserver/model/MessageImplTest.java --- a/chat/model/src/test/java/org/apidesign/html/chatserver/model/MessageImplTest.java Fri Dec 20 08:24:57 2013 +0100 +++ b/chat/model/src/test/java/org/apidesign/html/chatserver/model/MessageImplTest.java Sun Jan 12 23:25:42 2014 +0100 @@ -23,7 +23,6 @@ */ package org.apidesign.html.chatserver.model; -import net.java.html.json.Context; import static org.testng.Assert.*; import org.testng.annotations.Test; @@ -34,12 +33,12 @@ public class MessageImplTest { @Test public void properlyConvertedToSeconds() { - Message msg = new Message(Context.EMPTY); + Message msg = new Message(); msg.setSince(5143); assertEquals(msg.getAt(), "5s"); } @Test public void properlyConvertedToMinutes() { - Message msg = new Message(Context.EMPTY); + Message msg = new Message(); msg.setSince(63564); assertEquals(msg.getAt(), "1min"); } diff -r 68cecf6c3113 -r 9984b9f7d8c6 chat/pom.xml --- a/chat/pom.xml Fri Dec 20 08:24:57 2013 +0100 +++ b/chat/pom.xml Sun Jan 12 23:25:42 2014 +0100 @@ -13,8 +13,8 @@ Chat Server with Jersey and Bck2Brwsr UTF-8 - 0.3 - 0.7.2 + 0.7-SNAPSHOT + 0.9-SNAPSHOT MINIMAL diff -r 68cecf6c3113 -r 9984b9f7d8c6 chat/server/pom.xml --- a/chat/server/pom.xml Fri Dec 20 08:24:57 2013 +0100 +++ b/chat/server/pom.xml Sun Jan 12 23:25:42 2014 +0100 @@ -62,7 +62,7 @@ - org.apidesign.html + org.netbeans.html net.java.html.json ${net.java.html.version} jar @@ -70,7 +70,7 @@ org.glassfish.jersey.media html-json - 2.1 + 2.6-SNAPSHOT runtime @@ -82,18 +82,18 @@ org.glassfish.jersey.connectors jersey-grizzly-connector - 2.1 + 2.4.1 org.glassfish.jersey.containers jersey-container-grizzly2-http - 2.1 + 2.6-SNAPSHOT jar org.glassfish.grizzly grizzly-http-server - 2.3.1 + 2.3.8 org.apidesign.html.demo @@ -105,7 +105,7 @@ javax.ws.rs-api javax.ws.rs jar - 2.0-rc3 + 2.0 diff -r 68cecf6c3113 -r 9984b9f7d8c6 chat/server/src/main/java/org/apidesign/bck2brwsr/demo/chatserver/impl/ChatServerResource.java --- a/chat/server/src/main/java/org/apidesign/bck2brwsr/demo/chatserver/impl/ChatServerResource.java Fri Dec 20 08:24:57 2013 +0100 +++ b/chat/server/src/main/java/org/apidesign/bck2brwsr/demo/chatserver/impl/ChatServerResource.java Sun Jan 12 23:25:42 2014 +0100 @@ -39,7 +39,6 @@ import javax.ws.rs.container.AsyncResponse; import javax.ws.rs.container.Suspended; import javax.ws.rs.core.MediaType; -import net.java.html.json.Context; import org.apidesign.html.chatserver.model.Message; import org.apidesign.html.chatserver.model.Query; @@ -51,7 +50,7 @@ private List msgs = new ArrayList<>(); { - Message welcome = new Message(Context.findDefault(Message.class)); + Message welcome = new Message(); welcome.setUser("system"); welcome.setComment("Welcome and enjoy!"); welcome.setSince(10); @@ -65,7 +64,7 @@ @QueryParam("since") @DefaultValue("0") long since, @Suspended AsyncResponse ar ) { - Query q = new Query(Context.findDefault(ChatServerResource.class)); + Query q = new Query(); for (Message m : msgs) { if (m.getSince()>= since) { q.getMessages().add(m); diff -r 68cecf6c3113 -r 9984b9f7d8c6 chess/pom.xml --- a/chess/pom.xml Fri Dec 20 08:24:57 2013 +0100 +++ b/chess/pom.xml Sun Jan 12 23:25:42 2014 +0100 @@ -2,8 +2,8 @@ 4.0.0 - demo - org.apidesign.html + demo + org.apidesign.html 1.0-SNAPSHOT @@ -34,9 +34,9 @@ UTF-8 none - 0.6 - 0.8 - 0.8 + 0.7-SNAPSHOT + 0.9-SNAPSHOT + 0.9-SNAPSHOT MINIMAL pages/index.html @@ -58,7 +58,7 @@ - org.apidesign.html.demo.chess.Main + org.netbeans.html.demo.chess.Main true lib/ @@ -76,7 +76,7 @@ ${basedir}/src/main/webapp/ - org.apidesign.html.demo.chess.Main + org.netbeans.html.demo.chess.Main @@ -115,12 +115,12 @@ - org.apidesign.html + org.netbeans.html net.java.html.json ${net.java.html.version} - org.apidesign.html + org.netbeans.html net.java.html.boot ${net.java.html.version} @@ -131,7 +131,7 @@ test - org.apidesign.html + org.netbeans.html net.java.html.sound ${net.java.html.version} jar @@ -152,19 +152,19 @@ - org.apidesign.html - ko-fx + org.netbeans.html + ko4j ${net.java.html.version} runtime - org.apidesign.html - boot-fx + org.netbeans.html + net.java.html.boot.fx ${net.java.html.version} runtime - org.apidesign.html + org.netbeans.html ko-ws-tyrus runtime ${net.java.html.version} diff -r 68cecf6c3113 -r 9984b9f7d8c6 pom.xml --- a/pom.xml Fri Dec 20 08:24:57 2013 +0100 +++ b/pom.xml Sun Jan 12 23:25:42 2014 +0100 @@ -13,11 +13,10 @@ UTF-8 - 0.7 + 0.9-SNAPSHOT COPYING - twitter chat chess spinningcube diff -r 68cecf6c3113 -r 9984b9f7d8c6 spinningcube/pom.xml --- a/spinningcube/pom.xml Fri Dec 20 08:24:57 2013 +0100 +++ b/spinningcube/pom.xml Sun Jan 12 23:25:42 2014 +0100 @@ -26,7 +26,7 @@ UTF-8 - 0.4 + 0.7-SNAPSHOT org.apidesign.demo.spinningcube.Main none @@ -91,24 +91,24 @@ - org.apidesign.html + org.netbeans.html net.java.html.json ${net.java.html.version} - org.apidesign.html + org.netbeans.html net.java.html.boot ${net.java.html.version} - org.apidesign.html - ko-fx + org.netbeans.html + ko4j ${net.java.html.version} runtime - org.apidesign.html - boot-fx + org.netbeans.html + net.java.html.boot.fx ${net.java.html.version} runtime diff -r 68cecf6c3113 -r 9984b9f7d8c6 spinningcube/src/main/java/org/apidesign/demo/spinningcube/DataModel.java --- a/spinningcube/src/main/java/org/apidesign/demo/spinningcube/DataModel.java Fri Dec 20 08:24:57 2013 +0100 +++ b/spinningcube/src/main/java/org/apidesign/demo/spinningcube/DataModel.java Sun Jan 12 23:25:42 2014 +0100 @@ -23,6 +23,8 @@ */ package org.apidesign.demo.spinningcube; +import java.util.Arrays; +import java.util.List; import net.java.html.json.ComputedProperty; import net.java.html.json.Model; import net.java.html.json.Property; @@ -35,12 +37,12 @@ @Property(name = "message", type = String.class), }) final class DataModel { - @ComputedProperty static String[] sides(String message) { + @ComputedProperty static List sides(String message) { String[] arr = new String[6]; String[] words = message == null ? new String[0] : message.split(" ", 6); for (int i = 0; i < 6; i++) { arr[i] = words.length > i ? words[i] : "!"; } - return arr; + return Arrays.asList(arr); } } diff -r 68cecf6c3113 -r 9984b9f7d8c6 twitter/nbactions.xml --- a/twitter/nbactions.xml Fri Dec 20 08:24:57 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ - - - - - run - - package - exec:java - - - - debug - - package - exec:java - - - maven - - - diff -r 68cecf6c3113 -r 9984b9f7d8c6 twitter/pom.xml --- a/twitter/pom.xml Fri Dec 20 08:24:57 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ - - - 4.0.0 - - org.apidesign.html.demo - twitter - 1.0-SNAPSHOT - jar - - org.apidesign.html - demo - 1.0-SNAPSHOT - - - KO4Java's Twttr - - Rewrite of knockout.js example to use model written in Java displayed - by HTML. - - - - UTF-8 - 0.6 - org.apidesign.html.demo.twitter.TwitterMain - - - - - java.net - Java.net - https://maven.java.net/content/repositories/releases/ - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.14.1 - - - ${brwsr} - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - - browser.rootdir - ${basedir}/src/main/webapp/ - - - ${project.mainclass} - - - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - - - true - lib/ - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.7 - - true - - - - - - - - org.testng - testng - 6.5.2 - test - - - org.apidesign.html - net.java.html.json - ${net.java.html.version} - jar - - - org.apidesign.html - net.java.html.boot - ${net.java.html.version} - jar - - - org.apidesign.html - boot-fx - ${net.java.html.version} - runtime - - - org.apidesign.html - ko-fx - ${net.java.html.version} - runtime - - - diff -r 68cecf6c3113 -r 9984b9f7d8c6 twitter/src/main/assembly/fxbrwsr.xml --- a/twitter/src/main/assembly/fxbrwsr.xml Fri Dec 20 08:24:57 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ - - - - - fxbrwsr - - zip - - ${project.build.finalName}-fxbrwsr - - - false - runtime - lib - - - - - ${project.build.directory}/${project.build.finalName}.jar - / - - - \ No newline at end of file diff -r 68cecf6c3113 -r 9984b9f7d8c6 twitter/src/main/java/org/apidesign/html/demo/twitter/TwitterClient.java --- a/twitter/src/main/java/org/apidesign/html/demo/twitter/TwitterClient.java Fri Dec 20 08:24:57 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,205 +0,0 @@ -/** - * The MIT License (MIT) - * - * Copyright (C) 2013 Jaroslav Tulach - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package org.apidesign.html.demo.twitter; - -import java.util.Arrays; -import java.util.List; -import net.java.html.json.ComputedProperty; -import net.java.html.json.Function; -import net.java.html.json.Model; -import net.java.html.json.OnPropertyChange; -import net.java.html.json.OnReceive; -import net.java.html.json.Property; - -/** Controller class for access to Twitter. - * - * @author Jaroslav Tulach - */ -@Model(className="TwitterModel", properties={ - @Property(name="savedLists", type=Tweeters.class, array = true), - @Property(name="activeTweetersName", type=String.class), - @Property(name="activeTweeters", type=String.class, array = true), - @Property(name="userNameToAdd", type=String.class), - @Property(name="currentTweets", type=Tweet.class, array = true), - @Property(name="loading", type=boolean.class) -}) -final class TwitterClient { - @Model(className = "Tweeters", properties = { - @Property(name="name", type = String.class), - @Property(name="userNames", type = String.class, array = true) - }) - static class Twttrs { - } - @Model(className = "Tweet", properties = { - @Property(name = "from_user", type = String.class), - @Property(name = "from_user_id", type = int.class), - @Property(name = "profile_image_url", type = String.class), - @Property(name = "text", type = String.class), - @Property(name = "created_at", type = String.class), - }) - static final class Twt { - @ComputedProperty static String html(String text) { - StringBuilder sb = new StringBuilder(320); - for (int pos = 0;;) { - int http = text.indexOf("http", pos); - if (http == -1) { - sb.append(text.substring(pos)); - return sb.toString(); - } - int spc = text.indexOf(' ', http); - if (spc == -1) { - spc = text.length(); - } - sb.append(text.substring(pos, http)); - String url = text.substring(http, spc); - sb.append("").append(url).append(""); - pos = spc; - } - } - - @ComputedProperty static String userUrl(String from_user) { - return "http://twitter.com/" + from_user; - } - } - @Model(className = "TwitterQuery", properties = { - @Property(array = true, name = "results", type = Twt.class) - }) - public static final class TwttrQr { - } - - @OnReceive(url="{root}/search.json?{query}&callback={me}", jsonp="me") - static void queryTweets(TwitterModel page, TwitterQuery q) { - page.getCurrentTweets().clear(); - page.getCurrentTweets().addAll(q.getResults()); - page.setLoading(false); - } - - @OnPropertyChange("activeTweetersName") - static void changeTweetersList(TwitterModel model) { - Tweeters people = findByName(model.getSavedLists(), model.getActiveTweetersName()); - model.getActiveTweeters().clear(); - model.getActiveTweeters().addAll(people.getUserNames()); - } - - @OnPropertyChange({ "activeTweeters", "activeTweetersCount" }) - static void refreshTweets(TwitterModel model) { - StringBuilder sb = new StringBuilder(); - sb.append("rpp=25&q="); - String sep = ""; - for (String p : model.getActiveTweeters()) { - sb.append(sep); - sb.append("from:"); - sb.append(p); - sep = " OR "; - } - model.setLoading(true); - model.queryTweets("http://search.twitter.com", sb.toString()); - } - - static void init() { - final TwitterModel model = new TwitterModel(); - final List svdLst = model.getSavedLists(); - svdLst.add(newTweeters("API Design", "JaroslavTulach")); - svdLst.add(newTweeters("Celebrities", "JohnCleese", "MCHammer", "StephenFry", "algore", "StevenSanderson")); - svdLst.add(newTweeters("Microsoft people", "BillGates", "shanselman", "ScottGu")); - svdLst.add(newTweeters("NetBeans", "GeertjanW","monacotoni", "NetBeans", "petrjiricka")); - svdLst.add(newTweeters("Tech pundits", "Scobleizer", "LeoLaporte", "techcrunch", "BoingBoing", "timoreilly", "codinghorror")); - - model.setActiveTweetersName("NetBeans"); - - model.applyBindings(); - } - - @ComputedProperty - static boolean hasUnsavedChanges(List activeTweeters, List savedLists, String activeTweetersName) { - Tweeters tw = findByName(savedLists, activeTweetersName); - if (activeTweeters == null) { - return false; - } - return !tw.getUserNames().equals(activeTweeters); - } - - @ComputedProperty - static int activeTweetersCount(List activeTweeters) { - return activeTweeters.size(); - } - - @ComputedProperty - static boolean userNameToAddIsValid( - String userNameToAdd, String activeTweetersName, List savedLists, List activeTweeters - ) { - return userNameToAdd != null && - userNameToAdd.matches("[a-zA-Z0-9_]{1,15}") && - !activeTweeters.contains(userNameToAdd); - } - - @Function - static void deleteList(TwitterModel model) { - final List sl = model.getSavedLists(); - sl.remove(findByName(sl, model.getActiveTweetersName())); - if (sl.isEmpty()) { - final Tweeters t = new Tweeters(); - t.setName("New"); - sl.add(t); - } - model.setActiveTweetersName(sl.get(0).getName()); - } - - @Function - static void saveChanges(TwitterModel model) { - Tweeters t = findByName(model.getSavedLists(), model.getActiveTweetersName()); - int indx = model.getSavedLists().indexOf(t); - if (indx != -1) { - t.setName(model.getActiveTweetersName()); - t.getUserNames().clear(); - t.getUserNames().addAll(model.getActiveTweeters()); - } - } - - @Function - static void addUser(TwitterModel model) { - String n = model.getUserNameToAdd(); - model.getActiveTweeters().add(n); - } - @Function - static void removeUser(String data, TwitterModel model) { - model.getActiveTweeters().remove(data); - } - - private static Tweeters findByName(List list, String name) { - for (Tweeters l : list) { - if (l.getName() != null && l.getName().equals(name)) { - return l; - } - } - return list.isEmpty() ? new Tweeters() : list.get(0); - } - - private static Tweeters newTweeters(String listName, String... userNames) { - Tweeters t = new Tweeters(); - t.setName(listName); - t.getUserNames().addAll(Arrays.asList(userNames)); - return t; - } -} diff -r 68cecf6c3113 -r 9984b9f7d8c6 twitter/src/main/java/org/apidesign/html/demo/twitter/TwitterMain.java --- a/twitter/src/main/java/org/apidesign/html/demo/twitter/TwitterMain.java Fri Dec 20 08:24:57 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/** - * The MIT License (MIT) - * - * Copyright (C) 2013 Jaroslav Tulach - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package org.apidesign.html.demo.twitter; - -import net.java.html.boot.BrowserBuilder; - -/** Boots browser and then performs initialization when the HTML page - * is ready. - * - * @author Jaroslav Tulach - */ -public class TwitterMain { - private TwitterMain() { - } - - public static void main(String... args) { - BrowserBuilder.newBrowser().loadPage("pages/index.html") - .invoke("onPageLoad", args).loadClass(TwitterMain.class) - .showAndWait(); - System.exit(0); - } - - public static void onPageLoad(String... args) { - TwitterClient.init(); - } -} diff -r 68cecf6c3113 -r 9984b9f7d8c6 twitter/src/main/webapp/pages/index.html --- a/twitter/src/main/webapp/pages/index.html Fri Dec 20 08:24:57 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ - - - - - - - - - Html and Java Twitter - - - - - - - -

Bck2Brwsr's Twitter

- -

- This code is based on original knockout.js Twitter example and - uses almost unmodified HTML page. It just changes the model. It - is written in Java language and it is executed using the HotSpot - virtual machine. The Java source code has about 190 lines and is available - here - - in fact it may even be more dense than the original JavaScript model. -

- -
-
-
- - - -
- -

Currently viewing user(s):

-
-
    -
  • - -
    -
  • -
-
- -
- - - -
-
-
-
Loading...
- - - - - -
- - -
-
-
-
- - diff -r 68cecf6c3113 -r 9984b9f7d8c6 twitter/src/main/webapp/pages/twitterExample.css --- a/twitter/src/main/webapp/pages/twitterExample.css Fri Dec 20 08:24:57 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/** - * The MIT License (MIT) - * - * Copyright (C) 2013 Jaroslav Tulach - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - - -/* - Copied from knockout.js Twitter example: - http://knockoutjs.com/examples/twitter.html -*/ - -.configuration, .tweets, .tweets td { font-family: Verdana; font-size: 13px; } -.configuration { background-color: #DEDEDE; border: 2px solid gray; float:left; height: 40em; width: 40%; padding: 0.5em; border-right-width:0; } -.tweets { width: 55%; border: 2px solid gray; height: 40em; overflow: scroll; overflow-x: hidden; background-color: Black; color: White; padding: 0.5em; position: relative; } -.tweets table { border-width: 0;} -.tweets tr { vertical-align: top; } -.tweets td { padding: 0.4em 0.3em 1em 0.4em; border-width: 0; } -.tweets img { width: 4em; } -.tweetInfo { color: Gray; font-size: 0.9em; } -.twitterUser { color: #77AAFF; text-decoration: none; font-size: 1.1em; font-weight: bold; } -input.invalid { border: 1px solid red !important; background-color: #FFAAAA !important; } - -.listChooser select, .listChooser button { vertical-align:top; } -.listChooser select { width: 60%; font-size:1.2em; height:1.4em; } -.listChooser button { width: 19%; height:1.68em; float:right; } - -.currentUsers { height: 28em; overflow-y: auto; overflow-x: hidden; } -.currentUsers button { float: right; height: 2.5em; margin: 0.1em; padding-left: 1em; padding-right: 1em; } -.currentUsers ul, .configuration li { list-style: none; margin: 0; padding: 0 } -.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; } -.currentUsers li div { padding: 0.6em; } -.currentUsers li:hover { background-color: #EEC; } - -.configuration form label { width: 25%; display: inline-block; text-align:right; overflow: hidden; } -.configuration form input { width:40%; font-size: 1.3em; border:1px solid silver; background-color: White; padding: 0.1em; } -.configuration form button { width: 20%; margin-left: 0.3em; height: 2em; } - -.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; } diff -r 68cecf6c3113 -r 9984b9f7d8c6 twitter/src/test/java/org/apidesign/html/demo/twitter/TwitterClientTest.java --- a/twitter/src/test/java/org/apidesign/html/demo/twitter/TwitterClientTest.java Fri Dec 20 08:24:57 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/** - * The MIT License (MIT) - * - * Copyright (C) 2013 Jaroslav Tulach - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package org.apidesign.html.demo.twitter; - -import java.util.List; -import static org.testng.Assert.*; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** We can unit test the TwitterModel smoothly. - * - * @author Jaroslav Tulach - */ -public class TwitterClientTest { - private TwitterModel model; - - - @BeforeMethod - public void initModel() { - model = new TwitterModel(); - } - - @Test public void testIsValidToAdd() { - model.setUserNameToAdd("Joe"); - Tweeters t = new Tweeters(); - t.setName("test"); - model.getSavedLists().add(t); - model.setActiveTweetersName("test"); - - assertTrue(model.isUserNameToAddIsValid(), "Joe is OK"); - TwitterClient.addUser(model); - assertFalse(model.isUserNameToAddIsValid(), "Can't add Joe for the 2nd time"); - assertEquals(t.getUserNames().size(), 0, "Original tweeters list remains empty"); - - List mod = model.getActiveTweeters(); - assertTrue(model.isHasUnsavedChanges(), "We have modifications"); - assertEquals(mod.size(), 1, "One element in the list"); - assertEquals(mod.get(0), "Joe", "Its name is Joe"); - - assertSame(model.getActiveTweeters(), mod, "Editing list is the modified one"); - - TwitterClient.saveChanges(model); - assertFalse(model.isHasUnsavedChanges(), "Does not have anything to save"); - - assertSame(model.getActiveTweeters(), mod, "Still editing the old modified one"); - } - - @Test public void httpAtTheEnd() { - String res = TwitterClient.Twt.html("Ahoj http://kuk"); - assertEquals(res, "Ahoj http://kuk"); - } -} diff -r 68cecf6c3113 -r 9984b9f7d8c6 words/pom.xml --- a/words/pom.xml Fri Dec 20 08:24:57 2013 +0100 +++ b/words/pom.xml Sun Jan 12 23:25:42 2014 +0100 @@ -26,7 +26,7 @@ UTF-8 - 0.6 + 0.7-SNAPSHOT org.apidesign.demo.words.Main none @@ -91,24 +91,24 @@ - org.apidesign.html + org.netbeans.html net.java.html.json ${net.java.html.version} - org.apidesign.html + org.netbeans.html net.java.html.boot ${net.java.html.version} - org.apidesign.html - ko-fx + org.netbeans.html + ko4j ${net.java.html.version} runtime - org.apidesign.html - boot-fx + org.netbeans.html + net.java.html.boot.fx ${net.java.html.version} runtime