Benno is right, it’s already there. We’re happily using a combination of Java for the logic and HTML/JS for the views.
But there’s also the possibility to write code in HTML/JS if you prefer. The „Wizard Wizard“ is a good starting point. You can either write your Wizard completely in HTML/JS or bind the HTML to Java using Knockout. Also when you use the wizard for creating a new „portable HTML UI“ TopComponent, you can either use the HTML/Java API and bind the View to the (Java) ViewModel using knockout or code everything in JS inside the HTML API with occasional callbacks to Java. The HTML-Renderer used in the TC is a JavaFX WebView. The most basic part of HTML/Java API is the @JavaScriptBody annotation (http://bits.netbeans.org/html4j/1.3/net/java/html/js/package-summary.html) , which enables typesafe calls from Java to JavaScript. If you want to learn more about the API download this book (free with this link): https://leanpub.com/dukescript/c/whitepaper Cheers Toni Am 19.12.16, 18:17 schrieb "Emilian Bold" unter <[email protected]>: >I can certainly imagine an HTML UI for some existing parts of NetBeans >even >if we keep it pure Java. > >But once we do have JavaScript modules (like I'm suggesting here) the next >step will naturally be to use HTML for the UI instead of Swing. > > >În lun., 19 dec. 2016 la 17:08 Christian Lenz <[email protected]> a >scris: > >> For sure, but my plugins need a UIs and I really would like to use HTML >> for this. So it should be possible to use a Swing or JavaFX WebView to >> render that stuff. >> >> Like in Cordova/Phonegap and I think Electron does the same. >>NativeScript >> not, they will build it 1-to-1 to native elements and use XML. But for >>me I >> would like to have a markup that I can use and for me as a >>webdeveloper, it >> is HTML. >> >> >> >> >> >> >> >> Gesendet: Montag, 19. Dezember 2016 um 15:55 Uhr >> >> Von: "Emilian Bold" <[email protected]> >> >> An: [email protected] >> >> Betreff: Re: Scriptable NetBeans Modules >> >> All of Geertjan's articles are about the module author manually invoking >> >> the ScriptEngine. >> >> >> >> What I want is all of that to be included in the NetBeans Module System. >> >> >> >> So you could have pure Javascript modules with no Java at all. >> >> >> >> Note that the Javascript code will still be invoked by Nashorn in the >>Java >> >> runtime and will have to talk to Java APIs. >> >> >> >> So, this is not about replacing Swing with another Javascript UI. >>Although >> >> that would be an interesting feat! We could mix Swing with a browser two >> >> ways: either we embed the browser into the Swing tree (via the JavaFX >> >> WebView or something better) or we embed Swing into the browser (via an >> >> applet or something like http://webswing.org/ ). >> >> >> >> Anyhow, there are a lot of plugins that don't need an UI or that could >>call >> >> Swing from Javascript. >> >> >> >> And, of course, one could imagine hybrid modules, where you have Java >>code >> >> (perhaps in a wrapped library initially) and Javascript code intermixed. >> >> >> >> >> >> >> >> --emi >> >> >> >> On Mon, Dec 19, 2016 at 4:21 PM, Christian Lenz <[email protected]> >> >> wrote: >> >> >> >> > Sounds great, Geertjan wrote articles, how to create plugins with JS. >> >> > >> >> > JavaScript in JavaFX (Has nothing todo with NetBeans yet): >> >> > >> >>https://blogs.oracle.com/geertjan/entry/javafx_in_javascript[https://blog >>s.oracle.com/geertjan/entry/javafx_in_javascript] >> >> > Combining Nashorn Scripting with JavaFX (Has nothing todo with >>NetBeans >> >> > yet): >> >>https://blogs.oracle.com/geertjan/entry/combining_[https://blogs.oracle.c >>om/geertjan/entry/combining_] >> >> > nashorn_scripting_with_javafx >> >> > Extending NetBeans with Nashorn (Yes possible): >> https://blogs.oracle.com/[https://blogs.oracle.com/] >> >> > geertjan/entry/extending_netbeans_with_nashorn >> >> > >> >> > so with the last article it is possible to extend NetBeans with JS, I >> >> > tried a bit but I really need to have a view with XML or HTML, >>because it >> >> > is a mess and a pain in the ass to write new Button, new Label, new >> >> > Everything, inside a JS file. So it has to be possible to create View >> files >> >> > like MyWindow.xml or MyWindow.html and a js file behind like >>MyWindow.js >> >> > and for sure .css too. >> >> > >> >> > If this is possible, that would be great. This would be the same as >>with >> >> > Electron (http://electron.atom.io[http://electron.atom.io]) or >> NativeScript ( >> >> > https://www.nativescript.org/[https://www.nativescript.org/]) >> >> > But we need more info for this. >> >> > >> >> > >> >> > Cheers >> >> > >> >> > Chris >> >> > >> >> > >> >> > >> >> > Gesendet: Montag, 19. Dezember 2016 um 14:47 Uhr >> >> > Von: "Emilian Bold" <[email protected]> >> >> > An: [email protected] >> >> > Cc: [email protected] >> >> > Betreff: Scriptable NetBeans Modules >> >> > Hello, >> >> > >> >> > I think it would be useful to provide a bridge for NetBeans modules >>done >> >> > with scripting languages. >> >> > >> >> > Javascript is the prime candindate since we have Nashorn at JRE level, >> but >> >> > I assume once the hooks are in place more languages will be supported. >> >> > >> >> > The way I expect it to work is to use JAR files but in the MANIFEST >>add >> >> > >> >> > OpenIDE-Module-ScriptEngine: nashorn >> >> > >> >> > then all class references will be interpreted through the script >>engine. >> >> > >> >> > So, I could have >> >> > >> >> > OpenIDE-Module-Install: ro/emilianbold/js/install.js >> >> > >> >> > Then in META-INF/services/name.of.Class I could add >> >> > >> >> > ro/emilianbold/js/myservice.js >> >> > >> >> > For layer .instance file we could have another attribute like >> >> > >> >> > <file name="x.instance"> >> >> > <attr name="instanceScript" >> >> > stringvalue="ro/emilianbold/js/serviceimpl.js"/> >> >> > </file> >> >> > >> >> > or maybe register the extension and treat .EXT.instance as a script: >> >> > >> >> > OpenIDE-Module-ScriptExtension: js >> >> > <file name="ro-emilianbold-js-serviceimpl.js.instance" /> >> >> > >> >> > Were there some prior attempts towards something like this? >> >> > >> >> > Does anybody want to help me spec this out and write some prototype? >> >> > >> >> > One area that will be sub-optimal is lazy-loading: I believe the >>module >> >> > system used reflection to instantiate lazily services. This will not >>work >> >> > for scripts as they will have to be loaded and executed. Still, I >>believe >> >> > this will be manageable. >> >> > >> >> > PS: Also CCing [email protected] >> >> > >> >> > --emi >> >> > >> >>
