diff -r 341d8ed644df -r d382dacfd73f rt/mojo/src/main/resources/archetype-resources/src/main/java/App.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rt/mojo/src/main/resources/archetype-resources/src/main/java/App.java Tue Feb 26 16:54:16 2013 +0100 @@ -0,0 +1,34 @@ +package ${package}; + +import org.apidesign.bck2brwsr.htmlpage.api.*; +import static org.apidesign.bck2brwsr.htmlpage.api.OnEvent.*; +import org.apidesign.bck2brwsr.htmlpage.api.Page; +import org.apidesign.bck2brwsr.htmlpage.api.Property; +import org.apidesign.bck2brwsr.htmlpage.api.ComputedProperty; + +/** Edit the index.xhtml file. Use 'id' to name certain HTML elements. + * Use this class to define behavior of the elements. + */ +@Page(xhtml="index.html", className="Index", properties={ + @Property(name="name", type=String.class) +}) +public class App { + static { + Index model = new Index(); + model.setName("World"); + model.applyBindings(); + } + + @On(event = CLICK, id="hello") + static void hello(Index m) { + GraphicsContext g = m.CANVAS.getContext(); + g.clearRect(0, 0, 1000, 1000); + g.setFont("italic 40px Calibri"); + g.fillText(m.getHelloMessage(), 10, 40); + } + + @ComputedProperty + static String helloMessage(String name) { + return "Hello " + name + "!"; + } +}