mojo/src/main/resources/archetype-resources/src/main/java/App.java
branchmodel
changeset 528 08cd5a0c967e
parent 437 d7ec46950980
child 533 715a6c77b19e
     1.1 --- a/mojo/src/main/resources/archetype-resources/src/main/java/App.java	Sun Jan 13 06:59:05 2013 +0100
     1.2 +++ b/mojo/src/main/resources/archetype-resources/src/main/java/App.java	Tue Jan 22 09:19:47 2013 +0100
     1.3 @@ -3,15 +3,29 @@
     1.4  import org.apidesign.bck2brwsr.htmlpage.api.*;
     1.5  import static org.apidesign.bck2brwsr.htmlpage.api.OnEvent.*;
     1.6  import org.apidesign.bck2brwsr.htmlpage.api.Page;
     1.7 +import org.apidesign.bck2brwsr.htmlpage.api.Property;
     1.8 +import org.apidesign.bck2brwsr.htmlpage.api.ComputedProperty;
     1.9  
    1.10  /** Edit the index.xhtml file. Use 'id' to name certain HTML elements.
    1.11   * Use this class to define behavior of the elements.
    1.12   */
    1.13 -@Page(xhtml="index.xhtml", className="Index")
    1.14 +@Page(xhtml="index.xhtml", className="Index", properties={
    1.15 +    @Property(name="name", type=String.class)
    1.16 +})
    1.17  public class App {
    1.18 +    static {
    1.19 +        Index model = new Index();
    1.20 +        model.setName("World");
    1.21 +        model.applyBindings();
    1.22 +    }
    1.23 +    
    1.24      @On(event = CLICK, id="hello")
    1.25 -    static void hello() {
    1.26 -        Index.HELLO.setDisabled(true);
    1.27 -        Element.alert("Hello World!");
    1.28 +    static void hello(Index m) {
    1.29 +        Element.alert(m.getHelloMessage());
    1.30 +    }
    1.31 +    
    1.32 +    @ComputedProperty
    1.33 +    static String helloMessage(String name) {
    1.34 +        return "Hello " + name + "!";
    1.35      }
    1.36  }