# HG changeset patch # User Jaroslav Tulach # Date 1366976916 -7200 # Node ID ad9a37489365ba12f9ba1300d941c6169b459358 # Parent e62239aa85338597317b20e86b6b65145e3df4f2 Deprecating the javaquery.api's knockout annotation in favour of net.java.html.json ones. Providing default context for the browser. diff -r e62239aa8533 -r ad9a37489365 javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/BrwsrCntxtPrvdr.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/BrwsrCntxtPrvdr.java Fri Apr 26 13:48:36 2013 +0200 @@ -0,0 +1,34 @@ +/** + * Back 2 Browser Bytecode Translator + * Copyright (C) 2012 Jaroslav Tulach + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. Look for COPYING file in the top folder. + * If not, see http://opensource.org/licenses/GPL-2.0. + */ +package org.apidesign.bck2brwsr.htmlpage; + +import net.java.html.json.Context; +import org.apidesign.html.json.spi.ContextProvider; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author Jaroslav Tulach + */ +@ServiceProvider(service = ContextProvider.class) +public final class BrwsrCntxtPrvdr implements ContextProvider { + @Override + public Context findContext(Class requestor) { + return BrwsrCntxt.DEFAULT; + } +} diff -r e62239aa8533 -r ad9a37489365 javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/ComputedProperty.java --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/ComputedProperty.java Fri Apr 26 11:42:32 2013 +0200 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/ComputedProperty.java Fri Apr 26 13:48:36 2013 +0200 @@ -22,16 +22,11 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -/** Can be used in classes annotated with {@link Page} annotation to - * define a derived property. Value of derived property is based on values - * of {@link Property} as enumerated by {@link Page#properties()}. - *

- * The name of the derived property is the name of the method. The arguments - * of the method define the property names (from {@link Page#properties()} list) - * the value of property depends on. - * +/** + * @deprecated Replaced by new {@link net.java.html.json.ComputedProperty net.java.html.json} API. * @author Jaroslav Tulach */ +@Deprecated @Retention(RetentionPolicy.SOURCE) @Target(ElementType.METHOD) public @interface ComputedProperty { diff -r e62239aa8533 -r ad9a37489365 javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Model.java --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Model.java Fri Apr 26 11:42:32 2013 +0200 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Model.java Fri Apr 26 13:48:36 2013 +0200 @@ -22,19 +22,13 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -/** Defines a model class named {@link #className()} which contains - * defined {@link #properties()}. This class can have methods - * annotated by {@link ComputedProperty} which define derived - * properties in the model class. - *

- * The {@link #className() generated class}'s toString - * converts the state of the object into - * JSON format. - * +/** + * @deprecated Replaced by new {@link net.java.html.json.Model net.java.html.json} API. * @author Jaroslav Tulach */ @Retention(RetentionPolicy.SOURCE) @Target(ElementType.TYPE) +@Deprecated public @interface Model { /** Name of the model class */ String className(); diff -r e62239aa8533 -r ad9a37489365 javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnFunction.java --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnFunction.java Fri Apr 26 11:42:32 2013 +0200 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnFunction.java Fri Apr 26 13:48:36 2013 +0200 @@ -22,13 +22,12 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -/** Methods in class annotated by {@link Model} or {@link Page} can be - * annotated by this annotation to signal that they should be available - * as functions to users of the model classes. - * +/** + * @deprecated Replaced by new {@link net.java.html.json.Function net.java.html.json} API. * @author Jaroslav Tulach */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.SOURCE) +@Deprecated public @interface OnFunction { } diff -r e62239aa8533 -r ad9a37489365 javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnPropertyChange.java --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnPropertyChange.java Fri Apr 26 11:42:32 2013 +0200 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnPropertyChange.java Fri Apr 26 13:48:36 2013 +0200 @@ -22,13 +22,13 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -/** Represents a property. Either in a generated model of an HTML - * {@link Page} or in a class defined by {@link Model}. - * +/** + * @deprecated Replaced by new {@link net.java.html.json.OnPropertyChange net.java.html.json} API. * @author Jaroslav Tulach */ @Retention(RetentionPolicy.SOURCE) @Target(ElementType.METHOD) +@Deprecated public @interface OnPropertyChange { /** Name(s) of the properties. One wishes to observe. * diff -r e62239aa8533 -r ad9a37489365 javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnReceive.java --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnReceive.java Fri Apr 26 11:42:32 2013 +0200 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/OnReceive.java Fri Apr 26 13:48:36 2013 +0200 @@ -22,54 +22,14 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -/** Static methods in classes annotated by {@link Page} - * can be marked by this annotation to establish a - * JSON - * communication point. - * The associated model page then gets new method to invoke a network - * connection. Example follows: - * - *

- * {@link Page @Page}(className="MyModel", xhtml="page.html", properties={
- *   {@link Property @Property}(name = "people", type=Person.class, array=true)
- * })
- * class MyModelImpl {
- *   {@link Model @Model}(className="Person", properties={
- *     {@link Property @Property}(name = "firstName", type=String.class),
- *     {@link Property @Property}(name = "lastName", type=String.class)
- *   })
- *   static class PersonImpl {
- *     {@link ComputedProperty @ComputedProperty}
- *     static String fullName(String firstName, String lastName) {
- *       return firstName + " " + lastName;
- *     }
- *   }
- * 
- *   {@link OnReceive @OnReceive}(url = "{protocol}://your.server.com/person/{name}")
- *   static void getANewPerson(MyModel m, Person p) {
- *     {@link Element#alert Element.alert}("Adding " + p.getFullName() + '!');
- *     m.getPeople().add(p);
- *   }
- * 
- *   // the above will generate method getANewPerson in class MyModel.
- *   // with protocol and name arguments
- *   // which asynchronously contacts the server and in case of success calls
- *   // your {@link OnReceive @OnReceive} with parsed in data
- * 
- *   {@link On @On}(event={@link OnEvent#CLICK OnEvent.CLICK}, id="rqst")
- *   static void requestSmith(MyModel m) {
- *     m.getANewPerson("http", "Smith");
- *   }
- * }
- * 
- * When the server returns { "firstName" : "John", "lastName" : "Smith" } - * the browser will show alert message Adding John Smith!. - * +/** + * @deprecated Replaced by new {@link net.java.html.json.OnReceive net.java.html.json} API. * @author Jaroslav Tulach * @since 0.6 */ @Retention(RetentionPolicy.SOURCE) @Target(ElementType.METHOD) +@Deprecated public @interface OnReceive { /** The URL to connect to. Can contain variable names surrounded by '{' and '}'. * Those parameters will then become variables of the associated method. diff -r e62239aa8533 -r ad9a37489365 javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Property.java --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Property.java Fri Apr 26 11:42:32 2013 +0200 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Property.java Fri Apr 26 13:48:36 2013 +0200 @@ -22,13 +22,13 @@ import java.lang.annotation.Target; import java.util.List; -/** Represents a property. Either in a generated model of an HTML - * {@link Page} or in a class defined by {@link Model}. - * +/** + * @deprecated Replaced by new {@link net.java.html.json.Property net.java.html.json} API. * @author Jaroslav Tulach */ @Retention(RetentionPolicy.SOURCE) @Target({}) +@Deprecated public @interface Property { /** Name of the property. Will be used to define proper getter and setter * in the associated class.