From Swing to Vaadin?

Post to Twitter

Some days ago, vaadin released a Tutorial for Swing developers. It's a hitchhiker's guide to convert a Swing app to modern web app. It's a must-read if you plan to replace/migrate or modernize your Swing application.

We were mentioned in the last paragraph with our JVx framework, as possible conversion strategy. Thanks for that!

I want to hook in at this paragraph, because I totally agree with the rest of the tutorial.

It's true that a wrapper has pros, cons and limitations. You can't wrap everything. Sure you could try, but it needs so many developers and doesn't make sense because a wrapper shouldn't copy the underlying technology. The more features the wrapper has, the more problems will occur with new (different) technologies. The wrapper should be a subset of all technologies. But a subset is limited in functionality!

A wrapper should be focused on a specific domain, e.g. database/data driven applications or game development. A wrapper for multiple domains will fail!

I don't know many working wrappers. There were many attempts to create (UI) wrappers, in the past, but most were stopped because of complexity or the developers had other interests (if project was open source).

JVx is one working solution and in my opinion the most complete one because it contains an UI wrapper, has implementations for different technologies like Swing, JavaFX, Headless and Vaadin. The APIs are bulletproof and there are native applications for Android and iOS. JVx is a generic solution and doesn't generate additional source code.
But it has more than that, because it's full-stack and comes with different application frames for desktop, web and mobile applications.

But what is your advantage if you're using a wrapper?

You're (GUI) technology independent.

An example:

Your current business application is a Swing application and you plan the migration to a modern technology.
Your first migration decision should be: Desktop or Web
Next decision: which UI framework
Optional: Mobile support?

If your platform decision was: Desktop, then it's very simple to find the right UI framework: JavaFX and try JavaFXPorts for mobile support.
Fact: No real web and possible problems with mobile support

If your platform decision was: Web, then it's not an easy task to find the right UI framework, but vaadin should be the first choice because it's comparable to Swing and hides web technology for you!
Fact: No desktop but mobile support

Every decision has pros and cons. If you bet on one technology stack, you're fixed to this technology stack. In our example it was JavaFX or vaadin. And what will be the next preferred UI technology after JavaFX or vaadin?
You'll have the same problems again and it's never easy to migrate a (business) application.

You should bet on a technology independent solution, to be prepared for the future!
Means, you should use a wrapper. But don't use a wrapper which hides the technology from you. It should be possible to access the technology directly - if needed or if it's not important to be technology independent.

Sometimes it's not possible to be technology independent, e.g. some custom controls aren't available for all technologies.

The wrapper should allow technology dependent and independent development without any limitations!

Does it make sense to use the same application with different technologies?

Yes, but...

It's not a good idea to use e.g. Swing AND JavaFX because both technologies are desktop toolkits. But it makes sense to use JavaFX for your backend application and vaadin for your frontend or your mobile devices.

It's also a good idea to create only one application that works as desktop, web and mobile application - the same application. But show different screens/views on different platforms.

There's no big difference between desktop and a standard browser because resolution of a desktop pc is the same. A mobile browser has limited space and you shouldn't use the same screen/view on a mobile device as on the desktop pc.

We use an ERP backend application to manage vacations. The appliation has about 10 screens for resource management, master data management and accounting. The application runs as desktop application with JavaFX. The same application runs in desktop browsers with 3 screens because the web frontend doesn't offer master data management and accounting. The same application runs on mobile devices with only 1 screen because mobile devices are used from employees to enter and view vacations.

We have only one application, started with different UI technologies and with different screens/views.

It would be possible to create 3 different applications with different screens and with dependencies between the applications and ... (complex to maintain, 3 different projects, application frame x 3).

If you'll create a "native" vaadin application and a JavaFX application you'll need different development teams with different know-how.

Don't waste time and resources, focus on the real problems of your application. A wrapper hides technology problems and allows fast development with few developers: Win-win situation!

New application frame feature - No menu

Post to Twitter

All our applications have a menu and a toolbar. This is great for backend applications but not always good for web frontends. Our web UIs have a different menubar, styled for web, but it's always visible. If you have simple web forms, you won't use a menu. We did some changes and have new options for applications without menu and toolbar :)

Some impressions with standard (backend) Desktop application and as (frontend) web application:

Backend application (Swing)

Backend application

Frontend application (Vaadin)

Frontend application

It's very simple to hide the menu. Simply set an application property via application.xml or directly via launcher - that's it. We changed our web menu and allow access to internal panels and components. It will be possible to hide buttons, change layouts, etc.

It's still possible to create your own, custom, application frame or extend our pre-defined frame. The new feature will be available in the next VisionX update.

VisionX compared to RAD

Post to Twitter

We started with VisionX as RAD tool because we tried to solve common problems with database development. If you create applications with access to databases, you know what I mean. It's horrible to do the same boring things multiple times. You have to create table definitions, create screens, bind models to controllers or views, use or don't use ORM, implement business logic, ...
The most interesting part is business logic because all other things are not that complex (of course, database modelling is not a trivial task).

Today I'm conviced that VisionX is the evolution of RAD.

Why do I think that?

Usually, RAD tools offer an all-in-one solution for developing applications. They contain IDE features but aren't an IDE. A RAD tool is more like a lightweight IDE with some useful addons like database modeler, GUI editor and debugger. Some RAD tools offer SCM integration, Test automation and other ALM methods.

RAD is not the right definition for VisionX because it's more than that. It doesn't show you the source code directly because an IDE is better for that. Why shouldn't we use an IDE for editing source code? VisionX doesn't offer SCM features because there are enough good tools available.

VisionX primarily supports Eclipse as IDE and all available SCM tools but not directly linked with VisionX. VisionX is not open source but it uses open source frameworks and all built applications are available with their source code. We didn't re-invent the wheel but tried to allow end-users to create their own applications without being a developer.
We think it's better to use the best tools, instead of creating something similar. You decide what's the best tool.

VixionX wasn't designed for developers. It was designed for end users. This is a big difference compared to RAD tools.

But VisionX is not limited to end users, because it creates and reads Java source code. Every Java developer can work with VisionX but with familiar development tools like Eclipse. The tool offers a WYSIWYG editor and has some useful addons, but it goes a few steps further.
VisionX doesn't need a database modeler because an end user doesn't know what a database(model) is. The user knows which data is needed, like Phone number, currency, description. The user also knows if a selection field is needed or an image should be shown. But primary key, foreign key and constraints are totally unknown.

You can compare VisionX with Excel because the user enters data and the application decides what is shown. But there's no hidden magic because VisionX simply works with generated and interpreted source code. If you change the source code, VisionX takes care of it.

And another big difference to RAD tools is, that VisionX creates modern 3-tier applications following single-sourcing approach. It's the only tool that creates an application that runs without source code changes as Desktop application, native HTML5 application in modern web browsers and as native smartphone app. It offers live preview on all targets and it has a unique reporting included. It's not based on XML files or meta information. It's based on Word or Excel templates. Every end user is able to create a word or excel file.

VisionX is a tool, designed for end users but a developer will love it because it helps to do all the boring work and under the hood it's still a modern development tool.

JVx 1.2 is out

Post to Twitter

We released JVx 1.2 today - as planned ;-)

The binaries are available on SourceForge or via Maven central. We also updated our Archetype to version 1.2.0 and it should be available in Maven central in the next days.

We told you that the release contains about 90 tickets. The real number of changes is 123.
Check the changelog for a complete list.

Next version will be 2.0

We did decide that version 1.2 is the last release before 2.0. It's not because of new killer features or big API changes.
The higher version number should represent the maturity of JVx.

JVx was started in 2008 and the low version numbers were fine for our own goals, but our users asked for bigger steps. If we compare our 1.2 with other frameworks, we could use 5.0 without problems.

The version 2.0 will be a smaller feature release that changes MetaData handling on server-side. We'll introduce a new caching mechanism that allows manual change of storage metadata.

We plan the release for the end of this year - without guarantee.

We also plan maintenance releases starting with 2.0

Currently, we don't fix bugs in old JVx releases. We only fix bugs in our development version. We offer nightly builds and maven snapshots and we thought that's enough, but some users want to keep old releases. No worries, we'll do our best to make you happy!

Rolladen steuern mit Pi

Post to Twitter

RasPi mit Fernbedienung   Im aktuellen JavaAktuell wurde ein Artikel über die Ansteuerung von Rolläden mittels Raspberry Pi veröffentlicht. Bei JavaAktuell handelt es sich um ein Magazin des iJUG (Interessenverbund der Java User Groups). Das Magazin richtet sich an Java Entwickler und die Artikel werden von Anwendern, die spezialisten in Ihrem Gebiet sind, verfasst.

Wer die aktuelle Ausgabe noch nicht in seinen Händen hält, kann hier schon mal in den Artikel reinlesen.

Mein KMU bei Überall App Competition

Post to Twitter

Demnächst findet der erste App Kongress in Wien statt. Mit zur Veranstaltung zählt auch eine App Competition. Dabei werden aus einer Menge an App Ideen bzw. Konzepten die Top 10 ermittelt. Die Top 3 haben dann die Chance auf einen 3 Minuten Pitch und Crowd-Funding.

Unser R&D Team hat ebenfalls eine App Idee am Start, mit der erstmals unser JVx mobile zu sehen ist. Die Idee hat natürlich mit Business zu tun:

Eine App für kleine und mittlere Unternehmen (Handwerker, Dienstleister, Einzelunternehmer, .). Für diese gibt es kaum hilfreiche Apps und Kapital für die Umsetzung eigener Ideen ist meist nicht vorhanden bzw. wird an anderen Stellen benötigt.

Die App ermöglicht die Umsetzung eigener Ideen wie zB. Lagerstandsabfrage, Zeiterfassung für Monteure, mobile Angebotslegung, Preisabfragen, uvm. Damit die Daten auch im Büro eines KMU zur Verfügung stehen und verwendet werden können (zB. für Rechnungeslegung) kommuniziert die App mit einem Backend das entweder in der Cloud oder auf eigener Hardware läuft – je nach KMU. Das KMU erhält somit eine Kombination von Excel und Word das online zur Verfügung steht und angepasst ist an die eigenen Abläufe. Die App ist aber keine simple Dateiverwaltung wie z.B. Dropbox sondern verwaltet Unternehmensdaten in einer zentralen Datenbank. So einfach wie Excel.

Die App passt sich dynamisch an die zu verwaltenden Daten an und bietet eine Standardlösung für KMU.

Und natürlich gibt es auch ein Bild dafür:

Mein KMU

Mein KMU

Damit eine Idee unter die Top 10 kommt muss sie zuerst durch eine Community Bewertung. Die besten 33 Ideen werden dann noch von einer Jury unter die Lupe genommen. Wir würden uns natürlich freuen wenn Ihr uns unterstützt. Aber bitte Geduld bei der Bewertung, denn der Battle Modus ist etwas gewöhnungsbedürftig und es kann auch schon einige Versuche dauern bis "Mein KMU" antritt :)

Joomla/RSForms post request to Java Servlet

Post to Twitter

Maybe this information is useful for other Joomla/RSForms users or for developers who want send a post request from php to anywhere :)

I had the following configuration in my dev environment:

Joomla together with RSForms (free version)

I love to use this combination because it is easy and just works. With RSForms I created some forms like User registration. This tool allows you to send emails to the registered user and it stores the registration automatically in the database. It's really useful.

In my case, the user registration was not real-time because I got an email and had to create a user account manually. This is web 0.1.

Well, I decided to push the whole process to web 2012. My plan was to create a simple Java servlet that creates my user accounts. This servlet should be called from the RSForms component, with a simple POST request. I don't like SOAP overhead, so it was no option for me. Of course, my servlet is a service :)

BTW, I wouldn't change the RSForms component because it should work as it was. The component has a nice feature that allows you to configure custom scripts for loading and processing.

I started with the configuration and added following process script:

$url = 'https://tomcatvm/services/User';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

$data = array();
$data[] = 'language=en';

foreach ($_POST['form'] as $post => $value)
    if (is_array($value))
        foreach ($value as $post2 => $value2)
            $data[] = $post.'[]='.urlencode($value2);
        $data[] = $post.'='.urlencode($value);

curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $data));
$data = curl_exec($ch);

if (curl_errno($ch))
    '','Service error',
    'Service call failed! ('.curl_error($ch).')',$form->emailmode,null,null,null);


The code is written in php, but it is not rocket science. It simply sends a post request to the configured URL. The important thing is that all form parameters were used as parameters for the request, because the service needs the entered values!

That's all for Joomla/RSForms. During development I thought that the process script will be executed only once per form but that was not true. It was executed after loading and everytime when the user submits the form. If the forms had validation errors, the process script was executed more than once (with and without valid inputs).

I changed the php script a little bit and moved the process execution after the validation. It depends on your RSForms version, but in my case the original script (/plugins/content/mosforme.php) looks like:



and the new script:

    // store it in the db

But it is also possible to use the original script without modification.

The other side was the servlet... It's to simple to show you the whole source, only a snippet:

public void doPost(HttpServletRequest pRequest, HttpServletResponse pResponse) throws ServletException
    String sParamFirstName;
    String sParamLastName;
    String sParamEmail;

        sParamFirstName = getParameter(pRequest, "firstname");
        sParamLastName  = getParameter(pRequest, "lastname");
        sParamEmail     = getParameter(pRequest, "email");
        sParamLanguage  = getParameter(pRequest, "language");

JVx EE Source Code is available

Post to Twitter

The scource code is online. Thanks to Stefan for his great work!

Check out the project page.

In the coming weeks we will finalize the documentation and build the binaries.

You find the JPA integration and a complete example application in the repository.
Have fun.

Migration from Eclipse Galileo to Indigo

Post to Twitter

We use Eclipse Galileo for all our projects. It has some problems with CPU load if you use Subclipse with large Java projects. But if you disable SVN decorators, it is ok (not perfect, but still better than the rest)...

We don't use every new Eclipse version for development because it needs a lot of time to check and change our projects. Don't believe that everything works out-of-the-box.

In the last days, we tried to update our Android plugin and... the new version does not support our "old" Eclipse version. We need at least Eclipse Helios... sh*t. We opted for the update, hoping that it does not take too much time.

Installation of Indigo and all our plugins was straight forward. But the "new" JDT have some side effects. It was not possible to compile JVx because KeyValueList and IdentityKeyValueList have a "Name clash". The problem details are described here. Not an Eclipse problem, a generics problem. But even that is not great.

After we set the compliance level for JVx from 1.5 to 1.6, it was possible to compile the project. Now we have Name clash warnings instead of errors. Not great but we can live with it. After we "solved" the first problem we had the next with our Web projects, because the Project Facets use Java 1.5 compliance level. But we learned that it is enough to set the level to 1.6 :) . To set the level from 1.5. to 1.6, we had to change the JRE for our Server environment(s) from 1.5 to 1.6. It is not a problem to use 1.6 but JVx is 1.5 compatible and it is not great to test without 1.5, but it is what it is.

Most of our projects are now migrated and again it was not funny to search "no" problems. We look forward to the next waste of time.

If you need details about our migration steps, write a comment ;-)

Mysql and PostgreSql enum/set support

Post to Twitter

MySql and PostgreSql have some useful custom datatypes. Enum is one of them. MySql has a Set datatype too.

With an Enum, you define a list of allowed values, but only one value is possible for the column (same behaviour as check constraints in other databases)

With a Set, you define a list of allowed values and multiple values are possible for the column (more like a n:m relation). But you should not use Set datatypes, because it makes your data model unreadable and everyone wants clean data models?

With JVx 1.0 it is possible to use Enum or Set datatypes. On UI side you get a link cell editor (dropdown) or choice cell editor (e.g. checkbox).

Look at the image on the right. You see 3 columns. The first is a simple text column, the second is a linked cell editor (dropdown) and the third is a checkbox. Nothing special?

Not until you see the database table.
  Enum and Set

The table and types, in PostgreSQL, are defined as:

CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy');
CREATE TYPE yesno AS ENUM ('Y', 'N');

   name text,
   current_mood mood,
   active yesno

The server-side storage handles the enum/set detection automatically and sets the linked cell editor and allowed values into the MetaData. You don't have additional work on UI side to get above table!
And this is really cool, isn't it!

But we recommend a new creation style for your storages in your life-cycle objects, to get the new features:

Old style:

DBStorage dbs = new DBStorage();

New style:

DBStorage dbs = getDBAccess().createStorage();;

Why we recommend this?

With 1.0 we introduce db specific storages like MySqlDBStorage and PostgreSQLDBStorage. This storages support database specific features that are not standardized.
We avoid/reduce boilerplate code whenever possible and who wants to change source code if the database is changed?

With the new style, you get the best storage available for your database, automatically. Of course it is possible to create e.g. a MySqlDBStorage() manually, but keep in mind that you are fixed to MySql.

After you changed your life-cycle objects, you get linked cell editors for your enum columns. But in many cases you use enum datatypes as check constraints e.g. Yes/No columns. In that case, a linked cell editor is not very cool - you need a choice cell editor.

JVx defines some default choice cell editors, via


in the Application class. With this mechanism it is very easy to define choice cell editors for your enum types.

Set datatypes are very special and generally, we don't like unreadable data models. But JVx should support it as good as possible.

We handle Set datatypes like enum datatypes and we show a link or choice cell editor. The user can only select one value. A developer can set multiple values via API (as comma separated list).

Have you ever seen this comfort in other frameworks? Let us know ;-)