Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // JDK7 closure-esimerkki, kuvitellaan että kyseessä komponenttipohjainen web framework
- // (eli oikeasti Wicket closureina)
- // määrittelyt
- #model() = {
- #object() = { "Hello closure world!"; }
- }
- #onClickAlert() = {
- #ajax() {
- #onclick() {
- alert("Closure-controlled Ajax click!");
- }
- }
- }
- #classModifier() = {
- #markup() {
- #attributes() {
- { return "class" : "decoratedSpan" }
- }
- }
- }
- // itse komponentti
- Component label = new Component("id",
- #model,
- #behaviors() { return [onClickAlert, classModifier] }
- );
Add Comment
Please, Sign In to add comment