jaroslav@100: package org.apidesign.bck2brwsr.htmlpage; jaroslav@100: jaroslav@100: import org.apidesign.bck2brwsr.htmlpage.api.OnClick; jaroslav@100: import org.apidesign.bck2brwsr.htmlpage.api.Page; jaroslav@100: jaroslav@100: /** Trivial demo for the bck2brwsr project. First of all start jaroslav@100: * with your XHTML page. Include there jaroslav@100: * a script that will boot Java in your browser. jaroslav@100: *

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

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

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