# HG changeset patch # User Jaroslav Tulach # Date 1363967987 -3600 # Node ID 3392f250c78450c461baa282d066c2784aaf2903 # Parent 4f02c384b13d54fc7d867b1b4b6c83ac65f41d2d Modifying the calculator example to work with array of objects diff -r 4f02c384b13d -r 3392f250c784 javaquery/demo-calculator/src/main/java/org/apidesign/bck2brwsr/demo/calc/staticcompilation/Calc.java --- a/javaquery/demo-calculator/src/main/java/org/apidesign/bck2brwsr/demo/calc/staticcompilation/Calc.java Fri Mar 22 16:43:51 2013 +0100 +++ b/javaquery/demo-calculator/src/main/java/org/apidesign/bck2brwsr/demo/calc/staticcompilation/Calc.java Fri Mar 22 16:59:47 2013 +0100 @@ -33,7 +33,8 @@ @Property(name = "memory", type = double.class), @Property(name = "display", type = double.class), @Property(name = "operation", type = String.class), - @Property(name = "hover", type = boolean.class) + @Property(name = "hover", type = boolean.class), + @Property(name = "history", type = double.class, array = true) }) public class Calc { static { @@ -65,11 +66,13 @@ @On(event = CLICK, id="result") static void computeTheValue(Calculator c) { - c.setDisplay(compute( + final double newValue = compute( c.getOperation(), c.getMemory(), c.getDisplay() - )); + ); + c.setDisplay(newValue); + c.getHistory().add(newValue); c.setMemory(0); } diff -r 4f02c384b13d -r 3392f250c784 javaquery/demo-calculator/src/main/resources/org/apidesign/bck2brwsr/demo/calc/staticcompilation/Calculator.xhtml --- a/javaquery/demo-calculator/src/main/resources/org/apidesign/bck2brwsr/demo/calc/staticcompilation/Calculator.xhtml Fri Mar 22 16:43:51 2013 +0100 +++ b/javaquery/demo-calculator/src/main/resources/org/apidesign/bck2brwsr/demo/calc/staticcompilation/Calculator.xhtml Fri Mar 22 16:59:47 2013 +0100 @@ -76,6 +76,13 @@ + +

Previous Results

+ + +