1 package org.apidesign.bck2brwsr.htmlpage;
3 import org.apidesign.bck2brwsr.htmlpage.api.OnClick;
4 import org.apidesign.bck2brwsr.htmlpage.api.Page;
6 /** Trivial demo for the bck2brwsr project. First of all start
7 * with <a href="TestPage.html">your XHTML page</a>. Include there
8 * a script that will <em>boot Java</em> in your browser.
10 * Then use <code>@Page</code> annotation to
11 * generate a Java representation of elements with IDs in that page.
12 * Depending on the type of the elements, they will have different
13 * methods (e.g. <code>PG_TITLE</code> has <code>setText</code>, etc.).
14 * Use <code>@OnClick</code> annotation to associate behavior
15 * with existing elements. Use the generated elements
16 * (<code>PG_TITLE</code>, <code>PG_TEXT</code>) to modify the page.
18 * Everything is type-safe. As soon as somebody modifies the page and
19 * removes the IDs or re-assigns them to wrong elements. Java compiler
22 * Welcome to the type-safe HTML5 world!
24 * @author Jaroslav Tulach <jtulach@netbeans.org>
26 @Page(xhtml="TestPage.html", name="TestPage")
27 public class PageController {
28 @OnClick(id="pg.button")
29 static void updateTitle() {
30 TestPage.PG_TITLE.setText(TestPage.PG_TEXT.getValue());