javaquery/demo-calculator-dynamic/src/main/java/org/apidesign/bck2brwsr/demo/calc/Calc.java
branchmodel
changeset 763 ecd7294f1e17
parent 513 35e2c701e514
child 878 ecbd252fd3a7
     1.1 --- a/javaquery/demo-calculator-dynamic/src/main/java/org/apidesign/bck2brwsr/demo/calc/Calc.java	Mon Jan 21 16:21:14 2013 +0100
     1.2 +++ b/javaquery/demo-calculator-dynamic/src/main/java/org/apidesign/bck2brwsr/demo/calc/Calc.java	Mon Feb 18 19:42:02 2013 +0100
     1.3 @@ -33,11 +33,13 @@
     1.4      @Property(name = "memory", type = double.class),
     1.5      @Property(name = "display", type = double.class),
     1.6      @Property(name = "operation", type = String.class),
     1.7 -    @Property(name = "hover", type = boolean.class)
     1.8 +    @Property(name = "hover", type = boolean.class),
     1.9 +    @Property(name = "results", type = String.class, array = true)
    1.10  })
    1.11  public class Calc {
    1.12      static {
    1.13 -        new Calculator().applyBindings();
    1.14 +        Calculator m = new Calculator();
    1.15 +        m.applyBindings();
    1.16      }
    1.17      
    1.18      @On(event = CLICK, id="clear")
    1.19 @@ -65,11 +67,13 @@
    1.20      
    1.21      @On(event = CLICK, id="result")
    1.22      static void computeTheValue(Calculator c) {
    1.23 -        c.setDisplay(compute(
    1.24 +        final double val = compute(
    1.25              c.getOperation(), 
    1.26              c.getMemory(), 
    1.27              c.getDisplay()
    1.28 -        ));
    1.29 +        );
    1.30 +        c.getResults().add("another result " + val);
    1.31 +        c.setDisplay(val);
    1.32          c.setMemory(0);
    1.33      }
    1.34