Deprecating the javaquery.api's knockout annotation in favour of net.java.html.json ones. Providing default context for the browser. model
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 26 Apr 2013 13:48:36 +0200
branchmodel
changeset 1023ad9a37489365
parent 1021 e62239aa8533
child 1024 9af5b2f49cb0
Deprecating the javaquery.api's knockout annotation in favour of net.java.html.json ones. Providing default context for the browser.
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/BrwsrCntxtPrvdr.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/ComputedProperty.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Model.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnFunction.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnPropertyChange.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnReceive.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Property.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/BrwsrCntxtPrvdr.java	Fri Apr 26 13:48:36 2013 +0200
     1.3 @@ -0,0 +1,34 @@
     1.4 +/**
     1.5 + * Back 2 Browser Bytecode Translator
     1.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     1.7 + *
     1.8 + * This program is free software: you can redistribute it and/or modify
     1.9 + * it under the terms of the GNU General Public License as published by
    1.10 + * the Free Software Foundation, version 2 of the License.
    1.11 + *
    1.12 + * This program is distributed in the hope that it will be useful,
    1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.15 + * GNU General Public License for more details.
    1.16 + *
    1.17 + * You should have received a copy of the GNU General Public License
    1.18 + * along with this program. Look for COPYING file in the top folder.
    1.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
    1.20 + */
    1.21 +package org.apidesign.bck2brwsr.htmlpage;
    1.22 +
    1.23 +import net.java.html.json.Context;
    1.24 +import org.apidesign.html.json.spi.ContextProvider;
    1.25 +import org.openide.util.lookup.ServiceProvider;
    1.26 +
    1.27 +/**
    1.28 + *
    1.29 + * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    1.30 + */
    1.31 +@ServiceProvider(service = ContextProvider.class)
    1.32 +public final class BrwsrCntxtPrvdr implements ContextProvider {
    1.33 +    @Override
    1.34 +    public Context findContext(Class<?> requestor) {
    1.35 +        return BrwsrCntxt.DEFAULT;
    1.36 +    }
    1.37 +}
     2.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/ComputedProperty.java	Fri Apr 26 11:42:32 2013 +0200
     2.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/ComputedProperty.java	Fri Apr 26 13:48:36 2013 +0200
     2.3 @@ -22,16 +22,11 @@
     2.4  import java.lang.annotation.RetentionPolicy;
     2.5  import java.lang.annotation.Target;
     2.6  
     2.7 -/** Can be used in classes annotated with {@link Page} annotation to
     2.8 - * define a derived property. Value of derived property is based on values
     2.9 - * of {@link Property} as enumerated by {@link Page#properties()}.
    2.10 - * <p>
    2.11 - * The name of the derived property is the name of the method. The arguments
    2.12 - * of the method define the property names (from {@link Page#properties()} list)
    2.13 - * the value of property depends on. 
    2.14 - *
    2.15 +/** 
    2.16 + * @deprecated Replaced by new {@link net.java.html.json.ComputedProperty net.java.html.json} API.
    2.17   * @author Jaroslav Tulach <jtulach@netbeans.org>
    2.18   */
    2.19 +@Deprecated
    2.20  @Retention(RetentionPolicy.SOURCE)
    2.21  @Target(ElementType.METHOD)
    2.22  public @interface ComputedProperty {
     3.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Model.java	Fri Apr 26 11:42:32 2013 +0200
     3.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Model.java	Fri Apr 26 13:48:36 2013 +0200
     3.3 @@ -22,19 +22,13 @@
     3.4  import java.lang.annotation.RetentionPolicy;
     3.5  import java.lang.annotation.Target;
     3.6  
     3.7 -/** Defines a model class named {@link #className()} which contains
     3.8 - * defined {@link #properties()}. This class can have methods 
     3.9 - * annotated by {@link ComputedProperty} which define derived
    3.10 - * properties in the model class.
    3.11 - * <p>
    3.12 - * The {@link #className() generated class}'s <code>toString</code>
    3.13 - * converts the state of the object into 
    3.14 - * <a href="http://en.wikipedia.org/wiki/JSON">JSON</a> format.
    3.15 - *
    3.16 +/** 
    3.17 + * @deprecated Replaced by new {@link net.java.html.json.Model net.java.html.json} API.
    3.18   * @author Jaroslav Tulach <jtulach@netbeans.org>
    3.19   */
    3.20  @Retention(RetentionPolicy.SOURCE)
    3.21  @Target(ElementType.TYPE)
    3.22 +@Deprecated
    3.23  public @interface Model {
    3.24      /** Name of the model class */
    3.25      String className();
     4.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnFunction.java	Fri Apr 26 11:42:32 2013 +0200
     4.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnFunction.java	Fri Apr 26 13:48:36 2013 +0200
     4.3 @@ -22,13 +22,12 @@
     4.4  import java.lang.annotation.RetentionPolicy;
     4.5  import java.lang.annotation.Target;
     4.6  
     4.7 -/** Methods in class annotated by {@link Model} or {@link Page} can be 
     4.8 - * annotated by this annotation to signal that they should be available
     4.9 - * as functions to users of the model classes.
    4.10 - *
    4.11 +/** 
    4.12 + * @deprecated Replaced by new {@link net.java.html.json.Function net.java.html.json} API.
    4.13   * @author Jaroslav Tulach <jtulach@netbeans.org>
    4.14   */
    4.15  @Target(ElementType.METHOD)
    4.16  @Retention(RetentionPolicy.SOURCE)
    4.17 +@Deprecated
    4.18  public @interface OnFunction {
    4.19  }
     5.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnPropertyChange.java	Fri Apr 26 11:42:32 2013 +0200
     5.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnPropertyChange.java	Fri Apr 26 13:48:36 2013 +0200
     5.3 @@ -22,13 +22,13 @@
     5.4  import java.lang.annotation.RetentionPolicy;
     5.5  import java.lang.annotation.Target;
     5.6  
     5.7 -/** Represents a property. Either in a generated model of an HTML
     5.8 - * {@link Page} or in a class defined by {@link Model}.
     5.9 - *
    5.10 +/** 
    5.11 + * @deprecated Replaced by new {@link net.java.html.json.OnPropertyChange net.java.html.json} API.
    5.12   * @author Jaroslav Tulach <jtulach@netbeans.org>
    5.13   */
    5.14  @Retention(RetentionPolicy.SOURCE)
    5.15  @Target(ElementType.METHOD)
    5.16 +@Deprecated
    5.17  public @interface OnPropertyChange {
    5.18      /** Name(s) of the properties. One wishes to observe.
    5.19       * 
     6.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnReceive.java	Fri Apr 26 11:42:32 2013 +0200
     6.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnReceive.java	Fri Apr 26 13:48:36 2013 +0200
     6.3 @@ -22,54 +22,14 @@
     6.4  import java.lang.annotation.RetentionPolicy;
     6.5  import java.lang.annotation.Target;
     6.6  
     6.7 -/** Static methods in classes annotated by {@link Page}
     6.8 - * can be marked by this annotation to establish a 
     6.9 - * <a href="http://en.wikipedia.org/wiki/JSON">JSON</a>
    6.10 - * communication point.
    6.11 - * The associated model page then gets new method to invoke a network
    6.12 - * connection. Example follows:
    6.13 - * 
    6.14 - * <pre>
    6.15 - * {@link Page @Page}(className="MyModel", xhtml="page.html", properties={
    6.16 - *   {@link Property @Property}(name = "people", type=Person.class, array=true)
    6.17 - * })
    6.18 - * class MyModelImpl {
    6.19 - *   {@link Model @Model}(className="Person", properties={
    6.20 - *     {@link Property @Property}(name = "firstName", type=String.class),
    6.21 - *     {@link Property @Property}(name = "lastName", type=String.class)
    6.22 - *   })
    6.23 - *   static class PersonImpl {
    6.24 - *     {@link ComputedProperty @ComputedProperty}
    6.25 - *     static String fullName(String firstName, String lastName) {
    6.26 - *       return firstName + " " + lastName;
    6.27 - *     }
    6.28 - *   }
    6.29 - * 
    6.30 - *   {@link OnReceive @OnReceive}(url = "{protocol}://your.server.com/person/{name}")
    6.31 - *   static void getANewPerson(MyModel m, Person p) {
    6.32 - *     {@link Element#alert Element.alert}("Adding " + p.getFullName() + '!');
    6.33 - *     m.getPeople().add(p);
    6.34 - *   }
    6.35 - * 
    6.36 - *   // the above will generate method <code>getANewPerson</code> in class <code>MyModel</code>.
    6.37 - *   // with <code>protocol</code> and <code>name</code> arguments
    6.38 - *   // which asynchronously contacts the server and in case of success calls
    6.39 - *   // your {@link OnReceive @OnReceive} with parsed in data
    6.40 - * 
    6.41 - *   {@link On @On}(event={@link OnEvent#CLICK OnEvent.CLICK}, id="rqst")
    6.42 - *   static void requestSmith(MyModel m) {
    6.43 - *     m.getANewPerson("http", "Smith");
    6.44 - *   }
    6.45 - * }
    6.46 - * </pre>
    6.47 - * When the server returns <code>{ "firstName" : "John", "lastName" : "Smith" }</code>
    6.48 - * the browser will show alert message <em>Adding John Smith!</em>.
    6.49 - * 
    6.50 +/** 
    6.51 + * @deprecated Replaced by new {@link net.java.html.json.OnReceive net.java.html.json} API.
    6.52   * @author Jaroslav Tulach <jtulach@netbeans.org>
    6.53   * @since 0.6
    6.54   */
    6.55  @Retention(RetentionPolicy.SOURCE)
    6.56  @Target(ElementType.METHOD)
    6.57 +@Deprecated
    6.58  public @interface OnReceive {
    6.59      /** The URL to connect to. Can contain variable names surrounded by '{' and '}'.
    6.60       * Those parameters will then become variables of the associated method.
     7.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Property.java	Fri Apr 26 11:42:32 2013 +0200
     7.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Property.java	Fri Apr 26 13:48:36 2013 +0200
     7.3 @@ -22,13 +22,13 @@
     7.4  import java.lang.annotation.Target;
     7.5  import java.util.List;
     7.6  
     7.7 -/** Represents a property. Either in a generated model of an HTML
     7.8 - * {@link Page} or in a class defined by {@link Model}.
     7.9 - *
    7.10 +/** 
    7.11 + * @deprecated Replaced by new {@link net.java.html.json.Property net.java.html.json} API.
    7.12   * @author Jaroslav Tulach <jtulach@netbeans.org>
    7.13   */
    7.14  @Retention(RetentionPolicy.SOURCE)
    7.15  @Target({})
    7.16 +@Deprecated
    7.17  public @interface Property {
    7.18      /** Name of the property. Will be used to define proper getter and setter
    7.19       * in the associated class.