From b55ff51e8c254c56bb415432102b878fa053d8f3 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 27 Jun 2012 16:52:09 +0300 Subject: Add @JavaScript and @StyleSheet and remove @LoadScripts (#9044) --- src/com/vaadin/annotations/JavaScript.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/com/vaadin/annotations/JavaScript.java (limited to 'src/com/vaadin/annotations/JavaScript.java') diff --git a/src/com/vaadin/annotations/JavaScript.java b/src/com/vaadin/annotations/JavaScript.java new file mode 100644 index 0000000000..8e0bc09958 --- /dev/null +++ b/src/com/vaadin/annotations/JavaScript.java @@ -0,0 +1,16 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ + +package com.vaadin.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface JavaScript { + public String[] value(); +} -- cgit v1.2.3 From 48cc0f3973579ee6c5893b27e484afc3c87692ec Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 27 Jun 2012 17:12:49 +0300 Subject: Javadocs for @StyleSheet and @JavaScript (#9044) --- src/com/vaadin/annotations/JavaScript.java | 16 ++++++++++++++++ src/com/vaadin/annotations/StyleSheet.java | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'src/com/vaadin/annotations/JavaScript.java') diff --git a/src/com/vaadin/annotations/JavaScript.java b/src/com/vaadin/annotations/JavaScript.java index 8e0bc09958..3abe7467ba 100644 --- a/src/com/vaadin/annotations/JavaScript.java +++ b/src/com/vaadin/annotations/JavaScript.java @@ -9,8 +9,24 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import com.vaadin.terminal.gwt.server.ClientConnector; + +/** + * If this annotation is present on a {@link ClientConnector} class, the + * framework ensures the referenced JavaScript files are loaded before the + * corresponding client-side connector is initialized. + * + * @author Vaadin Ltd + * @version @VERSION@ + * @since 7.0.0 + */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface JavaScript { + /** + * JavaScript files to load before initializing the client-side connector. + * + * @return an array of JavaScript file urls + */ public String[] value(); } diff --git a/src/com/vaadin/annotations/StyleSheet.java b/src/com/vaadin/annotations/StyleSheet.java index 40f75511dd..7056853ff4 100644 --- a/src/com/vaadin/annotations/StyleSheet.java +++ b/src/com/vaadin/annotations/StyleSheet.java @@ -9,8 +9,24 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import com.vaadin.terminal.gwt.server.ClientConnector; + +/** + * If this annotation is present on a {@link ClientConnector} class, the + * framework ensures the referenced style sheets are loaded before the + * corresponding client-side connector is initialized. + * + * @author Vaadin Ltd + * @version @VERSION@ + * @since 7.0.0 + */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface StyleSheet { + /** + * Style sheets to load before initializing the client-side connector. + * + * @return an array of style sheet urls + */ public String[] value(); } -- cgit v1.2.3 From d9822150a389d97c50d9321752b5054ade336d5b Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Thu, 28 Jun 2012 11:52:03 +0300 Subject: Define what initialization corresponds to init method in javadoc (#9044) --- src/com/vaadin/annotations/JavaScript.java | 4 ++-- src/com/vaadin/annotations/StyleSheet.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/com/vaadin/annotations/JavaScript.java') diff --git a/src/com/vaadin/annotations/JavaScript.java b/src/com/vaadin/annotations/JavaScript.java index 3abe7467ba..065c37b78d 100644 --- a/src/com/vaadin/annotations/JavaScript.java +++ b/src/com/vaadin/annotations/JavaScript.java @@ -13,8 +13,8 @@ import com.vaadin.terminal.gwt.server.ClientConnector; /** * If this annotation is present on a {@link ClientConnector} class, the - * framework ensures the referenced JavaScript files are loaded before the - * corresponding client-side connector is initialized. + * framework ensures the referenced JavaScript files are loaded before the init + * method for the corresponding client-side connector is invoked. * * @author Vaadin Ltd * @version @VERSION@ diff --git a/src/com/vaadin/annotations/StyleSheet.java b/src/com/vaadin/annotations/StyleSheet.java index 7056853ff4..f8bf635474 100644 --- a/src/com/vaadin/annotations/StyleSheet.java +++ b/src/com/vaadin/annotations/StyleSheet.java @@ -13,8 +13,8 @@ import com.vaadin.terminal.gwt.server.ClientConnector; /** * If this annotation is present on a {@link ClientConnector} class, the - * framework ensures the referenced style sheets are loaded before the - * corresponding client-side connector is initialized. + * framework ensures the referenced style sheets are loaded before the init + * method for the corresponding client-side connector is invoked. * * @author Vaadin Ltd * @version @VERSION@ -- cgit v1.2.3 From 060ba3b63cf1c46bb726a6f6f0910924fb185364 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Thu, 28 Jun 2012 18:47:01 +0300 Subject: Describe how paths are resolved in javadoc (#9048) --- src/com/vaadin/annotations/JavaScript.java | 10 ++++++++++ src/com/vaadin/annotations/StyleSheet.java | 6 ++++++ 2 files changed, 16 insertions(+) (limited to 'src/com/vaadin/annotations/JavaScript.java') diff --git a/src/com/vaadin/annotations/JavaScript.java b/src/com/vaadin/annotations/JavaScript.java index 065c37b78d..f97457c1cd 100644 --- a/src/com/vaadin/annotations/JavaScript.java +++ b/src/com/vaadin/annotations/JavaScript.java @@ -15,6 +15,16 @@ import com.vaadin.terminal.gwt.server.ClientConnector; * If this annotation is present on a {@link ClientConnector} class, the * framework ensures the referenced JavaScript files are loaded before the init * method for the corresponding client-side connector is invoked. + *

+ * Absolute URLs including protocol and host are used as is on the client-side. + * Relative urls are mapped to APP/CONNECTOR/[url] which are by default served + * from the classpath relative to the class where the annotation is defined. + *

+ * Example: {@code @JavaScript( "http://host.com/file1.js", "file2.js"})} on + * the class com.example.MyConnector would load the file + * http://host.com/file1.js as is and file2.js from /com/example/file2.js on the + * server's classpath using the ClassLoader that was used to load + * com.example.MyConnector. * * @author Vaadin Ltd * @version @VERSION@ diff --git a/src/com/vaadin/annotations/StyleSheet.java b/src/com/vaadin/annotations/StyleSheet.java index f8bf635474..d082cb8d30 100644 --- a/src/com/vaadin/annotations/StyleSheet.java +++ b/src/com/vaadin/annotations/StyleSheet.java @@ -15,6 +15,12 @@ import com.vaadin.terminal.gwt.server.ClientConnector; * If this annotation is present on a {@link ClientConnector} class, the * framework ensures the referenced style sheets are loaded before the init * method for the corresponding client-side connector is invoked. + *

+ * Example: {@code @StyleSheet( "http://host.com/file1.css", "file2.css"})} on + * the class com.example.MyConnector would load the file + * http://host.com/file1.css as is and file2.css from /com/example/file2.css on + * the server's classpath using the ClassLoader that was used to load + * com.example.MyConnector. * * @author Vaadin Ltd * @version @VERSION@ -- cgit v1.2.3