diff -r 000000000000 -r 029e6eed60e9 htmlpage/src/test/java/org/apidesign/bck2brwsr/htmlpage/PageController.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htmlpage/src/test/java/org/apidesign/bck2brwsr/htmlpage/PageController.java Thu Oct 11 06:15:22 2012 -0700 @@ -0,0 +1,32 @@ +package org.apidesign.bck2brwsr.htmlpage; + +import org.apidesign.bck2brwsr.htmlpage.api.OnClick; +import org.apidesign.bck2brwsr.htmlpage.api.Page; + +/** Trivial demo for the bck2brwsr project. First of all start + * with your XHTML page. Include there + * a script that will boot Java in your browser. + *

+ * Then use @Page annotation to + * generate a Java representation of elements with IDs in that page. + * Depending on the type of the elements, they will have different + * methods (e.g. PG_TITLE has setText, etc.). + * Use @OnClick annotation to associate behavior + * with existing elements. Use the generated elements + * (PG_TITLE, PG_TEXT) to modify the page. + *

+ * Everything is type-safe. As soon as somebody modifies the page and + * removes the IDs or re-assigns them to wrong elements. Java compiler + * will emit an error. + *

+ * Welcome to the type-safe HTML5 world! + * + * @author Jaroslav Tulach + */ +@Page(xhtml="TestPage.html", name="TestPage") +public class PageController { + @OnClick(id="pg.button") + static void updateTitle() { + TestPage.PG_TITLE.setText(TestPage.PG_TEXT.getValue()); + } +}