Geertjan is a DZone Zone Leader and has posted 457 posts at DZone. You can read more from them at their website. View Full User Profile

NetBeans Platform Training in Belgrade, Serbia

03.23.2011
| 4769 views |
  • submit to reddit

The latest NetBeans Platform training course finished a few hours ago at the Faculty of Organizational Sciences at the University of Belgrade, Serbia. The first training was held here about a year ago and hopefully several more (including, especiially some medium/advanced training courses with Toni Epple from Eppleton) will be held in the coming months and years.

Here's a pic of the whole group on the steps of Belgrade University today with their freshly obtained certificates:

The students spent the last few days being trained about NetBeans Platform concepts by Zoran Sevarac, from the Faculty of Organizational Sciences, and myself. In fact, Zoran is now an offical community NetBeans Platform Certified Trainer. He has become this because of a combination of his NetBeans Platform knowledge and his training experiences. I.e., he's been architecting and driving the creation of the Neuroph Studio on the NetBeans Platform, while also teaching the NetBeans Platform to various groups of students. To celebrate this and to make it all official, he received his training certificate today, as can be seen below:

As a brand new trainer, Zoran's first task was to hand out certificates to the students on the course, e.g:

There's a whole bunch of similar photos and I'm sure they'll be on http://www.netbeans-serbia.org/ very soon!

Student Application During the Course

Zoran's idea for the course was to create a CD Catalog on the NetBeans Platform. This we did, bit by bit. First, Zoran taught the students how to create a basic application structure on the NetBeans Platform, including a wizard for creating CDs and storing them in a mock database (i.e., not a real database, but basically a List retrieved as a singleton). Next, I showed them how to display items in the database as nodes in an explorer view and then how to use the Lookup to synchronize with an editor document and with the Properties window:

The most interesting part of this application was that we plugged in some validators. Only if the validators returned true will the user of the application be able to create new CDs. The following is in the ChildFactory that creates the nodes:

@Override
protected boolean createKeys(List<CD> list) {
ArrayList<CD> cdDatabase = CdDatabase.getInstance().getCds();
for (CD cd : cdDatabase) {
boolean allOK = true;
Collection<? extends CDValidatorInterface> allValidators
= Lookup.getDefault().
lookupAll(CDValidatorInterface.class);
for (CDValidatorInterface oneValidator : allValidators) {
if (!oneValidator.validate(cd)) {
allOK = false;
}
}
if (allOK) {
list.add(cd);
} else {
StatusDisplayer.getDefault().setStatusText("Failed: " + cd.getArtist());
}
}
return true;
}

We created a few validators implementing the "CDValidatorInterface":

import org.netbeans.cdcatalog.domain.CD;

public interface CDValidatorInterface {

public boolean validate(CD cd);

}

The students agreed that a Serbian musician named "Zeljko" is so bad that the user of our application should not be able to create new CDs with his name:

import org.netbeans.cdcatalog.domain.CD;
import org.netbeans.cdcatalog.validator.api.CDValidatorInterface;
import org.openide.util.lookup.ServiceProvider;

@ServiceProvider(service=CDValidatorInterface.class)
public class ZeljkoValidator implements CDValidatorInterface {

@Override
public boolean validate(CD cd) {
if (cd.getArtist().equals("Zeljko")){
return false;
} else {
return true;
}
}

}

So, now, whenever a new CD is created and "Zeljko" is set as the name of the artist, the node will not be created. Instead, a message will be printed into the status bar.

Application Generation Project

Finally, I learned about a a very interesting project at the University of Belgrade, being created by students who previously attended this course, all about generating applications. I'm reading some papers by them, with names like "Automatic generation of executable UI prototypes using SilabReq language", which are very interesting indeed. Ultimately, you'll be able to generate different kinds of (among others) NetBeans Platform applications from various kinds of use cases.

Summary

Altogether, including the nice Serbian food (and beer), as well as a bit of sightseeing, it's been a great time in Serbia and a further step in solidifying the connections between NetBeans and the University of Belgrade.

Published at DZone with permission of its author, Geertjan Wielenga.