1.1 --- a/ko-bck2brwsr/pom.xml Tue Apr 30 17:27:18 2013 +0200
1.2 +++ b/ko-bck2brwsr/pom.xml Wed May 01 07:06:43 2013 +0200
1.3 @@ -22,6 +22,13 @@
1.4 <target>1.7</target>
1.5 </configuration>
1.6 </plugin>
1.7 + <plugin>
1.8 + <groupId>org.apache.maven.plugins</groupId>
1.9 + <artifactId>maven-javadoc-plugin</artifactId>
1.10 + <configuration>
1.11 + <skip>false</skip>
1.12 + </configuration>
1.13 + </plugin>
1.14 </plugins>
1.15 </build>
1.16 <dependencies>
2.1 --- a/ko-bck2brwsr/src/main/java/org/apidesign/html/ko2brwsr/BrwsrCntxt.java Tue Apr 30 17:27:18 2013 +0200
2.2 +++ b/ko-bck2brwsr/src/main/java/org/apidesign/html/ko2brwsr/BrwsrCntxt.java Wed May 01 07:06:43 2013 +0200
2.3 @@ -32,7 +32,7 @@
2.4 *
2.5 * @author Jaroslav Tulach <jtulach@netbeans.org>
2.6 */
2.7 -public final class BrwsrCntxt implements Technology<Object>, Transfer {
2.8 +final class BrwsrCntxt implements Technology<Object>, Transfer {
2.9 private BrwsrCntxt() {}
2.10
2.11 public static final Context DEFAULT;
3.1 --- a/ko-bck2brwsr/src/main/java/org/apidesign/html/ko2brwsr/BrwsrCntxtPrvdr.java Tue Apr 30 17:27:18 2013 +0200
3.2 +++ b/ko-bck2brwsr/src/main/java/org/apidesign/html/ko2brwsr/BrwsrCntxtPrvdr.java Wed May 01 07:06:43 2013 +0200
3.3 @@ -25,9 +25,15 @@
3.4 import org.apidesign.html.json.spi.ContextProvider;
3.5 import org.openide.util.lookup.ServiceProvider;
3.6
3.7 -/**
3.8 +/** This is an implementation package - just
3.9 + * include its JAR on classpath and use official {@link Context} API
3.10 + * to access the functionality.
3.11 + * <p>
3.12 + * Provides binding between models and <a href="http://bck2brwsr.apidesign.org">
3.13 + * Bck2Brwsr</a> VM.
3.14 + * Registers {@link ContextProvider}, so {@link ServiceLoader} can find it.
3.15 *
3.16 - * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
3.17 + * @author Jaroslav Tulach <jtulach@netbeans.org>
3.18 */
3.19 @ServiceProvider(service = ContextProvider.class)
3.20 public final class BrwsrCntxtPrvdr implements ContextProvider {
4.1 --- a/ko-bck2brwsr/src/main/java/org/apidesign/html/ko2brwsr/ConvertTypes.java Tue Apr 30 17:27:18 2013 +0200
4.2 +++ b/ko-bck2brwsr/src/main/java/org/apidesign/html/ko2brwsr/ConvertTypes.java Wed May 01 07:06:43 2013 +0200
4.3 @@ -26,7 +26,7 @@
4.4 *
4.5 * @author Jaroslav Tulach <jtulach@netbeans.org>
4.6 */
4.7 -public final class ConvertTypes {
4.8 +final class ConvertTypes {
4.9 ConvertTypes() {
4.10 }
4.11
5.1 --- a/ko-bck2brwsr/src/main/java/org/apidesign/html/ko2brwsr/KOList.java Tue Apr 30 17:27:18 2013 +0200
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,170 +0,0 @@
5.4 -/**
5.5 - * HTML via Java(tm) Language Bindings
5.6 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
5.7 - *
5.8 - * This program is free software: you can redistribute it and/or modify
5.9 - * it under the terms of the GNU General Public License as published by
5.10 - * the Free Software Foundation, version 2 of the License.
5.11 - *
5.12 - * This program is distributed in the hope that it will be useful,
5.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
5.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5.15 - * GNU General Public License for more details. apidesign.org
5.16 - * designates this particular file as subject to the
5.17 - * "Classpath" exception as provided by apidesign.org
5.18 - * in the License file that accompanied this code.
5.19 - *
5.20 - * You should have received a copy of the GNU General Public License
5.21 - * along with this program. Look for COPYING file in the top folder.
5.22 - * If not, see http://wiki.apidesign.org/wiki/GPLwithClassPathException
5.23 - */
5.24 -package org.apidesign.html.ko2brwsr;
5.25 -
5.26 -import java.util.ArrayList;
5.27 -import java.util.Collection;
5.28 -import java.util.Iterator;
5.29 -import org.apidesign.bck2brwsr.core.JavaScriptOnly;
5.30 -
5.31 -/**
5.32 - *
5.33 - * @author Jaroslav Tulach <jtulach@netbeans.org>
5.34 - */
5.35 -public final class KOList<T> extends ArrayList<T> {
5.36 - private final String name;
5.37 - private final String[] deps;
5.38 - private Knockout model;
5.39 - private Runnable onchange;
5.40 -
5.41 - public KOList(String name, String... deps) {
5.42 - this.name = name;
5.43 - this.deps = deps;
5.44 - }
5.45 -
5.46 - public void assign(Knockout model) {
5.47 - if (this.model != model) {
5.48 - this.model = model;
5.49 - notifyChange();
5.50 - }
5.51 - }
5.52 -
5.53 - public KOList<T> onChange(Runnable r) {
5.54 - if (this.onchange != null) {
5.55 - throw new IllegalStateException();
5.56 - }
5.57 - this.onchange = r;
5.58 - return this;
5.59 - }
5.60 -
5.61 - @Override
5.62 - public boolean add(T e) {
5.63 - boolean ret = super.add(e);
5.64 - notifyChange();
5.65 - return ret;
5.66 - }
5.67 -
5.68 - @Override
5.69 - public boolean addAll(Collection<? extends T> c) {
5.70 - boolean ret = super.addAll(c);
5.71 - notifyChange();
5.72 - return ret;
5.73 - }
5.74 -
5.75 - @Override
5.76 - public boolean addAll(int index, Collection<? extends T> c) {
5.77 - boolean ret = super.addAll(index, c);
5.78 - notifyChange();
5.79 - return ret;
5.80 - }
5.81 -
5.82 - @Override
5.83 - public boolean remove(Object o) {
5.84 - boolean ret = super.remove(o);
5.85 - notifyChange();
5.86 - return ret;
5.87 - }
5.88 -
5.89 - @Override
5.90 - public void clear() {
5.91 - super.clear();
5.92 - notifyChange();
5.93 - }
5.94 -
5.95 - @Override
5.96 - public boolean removeAll(Collection<?> c) {
5.97 - boolean ret = super.removeAll(c);
5.98 - notifyChange();
5.99 - return ret;
5.100 - }
5.101 -
5.102 - @Override
5.103 - public boolean retainAll(Collection<?> c) {
5.104 - boolean ret = super.retainAll(c);
5.105 - notifyChange();
5.106 - return ret;
5.107 - }
5.108 -
5.109 - @Override
5.110 - public T set(int index, T element) {
5.111 - T ret = super.set(index, element);
5.112 - notifyChange();
5.113 - return ret;
5.114 - }
5.115 -
5.116 - @Override
5.117 - public void add(int index, T element) {
5.118 - super.add(index, element);
5.119 - notifyChange();
5.120 - }
5.121 -
5.122 - @Override
5.123 - public T remove(int index) {
5.124 - T ret = super.remove(index);
5.125 - notifyChange();
5.126 - return ret;
5.127 - }
5.128 -
5.129 - @Override
5.130 - public String toString() {
5.131 - Iterator<T> it = iterator();
5.132 - if (!it.hasNext()) {
5.133 - return "[]";
5.134 - }
5.135 - String sep = "";
5.136 - StringBuilder sb = new StringBuilder();
5.137 - sb.append('[');
5.138 - while (it.hasNext()) {
5.139 - T t = it.next();
5.140 - sb.append(sep);
5.141 - sb.append(ConvertTypes.toJSON(t));
5.142 - sep = ",";
5.143 - }
5.144 - sb.append(']');
5.145 - return sb.toString();
5.146 - }
5.147 -
5.148 -
5.149 - @JavaScriptOnly(name = "koArray", value = "function() { return this.toArray___3Ljava_lang_Object_2(); }")
5.150 - private static native int koArray();
5.151 -
5.152 - private void notifyChange() {
5.153 - Knockout m = model;
5.154 - if (m != null) {
5.155 - m.valueHasMutated(name);
5.156 - for (String dependant : deps) {
5.157 - m.valueHasMutated(dependant);
5.158 - }
5.159 - }
5.160 - Runnable r = onchange;
5.161 - if (r != null) {
5.162 - r.run();
5.163 - }
5.164 - }
5.165 -
5.166 - @Override
5.167 - public KOList clone() {
5.168 - KOList ko = (KOList)super.clone();
5.169 - ko.model = null;
5.170 - return ko;
5.171 - }
5.172 -
5.173 -}
6.1 --- a/ko-bck2brwsr/src/main/java/org/apidesign/html/ko2brwsr/Knockout.java Tue Apr 30 17:27:18 2013 +0200
6.2 +++ b/ko-bck2brwsr/src/main/java/org/apidesign/html/ko2brwsr/Knockout.java Wed May 01 07:06:43 2013 +0200
6.3 @@ -25,12 +25,12 @@
6.4 import org.apidesign.bck2brwsr.core.ExtraJavaScript;
6.5 import org.apidesign.bck2brwsr.core.JavaScriptBody;
6.6
6.7 -/** Provides binding between models and
6.8 +/** Provides binding between models and bck2brwsr VM.
6.9 *
6.10 * @author Jaroslav Tulach <jtulach@netbeans.org>
6.11 */
6.12 @ExtraJavaScript(resource = "/org/apidesign/bck2brwsr/htmlpage/knockout-2.2.1.js")
6.13 -public class Knockout {
6.14 +final class Knockout {
6.15 /** used by tests */
6.16 static Knockout next;
6.17 private final Object model;