1.1 --- a/boot-fx/src/main/java/org/apidesign/html/boot/fx/FXPresenter.java Sun Sep 08 15:14:36 2013 +0200
1.2 +++ b/boot-fx/src/main/java/org/apidesign/html/boot/fx/FXPresenter.java Wed Sep 11 14:49:49 2013 +0200
1.3 @@ -66,6 +66,8 @@
1.4 */
1.5 @ServiceProvider(service = Fn.Presenter.class)
1.6 public final class FXPresenter implements Fn.Presenter {
1.7 + static final Logger LOG = Logger.getLogger(FXBrwsr.class.getName());
1.8 +
1.9 static {
1.10 try {
1.11 try {
1.12 @@ -88,6 +90,8 @@
1.13 private List<String> scripts;
1.14 private Runnable onLoad;
1.15 private WebEngine engine;
1.16 +
1.17 + private static int cnt;
1.18
1.19 @Override
1.20 public Fn defineFn(String code, String... names) {
1.21 @@ -103,9 +107,16 @@
1.22 sb.append(code);
1.23 sb.append("};");
1.24 sb.append("})()");
1.25 +
1.26 + if (LOG.isLoggable(Level.FINE)) {
1.27 + LOG.log(Level.FINE, "defining function #{0}", ++cnt);
1.28 + LOG.fine("-----");
1.29 + LOG.fine(code);
1.30 + LOG.fine("-----");
1.31 + }
1.32
1.33 JSObject x = (JSObject) engine.executeScript(sb.toString());
1.34 - return new JSFn(x);
1.35 + return new JSFn(x, cnt);
1.36 }
1.37
1.38 @Override
1.39 @@ -161,14 +172,20 @@
1.40
1.41 private static final class JSFn extends Fn {
1.42 private final JSObject fn;
1.43 + private static int call;
1.44 + private final int id;
1.45
1.46 - public JSFn(JSObject fn) {
1.47 + public JSFn(JSObject fn, int id) {
1.48 this.fn = fn;
1.49 + this.id = id;
1.50 }
1.51
1.52 @Override
1.53 public Object invoke(Object thiz, Object... args) throws Exception {
1.54 try {
1.55 + if (LOG.isLoggable(Level.FINE)) {
1.56 + LOG.log(Level.FINE, "calling {0} function #{1}", new Object[]{++call, id});
1.57 + }
1.58 List<Object> all = new ArrayList<Object>(args.length + 1);
1.59 all.add(thiz == null ? fn : thiz);
1.60 all.addAll(Arrays.asList(args));
1.61 @@ -194,8 +211,6 @@
1.62
1.63 private BorderPane root;
1.64
1.65 - private static final Logger LOG = Logger.getLogger(FXBrwsr.class.getName());
1.66 -
1.67 public synchronized static WebView findWebView(final URL url, final FXPresenter onLoad) {
1.68 if (INSTANCE == null) {
1.69 Executors.newFixedThreadPool(1).submit(new Runnable() {