This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 270096
Collapse All | Expand All

(-)a/.gitignore (+2 lines)
Line 0 Link Here
1
*/target/
2
/target/
(-)a/.hgignore (-3 lines)
Lines 1-3 Link Here
1
.*~
2
.*\.orig$
3
.*target/.*
(-)a/.travis.yml (+13 lines)
Line 0 Link Here
1
language: java
2
before_script:
3
  - export DISPLAY=:99.0
4
  - sh -e /etc/init.d/xvfb start || echo No X11
5
  - sleep 3
6
script:
7
  - jdk_switcher use oraclejdk8 || java -version
8
  - java -version
9
  - mvn install -DskipTests
10
  - mvn verify
11
os:
12
  - linux
13
(-)a/boot-agent-test/pom.xml (-1 / +1 lines)
Lines 48-54 Link Here
48
    <parent>
48
    <parent>
49
        <groupId>org.netbeans.html</groupId>
49
        <groupId>org.netbeans.html</groupId>
50
        <artifactId>pom</artifactId>
50
        <artifactId>pom</artifactId>
51
        <version>2.0-SNAPSHOT</version>
51
        <version>1.4</version>
52
    </parent>
52
    </parent>
53
    <artifactId>boot-agent-test</artifactId>
53
    <artifactId>boot-agent-test</artifactId>
54
    <packaging>jar</packaging>
54
    <packaging>jar</packaging>
(-)a/boot-fx/pom.xml (-2 / +2 lines)
Lines 48-58 Link Here
48
  <parent>
48
  <parent>
49
    <groupId>org.netbeans.html</groupId>
49
    <groupId>org.netbeans.html</groupId>
50
    <artifactId>pom</artifactId>
50
    <artifactId>pom</artifactId>
51
    <version>2.0-SNAPSHOT</version>
51
    <version>1.4</version>
52
  </parent>
52
  </parent>
53
  <groupId>org.netbeans.html</groupId>
53
  <groupId>org.netbeans.html</groupId>
54
  <artifactId>net.java.html.boot.fx</artifactId>
54
  <artifactId>net.java.html.boot.fx</artifactId>
55
  <version>2.0-SNAPSHOT</version>
55
  <version>1.4</version>
56
  <name>FX WebView Bootstrap</name>
56
  <name>FX WebView Bootstrap</name>
57
  <packaging>bundle</packaging>
57
  <packaging>bundle</packaging>
58
  <url>http://maven.apache.org</url>
58
  <url>http://maven.apache.org</url>
(-)a/boot-fx/src/main/java/org/netbeans/html/boot/fx/AbstractFXPresenter.java (-63 / +260 lines)
Lines 47-56 import java.io.Closeable; Link Here
47
import java.io.IOException;
47
import java.io.IOException;
48
import java.io.Reader;
48
import java.io.Reader;
49
import java.lang.ref.WeakReference;
49
import java.lang.ref.WeakReference;
50
import java.lang.reflect.Array;
50
import java.net.URL;
51
import java.net.URL;
51
import java.util.ArrayList;
52
import java.util.ArrayList;
52
import java.util.Arrays;
53
import java.util.Arrays;
54
import java.util.HashMap;
55
import java.util.Iterator;
53
import java.util.List;
56
import java.util.List;
57
import java.util.Map;
58
import java.util.NavigableSet;
59
import java.util.TreeSet;
54
import java.util.concurrent.Executor;
60
import java.util.concurrent.Executor;
55
import java.util.logging.Level;
61
import java.util.logging.Level;
56
import java.util.logging.Logger;
62
import java.util.logging.Logger;
Lines 59-64 import javafx.scene.Parent; Link Here
59
import javafx.scene.layout.BorderPane;
65
import javafx.scene.layout.BorderPane;
60
import javafx.scene.web.WebEngine;
66
import javafx.scene.web.WebEngine;
61
import javafx.scene.web.WebView;
67
import javafx.scene.web.WebView;
68
import netscape.javascript.JSException;
62
import netscape.javascript.JSObject;
69
import netscape.javascript.JSObject;
63
import org.netbeans.html.boot.spi.Fn;
70
import org.netbeans.html.boot.spi.Fn;
64
71
Lines 76-82 Fn.KeepAlive, Fn.ToJavaScript, Fn.FromJavaScript, Executor, Cloneable { Link Here
76
    // transient - e.g. not cloneable
83
    // transient - e.g. not cloneable
77
    private JSObject arraySize;
84
    private JSObject arraySize;
78
    private JSObject wrapArrImpl;
85
    private JSObject wrapArrImpl;
86
    private JSObject newPOJOImpl;
79
    private Object undefined;
87
    private Object undefined;
88
    private JavaValues values;
80
89
81
    @Override
90
    @Override
82
    protected AbstractFXPresenter clone() {
91
    protected AbstractFXPresenter clone() {
Lines 85-90 Fn.KeepAlive, Fn.ToJavaScript, Fn.FromJavaScript, Executor, Cloneable { Link Here
85
            p.arraySize = null;
94
            p.arraySize = null;
86
            p.wrapArrImpl = null;
95
            p.wrapArrImpl = null;
87
            p.undefined = null;
96
            p.undefined = null;
97
            p.newPOJOImpl = null;
98
            p.values = null;
88
            return p;
99
            return p;
89
        } catch (CloneNotSupportedException ex) {
100
        } catch (CloneNotSupportedException ex) {
90
            throw new IllegalStateException(ex);
101
            throw new IllegalStateException(ex);
Lines 209-214 Fn.KeepAlive, Fn.ToJavaScript, Fn.FromJavaScript, Executor, Cloneable { Link Here
209
        return wrapArr;
220
        return wrapArr;
210
    }
221
    }
211
222
223
    private final JavaValues values() {
224
        if (values == null) {
225
            values = new JavaValues();
226
        }
227
        return values;
228
    }
229
212
    private final JSObject wrapArrFn() {
230
    private final JSObject wrapArrFn() {
213
        if (wrapArrImpl == null) {
231
        if (wrapArrImpl == null) {
214
            try {
232
            try {
Lines 225-230 Fn.KeepAlive, Fn.ToJavaScript, Fn.FromJavaScript, Executor, Cloneable { Link Here
225
        return wrapArrImpl;
243
        return wrapArrImpl;
226
    }
244
    }
227
245
246
    JSObject createPOJOWrapper(int hash, int id) {
247
        if (newPOJOImpl == null) {
248
            try {
249
                newPOJOImpl = (JSObject) defineJSFn(
250
                    "var k = {};\n" +
251
                    "k.fxBrwsrId = function(hash, id) {\n" +
252
                    "  return {\n" +
253
                    "    'fxBrwsrId' : function(callback) { callback.hashAndId(hash, id); }\n" +
254
                    "  }\n" +
255
                    "};\n" +
256
                    "return k;\n", new String[] { "callback" }, null
257
                ).invokeImpl(null, false);
258
            } catch (Exception ex) {
259
                throw new IllegalStateException(ex);
260
            }
261
        }
262
        return (JSObject) newPOJOImpl.call("fxBrwsrId", hash, id);
263
    }
264
228
    final Object undefined() {
265
    final Object undefined() {
229
        if (undefined == null) {
266
        if (undefined == null) {
230
            undefined = engine.executeScript("undefined");
267
            undefined = engine.executeScript("undefined");
Lines 232-260 Fn.KeepAlive, Fn.ToJavaScript, Fn.FromJavaScript, Executor, Cloneable { Link Here
232
        return undefined;
269
        return undefined;
233
    }
270
    }
234
271
235
    final Object checkArray(Object val) {
272
    private int getArrayLength(Object val) throws JSException {
236
        if (!(val instanceof JSObject)) {
237
            return val;
238
        }
239
        int length = ((Number) arraySizeFn().call("array", val, null)).intValue();
273
        int length = ((Number) arraySizeFn().call("array", val, null)).intValue();
240
        if (length == -1) {
274
        return length;
241
            return val;
275
    }
242
        }
276
277
    private Object[] toArray(int length, Object val) throws JSException {
243
        Object[] arr = new Object[length];
278
        Object[] arr = new Object[length];
244
        arraySizeFn().call("array", val, arr);
279
        arraySizeFn().call("array", val, arr);
245
        clearUndefinedArray(arr);
280
        checkArray(arr);
246
        return arr;
281
        return arr;
247
    }
282
    }
248
283
249
    private void clearUndefinedArray(Object[] arr) {
284
    private void checkArray(Object[] arr) {
250
        for (int i = 0; i < arr.length; i++) {
285
        for (int i = 0; i < arr.length; i++) {
251
            if (arr[i] == undefined) {
286
            arr[i] = toJava(arr[i]);
252
                arr[i] = null;
253
                continue;
254
            }
255
            if (arr[i] instanceof Object[]) {
256
                clearUndefinedArray((Object[])arr[i]);
257
            }
258
        }
287
        }
259
    }
288
    }
260
289
Lines 283-309 Fn.KeepAlive, Fn.ToJavaScript, Fn.FromJavaScript, Executor, Cloneable { Link Here
283
312
284
    @Override
313
    @Override
285
    public Object toJava(Object toJS) {
314
    public Object toJava(Object toJS) {
286
        if (toJS instanceof Weak) {
287
            toJS = ((Weak)toJS).get();
288
        }
289
        if (toJS == undefined()) {
315
        if (toJS == undefined()) {
290
            return null;
316
            return null;
291
        }
317
        }
292
        return checkArray(toJS);
318
        if (!(toJS instanceof JSObject)) {
319
            return toJS;
320
        }
321
        JSObject js = (JSObject) toJS;
322
        int length = getArrayLength(toJS);
323
        if (length != -1) {
324
            Object[] arr = toArray(length, toJS);
325
            return arr;
326
        }
327
        return values().realValue(js);
293
    }
328
    }
294
329
295
    @Override
330
    @Override
296
    public Object toJavaScript(Object toReturn) {
331
    public Object toJavaScript(Object value) {
297
        if (toReturn instanceof Object[]) {
332
        return toJavaScript(value, true);
298
            return convertArrays((Object[])toReturn);
333
    }
299
        } else {
334
300
            if (toReturn instanceof Character) {
335
    final Object toJavaScript(Object value, boolean keep) {
301
                return (int)(Character)toReturn;
336
        if (value == null) {
337
            return null;
338
        }
339
        if (value instanceof String) {
340
            return value;
341
        }
342
        if (value instanceof Number) {
343
            return value;
344
        }
345
        if (value instanceof JSObject) {
346
            return value;
347
        }
348
        if (value instanceof Boolean) {
349
            return value;
350
        }
351
        if (value instanceof Character) {
352
            return (int) (char) (Character) value;
353
        }
354
        if (value instanceof Enum) {
355
            return value;
356
        }
357
        int len = isArray(value);
358
        if (len >= 0) {
359
            Object[] copy = new Object[len];
360
            for (int i = 0; i < len; i++) {
361
                copy[i] = toJavaScript(Array.get(value, i));
302
            }
362
            }
303
            return toReturn;
363
            final JSObject wrapArr = (JSObject)wrapArrFn().call("array", copy); // NOI18N
364
            return wrapArr;
365
        }
366
        if (value.getClass().getName().endsWith("$JsCallbacks$")) {
367
            return value;
304
        }
368
        }
369
        return values().wrap(value, keep);
305
    }
370
    }
306
371
372
307
    @Override public void execute(final Runnable r) {
373
    @Override public void execute(final Runnable r) {
308
        if (Platform.isFxApplicationThread()) {
374
        if (Platform.isFxApplicationThread()) {
309
            Closeable c = Fn.activate(this);
375
            Closeable c = Fn.activate(this);
Lines 364-400 Fn.KeepAlive, Fn.ToJavaScript, Fn.FromJavaScript, Executor, Cloneable { Link Here
364
                    LOG.log(Level.FINER, "  params: {0}", Arrays.asList(args));
430
                    LOG.log(Level.FINER, "  params: {0}", Arrays.asList(args));
365
                }
431
                }
366
                List<Object> all = new ArrayList<Object>(args.length + 1);
432
                List<Object> all = new ArrayList<Object>(args.length + 1);
367
                all.add(thiz == null ? fn : thiz);
433
                all.add(thiz == null ? presenter.undefined() : thiz);
368
                for (int i = 0; i < args.length; i++) {
434
                for (int i = 0; i < args.length; i++) {
369
                    Object conv = args[i];
435
                    Object conv = args[i];
370
                    if (arrayChecks) {
436
                    if (arrayChecks) {
371
                        if (args[i] instanceof Object[]) {
437
                        boolean alive = keepAlive == null || keepAlive[i];
372
                            Object[] arr = (Object[]) args[i];
438
                        conv = presenter.toJavaScript(conv, alive);
373
                            conv = presenter.convertArrays(arr);
374
                        }
375
                        if (conv != null && keepAlive != null &&
376
                            !keepAlive[i] && !isJSReady(conv) &&
377
                            !conv.getClass().getSimpleName().equals("$JsCallbacks$") // NOI18N
378
                        ) {
379
                            conv = new Weak(conv);
380
                        }
381
                        if (conv instanceof Character) {
382
                            conv = (int)(Character)conv;
383
                        }
384
                    }
439
                    }
385
                    all.add(conv);
440
                    all.add(conv);
386
                }
441
                }
387
                Object ret = fn.call("call", all.toArray()); // NOI18N
442
                Object ret = fn.call("call", all.toArray()); // NOI18N
388
                if (ret instanceof Weak) {
443
                if (ret == presenter.undefined()) {
389
                    ret = ((Weak)ret).get();
390
                }
391
                if (ret == fn || ret == presenter.undefined()) {
392
                    return null;
444
                    return null;
393
                }
445
                }
394
                if (!arrayChecks) {
446
                if (!arrayChecks) {
395
                    return ret;
447
                    return ret;
396
                }
448
                }
397
                return presenter.checkArray(ret);
449
                return presenter.toJava(ret);
398
            } catch (Error t) {
450
            } catch (Error t) {
399
                t.printStackTrace();
451
                t.printStackTrace();
400
                throw t;
452
                throw t;
Lines 405-433 Fn.KeepAlive, Fn.ToJavaScript, Fn.FromJavaScript, Executor, Cloneable { Link Here
405
        }
457
        }
406
    }
458
    }
407
459
408
    private static boolean isJSReady(Object obj) {
460
    protected int isArray(Object value) {
409
        if (obj == null) {
461
        try {
410
            return true;
462
            return Array.getLength(value);
463
        } catch (IllegalArgumentException ex) {
464
            return -1;
411
        }
465
        }
412
        if (obj instanceof String) {
466
    }
413
            return true;
467
468
    private interface Ref extends Comparable<Ref> {
469
        Object value();
470
        int id();
471
        JSObject jsObj();
472
    }
473
474
    private final class WeakRef extends WeakReference<Object> implements Ref {
475
        private final int id;
476
        private final JSObject js;
477
478
        WeakRef(Object value, int id, JSObject js) {
479
            super(value);
480
            this.id = id;
481
            this.js = js;
414
        }
482
        }
415
        if (obj instanceof Number) {
483
416
            return true;
484
        @Override
485
        public Object value() {
486
            return get();
417
        }
487
        }
418
        if (obj instanceof JSObject) {
488
419
            return true;
489
        @Override
490
        public int id() {
491
            return id;
420
        }
492
        }
421
        if (obj instanceof Character) {
493
422
            return true;
494
        @Override
495
        public JSObject jsObj() {
496
            return js;
497
        }
498
499
        @Override
500
        public int compareTo(Ref o) {
501
            return this.id() - o.id();
423
        }
502
        }
424
        return false;
425
    }
503
    }
426
504
427
    private static final class Weak extends WeakReference<Object> {
505
    private final class StrongRef implements Ref {
428
        public Weak(Object referent) {
506
        private final Object value;
429
            super(referent);
507
        private final int id;
430
            assert !(referent instanceof Weak);
508
        private final JSObject js;
509
510
        StrongRef(Object value, int id, JSObject js) {
511
            this.value = value;
512
            this.id = id;
513
            this.js = js;
514
        }
515
516
        @Override
517
        public Object value() {
518
            return value;
519
        }
520
521
        @Override
522
        public int id() {
523
            return id;
524
        }
525
526
        @Override
527
        public JSObject jsObj() {
528
            return js;
529
        }
530
531
        @Override
532
        public int compareTo(Ref o) {
533
            return this.id() - o.id();
534
        }
535
    }
536
537
    public final class JavaValues {
538
        private final Map<Integer,NavigableSet<Ref>> values;
539
        private int hash;
540
        private int id;
541
542
        JavaValues() {
543
            this.values = new HashMap<Integer,NavigableSet<Ref>>();
544
        }
545
546
        synchronized final JSObject wrap(Object pojo, boolean keep) {
547
            int hash = System.identityHashCode(pojo);
548
            NavigableSet<Ref> refs = values.get(hash);
549
            if (refs != null) {
550
                for (Ref ref : refs) {
551
                    if (ref.value() == pojo) {
552
                        return ref.jsObj();
553
                    }
554
                }
555
            } else {
556
                refs = new TreeSet<Ref>();
557
                values.put(hash, refs);
558
            }
559
            int id = findId(refs);
560
            JSObject js = createPOJOWrapper(hash, id);
561
            Ref newRef = keep ? new StrongRef(pojo, id, js) : new WeakRef(pojo, id, js);
562
            refs.add(newRef);
563
            return newRef.jsObj();
431
        }
564
        }
432
    } // end of Weak
565
566
        private int findId(NavigableSet<Ref> refs) {
567
            if (refs.isEmpty()) {
568
                return 0;
569
            }
570
            final Ref first = refs.first();
571
            int previous = first.id();
572
            if (previous > 0) {
573
                return 0;
574
            }
575
            for (Ref ref : refs.tailSet(first, false)) {
576
                int next = ref.id();
577
                if (previous + 1 < next) {
578
                    return previous + 1;
579
                }
580
                previous = next;
581
            }
582
            return previous + 1;
583
        }
584
585
        public void hashAndId(int hash, int id) {
586
            assert this.hash == -1;
587
            assert this.id == -1;
588
            this.hash = hash;
589
            this.id = id;
590
        }
591
592
        Object realValue(JSObject obj) {
593
            Object java = obj.getMember("fxBrwsrId");
594
            if (java instanceof JSObject) {
595
                for (;;) {
596
                    int resultHash;
597
                    int resultId;
598
                    synchronized (this) {
599
                        this.hash = -1;
600
                        this.id = -1;
601
                        obj.call("fxBrwsrId", this);
602
                        assert this.hash != -1;
603
                        assert this.id != -1;
604
                        resultHash = this.hash;
605
                        resultId = this.id;
606
                    }
607
608
                    final NavigableSet<Ref> refs = values.get(resultHash);
609
                    Iterator<Ref> it = refs.iterator();
610
                    while (it.hasNext()) {
611
                        Ref next = it.next();
612
                        Object pojo = next.value();
613
                        if (next.id() == resultId) {
614
                            return pojo;
615
                        }
616
                        if (pojo == null) {
617
                            it.remove();
618
                        }
619
                    }
620
                    if (refs.isEmpty()) {
621
                        values.remove(resultHash);
622
                    }
623
                }
624
            }
625
            return obj;
626
        }
627
    }
628
629
433
}
630
}
(-)a/boot-fx/src/main/java/org/netbeans/html/boot/fx/FXBrwsr.java (-19 / +41 lines)
Lines 66-77 import javafx.scene.layout.BorderPane; Link Here
66
import javafx.scene.layout.HBox;
66
import javafx.scene.layout.HBox;
67
import javafx.scene.layout.VBox;
67
import javafx.scene.layout.VBox;
68
import javafx.scene.text.Text;
68
import javafx.scene.text.Text;
69
import javafx.scene.web.PopupFeatures;
69
import javafx.scene.web.PromptData;
70
import javafx.scene.web.PromptData;
71
import javafx.scene.web.WebEngine;
70
import javafx.scene.web.WebEvent;
72
import javafx.scene.web.WebEvent;
71
import javafx.scene.web.WebView;
73
import javafx.scene.web.WebView;
72
import javafx.stage.Modality;
74
import javafx.stage.Modality;
73
import javafx.stage.Screen;
75
import javafx.stage.Screen;
74
import javafx.stage.Stage;
76
import javafx.stage.Stage;
77
import javafx.stage.StageStyle;
75
import javafx.stage.Window;
78
import javafx.stage.Window;
76
import javafx.stage.WindowEvent;
79
import javafx.stage.WindowEvent;
77
import javafx.util.Callback;
80
import javafx.util.Callback;
Lines 278-302 public class FXBrwsr extends Application { Link Here
278
            }
281
            }
279
282
280
        });
283
        });
281
        class Title implements ChangeListener<String> {
284
        Title.observeView(view, stage);
282
283
            private String title;
284
285
            public Title() {
286
                super();
287
            }
288
289
            @Override
290
            public void changed(ObservableValue<? extends String> ov, String t, String t1) {
291
                title = view.getEngine().getTitle();
292
                if (title != null) {
293
                    stage.setTitle(title);
294
                }
295
            }
296
        }
297
        final Title x = new Title();
298
        view.getEngine().titleProperty().addListener(x);
299
        x.changed(null, null, null);
300
        return view;
285
        return view;
301
    }
286
    }
302
287
Lines 393-398 public class FXBrwsr extends Application { Link Here
393
                return res[0] ? line.getText() : null;
378
                return res[0] ? line.getText() : null;
394
            }
379
            }
395
        });
380
        });
381
        view.getEngine().setCreatePopupHandler(new Callback<PopupFeatures, WebEngine>() {
382
            @Override
383
            public WebEngine call(PopupFeatures param) {
384
                final Stage stage = new Stage(StageStyle.UTILITY);
385
                stage.initOwner(owner);
386
                final WebView popUpView = new WebView();
387
                stage.setScene(new Scene(popUpView));
388
                Title.observeView(popUpView, stage);
389
                stage.show();
390
                return popUpView.getEngine();
391
            }
392
        });
396
    }
393
    }
397
394
398
    static void waitFinished() {
395
    static void waitFinished() {
Lines 423-427 public class FXBrwsr extends Application { Link Here
423
            }
420
            }
424
        }
421
        }
425
    }
422
    }
423
    private static class Title implements ChangeListener<String> {
424
        private String title;
425
        private final WebView view;
426
        private final Stage stage;
427
428
        private Title(WebView view, Stage stage) {
429
            super();
430
            this.view = view;
431
            this.stage = stage;
432
        }
433
434
        public static void observeView(WebView view, Stage stage) {
435
            Title t = new Title(view, stage);
436
            view.getEngine().titleProperty().addListener(t);
437
            t.changed(null, null, null);
438
        }
439
440
        @Override
441
        public void changed(ObservableValue<? extends String> ov, String t, String t1) {
442
            title = view.getEngine().getTitle();
443
            if (title != null) {
444
                stage.setTitle(title);
445
            }
446
        }
447
    }
426
448
427
}
449
}
(-)a/boot-fx/src/main/java/org/netbeans/html/boot/fx/WatchDir.java (-1 / +5 lines)
Lines 68-74 final class WatchDir implements Runnable { Link Here
68
    private final WebEngine engine;
68
    private final WebEngine engine;
69
    
69
    
70
    WatchDir(WebEngine eng) throws URISyntaxException, IOException {
70
    WatchDir(WebEngine eng) throws URISyntaxException, IOException {
71
        dir = Paths.get(new URI(eng.getLocation())).getParent();
71
        URI loc = new URI(eng.getLocation());
72
        if (loc.getFragment() != null) {
73
            loc = new URI(loc.getScheme(), loc.getHost(), loc.getPath(), null);
74
        }
75
        dir = Paths.get(loc).getParent();
72
        engine = eng;
76
        engine = eng;
73
        ws = dir.getFileSystem().newWatchService();
77
        ws = dir.getFileSystem().newWatchService();
74
        key = dir.register(ws, 
78
        key = dir.register(ws, 
(-)a/boot-fx/src/test/java/org/netbeans/html/boot/fx/Periodicaly.java (+103 lines)
Line 0 Link Here
1
/**
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Oracle. Portions Copyright 2013-2016 Oracle. All Rights Reserved.
31
 *
32
 * If you wish your version of this file to be governed by only the CDDL
33
 * or only the GPL Version 2, indicate your decision by adding
34
 * "[Contributor] elects to include this software in this distribution
35
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
36
 * single choice of license, a recipient has the option to distribute
37
 * your version of this file under either the CDDL, the GPL Version 2 or
38
 * to extend the choice of license to its licensees as provided above.
39
 * However, if you add GPL Version 2 code and therefore, elected the GPL
40
 * Version 2 license, then the option applies only if the new code is
41
 * made subject to such option by the copyright holder.
42
 */
43
package org.netbeans.html.boot.fx;
44
45
import java.util.Timer;
46
import java.util.TimerTask;
47
import net.java.html.BrwsrCtx;
48
import net.java.html.js.JavaScriptBody;
49
50
// BEGIN: org.netbeans.html.boot.fx.Periodicaly
51
public final class Periodicaly extends TimerTask {
52
    private final BrwsrCtx ctx;
53
    private int counter;
54
55
    private Periodicaly(BrwsrCtx ctx) {
56
        // remember the browser context and use it later
57
        this.ctx = ctx;
58
        this.counter = 0;
59
    }
60
61
    @Override
62
    public void run() {
63
        // arrives on wrong thread, needs to be re-scheduled
64
        ctx.execute(new Runnable() {
65
            @Override
66
            public void run() {
67
                codeThatNeedsToBeRunInABrowserEnvironment();
68
            }
69
        });
70
    }
71
72
    // called when your page is ready
73
    public static void onPageLoad(String... args) throws Exception {
74
        // the context at the time of page initialization
75
        BrwsrCtx initialCtx = BrwsrCtx.findDefault(Periodicaly.class);
76
        // the task that is associated with context
77
        Periodicaly task = new Periodicaly(initialCtx);
78
        // creates a new timer
79
        Timer t = new Timer("Move the box");
80
        // run the task every 100ms
81
        t.scheduleAtFixedRate(task, 0, 100);
82
    }
83
84
    @JavaScriptBody(args = { "a", "b" }, body = "return a + b")
85
    private static native int plus(int a, int b);
86
87
    void codeThatNeedsToBeRunInABrowserEnvironment() {
88
        // invokes JavaScript function in the browser environment
89
        counter = plus(counter, 1);
90
// FINISH: org.netbeans.html.boot.fx.Periodicaly
91
92
        synchronized (Periodicaly.class) {
93
            globalCounter = counter;
94
            Periodicaly.class.notifyAll();
95
        }
96
    }
97
    static int globalCounter;
98
    static synchronized void assertTen() throws InterruptedException {
99
        while (globalCounter < 10) {
100
            Periodicaly.class.wait();
101
        }
102
    }
103
}
(-)a/boot-fx/src/test/java/org/netbeans/html/boot/fx/PeriodicalyTest.java (+64 lines)
Line 0 Link Here
1
/**
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Oracle. Portions Copyright 2013-2016 Oracle. All Rights Reserved.
31
 *
32
 * If you wish your version of this file to be governed by only the CDDL
33
 * or only the GPL Version 2, indicate your decision by adding
34
 * "[Contributor] elects to include this software in this distribution
35
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
36
 * single choice of license, a recipient has the option to distribute
37
 * your version of this file under either the CDDL, the GPL Version 2 or
38
 * to extend the choice of license to its licensees as provided above.
39
 * However, if you add GPL Version 2 code and therefore, elected the GPL
40
 * Version 2 license, then the option applies only if the new code is
41
 * made subject to such option by the copyright holder.
42
 */
43
package org.netbeans.html.boot.fx;
44
45
import java.util.concurrent.Executors;
46
import net.java.html.boot.BrowserBuilder;
47
import org.testng.annotations.Test;
48
49
public final class PeriodicalyTest {
50
    @Test
51
    public void runPeriodically() throws Exception {
52
        final BrowserBuilder bb = BrowserBuilder.newBrowser(new FXPresenter())
53
                .loadPage("empty.html")
54
                .loadClass(Periodicaly.class)
55
                .invoke("onPageLoad");
56
        Executors.newSingleThreadExecutor().execute(new Runnable() {
57
            @Override
58
            public void run() {
59
                bb.showAndWait();
60
            }
61
        });
62
        Periodicaly.assertTen();
63
    }
64
}
(-)a/boot-fx/src/test/java/org/netbeans/html/boot/fx/PopupTest.java (+127 lines)
Line 0 Link Here
1
/**
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Oracle. Portions Copyright 2013-2016 Oracle. All Rights Reserved.
31
 *
32
 * If you wish your version of this file to be governed by only the CDDL
33
 * or only the GPL Version 2, indicate your decision by adding
34
 * "[Contributor] elects to include this software in this distribution
35
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
36
 * single choice of license, a recipient has the option to distribute
37
 * your version of this file under either the CDDL, the GPL Version 2 or
38
 * to extend the choice of license to its licensees as provided above.
39
 * However, if you add GPL Version 2 code and therefore, elected the GPL
40
 * Version 2 license, then the option applies only if the new code is
41
 * made subject to such option by the copyright holder.
42
 */
43
package org.netbeans.html.boot.fx;
44
45
import java.util.concurrent.CountDownLatch;
46
import java.util.concurrent.Executors;
47
import java.util.concurrent.TimeUnit;
48
import javafx.stage.Stage;
49
import net.java.html.BrwsrCtx;
50
import net.java.html.boot.BrowserBuilder;
51
import net.java.html.js.JavaScriptBody;
52
import org.netbeans.html.boot.spi.Fn;
53
import static org.testng.Assert.*;
54
import org.testng.annotations.Test;
55
56
/**
57
 *
58
 * @author Jaroslav Tulach
59
 */
60
public class PopupTest {
61
    public PopupTest() {
62
    }
63
64
    @JavaScriptBody(args = { "page" }, body =
65
        "return window.open(page, 'secondary', 'width=300,height=150');"
66
    )
67
    private static native Object openSecondaryWindow(String page);
68
69
    @Test public void checkReload() throws Throwable {
70
        final Throwable[] arr = { null };
71
72
        class WhenInitialized implements Runnable {
73
            CountDownLatch cdl = new CountDownLatch(1);
74
            AbstractFXPresenter p;
75
            BrwsrCtx ctx;
76
77
            @Override
78
            public void run() {
79
                try {
80
                    p = (AbstractFXPresenter) Fn.activePresenter();
81
                    assertNotNull(p, "Presenter is defined");
82
                    ctx = BrwsrCtx.findDefault(WhenInitialized.class);
83
                } catch (Throwable ex) {
84
                    arr[0] = ex;
85
                } finally {
86
                    cdl.countDown();
87
                }
88
            }
89
        }
90
        WhenInitialized when = new WhenInitialized();
91
92
        final BrowserBuilder bb = BrowserBuilder.newBrowser().loadClass(PopupTest.class).
93
                loadPage("empty.html").
94
                loadFinished(when);
95
96
        class ShowBrowser implements Runnable {
97
            @Override
98
            public void run() {
99
                bb.showAndWait();
100
            }
101
        }
102
103
        Executors.newSingleThreadExecutor().submit(new ShowBrowser());
104
        when.cdl.await();
105
        if (arr[0] != null) throw arr[0];
106
107
        Stage s = FXBrwsr.findStage();
108
        assertEquals(s.getTitle(), "FX Presenter Harness");
109
110
        final Object[] window = new Object[1];
111
        final CountDownLatch openWindow = new CountDownLatch(1);
112
        when.ctx.execute(new Runnable() {
113
            @Override
114
            public void run() {
115
                TitleTest.changeTitle("First window");
116
                window[0] = openSecondaryWindow("second.html");
117
                openWindow.countDown();
118
            }
119
        });
120
121
        openWindow.await(5, TimeUnit.SECONDS);
122
123
        assertNotNull(window[0], "Second window opened");
124
125
        assertEquals(s.getTitle(), "First window", "The title is kept");
126
    }
127
}
(-)a/boot-fx/src/test/resources/org/netbeans/html/boot/fx/second.html (+55 lines)
Line 0 Link Here
1
<!--
2
3
    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
5
    Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
6
7
    Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8
    Other names may be trademarks of their respective owners.
9
10
    The contents of this file are subject to the terms of either the GNU
11
    General Public License Version 2 only ("GPL") or the Common
12
    Development and Distribution License("CDDL") (collectively, the
13
    "License"). You may not use this file except in compliance with the
14
    License. You can obtain a copy of the License at
15
    http://www.netbeans.org/cddl-gplv2.html
16
    or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
17
    specific language governing permissions and limitations under the
18
    License.  When distributing the software, include this License Header
19
    Notice in each file and include the License file at
20
    nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
21
    particular file as subject to the "Classpath" exception as provided
22
    by Oracle in the GPL Version 2 section of the License file that
23
    accompanied this code. If applicable, add the following below the
24
    License Header, with the fields enclosed by brackets [] replaced by
25
    your own identifying information:
26
    "Portions Copyrighted [year] [name of copyright owner]"
27
28
    Contributor(s):
29
30
    The Original Software is NetBeans. The Initial Developer of the Original
31
    Software is Oracle. Portions Copyright 2013-2016 Oracle. All Rights Reserved.
32
33
    If you wish your version of this file to be governed by only the CDDL
34
    or only the GPL Version 2, indicate your decision by adding
35
    "[Contributor] elects to include this software in this distribution
36
    under the [CDDL or GPL Version 2] license." If you do not indicate a
37
    single choice of license, a recipient has the option to distribute
38
    your version of this file under either the CDDL, the GPL Version 2 or
39
    to extend the choice of license to its licensees as provided above.
40
    However, if you add GPL Version 2 code and therefore, elected the GPL
41
    Version 2 license, then the option applies only if the new code is
42
    made subject to such option by the copyright holder.
43
44
-->
45
<!DOCTYPE html>
46
<html>
47
    <head>
48
        <title>Second Window</title>
49
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
50
        <meta name="viewport" content="width=device-width">
51
    </head>
52
    <body>
53
        <div>Second Window</div>
54
    </body>
55
</html>
(-)a/boot-script/pom.xml (-2 / +2 lines)
Lines 48-58 Link Here
48
    <parent>
48
    <parent>
49
        <groupId>org.netbeans.html</groupId>
49
        <groupId>org.netbeans.html</groupId>
50
        <artifactId>pom</artifactId>
50
        <artifactId>pom</artifactId>
51
        <version>2.0-SNAPSHOT</version>
51
        <version>1.4</version>
52
    </parent>
52
    </parent>
53
    <name>Presenter via javax.script</name>
53
    <name>Presenter via javax.script</name>
54
    <artifactId>net.java.html.boot.script</artifactId>
54
    <artifactId>net.java.html.boot.script</artifactId>
55
    <version>2.0-SNAPSHOT</version>
55
    <version>1.4</version>
56
    <packaging>bundle</packaging>
56
    <packaging>bundle</packaging>
57
    <properties>
57
    <properties>
58
        <netbeans.compile.on.save>NONE</netbeans.compile.on.save>
58
        <netbeans.compile.on.save>NONE</netbeans.compile.on.save>
(-)a/boot-script/src/test/java/net/java/html/boot/script/ko4j/KnockoutEnvJSTest.java (-4 / +12 lines)
Lines 48-57 import java.io.InputStream; Link Here
48
import java.io.InputStreamReader;
48
import java.io.InputStreamReader;
49
import java.lang.annotation.Annotation;
49
import java.lang.annotation.Annotation;
50
import java.lang.reflect.Method;
50
import java.lang.reflect.Method;
51
import java.net.ConnectException;
51
import java.net.URI;
52
import java.net.URI;
52
import java.net.URISyntaxException;
53
import java.net.URISyntaxException;
53
import java.net.URL;
54
import java.net.URL;
54
import java.net.URLConnection;
55
import java.net.URLConnection;
56
import java.net.UnknownHostException;
55
import java.util.ArrayList;
57
import java.util.ArrayList;
56
import java.util.List;
58
import java.util.List;
57
import java.util.Map;
59
import java.util.Map;
Lines 108-117 public final class KnockoutEnvJSTest extends KnockoutTCK { Link Here
108
        baseUri = DynamicHTTP.initServer();
110
        baseUri = DynamicHTTP.initServer();
109
111
110
        final Fn.Presenter p = Scripts.createPresenter(KOCase.JS);
112
        final Fn.Presenter p = Scripts.createPresenter(KOCase.JS);
111
        URL envNashorn = new URL("https://bugs.openjdk.java.net/secure/attachment/11894/env.nashorn.1.2-debug.js");
113
        try {
112
        InputStream is = envNashorn.openStream();
114
            URL envNashorn = new URL("https://bugs.openjdk.java.net/secure/attachment/11894/env.nashorn.1.2-debug.js");
113
        p.loadScript(new InputStreamReader(is));
115
            InputStream is = envNashorn.openStream();
114
        is.close();
116
            p.loadScript(new InputStreamReader(is));
117
            is.close();
118
        } catch (UnknownHostException | ConnectException ex) {
119
            ex.printStackTrace();
120
            return new Object[0];
121
        }
115
122
116
        final BrowserBuilder bb = BrowserBuilder.newBrowser(p).
123
        final BrowserBuilder bb = BrowserBuilder.newBrowser(p).
117
            loadClass(KnockoutEnvJSTest.class).
124
            loadClass(KnockoutEnvJSTest.class).
Lines 149-154 public final class KnockoutEnvJSTest extends KnockoutTCK { Link Here
149
        final String ver = System.getProperty("java.runtime.version"); // NOI18N
156
        final String ver = System.getProperty("java.runtime.version"); // NOI18N
150
        if (
157
        if (
151
            ver.startsWith("1.8.0_25") ||
158
            ver.startsWith("1.8.0_25") ||
159
            ver.startsWith("1.8.0_31") ||
152
            ver.startsWith("1.8.0_40")
160
            ver.startsWith("1.8.0_40")
153
        ) {
161
        ) {
154
            return "Broken due to JDK-8047764";
162
            return "Broken due to JDK-8047764";
(-)a/boot-truffle/src/main/java/net/java/html/boot/truffle/JavaObject.java (+12 lines)
Lines 46-51 import com.oracle.truffle.api.interop.ForeignAccess; Link Here
46
import com.oracle.truffle.api.interop.MessageResolution;
46
import com.oracle.truffle.api.interop.MessageResolution;
47
import com.oracle.truffle.api.interop.Resolve;
47
import com.oracle.truffle.api.interop.Resolve;
48
import com.oracle.truffle.api.interop.TruffleObject;
48
import com.oracle.truffle.api.interop.TruffleObject;
49
import com.oracle.truffle.api.interop.UnknownIdentifierException;
49
import com.oracle.truffle.api.nodes.Node;
50
import com.oracle.truffle.api.nodes.Node;
50
51
51
@MessageResolution(receiverType = JavaObject.class, language = TrufflePresenter.JavaLang.class)
52
@MessageResolution(receiverType = JavaObject.class, language = TrufflePresenter.JavaLang.class)
Lines 79-82 final class JavaObject extends JavaValue implements TruffleObject { Link Here
79
        }
80
        }
80
    }
81
    }
81
82
83
    @Resolve(message = "INVOKE")
84
    static abstract class Methods extends Node {
85
86
        protected Object access(JavaObject javaObject, String methodName, Object[] args) {
87
            if (methodName.equals("toString")) {
88
                return javaObject.obj.toString();
89
            }
90
            throw UnknownIdentifierException.raise(methodName);
91
        }
92
    }
93
82
}
94
}
(-)a/boot-truffle/src/test/java/net/java/html/boot/truffle/TruffleJavaScriptTest.java (-1 / +1 lines)
Lines 74-80 public class TruffleJavaScriptTest { Link Here
74
        PolyglotEngine engine = PolyglotEngine.newBuilder().build();
74
        PolyglotEngine engine = PolyglotEngine.newBuilder().build();
75
        PolyglotEngine.Value result = null;
75
        PolyglotEngine.Value result = null;
76
        try {
76
        try {
77
            result = engine.eval(Source.fromText("6 * 7", "test.js").withMimeType("text/javascript"));
77
            result = engine.eval(Source.newBuilder("6 * 7").name("test.js").mimeType("text/javascript").build());
78
        } catch (Exception notSupported) {
78
        } catch (Exception notSupported) {
79
            if (notSupported.getMessage().contains("text/javascript")) {
79
            if (notSupported.getMessage().contains("text/javascript")) {
80
                return new Object[] { new Skip(true, notSupported.getMessage()) };
80
                return new Object[] { new Skip(true, notSupported.getMessage()) };
(-)a/boot/pom.xml (-2 / +2 lines)
Lines 48-58 Link Here
48
  <parent>
48
  <parent>
49
    <groupId>org.netbeans.html</groupId>
49
    <groupId>org.netbeans.html</groupId>
50
    <artifactId>pom</artifactId>
50
    <artifactId>pom</artifactId>
51
    <version>2.0-SNAPSHOT</version>
51
    <version>1.4</version>
52
  </parent>
52
  </parent>
53
  <groupId>org.netbeans.html</groupId>
53
  <groupId>org.netbeans.html</groupId>
54
  <artifactId>net.java.html.boot</artifactId>
54
  <artifactId>net.java.html.boot</artifactId>
55
  <version>2.0-SNAPSHOT</version>
55
  <version>1.4</version>
56
  <packaging>bundle</packaging>
56
  <packaging>bundle</packaging>
57
  <name>Browser Bootstrap</name>
57
  <name>Browser Bootstrap</name>
58
  <url>http://maven.apache.org</url>
58
  <url>http://maven.apache.org</url>
(-)a/context/pom.xml (-2 / +2 lines)
Lines 48-58 Link Here
48
  <parent>
48
  <parent>
49
    <groupId>org.netbeans.html</groupId>
49
    <groupId>org.netbeans.html</groupId>
50
    <artifactId>pom</artifactId>
50
    <artifactId>pom</artifactId>
51
    <version>2.0-SNAPSHOT</version>
51
    <version>1.4</version>
52
  </parent>
52
  </parent>
53
  <groupId>org.netbeans.html</groupId>
53
  <groupId>org.netbeans.html</groupId>
54
  <artifactId>net.java.html</artifactId>
54
  <artifactId>net.java.html</artifactId>
55
  <version>2.0-SNAPSHOT</version>
55
  <version>1.4</version>
56
  <packaging>bundle</packaging>
56
  <packaging>bundle</packaging>
57
  <name>HTML Context</name>
57
  <name>HTML Context</name>
58
  <url>http://maven.apache.org</url>
58
  <url>http://maven.apache.org</url>
(-)a/context/src/main/java/net/java/html/BrwsrCtx.java (-31 / +1 lines)
Lines 132-168 public final class BrwsrCtx implements Executor { Link Here
132
     * <p>
132
     * <p>
133
     * <b>Example Using a Timer</b>
133
     * <b>Example Using a Timer</b>
134
     * </p>
134
     * </p>
135
<pre>
135
     * {@codesnippet org.netbeans.html.boot.fx.Periodicaly}
136
<b>public final class</b> Periodicaly <b>extends</b> {@link java.util.TimerTask} {
137
    <b>private final</b> {@link BrwsrCtx} ctx;
138
139
    <b>private</b> Periodicaly(BrwsrCtx ctx) {
140
        // remember the browser context and use it later
141
        this.ctx = ctx;
142
    }
143
    
144
    <b>public void</b> run() {
145
        // arrives on wrong thread, needs to be re-scheduled
146
        ctx.{@link #execute(java.lang.Runnable) execute}(new Runnable() {
147
            <b>public void</b> run() {
148
                // code that needs to run in a browser environment
149
            }
150
        });
151
    }
152
153
    // called when your page is ready
154
    <b>public static void</b> onPageLoad(String... args) <b>throws</b> Exception {
155
        // the context at the time of page initialization
156
        BrwsrCtx initialCtx = BrwsrCtx.findDefault(Periodicaly.<b>class</b>);
157
        // the task that is associated with context 
158
        Periodicaly task = new Periodicaly(initialCtx);
159
        // creates a timer
160
        {@link java.util.Timer} t = new {@link java.util.Timer}("Move the box");
161
        // run the task every 100ms
162
        t.{@link java.util.Timer#scheduleAtFixedRate(java.util.TimerTask, long, long) scheduleAtFixedRate}(task, 0, 100);
163
    }
164
}
165
</pre>    
166
     * 
136
     * 
167
     * @param exec the code to execute
137
     * @param exec the code to execute
168
     * @since 0.7.6
138
     * @since 0.7.6
(-)a/equinox-agentclass-hook/pom.xml (-1 / +1 lines)
Lines 48-54 Link Here
48
    <parent>
48
    <parent>
49
        <groupId>org.netbeans.html</groupId>
49
        <groupId>org.netbeans.html</groupId>
50
        <artifactId>pom</artifactId>
50
        <artifactId>pom</artifactId>
51
        <version>2.0-SNAPSHOT</version>
51
        <version>1.4</version>
52
    </parent>
52
    </parent>
53
    <name>AgentClass Hook for Equinox</name>
53
    <name>AgentClass Hook for Equinox</name>
54
    <artifactId>equinox-agentclass-hook</artifactId>
54
    <artifactId>equinox-agentclass-hook</artifactId>
(-)a/geo/pom.xml (-2 / +2 lines)
Lines 48-58 Link Here
48
  <parent>
48
  <parent>
49
    <groupId>org.netbeans.html</groupId>
49
    <groupId>org.netbeans.html</groupId>
50
    <artifactId>pom</artifactId>
50
    <artifactId>pom</artifactId>
51
    <version>2.0-SNAPSHOT</version>
51
    <version>1.4</version>
52
  </parent>
52
  </parent>
53
  <groupId>org.netbeans.html</groupId>
53
  <groupId>org.netbeans.html</groupId>
54
  <artifactId>net.java.html.geo</artifactId>
54
  <artifactId>net.java.html.geo</artifactId>
55
  <version>2.0-SNAPSHOT</version>
55
  <version>1.4</version>
56
  <packaging>bundle</packaging>
56
  <packaging>bundle</packaging>
57
  <name>Geolocation API</name>
57
  <name>Geolocation API</name>
58
  <url>http://maven.apache.org</url>
58
  <url>http://maven.apache.org</url>
(-)a/html4j-maven-plugin/pom.xml (-2 / +2 lines)
Lines 48-59 Link Here
48
  <parent>
48
  <parent>
49
    <groupId>org.netbeans.html</groupId>
49
    <groupId>org.netbeans.html</groupId>
50
    <artifactId>pom</artifactId>
50
    <artifactId>pom</artifactId>
51
    <version>2.0-SNAPSHOT</version>
51
    <version>1.4</version>
52
  </parent>
52
  </parent>
53
  <packaging>maven-plugin</packaging>
53
  <packaging>maven-plugin</packaging>
54
  <groupId>org.netbeans.html</groupId>
54
  <groupId>org.netbeans.html</groupId>
55
  <artifactId>html4j-maven-plugin</artifactId>
55
  <artifactId>html4j-maven-plugin</artifactId>
56
  <version>2.0-SNAPSHOT</version>
56
  <version>1.4</version>
57
  <name>Html for Java Maven Plugin</name>
57
  <name>Html for Java Maven Plugin</name>
58
  <url>http://maven.apache.org</url>
58
  <url>http://maven.apache.org</url>
59
  <description>Maven plugin to post process the classes with @JavaScriptBody annotations</description>
59
  <description>Maven plugin to post process the classes with @JavaScriptBody annotations</description>
(-)a/json-tck/pom.xml (-3 / +3 lines)
Lines 48-58 Link Here
48
  <parent>
48
  <parent>
49
    <groupId>org.netbeans.html</groupId>
49
    <groupId>org.netbeans.html</groupId>
50
    <artifactId>pom</artifactId>
50
    <artifactId>pom</artifactId>
51
    <version>2.0-SNAPSHOT</version>
51
    <version>1.4</version>
52
  </parent>
52
  </parent>
53
  <groupId>org.netbeans.html</groupId>
53
  <groupId>org.netbeans.html</groupId>
54
  <artifactId>net.java.html.json.tck</artifactId>
54
  <artifactId>net.java.html.json.tck</artifactId>
55
  <version>2.0-SNAPSHOT</version>
55
  <version>1.4</version>
56
  <packaging>bundle</packaging>
56
  <packaging>bundle</packaging>
57
  <name>HTML for Java TCK</name>
57
  <name>HTML for Java TCK</name>
58
  <url>http://maven.apache.org</url>
58
  <url>http://maven.apache.org</url>
Lines 85-91 Link Here
85
    <dependency>
85
    <dependency>
86
      <groupId>org.netbeans.html</groupId>
86
      <groupId>org.netbeans.html</groupId>
87
      <artifactId>net.java.html.json</artifactId>
87
      <artifactId>net.java.html.json</artifactId>
88
      <version>2.0-SNAPSHOT</version>
88
      <version>1.4</version>
89
      <type>jar</type>
89
      <type>jar</type>
90
    </dependency>
90
    </dependency>
91
    <dependency>
91
    <dependency>
(-)a/json-tck/src/main/java/net/java/html/js/tests/Bodies.java (+15 lines)
Lines 92-97 final class Bodies { Link Here
92
        "return c.@net.java.html.js.tests.Sum::sum(II)(a, b);"
92
        "return c.@net.java.html.js.tests.Sum::sum(II)(a, b);"
93
    )
93
    )
94
    public static native int sumIndirect(Sum c, int a, int b);
94
    public static native int sumIndirect(Sum c, int a, int b);
95
96
    @JavaScriptBody(args = { "c" }, javacall = true, body =
97
        "return {\n" +
98
        "  'sum' : function(a,b) {\n" +
99
        "     return c.@net.java.html.js.tests.Sum::sum(II)(a, b);\n" +
100
        "  }\n" +
101
        "};\n"
102
    )
103
    public static native Object sumDelayed(Sum c);
104
105
    @JavaScriptBody(args = { "sum", "a", "b" }, body = "return sum.sum(a, b);")
106
    public static native int sumNow(Object sum, int a, int b);
95
    
107
    
96
    @JavaScriptBody(args = { "arr", "index" }, body = "return arr[index];")
108
    @JavaScriptBody(args = { "arr", "index" }, body = "return arr[index];")
97
    public static native Object select(Object[] arr, int index);
109
    public static native Object select(Object[] arr, int index);
Lines 105-110 final class Bodies { Link Here
105
    @JavaScriptBody(args = { "b" }, body = "return typeof b;")
117
    @JavaScriptBody(args = { "b" }, body = "return typeof b;")
106
    public static native String typeof(boolean b);
118
    public static native String typeof(boolean b);
107
119
120
    @JavaScriptBody(args = { "o" }, body = "return o.toString();")
121
    public static native String toString(Object o);
122
108
    @JavaScriptBody(args = { "o" }, body = "return Array.isArray(o);")
123
    @JavaScriptBody(args = { "o" }, body = "return Array.isArray(o);")
109
    public static native boolean isArray(Object o);
124
    public static native boolean isArray(Object o);
110
125
(-)a/json-tck/src/main/java/net/java/html/js/tests/GCBodyTest.java (+19 lines)
Lines 67-72 public class GCBodyTest { Link Here
67
        s = null;
67
        s = null;
68
        assertGC(ref, "Can disappear!");
68
        assertGC(ref, "Can disappear!");
69
    }
69
    }
70
71
    @KOTest public void callbackInterfaceShallNotDisappear() throws InterruptedException {
72
        Sum sum = new Sum();
73
        Object jsSum = Bodies.sumDelayed(sum);
74
        Reference<?> ref = new WeakReference<Object>(sum);
75
        sum = null;
76
        IllegalStateException gcError = null;
77
        try {
78
            assertNotGC(ref, false, "object s should still stay");
79
        } catch (IllegalStateException ex) {
80
            gcError = ex;
81
        }
82
83
        int res = Bodies.sumNow(jsSum, 22, 20);
84
        assertEquals(res, 42, "Expecting 42");
85
        if (gcError != null) {
86
            throw gcError;
87
        }
88
    }
70
    
89
    
71
    private Object assignInst() {
90
    private Object assignInst() {
72
        Object obj = Bodies.instance(0);
91
        Object obj = Bodies.instance(0);
(-)a/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java (+9 lines)
Lines 154-159 public class JavaScriptBodyTest { Link Here
154
        assertEquals("number", doubleType, "Expecting number type: " + doubleType);
154
        assertEquals("number", doubleType, "Expecting number type: " + doubleType);
155
    }
155
    }
156
156
157
    enum Two {
158
        ONE, TWO;
159
    }
160
161
    @KOTest public void toStringOfAnEnum() {
162
        String enumStr = Bodies.toString(Two.ONE);
163
        assertEquals(Two.ONE.toString(), enumStr, "Enum toString() used: " + enumStr);
164
    }
165
157
    @KOTest public void computeInARunnable() {
166
    @KOTest public void computeInARunnable() {
158
        final int[] sum = new int[2];
167
        final int[] sum = new int[2];
159
        class First implements Runnable {
168
        class First implements Runnable {
(-)a/json-tck/src/main/java/org/netbeans/html/json/tck/package.html (+56 lines)
Line 0 Link Here
1
<!--
2
3
    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
5
    Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
6
7
    Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8
    Other names may be trademarks of their respective owners.
9
10
    The contents of this file are subject to the terms of either the GNU
11
    General Public License Version 2 only ("GPL") or the Common
12
    Development and Distribution License("CDDL") (collectively, the
13
    "License"). You may not use this file except in compliance with the
14
    License. You can obtain a copy of the License at
15
    http://www.netbeans.org/cddl-gplv2.html
16
    or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
17
    specific language governing permissions and limitations under the
18
    License.  When distributing the software, include this License Header
19
    Notice in each file and include the License file at
20
    nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
21
    particular file as subject to the "Classpath" exception as provided
22
    by Oracle in the GPL Version 2 section of the License file that
23
    accompanied this code. If applicable, add the following below the
24
    License Header, with the fields enclosed by brackets [] replaced by
25
    your own identifying information:
26
    "Portions Copyrighted [year] [name of copyright owner]"
27
28
    Contributor(s):
29
30
    The Original Software is NetBeans. The Initial Developer of the Original
31
    Software is Oracle. Portions Copyright 2013-2016 Oracle. All Rights Reserved.
32
33
    If you wish your version of this file to be governed by only the CDDL
34
    or only the GPL Version 2, indicate your decision by adding
35
    "[Contributor] elects to include this software in this distribution
36
    under the [CDDL or GPL Version 2] license." If you do not indicate a
37
    single choice of license, a recipient has the option to distribute
38
    your version of this file under either the CDDL, the GPL Version 2 or
39
    to extend the choice of license to its licensees as provided above.
40
    However, if you add GPL Version 2 code and therefore, elected the GPL
41
    Version 2 license, then the option applies only if the new code is
42
    made subject to such option by the copyright holder.
43
44
-->
45
<!DOCTYPE html>
46
<html>
47
    <head>
48
        <title></title>
49
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
50
    </head>
51
    <body>
52
        <div>Entry point to the 
53
            <a href="KnockoutTCK.html">test compatibility kit</a>.
54
        </div>
55
    </body>
56
</html>
(-)a/json-tck/src/main/resources/org/netbeans/html/json/tck/package.html (-56 lines)
Lines 1-56 Link Here
1
<!--
2
3
    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
5
    Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
6
7
    Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8
    Other names may be trademarks of their respective owners.
9
10
    The contents of this file are subject to the terms of either the GNU
11
    General Public License Version 2 only ("GPL") or the Common
12
    Development and Distribution License("CDDL") (collectively, the
13
    "License"). You may not use this file except in compliance with the
14
    License. You can obtain a copy of the License at
15
    http://www.netbeans.org/cddl-gplv2.html
16
    or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
17
    specific language governing permissions and limitations under the
18
    License.  When distributing the software, include this License Header
19
    Notice in each file and include the License file at
20
    nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
21
    particular file as subject to the "Classpath" exception as provided
22
    by Oracle in the GPL Version 2 section of the License file that
23
    accompanied this code. If applicable, add the following below the
24
    License Header, with the fields enclosed by brackets [] replaced by
25
    your own identifying information:
26
    "Portions Copyrighted [year] [name of copyright owner]"
27
28
    Contributor(s):
29
30
    The Original Software is NetBeans. The Initial Developer of the Original
31
    Software is Oracle. Portions Copyright 2013-2016 Oracle. All Rights Reserved.
32
33
    If you wish your version of this file to be governed by only the CDDL
34
    or only the GPL Version 2, indicate your decision by adding
35
    "[Contributor] elects to include this software in this distribution
36
    under the [CDDL or GPL Version 2] license." If you do not indicate a
37
    single choice of license, a recipient has the option to distribute
38
    your version of this file under either the CDDL, the GPL Version 2 or
39
    to extend the choice of license to its licensees as provided above.
40
    However, if you add GPL Version 2 code and therefore, elected the GPL
41
    Version 2 license, then the option applies only if the new code is
42
    made subject to such option by the copyright holder.
43
44
-->
45
<!DOCTYPE html>
46
<html>
47
    <head>
48
        <title></title>
49
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
50
    </head>
51
    <body>
52
        <div>Entry point to the 
53
            <a href="KnockoutTCK.html">test compatibility kit</a>.
54
        </div>
55
    </body>
56
</html>
(-)a/json/pom.xml (-2 / +2 lines)
Lines 48-58 Link Here
48
  <parent>
48
  <parent>
49
    <groupId>org.netbeans.html</groupId>
49
    <groupId>org.netbeans.html</groupId>
50
    <artifactId>pom</artifactId>
50
    <artifactId>pom</artifactId>
51
    <version>2.0-SNAPSHOT</version>
51
    <version>1.4</version>
52
  </parent>
52
  </parent>
53
  <groupId>org.netbeans.html</groupId>
53
  <groupId>org.netbeans.html</groupId>
54
  <artifactId>net.java.html.json</artifactId>
54
  <artifactId>net.java.html.json</artifactId>
55
  <version>2.0-SNAPSHOT</version>
55
  <version>1.4</version>
56
  <packaging>bundle</packaging>
56
  <packaging>bundle</packaging>
57
  <name>JSON Model in Java</name>
57
  <name>JSON Model in Java</name>
58
  <url>http://maven.apache.org</url>
58
  <url>http://maven.apache.org</url>
(-)a/json/src/main/java/org/netbeans/html/json/impl/ModelProcessor.java (-1 / +8 lines)
Lines 1315-1328 public final class ModelProcessor extends AbstractProcessor { Link Here
1315
                }
1315
                }
1316
            }
1316
            }
1317
            String n = e.getSimpleName().toString();
1317
            String n = e.getSimpleName().toString();
1318
            String c = inPckName(clazz, false);
1318
            if (isWebSocket) {
1319
            if (isWebSocket) {
1319
                body.append("  /** Performs WebSocket communication. Call with <code>null</code> data parameter\n");
1320
                body.append("  /** Performs WebSocket communication and then calls {@link ");
1321
                body.append(c).append("#").append(n).append("}.\n");
1322
                body.append("  * Call with <code>null</code> data parameter\n");
1320
                body.append("  * to open the connection (even if not required). Call with non-null data to\n");
1323
                body.append("  * to open the connection (even if not required). Call with non-null data to\n");
1321
                body.append("  * send messages to server. Call again with <code>null</code> data to close the socket.\n");
1324
                body.append("  * send messages to server. Call again with <code>null</code> data to close the socket.\n");
1322
                body.append("  */\n");
1325
                body.append("  */\n");
1323
                if (onR.headers().length > 0) {
1326
                if (onR.headers().length > 0) {
1324
                    error("WebSocket spec does not support headers", e);
1327
                    error("WebSocket spec does not support headers", e);
1325
                }
1328
                }
1329
            } else {
1330
                body.append("  /** Performs network communication and then calls {@link ");
1331
                body.append(c).append("#").append(n).append("}.\n");
1332
                body.append("  */\n");
1326
            }
1333
            }
1327
            body.append("  public void ").append(n).append("(");
1334
            body.append("  public void ").append(n).append("(");
1328
            StringBuilder urlBefore = new StringBuilder();
1335
            StringBuilder urlBefore = new StringBuilder();
(-)a/json/src/main/resources/org/netbeans/html/json/spi/package.html (-59 lines)
Lines 1-59 Link Here
1
<!--
2
3
    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
5
    Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
6
7
    Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8
    Other names may be trademarks of their respective owners.
9
10
    The contents of this file are subject to the terms of either the GNU
11
    General Public License Version 2 only ("GPL") or the Common
12
    Development and Distribution License("CDDL") (collectively, the
13
    "License"). You may not use this file except in compliance with the
14
    License. You can obtain a copy of the License at
15
    http://www.netbeans.org/cddl-gplv2.html
16
    or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
17
    specific language governing permissions and limitations under the
18
    License.  When distributing the software, include this License Header
19
    Notice in each file and include the License file at
20
    nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
21
    particular file as subject to the "Classpath" exception as provided
22
    by Oracle in the GPL Version 2 section of the License file that
23
    accompanied this code. If applicable, add the following below the
24
    License Header, with the fields enclosed by brackets [] replaced by
25
    your own identifying information:
26
    "Portions Copyrighted [year] [name of copyright owner]"
27
28
    Contributor(s):
29
30
    The Original Software is NetBeans. The Initial Developer of the Original
31
    Software is Oracle. Portions Copyright 2013-2016 Oracle. All Rights Reserved.
32
33
    If you wish your version of this file to be governed by only the CDDL
34
    or only the GPL Version 2, indicate your decision by adding
35
    "[Contributor] elects to include this software in this distribution
36
    under the [CDDL or GPL Version 2] license." If you do not indicate a
37
    single choice of license, a recipient has the option to distribute
38
    your version of this file under either the CDDL, the GPL Version 2 or
39
    to extend the choice of license to its licensees as provided above.
40
    However, if you add GPL Version 2 code and therefore, elected the GPL
41
    Version 2 license, then the option applies only if the new code is
42
    made subject to such option by the copyright holder.
43
44
-->
45
<!DOCTYPE html>
46
<html>
47
    <head>
48
        <title></title>
49
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
50
    </head>
51
    <body>
52
        <div>Implement 
53
            <a href="Technology.html">Technology</a> and
54
            <a href="Transfer.html">Transfer</a> and use 
55
            <a href="ContextBuilder.html">ContextBuilder</a> to create an instance
56
            of <code>Context</code> representing your technology.
57
        </div>
58
    </body>
59
</html>
(-)a/ko-felix-test/pom.xml (-1 / +1 lines)
Lines 48-54 Link Here
48
    <parent>
48
    <parent>
49
        <groupId>org.netbeans.html</groupId>
49
        <groupId>org.netbeans.html</groupId>
50
        <artifactId>pom</artifactId>
50
        <artifactId>pom</artifactId>
51
        <version>2.0-SNAPSHOT</version>
51
        <version>1.4</version>
52
    </parent>
52
    </parent>
53
    <name>KO Tests in Felix OSGi Container</name>
53
    <name>KO Tests in Felix OSGi Container</name>
54
    <artifactId>ko-felix-test</artifactId>
54
    <artifactId>ko-felix-test</artifactId>
(-)a/ko-osgi-test/pom.xml (-1 / +1 lines)
Lines 48-54 Link Here
48
    <parent>
48
    <parent>
49
        <groupId>org.netbeans.html</groupId>
49
        <groupId>org.netbeans.html</groupId>
50
        <artifactId>pom</artifactId>
50
        <artifactId>pom</artifactId>
51
        <version>2.0-SNAPSHOT</version>
51
        <version>1.4</version>
52
    </parent>
52
    </parent>
53
    <name>KO Tests in Equinox OSGi Container</name>
53
    <name>KO Tests in Equinox OSGi Container</name>
54
    <artifactId>ko-osgi-test</artifactId>
54
    <artifactId>ko-osgi-test</artifactId>
(-)a/ko-ws-tyrus/pom.xml (-2 / +2 lines)
Lines 48-58 Link Here
48
  <parent>
48
  <parent>
49
    <groupId>org.netbeans.html</groupId>
49
    <groupId>org.netbeans.html</groupId>
50
    <artifactId>pom</artifactId>
50
    <artifactId>pom</artifactId>
51
    <version>2.0-SNAPSHOT</version>
51
    <version>1.4</version>
52
  </parent>
52
  </parent>
53
  <groupId>org.netbeans.html</groupId>
53
  <groupId>org.netbeans.html</groupId>
54
  <artifactId>ko-ws-tyrus</artifactId>
54
  <artifactId>ko-ws-tyrus</artifactId>
55
  <version>2.0-SNAPSHOT</version>
55
  <version>1.4</version>
56
  <packaging>bundle</packaging>
56
  <packaging>bundle</packaging>
57
  <name>Tyrus Based WebSockets</name>
57
  <name>Tyrus Based WebSockets</name>
58
  <url>http://maven.apache.org</url>
58
  <url>http://maven.apache.org</url>
(-)a/ko4j/pom.xml (-2 / +8 lines)
Lines 48-58 Link Here
48
  <parent>
48
  <parent>
49
    <groupId>org.netbeans.html</groupId>
49
    <groupId>org.netbeans.html</groupId>
50
    <artifactId>pom</artifactId>
50
    <artifactId>pom</artifactId>
51
    <version>2.0-SNAPSHOT</version>
51
    <version>1.4</version>
52
  </parent>
52
  </parent>
53
  <groupId>org.netbeans.html</groupId>
53
  <groupId>org.netbeans.html</groupId>
54
  <artifactId>ko4j</artifactId>
54
  <artifactId>ko4j</artifactId>
55
  <version>2.0-SNAPSHOT</version>
55
  <version>1.4</version>
56
  <packaging>bundle</packaging>
56
  <packaging>bundle</packaging>
57
  <name>Knockout.js for Java</name>
57
  <name>Knockout.js for Java</name>
58
  <url>http://maven.apache.org</url>
58
  <url>http://maven.apache.org</url>
Lines 140-145 Link Here
140
    </dependency>
140
    </dependency>
141
    <dependency>
141
    <dependency>
142
      <groupId>org.netbeans.html</groupId>
142
      <groupId>org.netbeans.html</groupId>
143
      <artifactId>ko4j</artifactId>
144
      <scope>provided</scope>
145
      <version>1.3</version>
146
    </dependency>
147
    <dependency>
148
      <groupId>org.netbeans.html</groupId>
143
      <artifactId>net.java.html.boot</artifactId>
149
      <artifactId>net.java.html.boot</artifactId>
144
      <version>${project.version}</version>
150
      <version>${project.version}</version>
145
      <type>jar</type>
151
      <type>jar</type>
(-)a/ko4j/src/main/java/org/netbeans/html/ko4j/Knockout.java (-1 / +1 lines)
Lines 72-78 final class Knockout extends WeakReference<Object> { Link Here
72
        "if (property === null) ret = object;\n" + 
72
        "if (property === null) ret = object;\n" + 
73
        "else if (object === null) ret = null;\n" + 
73
        "else if (object === null) ret = null;\n" + 
74
        "else ret = object[property];\n" + 
74
        "else ret = object[property];\n" + 
75
        "return ret ? ko.utils.unwrapObservable(ret) : null;"
75
        "return ret ? ko['utils']['unwrapObservable'](ret) : null;"
76
    )
76
    )
77
    static Object getProperty(Object object, String property) {
77
    static Object getProperty(Object object, String property) {
78
        return null;
78
        return null;
(-)a/pom.xml (-5 / +14 lines)
Lines 47-53 Link Here
47
  <modelVersion>4.0.0</modelVersion>
47
  <modelVersion>4.0.0</modelVersion>
48
  <groupId>org.netbeans.html</groupId>
48
  <groupId>org.netbeans.html</groupId>
49
  <artifactId>pom</artifactId>
49
  <artifactId>pom</artifactId>
50
  <version>2.0-SNAPSHOT</version>
50
  <version>1.4</version>
51
  <packaging>pom</packaging>
51
  <packaging>pom</packaging>
52
  <name>HTML APIs via Java</name>
52
  <name>HTML APIs via Java</name>
53
  <parent> 
53
  <parent> 
Lines 79-85 Link Here
79
    <module>ko-osgi-test</module>
79
    <module>ko-osgi-test</module>
80
    <module>equinox-agentclass-hook</module>
80
    <module>equinox-agentclass-hook</module>
81
    <module>boot-script</module>
81
    <module>boot-script</module>
82
    <!--
82
    <module>boot-truffle</module>
83
    <module>boot-truffle</module>
84
    -->
83
    <module>boot-agent-test</module>
85
    <module>boot-agent-test</module>
84
    <module>xhr4j</module>
86
    <module>xhr4j</module>
85
  </modules>
87
  </modules>
Lines 95-104 Link Here
95
      <url>http://netbeans.org</url>
97
      <url>http://netbeans.org</url>
96
  </organization>
98
  </organization>
97
  <scm>
99
  <scm>
98
      <connection>scm:hg:https://hg.netbeans.org/html4j</connection>
100
      <connection>scm:git:https://github.com/jtulach/html-java-api.git</connection>
99
      <developerConnection>scm:hg:https://hg.netbeans.org/html4j</developerConnection>
101
      <developerConnection>scm:git:https://github.com/jtulach/html-java-api.git</developerConnection>
100
      <url>https://hg.netbeans.org/html4j</url>
102
      <url>https://github.com/jtulach/html-java-api</url>
101
      <tag>default</tag>
103
      <tag>release-1.4</tag>
102
  </scm>
104
  </scm>
103
  <repositories>
105
  <repositories>
104
      <repository>
106
      <repository>
Lines 199-204 org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context. Link Here
199
                    <link>http://bits.netbeans.org/8.0/javadoc/org-openide-util-lookup/</link>
201
                    <link>http://bits.netbeans.org/8.0/javadoc/org-openide-util-lookup/</link>
200
                    <link>http://docs.oracle.com/javase/8/javafx/api/</link>
202
                    <link>http://docs.oracle.com/javase/8/javafx/api/</link>
201
                </links>              
203
                </links>              
204
                <doclet>org.apidesign.javadoc.codesnippet.Doclet</doclet>
205
                <docletArtifact>
206
                    <groupId>org.apidesign.javadoc</groupId>
207
                    <artifactId>codesnippet-doclet</artifactId>
208
                    <version>0.20</version>
209
                </docletArtifact>
210
                <additionalparam>-snippetpath "${basedir}"</additionalparam>
202
              </configuration>
211
              </configuration>
203
            </plugin>
212
            </plugin>
204
            <plugin>
213
            <plugin>
(-)a/sound/pom.xml (-3 / +3 lines)
Lines 48-58 Link Here
48
    <parent>
48
    <parent>
49
        <groupId>org.netbeans.html</groupId>
49
        <groupId>org.netbeans.html</groupId>
50
        <artifactId>pom</artifactId>
50
        <artifactId>pom</artifactId>
51
        <version>2.0-SNAPSHOT</version>
51
        <version>1.4</version>
52
    </parent>
52
    </parent>
53
    <groupId>org.netbeans.html</groupId>
53
    <groupId>org.netbeans.html</groupId>
54
    <artifactId>net.java.html.sound</artifactId>
54
    <artifactId>net.java.html.sound</artifactId>
55
    <version>2.0-SNAPSHOT</version>
55
    <version>1.4</version>
56
    <packaging>bundle</packaging>
56
    <packaging>bundle</packaging>
57
    <name>Sound API via HTML</name>
57
    <name>Sound API via HTML</name>
58
    <url>http://maven.apache.org</url>
58
    <url>http://maven.apache.org</url>
Lines 81-87 Link Here
81
        <dependency>
81
        <dependency>
82
            <groupId>org.netbeans.html</groupId>
82
            <groupId>org.netbeans.html</groupId>
83
            <artifactId>net.java.html.boot</artifactId>
83
            <artifactId>net.java.html.boot</artifactId>
84
            <version>2.0-SNAPSHOT</version>
84
            <version>1.4</version>
85
            <type>jar</type>
85
            <type>jar</type>
86
        </dependency>
86
        </dependency>
87
        <dependency>
87
        <dependency>
(-)a/src/main/javadoc/overview.html (-23 / +46 lines)
Lines 81-91 Link Here
81
        <a href="net/java/html/js/package-summary.html#undefined">treated as null</a>.
81
        <a href="net/java/html/js/package-summary.html#undefined">treated as null</a>.
82
        Better behavior under <a target="_blank" href="https://netbeans.org/bugzilla/show_bug.cgi?id=259132">
82
        Better behavior under <a target="_blank" href="https://netbeans.org/bugzilla/show_bug.cgi?id=259132">
83
        multi-threaded load</a>.
83
        multi-threaded load</a>.
84
        <!--
84
        Integration with <a href="net/java/html/boot/truffle/package-summary.html">Truffle</a>.
85
        Integration with <a href="net/java/html/boot/truffle/package-summary.html">Truffle</a>.
86
        <a target="_blank" href="https://netbeans.org/bugzilla/show_bug.cgi?id=269549"/>
87
        -->
88
        Workaround</a> for garbage collector behavior of modern JavaFX WebView
89
        implementations (JDK8 u112 and newer).
90
        JavaFX Presenter can
91
        <a target="_blank" href="https://netbeans.org/bugzilla/show_bug.cgi?id=269456"/>
92
        show popup</a> window.
93
        Development has switched to
94
        <a target="_blank" href="https://github.com/jtulach/html-java-api/"/>
95
        Git repository</a> thanks to
96
        <a target="_blank" href="http://wiki.apidesign.org/wiki/Apache"/>
97
        conversion by Emilian Bold</a>.
98
        Better support for obfuscation of knockout module
99
        (bug <a target="_blank" href="https://netbeans.org/bugzilla/show_bug.cgi?id=270013"/>
100
        270013</a>).
101
85
102
86
        <h3>Improvements in version 1.3</h3>
103
        <h3>Improvements in version 1.3</h3>
87
104
88
        {@link net.java.html.json.Model Model classes} can have 
105
        {@link net.java.html.json.Model Model classes} can have
89
        {@link net.java.html.json.Model#instance() per-instance private data}.
106
        {@link net.java.html.json.Model#instance() per-instance private data}.
90
        {@link net.java.html.json.Model Model classes} can generate
107
        {@link net.java.html.json.Model Model classes} can generate
91
        builder-like construction methods if builder
108
        builder-like construction methods if builder
Lines 124-131 Link Here
124
        of CORS</a> by handling the {@link net.java.html.json.OnReceive}
141
        of CORS</a> by handling the {@link net.java.html.json.OnReceive}
125
        connections in Java.
142
        connections in Java.
126
143
144
        <h3>What's new in older versions?</h3>
145
146
        <p>
147
        Click the
148
        <a href="#" onclick="return showHistoric(true)">link</a>
149
        to view even more
150
        <a href="#" onclick="return showHistoric(true)">historic changes</a>...
151
        </p>
152
153
        <a name="historic.changes"></a>
154
        <div id="historic.changes">
155
            <script>
156
            function showHistoric(show) {
157
                var e = document.getElementById("historic.changes");
158
                if (show) {
159
                    e.style.display="block";
160
                } else {
161
                    e.style.display="none";
162
                }
163
                return false;
164
            }
165
            showHistoric(false);
166
            </script>
167
127
        <h3>What's Been Improved in Version 1.2.3?</h3>
168
        <h3>What's Been Improved in Version 1.2.3?</h3>
128
169
170
        <p>
129
        One can control {@link net.java.html.json.OnReceive#headers() HTTP request headers}
171
        One can control {@link net.java.html.json.OnReceive#headers() HTTP request headers}
130
        when connecting to server using the {@link net.java.html.json.OnReceive}
172
        when connecting to server using the {@link net.java.html.json.OnReceive}
131
        annotation. It is possible to have
173
        annotation. It is possible to have
Lines 137-142 Link Here
137
        demonstrates.
179
        demonstrates.
138
        Bugfix of issues <a target="_blank" href='https://netbeans.org/bugzilla/show_bug.cgi?id=250503'>250503</a>,
180
        Bugfix of issues <a target="_blank" href='https://netbeans.org/bugzilla/show_bug.cgi?id=250503'>250503</a>,
139
        <a target="_blank" href='https://netbeans.org/bugzilla/show_bug.cgi?id=252987'>252987</a>.
181
        <a target="_blank" href='https://netbeans.org/bugzilla/show_bug.cgi?id=252987'>252987</a>.
182
        </p>
140
183
141
        <h3>What's New in Version 1.1?</h3>
184
        <h3>What's New in Version 1.1?</h3>
142
185
Lines 211-237 Link Here
211
            prevent endless debugging when one forgets to do so.
254
            prevent endless debugging when one forgets to do so.
212
        </p>
255
        </p>
213
256
214
        <p>
215
        What's new in older versions? Click the
216
        <a href="#" onclick="return showHistoric(true)">link</a>
217
        to view even more
218
        <a href="#" onclick="return showHistoric(true)">historic changes</a> below:
219
        </p>
220
221
        <a name="historic.changes"></a>
222
        <div id="historic.changes">
223
            <script>
224
            function showHistoric(show) {
225
                var e = document.getElementById("historic.changes");
226
                if (show) {
227
                    e.style.display="block";
228
                } else {
229
                    e.style.display="none";
230
                }
231
                return false;
232
            }
233
            showHistoric(false);
234
            </script>
235
257
236
        <h3>What's New in Version 0.9?</h3>
258
        <h3>What's New in Version 0.9?</h3>
237
259
Lines 349-355 Link Here
349
$ mvn archetype:generate \
371
$ mvn archetype:generate \
350
 -DarchetypeGroupId=com.dukescript.archetype \
372
 -DarchetypeGroupId=com.dukescript.archetype \
351
 -DarchetypeArtifactId=knockout4j-archetype \
373
 -DarchetypeArtifactId=knockout4j-archetype \
352
 -DarchetypeVersion=0.11 <em># or newer version, if available</em>
374
 -DarchetypeVersion=0.16 <em># or newer version, if available</em>
353
        </pre>
375
        </pre>
354
        Answer few questions (for example choose <em>myfirstbrwsrpage</em> as artifactId)
376
        Answer few questions (for example choose <em>myfirstbrwsrpage</em> as artifactId)
355
        and then you can:
377
        and then you can:
Lines 608-613 $ ls client/src/main/webapp/pages/index.html Link Here
608
        online:
630
        online:
609
        <ul>
631
        <ul>
610
            <li>Current <a target="_blank" href="http://bits.netbeans.org/html+java/dev/">development</a> version
632
            <li>Current <a target="_blank" href="http://bits.netbeans.org/html+java/dev/">development</a> version
633
            <li>Version <a target="_blank" href="http://bits.netbeans.org/html+java/1.3">1.3</a>
611
            <li>Version <a target="_blank" href="http://bits.netbeans.org/html+java/1.2.3">1.2.3</a>
634
            <li>Version <a target="_blank" href="http://bits.netbeans.org/html+java/1.2.3">1.2.3</a>
612
            <li>Version <a target="_blank" href="http://bits.netbeans.org/html+java/1.1">1.1</a>
635
            <li>Version <a target="_blank" href="http://bits.netbeans.org/html+java/1.1">1.1</a>
613
            <li>Version <a target="_blank" href="http://bits.netbeans.org/html+java/1.0">1.0</a>
636
            <li>Version <a target="_blank" href="http://bits.netbeans.org/html+java/1.0">1.0</a>
(-)a/xhr4j/pom.xml (-2 / +2 lines)
Lines 48-58 Link Here
48
  <parent>
48
  <parent>
49
    <groupId>org.netbeans.html</groupId>
49
    <groupId>org.netbeans.html</groupId>
50
    <artifactId>pom</artifactId>
50
    <artifactId>pom</artifactId>
51
    <version>2.0-SNAPSHOT</version>
51
    <version>1.4</version>
52
  </parent>
52
  </parent>
53
  <groupId>org.netbeans.html</groupId>
53
  <groupId>org.netbeans.html</groupId>
54
  <artifactId>xhr4j</artifactId>
54
  <artifactId>xhr4j</artifactId>
55
  <version>2.0-SNAPSHOT</version>
55
  <version>1.4</version>
56
  <packaging>bundle</packaging>
56
  <packaging>bundle</packaging>
57
  <name>XHR via Java</name>
57
  <name>XHR via Java</name>
58
  <url>http://maven.apache.org</url>
58
  <url>http://maven.apache.org</url>

Return to bug 270096