Skip to content

Instantly share code, notes, and snippets.

@jtulach
jtulach / BiggestDivisor.java
Last active November 12, 2017 12:32
Greatest Divisor of two numbers
package dew.demo.namesmodel;
import net.java.html.json.Model;
import net.java.html.json.Property;
import net.java.html.json.ComputedProperty;
@Model(targetId="", className="GreatDiv", properties={
@Property(name = "a", type=int.class),
@Property(name = "b", type=int.class)
})
@jtulach
jtulach / Matrix.java
Last active September 4, 2017 18:31
Compute function matrix
package dew.demo.quiz;
import net.java.html.json.*;
@Model(className="UI", properties={
@Property(name="all", type=boolean.class),
@Property(name="results", type=Task.class, array=true)
})
class UICntrl {
static {
UI ui = new UI(true);
@jtulach
jtulach / HelloViaKO.java
Created December 15, 2015 21:59 — forked from javatlacati/HelloViaKO.java
Hello World via Knockout4Java weird bug
package dew.demo.namesmodel;
import net.java.html.json.Model;
import net.java.html.json.Property;
import net.java.html.json.Function;
@Model(className="Names", properties={
@Property(name = "selectedName", type=String.class),
@Property(name = "names", type=String.class, array = true)
})
@jtulach
jtulach / ClockCntrl.java
Last active August 29, 2015 14:09 — forked from rosvit/Todo.java
Renders analog clock
package dew.demo.time;
import java.util.ArrayList;
import java.util.List;
import net.java.html.json.ComputedProperty;
import net.java.html.json.Model;
import net.java.html.json.ModelOperation;
import net.java.html.json.Property;
@Model(className = "ClockModel", properties = {
@jtulach
jtulach / Todo.java
Last active November 5, 2017 05:50 — forked from rosvit/Todo.java
ToDo Example with HTML/Java API
package dew.demo.todos;
import net.java.html.json.*;
import java.util.List;
import java.util.ArrayList;
@Model(className="TodoUI", properties={
@Property(name="todos", type=Todo.class, array=true),
@Property(name="todoText", type=String.class)
})
@jtulach
jtulach / NamesModel.java
Last active October 24, 2015 18:56
Shows usage of @function callback
package dew.demo.namesmodel;
import net.java.html.json.Model;
import net.java.html.json.Property;
import net.java.html.json.Function;
@Model(className="Names", properties={
@Property(name = "selectedName", type=String.class),
@Property(name = "names", type=String.class, array = true)
})
@jtulach
jtulach / Prime.java
Created November 19, 2013 13:45
Is it a prime?
package dew.demo.prime;
import net.java.html.json.Model;
import net.java.html.json.ComputedProperty;
import net.java.html.json.Property;
@Model(className="PrimeUI", properties={
@Property(name="number", type=int.class),
})
class PrimeDemo {
@jtulach
jtulach / Data.java
Created November 17, 2013 08:28
Histogram in Java and HTML+CSS
package dew.demo.histogram;
import java.util.ArrayList;
import java.util.List;
import net.java.html.json.ComputedProperty;
import net.java.html.json.Model;
import net.java.html.json.Property;
/** Model annotation generates class Data with
* one property for list of of numbers and read-only property
@jtulach
jtulach / Factorial.java
Last active November 12, 2017 12:29
Compute Factorial in a Web Page
package dew.demo.factorial;
import java.math.BigInteger;
import net.java.html.json.*;
@Model(targetId="", className="UI", properties={
/** n is the number we want to compute factorial
* when the Compute! button is pressed
*/
@Property(name="n", type=int.class),
@jtulach
jtulach / MulDivPlusMinus.java
Created November 1, 2013 09:37
Math for Kids
package dew.demo.muldiv;
import java.util.Random;
import net.java.html.json.ComputedProperty;
import net.java.html.json.Function;
import net.java.html.json.Model;
import net.java.html.json.Property;
/** Represents a computational quiz.
*/