diff -r 80e39583b35d -r d3cbe257c4e9 ko/archetype/src/main/resources/archetype-resources/src/main/java/DataModel.java --- a/ko/archetype/src/main/resources/archetype-resources/src/main/java/DataModel.java Mon Jun 09 09:38:03 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -package ${package}; - -import net.java.html.json.ComputedProperty; -import net.java.html.json.Function; -import net.java.html.json.Model; -import net.java.html.json.Property; - -/** Model annotation generates class Data with - * one message property, boolean property and read only words property - */ -@Model(className = "Data", properties = { - @Property(name = "message", type = String.class), - @Property(name = "on", type = boolean.class) -}) -final class DataModel { - @ComputedProperty static java.util.List words(String message) { - String[] arr = new String[6]; - String[] words = message == null ? new String[0] : message.split(" ", 6); - for (int i = 0; i < 6; i++) { - arr[i] = words.length > i ? words[i] : "!"; - } - return java.util.Arrays.asList(arr); - } - - @Function static void turnOn(Data model) { - model.setOn(true); - } - - @Function static void turnOff(final Data model) { - confirmByUser("Really turn off?", new Runnable() { - @Override - public void run() { - model.setOn(false); - } - }); - } - - /** Shows direct interaction with JavaScript */ - @net.java.html.js.JavaScriptBody( - args = { "msg", "callback" }, - javacall = true, - body = "alert(msg); callback.@java.lang.Runnable::run()();" - ) - static native void confirmByUser(String msg, Runnable callback); -}