Guest User

Untitled

a guest
Jul 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. // JDK7 closure-esimerkki, kuvitellaan että kyseessä komponenttipohjainen web framework
  2. // (eli oikeasti Wicket closureina)
  3.  
  4. // määrittelyt
  5. #model() = {
  6. #object() = { "Hello closure world!"; }
  7. }
  8.  
  9. #onClickAlert() = {
  10. #ajax() {
  11. #onclick() {
  12. alert("Closure-controlled Ajax click!");
  13. }
  14. }
  15. }
  16.  
  17. #classModifier() = {
  18. #markup() {
  19. #attributes() {
  20. { return "class" : "decoratedSpan" }
  21. }
  22. }
  23. }
  24.  
  25. // itse komponentti
  26. Component label = new Component("id",
  27. #model,
  28. #behaviors() { return [onClickAlert, classModifier] }
  29. );
Add Comment
Please, Sign In to add comment