Guest User

Untitled

a guest
Jan 23rd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. package com.google.gwt.sample.jribble.client;
  2.  
  3. import com.google.gwt.core.client.EntryPoint;
  4. import com.google.gwt.event.dom.client.ClickEvent;
  5. import com.google.gwt.event.dom.client.ClickHandler;
  6. import com.google.gwt.user.client.ui.Button;
  7. import com.google.gwt.user.client.Window;
  8. import com.google.gwt.user.client.ui.RootPanel;
  9.  
  10. class Hello extends EntryPoint {
  11.  
  12. def onModuleLoad() {
  13. val numbers = List(1, 2, 3, 4)
  14. val strings = numbers map (_.toString + "...")
  15. val a = foo(1)
  16. val s = a.toList.toString
  17. val b = new Button("Click me", (_: ClickEvent) => Window.alert("Hello, AJAX, said Scala\nThose numbers are coming from list!\n" + s));
  18. RootPanel.get().add(b);
  19. }
  20.  
  21. def foo[T: ClassManifest](x: T): Array[Array[T]] = foo2(Array.tabulate(2)(_ => x))
  22.  
  23. def foo2[T: ClassManifest](x: T): Array[T] = Array.tabulate(2)(_ => x)
  24.  
  25. implicit def clickHandler(f: ClickEvent => Unit): ClickHandler = new ClickHandler {
  26. def onClick(event: ClickEvent) = f(event)
  27. }
  28. }
Add Comment
Please, Sign In to add comment