Česky   |  Deutsch   |  English   |  Español   |  Français   |  Indonesia   |  日本語   |  한글   |  Polski   |  Português (BR)   |  Türkçe   |  中文   |  正體中文   |  Your Language  
PlanetNetbeans
Planet NetBeans is an aggregation of NetBeans related musings from all over the Blogosphere.
Feeds
[RSS 1.0 Feed] [RSS 2.0 Feed]
[FOAF Subscriptions] [OPML Subscriptions]
Do you blog about NetBeans ? Add your blog to PlanetNetBeans.
Feed Subscriptions
APIDesign - Blogs (feed)
David R. Heffelfinger (feed)
Carsten Zerbst's Weblog (feed)
Winston Prakash's Weblog (feed)
NetBeans – Michael's blog (feed)
DukeScript (feed)
ProNetBeans (feed)
Paulo Canedo » NetBeans English (feed)
Anchialas' Java Blog (feed)
markiewb's blog (feed)
Need to find a title (feed)
Category: NetBeans | Software and Science (feed)
Roger Searjeant's blog (feed)
Inspiration and Expression » Netbeans (feed)
Adam Bien (feed)
Bernhard's Weblog (feed)
Michel Graciano's Weblog (feed)
Ramon.Ramos (feed)
Ozone and Programming » netbeans (feed)
NetBeans Ruminations » NetBeans (feed)
NetBeans – Java PDF Blog (feed)
Arun Gupta, Miles to go ... (feed)
Geertjan's Blog (feed)
.JARa's Bilingual Weblog (feed)
JavaFX Composer (feed)
The Java Jungle (feed)
Jesse Glick (feed)
Martin Grebac (feed)
The NetBeans Community Podcast (feed)
NetBeans Profiler (feed)
NetBeans for PHP (feed)
NetBeans Web Client (feed)
Rechtacek's (feed)
Virtual Steve (feed)
The Aquarium (feed)
Tinuola Awopetu (feed)
Insert Witty Irony Here (feed)
Netbeans – Gualtiero Testa (feed)
netbeans – James Selvakumar’s Blog (feed)
NetBeans – nB gUru (feed)
netbeans – Newsintegrator Blog (feed)
NetBeans – Praxis LIVE (feed)
NetBeans – TechAshram (feed)
Netbeans – There's no place like 127.0.0.1 (feed)
Anuradha (feed)
Netbeans6/6.5 my best practices (feed)
Java Evangelist John Yeary (feed)
Neil's Dev Stuff (feed)
Computer says null; (feed)
NetBeans Adventures, Java and more (feed)
NetBeans – John O'Conner (feed)
Bistro! 2.0 (feed)
NetBeans Community Docs Blog (feed)
The Netbeans Experience (feed)
NbPython/ jpydbg / pymvs (feed)
Wade Chandler's Programming Blog (feed)
Devlin's Lab (feed)
Big Al's Blog (feed)
Code Snakes (feed)
In perfect (spherical) shape (feed)
Van Couvering Is Not a Verb (feed)
Diego Torres Milano's blog (feed)
Vroom Framework (feed)
Messages from mrhaki (feed)
Jeff's Blog (feed)
Manikantan's Netbeans (feed)
Oliver Wahlen's Blog (feed)
Shuttle between Galaxies (feed)
Shanbag's Blog (ರಜತ ಲೋಕ) (feed)
Welcome to my live... (feed)
Netbeans IDE Blog by Tushar Joshi, Nagpur (feed)
Devel Blog (feed)
diamond-powder (feed)
Antonio's blog (feed)
Where's my Blog?!

Powered by:    Planet

Last updated:
June 29, 2016 06:04 AM
All times are UTC

Sponsored by
sponsored by Oracle

visit NetBeans website
NetBeans – Java PDF Blog - June 28, 2016 01:20 PM
NetCat 8.2 – what it is and why you should care…

NetCat 8.2, not just about Cats on the Net……

Today sees the start of the NetCat 8.2 test program.

NetCat is the Community Test program that Oracle runs for each new release of NetBeans once it has completed its development and internal testing. It is only when you ask real users to use software that you find the real issues….

NetCat programs have run on previous releases of NetBeans, and one of the reasons why it is such a solid platform.

So what does it involve?

NetCat testing involves spending some time running though a test script. If you do A, B and C then does D happen. This is a really good way to get a better understanding of both the NetBeans IDE and the feature you are testing.

So why should you get involved?

Here are my top reasons for being involved….

1. It gives you a much  deeper understanding of the NetBeans IDE. 

I have been involved in the NetCat testing program since 7.4 It has given me a much better understanding of what NetBeans can do and I now write better code faster. NetCat testing of features means I now know many of the features which are hidden inside NetBeans and how to use them. I have recouped the time invested in testing many times over with my better coding skills.

2. It gives you a deeper understanding of testing.

Being part of the NetBeans test program has given us a much better of idea of how we can test and improve how we develop and test our own software.

3. We get a reliable platform for our coding.

NetBeans is a critical tool for our software development. While the tool is free, if it is buggy, slow or unreliable, this is a significant cost to us. As part of the NetCat program, we know that the next release will be very usable for us and we know what all the new feature are.

4. Cool swag.

As a thank-you for being involved, the testers all get free t-shirts, or other items (it varies with each release).

So how can you get involved?

That is easy….

You can sign-up for NetCat here.

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (TwitterFacebook and Google+) or the  Blog RSS.

Related Posts:

The post NetCat 8.2 – what it is and why you should care… appeared first on Java PDF Blog and was written by Mark Stephens.

Adam Bien - June 28, 2016 09:41 AM
The Enterprise Java Future Is Bright: Java EE 8 MicroProfile Launched

During the DevNation conference at 27.06.2016 in San Francisco, Red Hat, IBM, Payara, Tomitribe, LJC (additional surprises are possible :-)) announced the availability of the Java EE 8 MicroProfile (at 36m, after the announcement of commercial support of Java EE 7 for JBoss):

See also related blog posts: RedHat, IBM, Payara, TomEE.

What's inside? Right now it is an essential set of JSRs: CDI, JAX-RS and JSON-P (inclusion of Bean Validation 2.0 is also considered). Anything else is going to be decided by the community (join the discussion). The Microprofile Dockerfiles of the supporting vendors are expected to arrive soon.

The Java EE 8 microprofile.io focusses on productivity and "cloud-native" / microservices readiness in high-density scenarios. Before you start solving problems you don't have, consider that "fully loaded" application servers are already surprisingly small, particularly on docker.

See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Java EE 7 Microservices, or online: javaeemicro.services


Real World Java EE Workshops [Airport Munich]>

NetBeans – Michael's blog - June 27, 2016 07:13 PM
NetCAT 8.2 starts

Today NetBeans Community Manager Jirí Kovalský announced that a brand new team for the NetBeans Community Acceptance Test will be formed. Joining this team is a great opportunity to improve your knowledge of software testing as well as NetBeans.All you have to do is to use the latest NetBeans build or special versions like a … Continue reading "NetCAT 8.2 starts"

Adam Bien - June 27, 2016 04:38 AM
A Code-Driven Microservices Session. From infoSharePL 2016

During the (great) infoShare 2016 conference (reminds me at the early JavaOne's), I delivered a short session as an intro to the microservice workshop afterwards:

The workshop was not recorded and comprised a constant stream of questions. However, if you are interested, attend a workshop at Munich's Airport Java EE Microservices, or online: javaeemicro.services.


Real World Java EE Workshops [Airport Munich]>

APIDesign - Blogs - June 26, 2016 08:00 PM
Make Your Builder Whine!

Another variation on the topic of builder patterns. A builder that can track N essential attributes and whine (by throwing a checked exception) until all of them are specified.

Learn how to make your builder whine!

--JaroslavTulach 20:00, 26 June 2016 (UTC)

NetBeans – Michael's blog - June 25, 2016 08:11 PM
Thank you!

Last week I requested you to check the speed of my blog. On Monday the traffic on my server was comparable to the traffic I gained for some top articles (I’m always surprised, which articles become top for you ;-)). Thus, it had been a realistic test. Thank you for testing! Some people provided me … Continue reading "Thank you!"

Adam Bien - June 23, 2016 04:36 AM
From Electronic Transactions Over Banking Services To Payment Gateways--Java EE 7 In FinTech

Jakub, please introduce yourself

Hi. I've been a Java developer for almost 10 years now, working mostly with Java EE. Here at Blue Media I'm a Software Architect who tries to stay in touch with the code.

What are you building with Java EE?

We're a company which invents and delivers our own services in so called FinTech. Blue Media is a provider of solutions for electronic transactions and online support--from the automation of home payments to complex, custom-designed electronic banking services. We're building payment gateways and software that helps people move funds from one bank to another. Everything is developed as a service that is integrated with our clients systems

How big is your team?

The team I manage comprises of 11 talented developers who are divided into 4 working groups which are handling modules of our systems. This structure allows as to cope and hand-deliver tasks with great efficiency.

Can you share with us some geeky numbers like e.g. TX per seconds, heap sizes etc -- whatever Java EE devs might find interesting.

Our biggest database hits 150 TX/s running on 64GB of RAM and 16CPUs, we're running our production systems on around 400 virtual hosts

150 tx/s does not sounds a lot. What comprises a typical transaction in your system (DB access, verification, remote communication etc.)?

A single transaction comprises of a few "jumps" between various modules (microservices) each of which usually has it's own database, so the workload is somehow distributed. For example a payment transaction is:

  1. validate (read conf from db)
  2. insert into db
  3. 5-6 updates in db later on (changing payment status, filling up payer data)
  4. external communication through JMS (internal calls) or HTTPS
  5. execute settlement (update again)
This is also distributed in time (5-10min) Highest value for TPS in our payment database I've got from Zabbix is 250

For comparison our highest throughput system running SMS Gateway (sending authorization messages for banks) has this metric at around 200, with peeks hitting 1000

Are you happy with Java EE so far?

Yes, it's a great environment to work with, provides lots of features out of the box and really simplifies development in a transaction dependent software. Otherwise I don't think I'd have stick to it for so long. I'd really encourage everyone to give it a try and see for themselves how easy it is to do things with it

Which application servers, tools or IDEs are you using?

We're running our systems on JBoss/Widlfy with Postgres as our database and ActiveMQ for JMS. We're trying to stay up-to-date with our app servers as much as we can, but to be honest we're still running few instances of old Jboss 4.2.0. On daily basis we work with Maven, GIT, Bamboo as CI and continuous delivery, Intellij IDEA is out IDE of choice, Crucible for peer code review and pgAdmin. Other tools for task management are Jira, Confluence. We're now trying to move to Docker and experiment with ELK stack which hopefully will help us handle our enviroment even better

How important are standards for you? Does your application depend on application server specific APIs?

We try to stick to standards as long as we can so we usually don’t use anything that is not specified by the core Java EE. This helps us to move to newer versions of the spec and app servers faster. Our systems were first developed using old J2EE, and we've had some trouble moving to later version but since JEE 6 it have been definitely easier. Sometimes though it is necessary to write some server specific code like for example when clustering singletons.

Which Java EE APIs are you using in your products?

JPA, JMS, JAX-RS, Bean Validation, JTA, EJB, CDI

Take a look at the Java EE 8 APIs. Which of the APIs are most interesting / important to you?

From the new features I'd go with JSR 107
As for existing things JMS 2.1, JAX-RS 2.1 and CDI 2.0 since we heavily use them in everyday development

Can you share any resources (blogs, etc feel free to promote yourself) with us?

On of my favorite places lately is HackerNews where you can find useful and interesting stuff happening in and our development world. Comments sections is really great here as well. I also like to read DaedTech which is more of a developer-philosophy blog than a technical one.

Is Blue Media hiring Java EE developers?

Yes ! If you are Java JEE developer or someone who is passionate about new technologies come and join Blue Media! We come from all places and backgrounds but we all share a passion for the future

Jakub, thank you for the interview!


Real World Java EE Workshops [Airport Munich]>

Adam Bien - June 21, 2016 06:49 AM
Singleton Pattern in ES6 and ES7


export default class Singleton {

  static instance;

  constructor(){
    if(instance){
      return instance;
    }

    this.state = "duke";
    this.instance = this;
  }

}

Now:


let first = new Singleton();
let second = new Singleton();
console.log(first===second);

//output: true

The code above uses ECMAScript 2015/ES6 (classes) and ECMAScript 2016/ES7 (static fields) features. It transcompiled, "old school" ES5 representation looks like:


	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

	var Singleton = function Singleton() {
	  _classCallCheck(this, Singleton);

	  if (instance) {
	    return instance;
	  }

	  this.state = "duke";
	  this.instance = this;
	};

	exports.default = Singleton;

See you at JavaScript Bootstrap or Building Apps with React!


Real World Java EE Workshops [Airport Munich]>

Adam Bien - June 20, 2016 02:44 AM
Platform-Neutral Microservices Discussion--DevDay 2016 Keynote

I was asked to deliver a keynote [in German] at DevDay 2016 about Microservices without mentioning "Java" too much. Partially I managed to deliver the keynote in a platform-neutral fashion :-)

See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Java EE 7 Microservices. Also checkout javaeemicro.services.


Real World Java EE Workshops [Airport Munich]>

NetBeans – Michael's blog - June 19, 2016 09:03 PM
Next version of NetBeans

NetBeans 8.2 is announced to be feature complete. The Netbeans Community Acceptance Test (NetCAT) will start soon. Try NetBeans 8.2. Get a first impression and report potential problems to the NetBeans team to make 8.2 the next great version. Read about this upcoming version at the new and noteworthy site [1].   [1] wiki.netbeans.org/NewAndNoteworthyNB82

NetBeans – Michael's blog - June 19, 2016 04:59 PM
Help needed

Hello all, Usually I write about software development, preferable JSF, Lambdas & Streams, and NetBeans. I hope, my blog is valuable and interesting for you. Now, I need your help.Last week, my internet connection had been technically updated. The upload speed was increased from 700K to 5,5M Bit per second. Thus, you should receive the … Continue reading "Help needed"

Geertjan's Blog - June 18, 2016 08:31 AM
Structuring ECMAScript 6 Modules via Babel and Webpack

Continuing from yesterday, since transpilation of ECMAScript 6 to ECMAScript 5 is needed because of the current state of browsers, and we've chosen Babel for that, and since we're using Webpack to bundle our generated ECMAScript 5 files... what would be a logical way to structure our source code so that you can easily find the code with which you need to work?

Let me suggest the following entries in package.json:

"scripts": {
    "babel": "babel public_html/js/src --presets babel-preset-es2015 --out-dir public_html/js/gen",
    "webpack": "webpack public_html/js/gen/main.js public_html/js/bundle.js"
},

What the above gives you is this:

In the "gen" folder is the output of Babel. And 'bundle.js', in the root of the "js" folder, is the result of Webpack's bundling process. They're green above because I haven't (and won't) commit them into my repo, they're simply generated whenever I need them to be. And that's a clear structure and let's me easily see what's what.

Does anyone have other/different/complementary/conflicting ideas about this structure? 

Geertjan's Blog - June 17, 2016 05:30 PM
ECMAScript 6, Modules, Babel, Webpack, and NetBeans IDE

I've been talking about modularity via Require.js in enterprise JavaScript applications for some time (because Oracle JET bundles Require.js as its modularity solution). ECMAScript 6 provides its own built-in module system and, since NetBeans IDE now provides ECMAScript 6 support (in development builds), let's rewrite my Require.js application to use ECMAScript 6 modularity.

The complete sample discussed below is here:

https://github.com/GeertjanWielenga/RequireJSSamples/tree/master/ECMAScript6Sales

Handily, you can compare the ECMAScript 6 sample above to the Require.js implementation:

https://github.com/GeertjanWielenga/RequireJSSamples/tree/master/ModularSales

...as well as the non-modular Sales application:

https://github.com/GeertjanWielenga/RequireJSSamples/tree/master/SimpleSales

Here's 'main.js':

import { buyThing } from './buyer';
name = 'John Smith';
console.log(name + " enters the system");
var result = buyThing(name);
console.log("sale success " + result);

In NetBeans, the above looks as follows:

Take note that there's the "import" keyword above, enabling me to import "buyThing" from 'buyer.js', since here there's an "export" keyword:

import { verifyName } from './authenticator';
import { sendThing } from './thing';
import { sendApology } from './thing';
export function buyThing(name) {
console.log(name + " is trying to buy"); var verified = verifyName(name); if(verified){ sendThing(name); } else { sendApology(name); } return verified; }

In NetBeans, the above looks as follows:

Notice that there are three imports above, the first of which is for 'authenticator.js', which is below...

export function verifyName(name) {
    var requiredNameLength = 1;
    console.log("authenticating " + name);
    return name.length > requiredNameLength;
}

...and here's the above in NetBeans...

...and the other two are for for 'thing.js':

export function sendThing(name){
    console.log("send thing to " + name);
}
export function sendApology(name){
    console.log("say sorry to " + name);
}

Here's the above in NetBeans:

In my 'package.json', I'm using Babel and Webpack: 

"scripts": {
    "babel": "babel public_html/js/src --presets babel-preset-es2015 --out-dir public_html/js",
    "webpack": "webpack public_html/js/main.js public_html/js/bundle.js"
},
"devDependencies": {
  "babel-cli": "^6.10.1",
  "babel-preset-es2015": "^6.9.0",
  "webpack": "^1.8.5"
}

You'll now have this:

You can run "npm install" directly in NetBeans:

You can run Babel and Webpack directly in NetBeans:

When I run Babel, the JavaScript files are transpiled to ECMAScript 5, since that's what browsers support right now. When Webpack is used, the entire application is bundled into "bundle.js", which avoids problems with the "require" keyword that you get from Babel transpilation.

Now, I refer to that one single file, i.e., "bundle.js", that you see above, in my "index.html" file.

Related reading:

APIDesign - Blogs - June 16, 2016 09:34 AM
Chameleon Builder: Changes its Return Color!

Hear the news! A new creature of the API design patterns rare species has been discovered. It looks like a builder pattern, but it ducks like something else. If you take a closer look you'll find out it is a chameleon! It changes its return type depending on its state.

Do you want to protect your own builder like a chameleon? Follow this link and learn the trick!

Once you discover the beauty, you'll not stop until you get your own chameleon builder into your own design!

--JaroslavTulach 09:34, 16 June 2016 (UTC)

Geertjan's Blog - June 16, 2016 04:33 AM
Track the Closest Beacon on Android via Cordova

I've blogged a series of articles on getting started with beacons on Android via Cordova, starting here.

The tricky bit comes in when you want to keep track of the closest beacon. Here is an approach to doing so, based on a variety of resources on-line.

References:

The code below is a subset of this example:

https://github.com/mikaelkindborg/evo-demos/tree/master/Demos2015/cordova-ibeacon

Code in the JavaScript (i.e., "viewModel") side of a JET module:

define(['ojs/ojcore', 'knockout', 'jquery'],
    function (oj, ko, $) {
        function IncidentsViewModel() {
            var self = this;
            var mNearestBeacon = null;
            var mNearestBeaconDisplayTimer = null;
            self.beaconName = ko.observable();
            self.beaconDescription = ko.observable();
            self.proximity = ko.observable();
            self.accuracy = ko.observable();
            self.rssi = ko.observable();
            var uuid1 = '0ea75ed4-ce75-4a09-bca8-f0565bae82bb';
            var major1 = 5;
            var minor1 = 2;
            var uuid2 = '0ea75ed4-ce75-4a09-bca8-f0565bae82bb';
            var major2 = 5;
            var minor2 = 3;
            var beacon1 = uuid1 + ":" + major1 + ":" + minor1;
            var beacon2 = uuid2 + ":" + major2 + ":" + minor2;
            var mRegions =
                    [
                        {
                            id: 'region1',
                            uuid: uuid1,
                            major: major1,
                            minor: minor1
                        },
                        {
                            id: 'region2',
                            uuid: uuid2,
                            major: major2,
                            minor: minor2
                        }
                    ];
            self.handleAttached = function () {
                document.addEventListener('deviceready', onDeviceReady);
            };
            self.handleDetached = function () {
                document.removeEventListener('deviceready', onDeviceReady);
                clearInterval(mNearestBeaconDisplayTimer);
                mNearestBeaconDisplayTimer = null;
            };
            function onDeviceReady()
            {
                startRanging();
                mNearestBeaconDisplayTimer = setInterval(displayNearestBeacon, 1000);
            }
            function startRanging()
            {
                function onDidRangeBeaconsInRegion(result)
                {
                    updateNearestBeacon(result.beacons);
                }
                var delegate = new cordova.plugins.locationManager.Delegate();
                cordova.plugins.locationManager.setDelegate(delegate);
                delegate.didRangeBeaconsInRegion = onDidRangeBeaconsInRegion;
                startRangingRegions(mRegions);
            }
            function startRangingRegions(regions)
            {
                for (var i in regions)
                {
                    startRangingRegion(regions[i]);
                }
            }
            function startRangingRegion(region)
            {
                var beaconRegion = new cordova.plugins.locationManager.BeaconRegion(
                        region.id,
                        region.uuid,
                        region.major,
                        region.minor);
                cordova.plugins.locationManager.startRangingBeaconsInRegion(beaconRegion)
                        .fail()
                        .done();
            }
            function getBeaconId(beacon)
            {
                return beacon.uuid + ':' + beacon.major + ':' + beacon.minor;
            }
            function isSameBeacon(beacon1, beacon2)
            {
                return getBeaconId(beacon1) === getBeaconId(beacon2);
            }
            function isNearerThan(beacon1, beacon2)
            {
                return beacon1.accuracy > 0
                        && beacon2.accuracy > 0
                        && beacon1.accuracy < beacon2.accuracy;
            }
            function updateNearestBeacon(beacons)
            {
                for (var i = 0; i < beacons.length; ++i)
                {
                    var beacon = beacons[i];
                    if (!mNearestBeacon)
                    {
                        mNearestBeacon = beacon;
                    } else
                    {
                        if (isSameBeacon(beacon, mNearestBeacon) ||
                                isNearerThan(beacon, mNearestBeacon))
                        {
                            mNearestBeacon = beacon;
                        }
                    }
                }
            }
            function displayNearestBeacon()
            {
                if (!mNearestBeacon) {
                    return;
                }
                var beaconId = getBeaconId(mNearestBeacon);
                if (beaconId === beacon1) {
                    self.beaconName('Rembrandt van Rijn');
                    self.beaconDescription('Nachtwacht');
                } else if (beaconId === beacon2) {
                    self.beaconName('Vincent van Gogh');
                    self.beaconDescription('Sunflowers');
                }
                self.proximity(mNearestBeacon.proximity);
                self.accuracy(mNearestBeacon.accuracy);
                self.rssi(mNearestBeacon.rssi);
            }
        }
        return new IncidentsViewModel;
    }
);

The above enables you to create a simple view, like this:

<h2><span data-bind="text: beaconName"></span></h2>
<h3><span data-bind="text: beaconDescription"></span></h3>
<hr>
<p><b><span data-bind="text: proximity"></span></b></p>
<p>Distance: <b><span data-bind="text: accuracy"></span></b></p>
<p>RSSI: <b><span data-bind="text: rssi"></span></b></p>

The next step is to use Oracle Mobile Cloud Service 2.0 as a beacon registry so that the UUID information does not need to be hardcoded, i.e., so that it can be managed in the Cloud.

The big problem with the code above is that it takes about 5 seconds for my app to detect the closest beacon. Maybe that means I need to finetune the beacons or maybe there's something sub-optimal about the code or maybe the beacons themselves. 

Adam Bien - June 15, 2016 03:30 AM
Headlands Firehose Edition Is Available

The "Firehose" release (v0.0.4) headlands (a JCache based in-memory grid) delivers CacheEntryEvents via WebSockets in JSON-format.

Cache change events can be received in real-time from Java clients:



import javax.websocket.ContainerProvider;
import javax.websocket.DeploymentException;
import javax.websocket.WebSocketContainer;



public class NotificationsReceiver extends Endpoint {

    @Override
    public void onOpen(Session session, EndpointConfig ec) {
        this.session = session;
        this.session.addMessageHandler(new MessageHandler.Whole<String>() {

            @Override
            public void onMessage(String msg) {
            }
        });
    }

}


WebSocketContainer containerProvider = ContainerProvider.getWebSocketContainer();
NotificationsReceiver messagesEndpoint = new NotificationsReceiver();
containerProvider.connectToServer(this.messagesEndpoint, new URI("ws://localhost:8080/headlands/firehose/" + channel));

...or JavaScript:

   this.callback = function(payload){
   
   }

  let socket = new WebSocket(`ws://${this.uri}/headlands/firehose/*`);
   socket.onmessage =  (event) => {
     this.serialize(event.data,this.callback);
   };
   socket.onopen = (event) => {
     console.log("socket connection established",event);
   };

See you at: Building HTML 5 Applications with react.js and Java EE 7 workshops at MUC Airport!


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - June 14, 2016 07:14 AM
Integrating Mapbox with Oracle JET

Mapbox is a developer platform for creating and using maps. It is based on Leaflet, which I discussed recently here.

In this article I'll show how to get started integrating Mapbox into an Oracle JET application. The benefit of Mapbox is that it gives you maps, and a lot of related concepts, such as markers, while the benefit of Oracle JET is that it gives your application a well structured architecture based on open source libraries. By following the steps below, you'll end up with an application that looks like this:

Take the following steps:

  1. Use the "Oracle JET QuickStart Basic" template to set up your Oracle JET application. For example, in NetBeans IDE 8.1, with the Oracle JET Support plugin installed, you'll find it in the Samples category in the New Project window.

  2. Use Bower to install "mapbox.js", e.g., from the tools provided in NetBeans IDE 8.1, e.g., shown below:



  3. Add to the "requirejs.config" section in "main.js":
    'mapbox': 'libs/mapbox.js/mapbox'
  4. In the "index.html" file, refer to the "mapbox.css" file, as follows:
    <link href="js/libs/mapbox.js/mapbox.css" rel="stylesheet" type="text/css"/>
  5. Next, create a new CSS file, in the "css" folder, with any name, e.g., "styles.css", with this content:
    #map { width:100%; height:100%; }
  6. Rewrite "home.html" to the following:
    <STYLE TYPE="text/css">
    <!--
      @import url(css/styles.css);
    -->
    </STYLE>
    
    <div id='map'></div>
  7. Rewrite "home.js" to the following:
    define(['ojs/ojcore', 'knockout', 'mapbox'],
        function (oj, ko) {
            function mainContentViewModel() {
                var self = this;
                self.handleAttached = function () {
                    L.mapbox.accessToken = your-access-token-goes-here';
                    var map = L.mapbox.map('map', 'mapbox.dc-markers');
                    map.featureLayer.on('click', function (e) {
                        map.panTo(e.layer.getLatLng());
                    });
                };
            }
            return new mainContentViewModel();
        });

That's it, you've taken your first steps in bringing Mapbox into your Oracle JET application.

Next steps might include communicating with other modules the geolocation of the selected marker, so that the related address and other information can be displayed in some way, using knockout-postbox (as explained here):

Here's the publishing side, i.e., here we are communicating the currently selected marker:

L.mapbox.accessToken = 'pk.eyJ1IjoiZ2VlcnRqYW53aWVsZW5nYSIsImEiOiJjaXBkcWQxYTcwMDA3dXFuZmVlZTA2aXQyIn0.h7YKD28ii2TbOEzfvns5JQ';
var map = L.mapbox.map('map', 'mapbox.dc-markers');
map.featureLayer.on('click', function (e) {
    var latLng = e.layer.getLatLng();
    map.panTo(latLng);
    ko.postbox.publish("publishLatLng",
        {
            'lat': latLng.lat,
            'lon': latLng.lng
        });
});

And here we are using Knockout Postbox to pick up and process the geolocations:

define(['ojs/ojcore', 'knockout', 'knockout-postbox'],
    function (oj, ko) {
        function navContentViewModel() {
            var self = this;
            self.street = ko.observable();
            self.streetNumber = ko.observable();
            self.placename = ko.observable();
            self.postalcode = ko.observable();
            self.adminName1 = ko.observable();
            self.handleAttached = function () {
                ko.postbox.subscribe("publishLatLng", function (newValue) {
                    var lat = newValue.lat;
                    var lon = newValue.lon;
                    $.getJSON("http://api.geonames.org/findNearestAddressJSON?lat=+"+
                            lat+"+&lng=+"+
                            lon+"+&username=demo").
                            then(function (json) {
                                var address = json.address;
                                $.each(json, function () {
                                    self.street(address.street);
                                    self.streetNumber(address.streetNumber);
                                    self.placename(address.placename);
                                    self.postalcode(address.postalcode);
                                    self.adminName1(address.adminName1);
                                });
                            });
                });
            };
        }
        return new navContentViewModel();
    });

Finally, here's how to render the properties above, i.e., in the matching view expressed in HTML:

<p><b>Address Details</b></p>
<div class="oj-flex">
    <div class="oj-flex-item oj-panel">
        <p>
            <span data-bind="text: street"></span>
            <span data-bind="text: streetNumber"></span>
        </p>
        <p><span data-bind="text: placename"></span></p>
        <p><span data-bind="text: postalcode"></span></p>
        <p><span data-bind="text: adminName1"></span></p>
    </div>
</div>

Adam Bien - June 14, 2016 04:17 AM
Satellites, Internet of Tractors, Machine Tracks Or Next Generation Farming With Java 7

Manuel, please introduce yourself

Hi, my name is Manuel Blechschmidt, I am currently the team lead of www.nextfarming.de where we develop a NEXT generation farm management system. I have a personal blog where I write about Jave EE and technology here: www.incentergy.de/ and I post all of my ideas on my twitter account twitter.com/Manuel_B if you want to judge my coding skills you can look into my github account: github.com/ManuelB

What are you currently building?

We are building a multi-tenancy farm management system which helps farmers to enhance their processes and be more profitable. A big part of the system is about handling geospatial data like satellite images or machine tracks.

We discussed an interesting use case with satellite images, fertilizers and big machines involved. Please tell me more about it.

This functionality is one of the key innovations that we are delivering. We have a partner called Vista Geo who takes satellite images from the copernicus project from ESA. Based on these satellite images they can calculate how much bio mass is growing on a certain place on earth. We call the produced map TalkingFields base map. In NEXT Farming you can import these maps and use an online editor to plan how much fertilizer or how many seeds you are going to use on a certain place on the field. This is especially important because if a farmer overfertilizes he might pollute our drinking water. Our software helps the farmer to make sure that the fertilizer is put on a place where it is consumed by the plant. The whole application runs in the browser without installation and produces in the end an ISOXML file which can be consumed by a machine. Currently we get a lot of positive feedback from the market how easy our software is and collaborating with machine manufactures to make it even easier to use it.

Why are you using Java EE?

Java EE has by far the best tool support and is an open standard. It does not have a vendor lock-in and a proven track record of successes in big enterprise systems.

How big is your WAR and why?

83mb. We are bundling multiple JavaScript libraries and some JARs with domain logic like geo spatial processing of shape files or CSV processing. This is not part of the Java EE standard therefore our war is a little bit bigger.

How fast is the build?

Our system takes currently 2 min 14 sec to build including unit tests for our Java and JavaScript code.

How fast is the deployment?

On our test machine it takes 18 seconds to deploy sometimes faster sometimes slower depending on what else is running on the machine.

You started with developers without any Java experience. How long did it took to become productive with Java EE 7? What about the learning curve?

I would say it took one to two weeks for them to work productively. Java EE 7 is a lot more straight-forward then Java EE 1.4. A lot of problems like ORM or serialization are already solved so the developers can concentrate on domain logic. I created a template for all important concepts like JPA beans, JAX-RS beans and Enterprise Java Beans. My team could base their work on these templates. Nevertheless we are still learning every week something new and try to enhance our current code. The learning curve was quite flat so the team produced very fast working and maintainable code.

Which application servers, tools and IDEs are you using?

We are using Wildfly 8.2 in production. As an IDE I recommend JBoss Developer Studio but every developer is free to choose their own tools. So some switched to NetBeans and there are also people that are using Sublime. Our build is using maven so there is no dependency to a specific IDE.

How important is the Java EE standard to you? Is your code dependent on application server specific features?

I like the idea of using a standard. Nevertheless if we have to use vendor specific extensions like hibernate spatial or special jackson serializers we are doing that. We try to be as pragmatic as possible. If a certain solution solves our problem we don't care it it is part of the standard or not.

Take a look at the Java EE 8 APIs. Which of the APIs are most interesting / important to you?

The question would be easier if I would just have to say which API is not important or interesting to us ;-) So we are using JPA, EJB, JSF, JAX-RS, JMS, Bean Validation, JAX-B for JSON Binding and CDI. I have to admit that I participated in the Java EE 8 survey but that most of my concerns weren't addressed. We have a multi-tenancy architecture so having these features would be great. From the Java EE 8 set I will look deeper into Java EE Security API and MVC 1.0.

Is your company hiring Java EE developers?

Yes, we are actively searching people as Java, JavaScript and HTML5 developers. If you are interested please visit: www.farmfacts.de/jobs

Any links you would like to share with us?

http://www.nextfarming.de

Manuel, thank you for the interview!


Real World Java EE Workshops [Airport Munich]>

APIDesign - Blogs - June 13, 2016 08:00 AM
Builder to Tame Your Checked exception!

Here is a nice extension to the builder pattern that allows one to control whether the final build() method throws a Checked IOException or not.

Enjoy this new addition to the list of APIDesignPatterns.

--JaroslavTulach 08:00, 13 June 2016 (UTC)


Geertjan's Blog - June 13, 2016 07:04 AM
Visualizing 3DCityDB in an Oracle JET Application

Let's take 3dcitydb-web-map and integrate it into an Oracle JET application, so that the map ends up contained within a module (defined by Require.js) in the helpful architecture that Oracle JET provides out of the box, all of it free and open source.

At the end of the instructions that follow, you'll have a browser-based application defined by Oracle JET and containing a 3D map:



Take the following steps:

  1. Clone everything from this repo: https://github.com/3dcitydb/3dcitydb-web-map.git

  2. Create a standard HTML/JavaScript application and let's start by setting up a small sample application that reorganizes the various pieces from the repo above into a working scenario. What we'll do is recreate the "b3dmBerlinExample" example, which is in the "examples" folder of the repo above. Start by copying the complete "index.html" from that example and pasting it over the default "index.html" file in your application, copy the folders as you see them below and change the references in the "index.html" file to point to the new locations.



    If the above works, i.e., you can run it and see a 3D map, everything's good and you can continue to the next step wherein you'll port the above structure into module within an Oracle JET application.

  3. The aim now is to migrate the standard HTML/JavaScript application above to an Oracle JET application. The starting point for the below is the "Quick Start Basic" template, which provides an out of the box architecture, including several modules.



    To get to the above point, copy the files from your earlier application, following the structure shown in the screenshot above.

  4. In the "requirejs.config" block, add the following to the "paths":
    'cesium': 'libs/Cesium-1-14-3dtiles/Cesium',
    'webmap': '3dcitydb-web-map',
    'b3dmlayer': 'b3dmlayer'
  5. Define the view as follows:
    <STYLE TYPE="text/css">
        <!--
        @import url(js/libs/Cesium-1-14-3dtiles/Widgets/widgets.css);
        -->
    </STYLE>
    
    <div id="cesiumContainer"></div>
    
  6. Here is the viewModel, i.e., the JavaScript side of the JET module:
    define(['ojs/ojcore', 'knockout', 'cesium', 'webmap', 'b3dmlayer'],
        function (oj, ko, cesium, webmap, b3dmlayer) {
            function mainContentViewModel() {
                var self = this;
                self.handleAttached = function () {
                    Cesium.BingMapsApi.defaultKey = someNumber'
                    var terrainProvider = new Cesium.CesiumTerrainProvider({
                        "url": "./terrain",
                        "requestVertexNormals": true
                    });
                    var viewer = new Cesium.Viewer('cesiumContainer', {baseLayerPicker: false,
                        terrainProvider: terrainProvider
                    });
                    var extent = new Cesium.Rectangle.fromDegrees(1,1,1,1);
                    viewer.camera.viewRectangle(extent);
                }
            }
            return new mainContentViewModel();
        });
    

And that's all you need to do to get started with 3dcitydb-web-map in an Oracle JET application.

Adam Bien - June 13, 2016 03:47 AM
@Stateful vs. @SessionScoped

CDI's @SessionScoped annotation specifies CDI beans maintained within a HTTP session:

"...The session context is shared between all servlet requests that occur in the same HTTP session. The session context is destroyed when the HTTPSession times out, after all HttpSessionListener's have been called, and at the very end of any request in which invalidate() was called, after all filters and ServletRequestListener s have been called..."
JSR 346: Contexts and Dependency Injection for JavaTM EE 1.1,[6.7.2 Session context lifecycle]

The EJB @Stateful annotation denotes classes which are entirely controlled by the client. Their lifecycle is completely independent from HTTP session. In fact EJBs could be even present in environments without an installed servlet container.

An @Stateful EJB instance is exclusively created for a client when:

"...A session bean instance’s life starts when a client obtains a reference to a stateful session bean instance through dependency injection or JNDI lookup, or when the client invokes a create METHOD method on the session bean’s home interface..."
The same instance is destroyed in case:
"...When the client calls a business method of the bean that has been designated as a Remove method on the bean class or a remove method on the home or component interface, the container invokes PreDestroy lifecycle callback interceptor methods, if any, for the bean instance after the Remove method completes..."
JSR 345: Enterprise JavaBeansTM 3.2, [4.6 Stateful Session Beans]

Although the names are similar, @Stateful and @SessionScoped behave differently. @SessionScoped bean instances are maintained within the HTTP session. Only one instance of a given class can exist within a HTTP session. All @SessionScoped instances are destroyed together with the HTTP session.

@Stateful EJBs, on the other hand, maintain usually 1:1 relation between an instance and the client. The client is completely in charge of creating and destroying the instances. A single client (=usual Java class) could even maintain multiple @Stateful instances.

@Stateful EJBs can be also denoted with @SessionScoped annotation. Then the active HTTP session becomes the "EJB client" and maintains the instances.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - June 12, 2016 07:03 AM
Indoor Maps with Leaflet and Oracle JET

Let's take Leaflet Indoor and create an Oracle JET application (i.e., an enterprise-ready application based on Require, Knockout, JQuery, and more) that provides indoor map features:


Here are the steps:

  1. Clone everything from the repo at this location: https://github.com/cbaines/leaflet-indoor

  2. Put "leaflet-indoor.js", "leaflet-src.js", and "osmtogeojson.js" into the "js/libs" folder of your project.

  3. Add to the "paths" in "requirejs.config":
    'leaflet-indoor': 'libs/leaflet-indoor',
    'leaflet-src': 'libs/leaflet-src',
    'osmtogeojson': 'libs/osmtogeojson'
  4. Add to the "shim" in "requirejs.config":
    'leaflet-indoor': {
        deps: ['leaflet-src'],
        exports: 'L'
    }
  5. Copy "leaflet.css" into "css" and reference it in the "index.html".

  6. We'll now port one of the samples from the repo that you cloned in part 1, which uses OpenStreetMap, into a JET module. In the view of your JET module:
    <div id="map"></div>
  7. In the viewModel of your JET module:
    define(['ojs/ojcore',
        'knockout',
        'osmtogeojson',
        'leaflet-indoor',
        'leaflet-src'
    ], function (oj, ko, osmtogeojson) {
        function leafletContentViewModel() {
            var self = this;
            self.handleAttached = function () {
                var osmUrl = '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
                        osm = new L.TileLayer(osmUrl, {
                            maxZoom: 22,
                            attribution: "Map data © OpenStreetMap contributors"
                        });
                map = new L.Map('map', {
                    layers: [osm],
                    center: new L.LatLng(49.41873, 8.67689),
                    zoom: 19
                });
                var query = '(relation(1370729);>>->.rels;>;);out;';
                $.get("//overpass-api.de/api/interpreter?data=" + query, function (data) {
                    var geoJSON = osmtogeojson(data, {
                        polygonFeatures: {
                            buildingpart: true
                        }
                    });
                    var indoorLayer = new L.Indoor(geoJSON, {
                        getLevel: function (feature) {
                            if (feature.properties.relations.length === 0)
                                return null;
                            return feature.properties.relations[0].reltags.level;
                        },
                        onEachFeature: function (feature, layer) {
                            layer.bindPopup(JSON.stringify(feature.properties, null, 4));
                        },
                        style: function (feature) {
                            var fill = 'white';
                            if (feature.properties.tags.buildingpart === 'corridor') {
                                fill = '#169EC6';
                            } else if (feature.properties.tags.buildingpart === 'verticalpassage') {
                                fill = '#0A485B';
                            }
                            return {
                                fillColor: fill,
                                weight: 1,
                                color: '#666',
                                fillOpacity: 1
                            };
                        }
                    });
                    indoorLayer.setLevel("0");
                    indoorLayer.addTo(map);
                    var levelControl = new L.Control.Level({
                        level: "0",
                        levels: indoorLayer.getLevels()
                    });
                    // Connect the level control to the indoor layer
                    levelControl.addEventListener("levelchange", indoorLayer.setLevel, indoorLayer);
                    levelControl.addTo(map);
                });
                $(window).on("resize", function () {
                    $("#map").height($(window).height()).width($(window).width());
                    map.invalidateSize();
                }).trigger("resize");
            };
        }
        return leafletContentViewModel;
    });
    

That's all you need to do. Also take a look at this example:

http://jsfiddle.net/fPEaV/

Geertjan's Blog - June 11, 2016 08:27 AM
Getting Started Integrating LuciadRIA into Oracle JET

So you need Geospatial Situational Awareness in your Oracle JET application and you've decided that LuciadRIA is the right choice for you. LuciadRIA offers Geospatial Situational Awareness in the browser. LuciadRIA enables the development of advanced and easy-to-use browser applications, using web technologies, such as JavaScript, WebGL, and HTML5.

You've obtained LuciadRIA and now you're wondering how to integrate it into an Oracle JET application. The aim here is to get this result, as a kind of "hello world" scenario:

Here are the steps, with thanks to Tom Mahieu from Luciad, who provided me with an Oracle JET application that incorporates LuciadRIA and from which I have extrapolated the instructions below.

  1. In "js/libs", include "dijit", "dojo", "luciad", and "luciadui":



  2. In the "paths" of your "require.config" section, reference the libraries you added above:
    'dojo': 'libs/dojo',
    'dijit': 'libs/dijit',
    'luciad': 'libs/luciad',
    'luciadui': 'libs/luciadui'
  3. In the "css" folder, include "luciad.css" and reference it in your "index.html" file.

  4. In the view of one of your JET modules, include this:
    <div class="claro" 
         id="luciadMap" 
         style="width: 100%; height: 500px; background-color: black; position: relative;">
      <div id="logo"/>
    </div>
  5. In the viewModel of one of your JET modules, include this:
  6. define([
      'ojs/ojcore',
      'knockout',
      'jquery',
      'luciad/view/WebGLMap',
      'luciad/reference/ReferenceProvider',
      'luciad/model/tileset/FusionTileSetModel',
      'luciad/view/tileset/RasterTileSetLayer',
      'luciad/view/LayerType',
      'luciad/shape/ShapeFactory',
      'luciadui/layertreecontrol/FoldableLayerControl'
    ], function(oj, ko, $, WebGLMap, ReferenceProvider,
                FusionTileSetModel, RasterTileSetLayer,
                LayerType, ShapeFactory,
                FoldableLayerControl) {
      function createElevationLayer() {
        var tileSetReference = ReferenceProvider.getReference("EPSG:4326");
        var elevationParameters = {
          reference: tileSetReference,
          level0Columns: 4,
          level0Rows: 2,
          levelCount: 24,
          bounds: ShapeFactory.createBounds(tileSetReference, [-180, 360, -90, 180]),
          url: "http://fusion.3d.luciad.com/lts",
          coverageId: "1baecde9-0209-4570-b110-90eff3263e9b",
          tileWidth: 64,
          tileHeight: 64,
          dataType: FusionTileSetModel.DataType.ELEVATION,
          samplingMode: FusionTileSetModel.SamplingMode.AREA
        };
        return new RasterTileSetLayer(
                new FusionTileSetModel(elevationParameters),
                {label: "Elevation"}
        );
      }
      function createFusionBackgroundLayer() {
        var tileSetReference = ReferenceProvider.getReference("EPSG:4326");
        var elevationParameters = {
          reference: tileSetReference,
          level0Columns: 4,
          level0Rows: 2,
          levelCount: 24,
          bounds: ShapeFactory.createBounds(tileSetReference, [-180, 360, -90, 180]),
          url: "http://fusion.3d.luciad.com/lts",
          coverageId: "4ceea49c-3e7c-4e2d-973d-c608fb2fb07e",
          tileWidth: 256,
          tileHeight: 256
        };
        return new RasterTileSetLayer(
            new FusionTileSetModel(elevationParameters), {
              label: "Satellite imagery",
              layerType: LayerType.BASE
            }
        );
      }
      function LuciadContentViewModel() {
        var self = this;
        self.handleAttached = function() {
          var node = document.getElementById("luciadMap");
          self.map = new WebGLMap(node, {
            reference: ReferenceProvider.getReference("EPSG:4978")
          });
          new FoldableLayerControl(self.map, node);
          self.map.layerTree.addChild(createElevationLayer());
          self.map.layerTree.addChild(createFusionBackgroundLayer(), "bottom");
        };
        self.handleDetached = function() {
          self.map.destroy();
        };
      }
      return new LuciadContentViewModel();
    });
    

That's it, you're done. Make sure to include your license files in "libs/luciad/licenses" and then run the application and you should see the result with which this blog entry started!

Geertjan's Blog - June 10, 2016 01:34 PM
Geospatial Situational Awareness via LuciadRIA in Oracle JET

Luciad provides components that empower organizations to inject real-time Geospatial Situational Awareness into their software.

Part of their product offering is LuciadRIA, which offers Geospatial Situational Awareness in the browser. The fluency promised by LuciadRIA in the browser is that of the speed of their offerings for desktop applications. LuciadRIA enables the development of advanced and easy-to-use browser applications, using web technologies, such as JavaScript, WebGL, and HTML5.

Here's how components provided by LuciadRIA look when they are embedded in an Oracle JET application:

So, does your Oracle JET application need Geospatial Situational Awareness built into it? Take a look at LuciadRIA, it integrates very nicely into Oracle JET!

NetBeans Ruminations » NetBeans - June 10, 2016 12:31 PM
JavaFX makeover for the NetBeans Platform

I was honoured to present last weekend at the Java 9 and Women in Tech Unconference in Sandton, South Africa. The topic of the presentation was a JavaFX makeover for the NetBeans Platform – get the slides here.

Today I want to share the details of the process of transforming the GUI of an existing NetBeans Platform Application from Swing to JavaFX. There was not enough time to discuss all the details during the presentation, so I prepared the project before I started. However, here I will describe all of the steps that are required. I am using JDK 8, NetBeans 8.1 (the Java SE bundle has everything we need) and Scene Builder 2.0.

1 – Create the sample application

The application that I will be giving a makeover is the Sample CRUD Application that ships with the NetBeans IDE. From the File menu, choose New Project… Browse to the Samples > NetBeans modules category and choose Sample CRUD Application. On the next page of the wizard, specify a location and click Finish.

Creating the Sample CRUD Application

Creating the Sample CRUD Application

At this point, the sample application will not compile – please read my earlier post about Module Dependencies and Java 8 for more information. Here is a brief summary of the two steps that are required:

  • Add a dependency on the Explorer & Property Sheet API for the CustomerEditor module.
  • Remove the Command-line Serviceability module from the application.

Run the application. It should look something like this:

CRUD Application

Running CRUD Application

2 – Create a new module

Lets create a new module to house our JavaFX code. Right-click on the Modules node under the CRUD Customber DB Manager project, and choose Add New… Follow the steps of the wizard – I called my project JavaFXWindowSystem and I chose za.co.pellissier.javafxwindowsystem as my code name base. If you are following step by step, I suggest that you keep at least the code name base the same.

Creating a new module

Creating a new module

3 – Find the right class to replace

It is possible to replace the Window System of the NetBeans Platform because it was designed right from the start in a very modular way. (Reading the platform source code, you might spot cases where there are specialized mock classes in the unit tests that are loaded just like the normal implementations, except during test execution.)

Before continuing, you will have to download and configure the source code of the NetBeans platform if you want to follow the steps. On the NetBeans download page, you will find a link referring to ZIP files for that build. (For the latest version, that link points here.) Download the file ending in platform-src.zip, and extract its contents. In the NetBeans IDE, access Tools > NetBeans Platforms. Under the Sources tab, choose the folder where the extracted source code lives, and close the dialog box.

If you have worked with the NetBeans Window System before, you will probably have encountered the class WindowManager before. This is the most important class when it comes to, well, managing windows. So lets find a spot where we can debug into that class to see what is going on. The easiest spot to put the code is in module CustomerViewer, org.netbeans.modules.customerviewer.CustomerTopComponent, in the method componentOpened(). The framework will call this method when the window is opened. Put these two lines of code into that method:

WindowManager winMngr = WindowManager.getDefault();
winMngr.getMainWindow();

Remember to fix any imports that are missing (Ctrl + Shift + I on Windows).

With the platform source code set up, you can Ctrl + Left Click on the name of the WindowManager class to access the source code of the platform. Go ahead and do so – be brave! :)

public abstract class WindowManager extends Object implements Serializable {

You will notice that WindowManager is in fact an abstract class. So we will need to locate the concrete implementation that needs replacing. The easiest way to do this in a very modular system like this is to debug. So put a breakpoint on the first line that we inserted (by clicking in the left margin) and start the application in debug mode by clicking the Debug Project button on the main toolbar.

When the breakpoint is hit, step over the first line (F8). And then step into the getMainWindow() call on the second line (F7). Take a look at the class that you encounter…

package org.netbeans.core.windows;

...

@org.openide.util.lookup.ServiceProvider(service=org.openide.windows.WindowManager.class)
public final class WindowManagerImpl extends WindowManager implements Workspace {

We have found it – WindowManagerImpl is the class that we need to replace.

4 – Create a basic new WindowManager implementation

In the new za.co.pellissier.javafxwindowsystem package of the new module, create a class called JavaFXWindowManager and add the service provider annotation:

@org.openide.util.lookup.ServiceProvider(service=org.openide.windows.WindowManager.class,
supersedes = "org.netbeans.core.windows.WindowManagerImpl")
public class JavaFXWindowManager extends WindowManager {

The annotation indicates what type of service the class provides, and it also (very important!) indicates that this new implementation will supersede the existing one.

Now we need to add some dependencies in order to resolve all the imports.

Adding a dependency

Adding a dependency

Adding Window System API

Adding Window System API dependency

Add the following dependencies:

  • Lookup API
  • Nodes API
  • Utilities API
  • Window System API

Implement all abstract methods (hint in the margin) and fix imports again if necessary.

Quite a long list of methods will be generated, but thankfully there is only one that we are interested in implementing right now – getMainWindow(). So lets add the basics of creating a window:

@ServiceProvider(service = WindowManager.class, 
                  supersedes = "org.netbeans.core.windows.WindowManagerImpl")
public class JavaFXWindowManager extends WindowManager {

    public static JFrame mMainWindow = new JFrame();

    public JavaFXWindowManager() {

        mMainWindow.setSize(new Dimension(640, 480));
        mMainWindow.addWindowListener(new WindowAdapter()
        {
            @Override
            public void windowClosing(WindowEvent evt)
            {
               LifecycleManager.getDefault().exit();
            }
        }
        );
    }

    @Override
    public Frame getMainWindow() {
        return mMainWindow;
    }

When you fix imports, make sure that you import java.awt.event.WindowEvent and NOT the JavaFX equivalent!

Note that I added a call to the NetBeans Platform’s LifecycleManager when the application is closed. This ensures that the normal process will be followed for shutting the application down, just like the original Window System would have done.

5 – Fix the issues caused by replacing the WindowManager

Clean and build, and then run the application, and have a look at the exception that is raised by the framework:

java.lang.ClassCastException: za.co.pellissier.javafxwindowsystem.JavaFXWindowManager cannot be cast to org.netbeans.core.windows.WindowManagerImpl
    at org.netbeans.core.windows.WindowManagerImpl.getInstance(WindowManagerImpl.java:148)
    at org.netbeans.core.windows.WindowSystemImpl.load(WindowSystemImpl.java:78)
    at org.netbeans.core.GuiRunLevel$InitWinSys.run(GuiRunLevel.java:229)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
...

So we see that there is another class that is involved – WindowSystemImpl. Let us replace it with a new class as well – create a class called JavaFXWindowSystem in the same package:

@ServiceProvider(service=WindowSystem.class, supersedes = "org.netbeans.core.windows.WindowSystemImpl")
public class JavaFXWindowSystem implements WindowSystem {

    @Override
    public void init() {
    }

    @Override
    public void show() {
        JavaFXWindowManager.getDefault().getMainWindow().setVisible(true);
    }

    @Override
    public void hide() {
        JavaFXWindowManager.getDefault().getMainWindow().setVisible(false);
    }

    @Override
    public void load() {
    }

    @Override
    public void save() {
    }
}

This time adding the required dependencies is more difficult. We need a dependency on the Core module – click the Show Non-API Module checkbox to even see it on the list of dependencies.

Add a dependency on Core

Add a dependency on Core

Once it is added, edit the dependency and set it to use implementation version.

Editing dependency

Editing dependency

Setting implementation version

Setting implementation version

If you do not do this, you will see this error message:

The module za.co.pellissier.javafxwindowsystem is not a friend of org-netbeans-core.jar

Do take note that this means that you are setting a dependency on a very specific version of the Core module – should you ever change the version of the NetBeans Platform that you build against, you would have to fix this dependency!

You will have to stop the previous execution from the IDE before running the application again. Running it again now shows a very minimal JFrame:

Empty JFrame

Empty JFrame

6 – Including Branding

A NetBeans Platform Application includes branding information – application icons, splash screen image and so forth. To improve the look of our very basic JFrame, we can use some of these elements:

public JavaFXWindowManager() {

    mMainWindow.setSize(new Dimension(640, 480));
    mMainWindow.addWindowListener(new WindowAdapter()
    {
        @Override
        public void windowClosing(WindowEvent evt)
        {
            LifecycleManager.getDefault().exit();
        }
    }
    );

    String title = NbBundle.getBundle("org.netbeans.core.windows.view.ui.Bundle").getString("CTL_MainWindow_Title_No_Project"); //NOI18N
    if (!title.isEmpty())
    {
        mMainWindow.setTitle(title);
    }
    mMainWindow.setIconImages(Arrays.asList(
        ImageUtilities.loadImage("org/netbeans/core/startup/frame.gif", true),
        ImageUtilities.loadImage("org/netbeans/core/startup/frame32.gif", true),
        ImageUtilities.loadImage("org/netbeans/core/startup/frame48.gif", true)));
    mMainWindow.setLayout(new java.awt.BorderLayout());
}

Add a dependency on the Base Utilities API module and fix imports.

Now the main window title and application icons are set just like would be done for a standard NetBeans Platform application. So you can configure these elements in the normal branding window in the IDE!

With Branding

With Branding

7 – Building a new GUI

All the difficult parts are now done – from this point on, we can develop a normal JavaFX GUI using SceneBuilder and the JavaFX infrastructure in the NetBeans IDE. Here is the contents of my crudwindow.fxml file:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="276.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="za.co.pellissier.javafxwindowsystem.CrudwindowController">
   <children>
      <ListView fx:id="list" prefHeight="400.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
      <Label layoutX="220.0" layoutY="18.0" text="Name:" />
      <Label layoutX="220.0" layoutY="52.0" text="City:" />
      <TextField fx:id="txtName" layoutX="269.0" layoutY="14.0" prefHeight="25.0" prefWidth="233.0" />
      <TextField fx:id="txtCity" layoutX="269.0" layoutY="48.0" prefHeight="25.0" prefWidth="233.0" />
   </children>
</AnchorPane>

And the CrudwindowController controller class, which contains bits and pieces copied from the sample code to make the DB access work:

package za.co.pellissier.javafxwindowsystem;

import demo.Customer;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
import javax.swing.SwingUtilities;
import org.netbeans.modules.customerdb.JavaDBSupport;

/**
 * FXML Controller class
 *
 * @author Hermien Pellissier
 */
public class CrudwindowController implements Initializable {

    @FXML
    private ListView<CustomerWrapper> list;
    @FXML
    private TextField txtName;
    @FXML
    private TextField txtCity;
    
    private static class CustomerWrapper
    {
        private String displayName;
        private Customer customer;

        public String getDisplayName() {
            return displayName;
        }

        public void setDisplayName(String displayName) {
            this.displayName = displayName;
        }

        public Customer getCustomer() {
            return customer;
        }

        public void setCustomer(Customer customer) {
            this.customer = customer;
        }

        @Override
        public String toString() {
            return displayName;
        }
    }

    /**
     * Initializes the controller class.
     */
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        JavaDBSupport.ensureStartedDB();
        EntityManagerFactory factory = Persistence.createEntityManagerFactory("CustomerDBAccessPU");
        if (factory == null) {
            // XXX: message box?
            return ;
        }
        EntityManager entityManager = null;
        try {
            entityManager = factory.createEntityManager();
        } catch (RuntimeException re) {
            // XXX: message box?
            return ;
        }
        final Query query = entityManager.createQuery("SELECT c FROM Customer c");
        SwingUtilities.invokeLater(new Runnable () {
            @Override
            public void run() {
                @SuppressWarnings("unchecked")
                List<Customer> resultList = query.getResultList();
                List<CustomerWrapper> wrappersList = new ArrayList<>();
                for (Customer customer : resultList) {
                    CustomerWrapper w = new CustomerWrapper();
                    w.setCustomer(customer);
                    w.setDisplayName(customer.getName());
                    wrappersList.add(w);
                }
                ObservableList<CustomerWrapper> items = FXCollections.observableArrayList(wrappersList);
                list.setItems(items);
            }
        });
        
        list.getSelectionModel().selectedItemProperty().addListener(
                new ChangeListener<CustomerWrapper>() {
            @Override
            public void changed(ObservableValue<? extends CustomerWrapper> ov,
                    CustomerWrapper old_val, CustomerWrapper new_val) {
                txtName.setText(new_val.getDisplayName());
                txtCity.setText(new_val.getCustomer().getCity());
            }
        });
    }    
}

Note that you will need a dependency on the CustomerDBAccessLibrary module from the sample app.

The last step is add the code to display the JavaFX scene to the end of the constructor of the JavaFXWindowManager class:

        try {
            JFXPanel fxPanel = new JFXPanel();
            Parent root = FXMLLoader.load(JavaFXWindowManager.class.getResource("crudwindow.fxml"));
            Scene scene = new Scene(root);
            fxPanel.setScene(scene);
            mMainWindow.add(fxPanel, BorderLayout.CENTER);
        }
        catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        }

The complete project structure now looks like this:

Completed Project

Completed Project

And the running application:

The new JavaFX GUI

The new JavaFX GUI

NetBeans Ruminations » NetBeans - June 10, 2016 08:23 AM
Module Dependencies and Java 8

I recently decided to use the Sample CRUD Application that is available in the NetBeans IDE as the basis for a demonstration that I did at a conference. (More about that in a future post.) It is a very useful sample that illustrates how to get up and running with database access from a NetBeans Platform Application.

Side note: The sample is an Ant-based application, which is in my opinion better for a demonstration than a Maven-based one. And that is simply because it won’t want to download dependencies at the worst possible time during the demonstration, making everybody wait. :)

CRUD Application

Running CRUD Application

So I installed JDK 8 and NetBeans 8.1, and without further delay created the application.

Creating the Sample CRUD Application

Creating the Sample CRUD Application

But when I tried to run the application, I got this compile error:

SampleCRUDApp2\CustomerEditor\src\org\netbeans\modules\customereditor\EditorTopComponent.java:362:
error: cannot access ExplorerManager
CustomerTopComponent.refreshNode();
class file for org.openide.explorer.ExplorerManager not found

This appears on the surface to be a really strange error… ExplorerManager is not even mentioned on that line! I decided to just add a dependency on the Explorer & Property Sheet API for the CustomerEditor module, and the code compiled. Now I could use the sample for my demonstration, and I didn’t give it any more thought. But when I sat down this morning to write about the demonstration, I realised that I need to find an explanation for this issue.

Project Structure

Project structure after creation by the wizard

So let us consider the structure of the sample project, as it stands just after creation by the project wizard. It is a very modular design, since that is partially what the sample is meant to demonstrate. The CustomerEditor (the module that is causing the compile error) depends on the CustomerViewer, which is perfectly sensible. And the CustomerViewer does have a dependency on the Explorer & Property Sheet API module from the NetBeans Platform since it uses classes that live there. Again, a perfectly sensible arrangement.

And then it hit me – I have seen this issue before in my own code! When compiling a NetBeans Platform Application on JDK 8, it is sometimes necessary to include direct dependencies on modules that are used by classes in dependent modules. Dependencies that are definitely NOT required when compiling with JDK 7. The sample is not broken, it is simply JDK 8 that is stricter in its requirements when compiling the code!

Side note: Looking at the code in the sample application, we can form an idea of how old the code is. This still has the Settings.xml and Wstcref.xml files for each TopComponent, which means that it dates back to before the introduction of annotations to register TopComponents. :)

One last issue did arise when I ran the application:

Warning - could not install some modules:
Command-line Serviceability - The module named
org.netbeans.modules.autoupdate.services was needed and not found.

This must be due to new modules introduced since the creation of the sample source code. In an Ant-based NetBeans Platform Application, new modules that are introduced in clusters or projects that the application depends on will automatically get included. This is because the way the dependencies are specified is by listing the EXCLUDED modules from each cluster.

I could safely click Disable and Continue without affecting functionality, so I removed the Command-line Serviceability module from the application (CRUD Customer DB Manager project properties > libraries tab) and thus permanently resolved the last issue.

Removing Command-line Serviceability

Removing Command-line Serviceability

Now we are finally ready for the demonstration code… coming soon!

NetBeans – Michael's blog - June 09, 2016 05:02 PM
Java Lambdas and Parallel Streams: collect()

I’m proud to announce an enhanced edition of my book “Java Lambdas and Parallel Streams” [1]. I added a chapter about the collect() method of the stream interface with respect to Java concurrency. Understand how to collect data or to write your own Collector, which is capable to run in concurrency without special synchronization. If … Continue reading "Java Lambdas and Parallel Streams: collect()"

Geertjan's Blog - June 09, 2016 07:00 AM
Referencing CSS from an Oracle JET Module

Here's the "home.html" of the "home" JET module my application. Here you can see how to reference a CSS file within a view of a JET module, rather than in the "index.html" file, where the standard CSS references is used. In this way, you can import fragments of CSS specific to a JET module and, in that way, create a modular approach to your CSS stylings:

<STYLE TYPE="text/css">
<!--
  @import url(css/styles.css);
-->
</STYLE>

<div id="circle"></div>

And here's the content of the CSS file referred to above: 

#circle {
    border-radius: 50px/50px;
    border:solid 21px #f00;
    width:50px;
    height:50px;
}

Adam Bien - June 09, 2016 03:47 AM
Drones, Smart TVs, Gaming -- Java EE Through The Eyes Of A Serial Entrepreneur

Phil, please introduce yourself

Hi Adam. I’m a veteran software developer with over 15 years of experience working with companies of all sizes, including fairly large enterprises such as Citigroup, IBM, Microsoft, Nokia, Oracle, and the Volkswagen Group. I’ve been part of the Java community from the age of 19, and joined the Java Community Process in 2004, (I believe). I also became an evangelist of Sun Microsystems development tools for Java a few years later. I think Sun called us “Heroes”.

I have a rather out-of-date professional site at fillip.pro, and can often be found tweeting about the tech. that mosts interests me on Twitter (twitter.com/siilime).

You are "Consultant CTO" and you are also working on new technology startups. What are you exactly doing?

A few years ago I moved from large enterprises to support startups. I felt large enterprises were stagnating, and most of the innovation was happening on a small scale. I’d had a few startups already by that point, but always felt pulled back to large companies. That changed in 2014. I began advising investors on which startups to invest in, from a technical view point, and then that led to sitting on the board of several startups, and eventually leading / developing products and services for a few. Now I focus on developing idea and concepts for startups to prepare them for scale and investment.

What are you building with Java EE?

Well, that’s a good question. What can I openly discuss? Actually, I’m developing some large-scale solutions that integrate with agricultural systems in South Africa and South America, drones, professional hardware devices, a machine learning system, and consumer apps. Actually, that’s all one project. It’s been in development for a few years, and despite the fact it’s for a startup, it’s possibly the largest system I’ve been working on. In addition to that I’ve been working on enhancing the security in several cloud-based systems and developing a scalable video game platform using Java EE. All of which play to Java EE’s strengths. I’m technology agnostic, and only pick what works best in each case. Scale and security are definitely a bonus of working with Java EE.

What was your geekiest Java EE project?

That’s a tough question. I’ve had so many geek moments in my career. I worked on a smart TV that had a custom JVM running on a custom Linux-based operating system. Java EE provided the TVs app store and advertisement network, so through and through that consumer product was entirely Java based.

That would probably go hand-in-hand with working on a government intelligence project; prototyping an enterprise intelligence system with service bus, which integrated a large number of disparate data systems, including projects from Oracle and Motorola, and displaying real-time data on a web-based geographic information system. Some of that work included collaborating with interesting government intelligence folk, and was a lot of fun.

Can you share with us some geeky numbers like e.g. TX per seconds, heap sizes etc -- whatever Java EE devs might find interesting.

Honestly, I can’t remember the statistics. Those projects were both in 2008 and 2009. The intelligence system had to be real time though, and managed significant amounts of data. Some of the feeds came from systems that were built before Java existed. It certainly competed with some of the largest banking systems I’ve seen in terms of transaction throughput. Reducing things like reliance on sessions and in-memory storage, kept the system running with minimum memory requirements. It’s a fine balance between runtime performance and instantiation performance when working on systems on that scale, and we built it with runtime performance in mind.

Is Java EE the right choice for a startup?

That all depends on what the startup is trying to achieve, and what resources they have available. I’ve seen startups move from Java to Ruby. That has never ended well. And I like Ruby. But scaling teams with Ruby can be quite painful. Some startups can get away with lightweight Node.js, and it works quite well for them. I’ve used it a lot myself. If I see PHP, I’ll walk swiftly in the opposite direction. If a team is considering Python, I tend to push them towards Go these days.

Java EE works well for a startup with security and scale. Those two aspects should be considered with every technology startup, but when they are critical to what you’re trying to achieve, then there is nothing better, yet. Also, if you look at cloud infrastructure, concurrent development, machine learning, and scalable data processing, then Java EE has it all there. If you look at some of the largest tech. companies, and the decisions they made over time, you’ll see Facebook moved quite a lot to Java, Twitter is predominantly Java-based, from Ruby, and Apple has been for many years.

That doesn’t mean Java is a silver bullet. It still requires intelligent architecting of solutions, and a sensible approach to infrastructure design.

Which application servers, tools or IDEs are you using?

I tend to use Wildfly at the moment. I was a Glassfish user, but Oracle’s position on its technology tends to make me want to find an alternative these days. I use Maven, against the popular trend. I heavily rely on inheritance on Maven project files to keep them lightweight and simple, and I use NetBeans mostly for Java development. However, I also use Atom and Visual Studio Code more recently, and then manage my builds on the command-line. That workflow ensures I’m comfortable with the portability of the project in its current state. I use Codeship to maintain continuous testing and deployment, to enhance my confidence with the work I’m doing.

I also write code on my Mac in an Ubuntu virtual machine, as that’s what my projects tend to run on. That way, I can design and develop immutable instances using Docker on my local workstation, and commit the system scripts to my code repository with the same workflow in which I manage my application code. That enables me to hand over a project to a third-party developer and know they can run a simple command and have a whole application instance built, deployed, and have the application subsequently built and installed onto that instance, without having to concern themselves with anything but the changes they are there to make.

How important are standards for you? Does your application depend on application server specific APIs?

My view on this has evolved over the years. When I joined the JCP I was all about standards. I joined W3C working groups for the same reason. I still believe standards are essential, but the way in which standards can come about should be flexible. I prefer to wait for a platform to innately mature with platform standards, than use a server-specific API out of impatience. I never jumped in to Spring or Hibernate if I didn’t need to either, as Java often provided decent tools. These days I evaluate on a case-by-case basis, but I still tend to avoid application server-specific APIs. I don’t want to struggle to move my application between platforms, or struggle to find resources capable of understanding what I’ve built and why.

Which Java EE APIs are you using in your products?

Lots. I use Java EE 7, across all of my Java EE-based projects. EJBs, Servlets, Authentication, JMS, JAX-RS, JPA and JTA. Leveraging mature APIs enables me to rapidly develop performant systems without having to identify a new approach or identify compatibility between two different third-party components too often.

You commented my post "Oracle Moves In Strange Ways", what is your take on current Oracle's strategy?

When I make decisions on new projects, or new components of new projects, I will always re-evaluate the current technological landscape and where I expect a system to be in 3 years. Oracle is tainting that view significantly by not loosening the reigns on Java to allow Java EE 8 to be completed. It should be looking at the more modern Node.js, Go, and Rust programmes, to understand how best to support the development community. Oracle is living on a legacy of enterprise software licensing, and that doesn’t work with Java. If it wishes to benefit from the huge ecosystem surrounding Java, specifically the free resources that can help support the platform, then Oracle needs to let the community drive it rapidly, or risk losing a costly acquisition. There is no bigger community of developers than the Java community, and that alone is invaluable to Oracle.

Take a look at the Java EE 8 APIs. Which of the APIs are most interesting / important to you?

Java Security as it needs to stay modern and relevant. JSON-B is also key to that. WebSockets and Concurrency are also key to making Java EE a relevant platform for new system development.

Can you share any resources (blogs, etc feel free to promote yourself) with us?

My blog is in refurbishment! I tend to read yours for Java Enterprise. Otherwise I just follow people that interest me on Twitter and follow the links from there. It’s replaced my RSS feed for Java news.

Phil, thank you for the interview!


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - June 08, 2016 12:36 PM
Tools for MVC in Java EE 8 (Part 3)

Part 2 of this series was... November 12, 2014, i.e., Devoxx in Belgium in 2014, during which time I worked with Manfred Riem to create a plugin for NetBeans IDE to support his Devoxx presentation on MVC. Fast forward to today and here I am at Devoxx UK with Ivar Grimstad, working on the same plugin, though the MVC spec has changed quite a bit, requiring some new work on the plugin.

Ivar has a set of MVC samples here:

https://github.com/ivargrimstad/mvc-samples

The simplest one looks like this in NetBeans IDE:

After some discussion at the Devoxx UK hackergarden run by Heather VanCura, Ivar and I have scoped out what the plugin should do. (And in the meantime there's also Gaurav Gupta's great JPA Modeler, which provides a bunch of related features too.)

Take a look at the "RESTful Web Services" node in the screenshot above. Right below that node, we want to create a "MVC Controllers" node. Within that node, we'd like to list all Java source files that have a class-level or at least one method-level annotation of type "javax.mvc.annotation.Controller". Within each of the Controller nodes, we want to list all the MVC methods, which are either (1) all the public methods in the class if @Controller is used at class-level or (2) the specific methods within the class annotated with @Controller, if the class does not have the @Controller annotation.

Also, as a secondary feature, a further simplified application based on the above shown application will be in the New Project wizard, instead of the old one that is currently there. 

Here's the code from the original plugin, created with Manfred Riem, which will be the basis of the features described above:

https://github.com/GeertjanWielenga/BasicMVCSupport

A quick first attempt, simply tweaking a little bit without going into things too deeply, gives us the following:

As you can see, while the MVC Controller methods are shown, correctly, for "HelloController" (and can be double-clicked to get to the related source code), the other two Java source files shouldn't be there since they don't contain a @Controller annotation at all. So, right now (1) all the Java source files are shown regardless of whether they have the required annotation, while (2) methods are shown only if they have the annotation on them, not if the annotation is set on class-level.

So, it's a work in progress, though some way along already. 

Update 1: As you can see below, the two other Java source files are now not shown anymore, because the plugin parses the Java source file and determines whether methods have a @Controller annotation and, if a Java source file has one such method, it is included in the "MVC Controllers" node, otherwise it is excluded.

The next step will be to add functionality to not only work with method-level @Controller annotations, but class-level @Controller annotations as well. 

Update 2: Next, I can now display all the class members within a Java source file that has a class-level @Controller annotation:

The final step will be to only display public methods, not all class members, within a Java source file that has a @Controller annotation.

Update 3: Now it's working and here you can see the controllers within the class that contains them and nothing else:

Here's the plugin, install it into NetBeans IDE 8.1 to get the feature above:

http://plugins.netbeans.org/plugin/67897

Here it is in action on Ivar's system with a more complex sample app: